From b4ddf5c2815f7b8afa608dbb426a1cc517089175 Mon Sep 17 00:00:00 2001 From: gedoor Date: Mon, 26 Jul 2021 15:45:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../assets/web/uploadBook/css/stylewf.css | 49 + .../assets/web/uploadBook/i/wifi_logo_3.png | Bin 0 -> 10391 bytes .../assets/web/uploadBook/i/wifi_logo_3.svg | 14 + .../main/assets/web/uploadBook/i/wifi_tz0.png | Bin 0 -> 3793 bytes app/src/main/assets/web/uploadBook/index.html | 68 +- .../main/assets/web/uploadBook/js/common.js | 269 ++++ .../assets/web/uploadBook/js/html5_fun.js | 244 ++++ .../web/uploadBook/js/jquery-1.4.2.min.js | 154 +++ .../assets/web/uploadBook/js/langSwich.js | 88 ++ .../main/assets/web/uploadBook/js/swf_fun.js | 192 +++ .../assets/web/uploadBook/js/swfupload.js | 1146 +++++++++++++++++ .../java/io/legado/app/utils/JsExtensions.kt | 68 - 12 files changed, 2195 insertions(+), 97 deletions(-) create mode 100644 app/src/main/assets/web/uploadBook/css/stylewf.css create mode 100644 app/src/main/assets/web/uploadBook/i/wifi_logo_3.png create mode 100644 app/src/main/assets/web/uploadBook/i/wifi_logo_3.svg create mode 100644 app/src/main/assets/web/uploadBook/i/wifi_tz0.png create mode 100644 app/src/main/assets/web/uploadBook/js/common.js create mode 100644 app/src/main/assets/web/uploadBook/js/html5_fun.js create mode 100644 app/src/main/assets/web/uploadBook/js/jquery-1.4.2.min.js create mode 100644 app/src/main/assets/web/uploadBook/js/langSwich.js create mode 100644 app/src/main/assets/web/uploadBook/js/swf_fun.js create mode 100644 app/src/main/assets/web/uploadBook/js/swfupload.js delete mode 100644 app/src/main/java/io/legado/app/utils/JsExtensions.kt diff --git a/app/src/main/assets/web/uploadBook/css/stylewf.css b/app/src/main/assets/web/uploadBook/css/stylewf.css new file mode 100644 index 000000000..ff8d10457 --- /dev/null +++ b/app/src/main/assets/web/uploadBook/css/stylewf.css @@ -0,0 +1,49 @@ +@charset "utf-8"; +/* CSS Document */ +body, div, p, ul, h1, h2, h3, h4, h5,span , img,dl,dt,dd{ margin: 0; padding: 0; } +html, body { height: 100%;} +body { font-family: Helvetica,'微软雅黑';background:#03a9f4 + /*url(../i/bg.jpg)*/; font-size: 14px; color: #313131; } +h1, h2, h3, h4, h5 {margin:0;padding:0;} +em { font-style: normal; } +ul, ol, li { list-style: none } +img { border: 0 none } +a { text-decoration: none; color: #858585; } +.fl{float:left;} +.fr{float:right;} +/*layut css*/ +.wrap{width:860px; margin:0 auto; overflow:hidden;zoom:1;} +.right{width:527px; float:right; background:#eeeeed; overflow:hidden;} +.title{height:50px; background:#8bc34a; line-height:3.0em;color:#fff;font-size:16px;padding-left:25px;} +.jdt{ background:#bebebe; height:3px; position:relative;} +.jdt p{ position:absolute;left:0;top:0; height:3px; } +.jdt p.orange{background:#8bc34a;} +.jdt p.gray{background:#999;} + +.first{background:#8bc34a;} +.right dl{ overflow:hidden;zoom:1;} +.grybg{background:#eaeae9;} +.first dt,.first dd{ background:url(../i/wifi_d_bg.png) no-repeat right top;_background:none;_filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src="wifi_d_bg.png")} +.right dt,.first dt{width:255px;padding-left:25px;} +.right dd,.first dd{width:110px; text-align:center;} +.right dt,.right dd{color:#555;float:left; line-height:2.8em;font-size:16px;} +.right dd.orange{color:#8bc34a; cursor:pointer} +.right dd.gray{color:#aaa;} + +.scroll{height:900px; overflow-y:scroll;padding-bottom:10px;position:relative;z-index:9999;} +.left{margin-right:527px;} +.logo{height:112px; background:url(../i/wifi_logo_3.png) no-repeat left 24px;margin-bottom:36px;} +.wf_box{height:204px;margin-bottom:46px; overflow:hidden;} +.wf_box h3{padding:124px 0 0 0;color:#fff;width:200px; height:76px; margin-left:55px; text-align:center;} +.wf_wifi{ background:url(../i/wifi_img.png) no-repeat 47px top;} +.wf_active,.wf_normal{background:url(../i/wifi_tz0.png) no-repeat;} +.wf_active{background-position:56px -210px;} +.wf_normal{background-position:56px top;} +.wf_btn{width:203px;height:100px;padding-left:37px;margin-bottom:16px;} +.wf_left{width:6px; height:100px; background:url(../i/wifi_left.png) no-repeat left top; float:left;} +.wf_right{width:6px; height:100px; background:url(../i/wifi_right.png) no-repeat left top; float:left;} +.wf_center{width:228px; float:left; background:#8bc34a; text-align:center;color:#fff;height:100px;} +.wf_center h3{font-size:24px; line-height:1.6em;margin-top:22px;} +.wf_center p{font-size:14px; line-height:1.6em;} +.wf_gs{color:#fff; line-height:1.6em;padding-left:37px;} +.right dd.wf_bgn{ background:none;} \ No newline at end of file diff --git a/app/src/main/assets/web/uploadBook/i/wifi_logo_3.png b/app/src/main/assets/web/uploadBook/i/wifi_logo_3.png new file mode 100644 index 0000000000000000000000000000000000000000..618c4873aaafa588faa98a48eb734cddad3c0f41 GIT binary patch literal 10391 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

a+LsLg&3x3R%DeQ2o{WDu zVoeJcNb(zte;Ac%Ry5E?L_U%y7h`6VP)~vE>65b0Dbv>}RR-pdV{A z;f#YiAJFeT1e96d;oTA!qdQJPbOzg3TfngfUoXeAiE{K0M;$&GS@IpYJk`~8y7d?e zc7v$(83z$E0QwBk@Oa!KIiVEH!gBQT@_j3E;fu{T$pb7GyCA$1MVh{GuysfLSUq1a z1HPsU*zzR3=;uB7mKP;^{z7+5BTfwgW zxmkS(MITDrTLC99LuBymQgxdbr_9-Abt8_QEMM2Ylv(?A4nUn|#(8pA1d=};AO-+x zZ^m5P`VCY_sqf==ej+|vC-$?@HnDlZz*dwX2GM4KYlmHo!jStuX7=5SUcPLpNlz5~*vPnMg$ zzo<$GA_@Vseo9_4Sm?gq(ToNVtmj(G%=7Tk3{7f{>U-c+0AymNU9Z1^-rkhEuJ7pCG0FodQo3R!06;(?&HV593%|d) zDULdR1vEq*DX+lWjkftY0Rn8G@A1@fuUs{N-pizQhyfpw6^;iNUiqVXxs?Igw6J7x zGF6as_>r7^7x3xc%b&$RzTvPE&opNXyUj&VgsP}3c;^IA+Y*3Z#XT!JO?AOW+BrSs zQ$fJFf>#!voCgZ<>O4#p!g6;n2XTQM+<NE9M&s`0@yxof& z2q=f{rfo)lSC7hM~CM?i0(+B$3!84lr8u + + + + + + + diff --git a/app/src/main/assets/web/uploadBook/i/wifi_tz0.png b/app/src/main/assets/web/uploadBook/i/wifi_tz0.png new file mode 100644 index 0000000000000000000000000000000000000000..85aa8a7e4d06b3b2804bd5851d1f0f80e7476b13 GIT binary patch literal 3793 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 literal 0 HcmV?d00001 diff --git a/app/src/main/assets/web/uploadBook/index.html b/app/src/main/assets/web/uploadBook/index.html index 8caa97705..a3e99428f 100644 --- a/app/src/main/assets/web/uploadBook/index.html +++ b/app/src/main/assets/web/uploadBook/index.html @@ -1,33 +1,43 @@ - - - + + - - 传书 - - + + + + - -

-

传书

- 拖拽到此处上传书籍 +
+
+

+
+
+
+
+
+ +
+
    +
    +
    +
    + +
    +

    +
    +
    +
    +
    +

    +
    - \ No newline at end of file + + + + + + + + + diff --git a/app/src/main/assets/web/uploadBook/js/common.js b/app/src/main/assets/web/uploadBook/js/common.js new file mode 100644 index 000000000..6ba1fe6cf --- /dev/null +++ b/app/src/main/assets/web/uploadBook/js/common.js @@ -0,0 +1,269 @@ +/** + * 公共函数 + */ + +//全局的配置文件 +var config = { + fileTypes : "txt|epub|umd", //允许上传的文件格式 "txt|epub" // |doc|docx|wps|xls|xlsx|et|ppt|pptx|dps + //url : "http://"+location.host+"?action=addBook",//"http://localhost/t/post.php",// + url: "http://192.168.1.16:1122/addLocalBook", + fileLimitSize : 500 * 1024 *1024 + +} + +var file = { + "inQueue" : [], //已经在队列里面的文件,包括 HTML5上传和 Flash上传的 + "clientHaveFiles" : [] // 客户端已经存在的文件列表 +} + +/** + * HTML5 和 flash 公用,所有文件对象集合 + * @var array + */ +var filesUpload = []; // + +$.ajax({ + url : "http://"+location.host+'?action=getBooksList&t='+(+new Date()),//"http://localhost/t/t.php",// + async:false,//同步获取数据 + dataType : "json", + success:function(data){ + + try{ + var dataLen = data.length; + if(dataLen > 0 ){ + for(var i=0; i < dataLen; i++){ + filesUpload.push(data[i]); + } + } + }catch(e){} + + } +}) + +//统计文件大小 +function countFileSize(fileSize) +{ + var KB = 1024; + var MB = 1024 * 1024; + if(KB >= fileSize){ + return fileSize+"B"; + }else if(MB >= fileSize){ + return (fileSize/KB).toFixed(2)+"KB"; + }else{ + return (fileSize/MB).toFixed(2)+"MB"; + } +} + +//如果文件太长进行截取 +function substr_string(name) +{ + var maxLen = 15; + var len = name.length; + if(len < 17 )return name; + + var lastIndex = name.lastIndexOf("."); + var suffix = name.substr(lastIndex); + var pre = name.substr(0,lastIndex); + var preLen = pre.length; + var preStart = preLen - 10; + //前面10个 + 后面5个 + var fileName = pre.substr(0,10) + "...." + pre.substr( preStart > 4 ? -4 : -preStart , 4)+suffix; + return fileName +} + + +function checkFile(file) { + + if(file.size > config.fileLimitSize){ + return jsonLang.t11; + } + + if (!file.name || !file.name.toLowerCase().match('('+config.fileTypes+')$')) { + return jsonLang.t12; + } + + var len = filesUpload.length; + for(var i=0; i< len; i++){ + if(filesUpload[i].name == file.name) { + return jsonLang.t13; + } + } + return null; +} + + + + + + +/** + * 添加文件时,回调的函数 + * @param object file 文件对象 + * @param int type 0 是swf 上传的,1 是html5上传的 + */ +function fileQueued(file, type) +{ + var size=0 ,fid=file.id, name=""; + type = type || 0; + + if(file != undefined ) + { + //计算文件大小 单位MB + size = countFileSize(file.size); + name = substr_string(file.name) + //创建要插入的元素 +// "

    "+name+"

    "+ +// "
    "+ +// "
    "+ +// "
    "+size+""; + + var HTML = '
  • '+ + '
    '+ + '
    '+name+'
    '+ + '
    '+size+'
    '+ + '
    '+ + '0% '+jsonLang.t9+'
    '+ + '
    '+ + '

    '+ + '
  • '; + + + jQuery("#tableStyle").append(HTML); + //保存falsh_id,为上传做准备 + //global_flash_id.push(file.id); + //更改背景颜色 + changeTrBackGroundColor() + } +} + +function changeTrBackGroundColor() +{ + var getTr=document.getElementById("tableStyle").getElementsByTagName("dl"); + trNum=getTr.length; + for(var i=0;i"+jsonLang.t10+"") +} + + +//取消上传 +function userCancelUpload(file_id, type) +{ + + if(type==0){ + SWFFuns.cancelUpload(file_id); + }else{ + HTML5Funs.cancelUpload(file_id); + } + + $("#handle_button_"+file_id).html(jsonLang.t14).removeClass("orange").addClass("gray"); + //如果已经上传一部分了 + if($("#progress_bar_p_"+file_id).hasClass("orange")){ + $("#progress_bar_p_"+file_id).removeClass("orange"); + $("#progress_bar_p_"+file_id).addClass("gray"); + } +} + + +/** + * 通过文件名称 从全局的文件列表中获取文件对象 + * + */ +function getFileFomeFilesUpload(filename){ + var len = filesUpload.length; + for(var i=0; i < len; i++){ + if(filesUpload[i].name == filename){ + return filesUpload[i]; + } + } + + return null; +} + + +/** + * 往全局的 上传列表添加一个数据 + */ +function addFileToFilesUpload(file){ + + if(typeof file == "string"){ + filesUpload.push({"name":file}) + return true; + }else if(typeof file == "object"){ + filesUpload.push(file); + return true; + } + + return false; +} + +/** + * 往全局的 上传列表添加一个数据 + */ +function updateFileToFilesUpload(file){ + + var len = filesUpload.length; + for(var i=0; i < len; i++){ + if(filesUpload[i].name == file.name){ + filesUpload[i] = file; + return true; + } + } + + return false; +} + +/** + * 查找在数组中的位置 + */ +function findObjectKey (object, fid){ + var len = object.length; + for(var i=0; i -1) + files.splice(filesUploadKey, 1); + + return files; +} \ No newline at end of file diff --git a/app/src/main/assets/web/uploadBook/js/html5_fun.js b/app/src/main/assets/web/uploadBook/js/html5_fun.js new file mode 100644 index 000000000..6ef0f2944 --- /dev/null +++ b/app/src/main/assets/web/uploadBook/js/html5_fun.js @@ -0,0 +1,244 @@ +/** + * 处理拖拽上传 + */ + var isDragOver = false;//拖拽触发点 + var fileNumber = -1; //上传文件编号 + var fileNumberPex = "zyFileUpload_"; //编号前缀 + var currUploadfile = {}; //当前上传的文件对象 + + var uploadQueue = [];//上传队列集合 + var isUploading = false;//是否正在上传 + + var XHR + try{ + XHR = new XMLHttpRequest(); + }catch(e){} + +(function(isSupportFileUpload){ + + //不支持拖拽上传,或者 不支持FormData ,显示WiFi表示 + if(!isSupportFileUpload){ + $("#drag_area").addClass("wf_wifi"); + $("#drag_area h3").html(""); + return; + //更换样式 + }else{ + $("#drag_area").addClass("wf_normal"); + } + + + addEvent(); + + /** + * 添加事件 + */ + function addEvent(){ + var dropArea = $('#drag_area h3')[0]; + dropArea.addEventListener('dragover', handleDragOver, false); + dropArea.addEventListener('dragleave', handleDragLeave, false); + dropArea.addEventListener('drop', handleDrop, false); + } + + /** + * 松开拖拽文件的处理,进行上传 + */ + function handleDrop(evt){ + + evt.stopPropagation(); + evt.preventDefault(); + $('#drag_area').addClass('wf_normal').removeClass('wf_active'); + + console.log("Drop"); + isDragOver = false; + + var file={}; + var errorMsgs = []; + var len = evt.dataTransfer.files.length; + + for(var i=0; i < len; i++){ + fileNumber ++ ; + file = evt.dataTransfer.files[i]; + file.id = fileNumberPex+fileNumber; + + //检测文件 + msg = checkFile(file) + //文件可以通过 + if(!msg){ + //添加全局 + filesUpload.push(file); + //添加上传队列 + uploadQueue.push(file); + //在页面进行展示 + fileQueued(file, 1); + }else{ + errorMsgs.push(msg) + } + } + + if(errorMsgs.length>0){ + //只选择做一个进行上传 + if(len==1){ + alert(errorMsgs[0]); + + }else{ + a1=len; + a2=len - errorMsgs.length; + + var replaceArr = new Array(a1,a2); + alert(stringReplace(jsonLang.t7,replaceArr)); + } + } + + //拿出第一个,进行上传 + if(!isUploading && uploadQueue.length>0) uploadFiles(uploadQueue.shift()); + } + + + function handleDragOver(evt){ + + evt.stopPropagation(); + evt.preventDefault(); + //防止多次DOM操作 + if (!isDragOver) { + console.log("Over"); + $('#drag_area').addClass('wf_active').removeClass('wf_normal'); + isDragOver = true; + } + + + } + + function handleDragLeave(evt){ + + console.log("DragLeave"); + evt.stopPropagation(); + evt.preventDefault(); + isDragOver = false; + $('#drag_area').addClass('wf_normal').removeClass('wf_active'); + } + + + + function uploadFiles(file){ + //正在上传 + isUploading = true; + //设置上传的数据 + var fd = new FormData(); + fd.append("Filename", file.name); + fd.append("Filedata", file); + fd.append("Upload", "Submit Query"); + //设置当前的上传对象 + currUploadfile = file; + if(XHR.readyState>0){ + XHR = new XMLHttpRequest(); + } + + XHR.upload.addEventListener("progress", progress, false); + XHR.upload.addEventListener("load", requestLoad, false); + XHR.upload.addEventListener("error", error, false); + XHR.upload.addEventListener("abort", abort, false); + XHR.upload.addEventListener("loadend", loadend, false); + XHR.upload.addEventListener("loadstart", loadstart, false); + XHR.open("POST", config.url); + XHR.setRequestHeader("Content-Type","application/octet-stream"); + XHR.send(fd); + XHR.onreadystatechange = function() { + + //只要上传完成不管成功失败 + if (XHR.readyState == 4 ){ + console.log("onreadystatechange " , XHR.status, +new Date()); + + if(XHR.status == 200){ + uploadSuccess(currUploadfile, {}, XHR.status) + }else{ + uploadError() + } + + //进行下一个上传 + nextUpload() + } + }; + + } + + //请求完成,无论失败或成功 + function loadend(evt){ + console.log("loadend",+new Date(),evt); + } + //请求开始 + function loadstart(evt){ + console.log("loadstart",evt); + } + + //在请求发送或接收数据期间,在服务器指定的时间间隔触发。 + function progress(evt){ + uploadProgress(currUploadfile, evt.loaded || evt.position , evt.total) + } + + //在请求被取消时触发,例如,在调用 abort() 方法时。 + function abort(evt){ + console.log("abort",evt); + } + + //在请求失败时触发。 + function error(evt){ + //终止ajax请求 + XHR.abort(); + uploadError() + nextUpload(); + } + + //在请求成功完成时触发。 + function requestLoad(evt){ + console.log("requestLoad", +new Date(),evt); + } + + //进行下一个上传 + function nextUpload(){ + isUploading = false; + if(uploadQueue.length>0){ + uploadFiles(uploadQueue.shift()); + }else{ + //米有正在上传的了 + currUploadfile = {} + } + } + + //上传出错误了,比如断网, + function uploadError(){ + //移除全局变量中的,上传出错的 + removeFileFromFilesUpload(filesUpload, currUploadfile.id) + var file = currUploadfile; + $("#handle_button_"+file.id).replaceWith("
    "+jsonLang.t8+"
    ") + } + + + //对外部注册的函数 + var HTML5Funs = { + /** + * 取消上传 + * @param string fid 文件的Id + */ + cancelUpload : function(fid){ + + var filesUploadKey = -1; + var uploadQueueKey = -1; + + + //从全局中删除文件 + removeFileFromFilesUpload(filesUpload, fid) + + //如果是正在上传的,AJAX取消 + if(currUploadfile.id == fid){ + XHR.abort(); + }else{ + //从上传队列中移除 + removeFileFromFilesUpload(uploadQueue, fid) + } + } + } + + window.HTML5Funs = HTML5Funs; + + +})("FormData" in window && "ondrop" in document.body) \ No newline at end of file diff --git a/app/src/main/assets/web/uploadBook/js/jquery-1.4.2.min.js b/app/src/main/assets/web/uploadBook/js/jquery-1.4.2.min.js new file mode 100644 index 000000000..7c2430802 --- /dev/null +++ b/app/src/main/assets/web/uploadBook/js/jquery-1.4.2.min.js @@ -0,0 +1,154 @@ +/*! + * jQuery JavaScript Library v1.4.2 + * http://jquery.com/ + * + * Copyright 2010, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2010, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Sat Feb 13 22:33:48 2010 -0500 + */ +(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/, +Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&& +(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this, +a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b=== +"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this, +function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b
    a"; +var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected, +parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent= +false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n= +s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true, +applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando]; +else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this, +a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b=== +w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i, +cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected= +c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed"); +a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g, +function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split("."); +k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a), +C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B=0){a.type= +e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&& +f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive; +if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data", +e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a, +"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a, +d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, +e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift(); +t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D|| +g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()}, +CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m, +g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)}, +text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}}, +setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return hl[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h= +h[3];l=0;for(m=h.length;l=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m=== +"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g, +h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&& +q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML=""; +if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="

    ";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}(); +(function(){var g=s.createElement("div");g.innerHTML="
    ";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}: +function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f0)for(var j=d;j0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j= +{},i;if(f&&a.length){e=0;for(var o=a.length;e-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a=== +"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode", +d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")? +a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType=== +1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/"},F={option:[1,""],legend:[1,"
    ","
    "],thead:[1,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],col:[2,"","
    "],area:[1,"",""],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div
    ","
    "];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= +c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, +wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, +prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b, +this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); +return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja, +""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]); +return this}else{e=0;for(var j=d.length;e0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["", +""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]===""&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e= +c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]? +c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja= +function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter= +Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a, +"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f= +a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b= +a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=//gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!== +"string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("
    ").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this}, +serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), +function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href, +global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&& +e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)? +"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache=== +false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B= +false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since", +c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E|| +d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x); +g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status=== +1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b=== +"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional; +if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration=== +"number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]|| +c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start; +this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now= +this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem, +e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b
    "; +a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b); +c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a, +d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top- +f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset": +"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in +e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window); diff --git a/app/src/main/assets/web/uploadBook/js/langSwich.js b/app/src/main/assets/web/uploadBook/js/langSwich.js new file mode 100644 index 000000000..a313747bf --- /dev/null +++ b/app/src/main/assets/web/uploadBook/js/langSwich.js @@ -0,0 +1,88 @@ +/** + * wifi传书功能,供客户端调用 + * 切换语言环境 addby zhongweikang@zhangyue.com 2015/09/23 + */ + + var language;//当前语言 + var jsonEn;//英文 + var jsonZh;//中文 + + /** + * 语言包 + */ + jsonEn = { t0:"WiFi Upload",t1:"Documents",t2:"Name",t3:"Size",t4:"Operation", + t5:"Supported Format:TXT、EPUB、UMD",t6:"Drag here and Drop to upload", + t7:"You choosed [txt] files ,we only can upload [txt] of them。\nPlease choose TXT、EPUB、UMD files, file name cannot be repeated.", + t8:"Failed",t9:"Cancel",t10:"Done",t11:"One of books is over 500MB",t12:"Bad file mode", + t13:"File already exists",t14:"Canceled" + }; + jsonZh = { t0:"WiFi 下载",t1:"文档",t2:"名字",t3:"大小",t4:"操作", + t5:"支持类型:TXT、EPUB、UMD",t6:"拖至此处上传", + t7:"你选择了[txt]个文件,我们只能上传其中的[txt]。\n请选择 TXT、EPUB、UMD 类型的文件,文件的名字不能重复。", + t8:"失败",t9:"取消",t10:"完成",t11:"上传文件不能大于500MB",t12:"无效的文件格式", + t13:"文件已存在",t14:"已取消" + }; + + if (navigator.language) { + language = navigator.language; + } + else { + language = navigator.browserLanguage; + } + language = language.toLowerCase(language); + + /** + * 切换语言 + */ + function langSwich(s){ + switch(s){ + case 'en-us': + _strReplace(jsonEn); + break; + case 'zh-cn': + _strReplace(jsonZh); + break; + default: + _strReplace(jsonEn); + break; + } + } + function _strReplace(d){ + window.jsonLang=d;//全局变量在其他js文件中会遇到,勿删。 + for(var i in jsonLang){ + $('[data-js=' + i + ']').html(d[i]) + } + } + + /** + * 特殊字符串替换,例:语言包中的 t7 + * content 替换前的文本 + * replace 待插入的文本 (支持变量或数组) + */ + var isArray = function(obj) { + return Object.prototype.toString.call(obj) === '[object Array]'; + } + function stringReplace(content,replace){ + + var str = content; + if(!str){return null;} + + if(isArray(replace)){ + strs=str.split("[txt]"); + count = strs.length-1; + + var string = ''; + for(var i=0;i"},*/ + file_size_limit : config.fileLimitSize+" B", + file_types : "*."+config.fileTypes.split("|").join(";*."), + + file_types_description : "All Files", + file_upload_limit : 1000, //配置上传个数 + file_queue_limit : 0, + custom_settings : { + progressTarget : "fsUploadProgress", + cancelButtonId : "btnCancel" + }, + debug: 0, + + button_cursor:SWFUpload.CURSOR.HAND, + button_image_url: "i/wifi_btn_b.png", + button_width: "240", + button_height: "100", + button_float: "right", + button_placeholder_id: "spanButtonPlaceHolder", + button_text: '', + + assume_success_timeout:30, + file_queued_handler : swfFileQueued, + file_queue_error_handler : fileQueueError, + file_dialog_complete_handler : fileDialogComplete, + upload_start_handler : uploadStart, + upload_progress_handler : uploadProgress, + upload_error_handler : uploadError, + upload_success_handler : uploadSuccess, + upload_complete_handler : uploadComplete, + queue_complete_handler : queueComplete + }; + swfu = new SWFUpload(settings); + }; + + + + //上传完成 +function uploadComplete(file,server,response) +{ + //继续下一个文件的上传 + this.startUpload(); +} + +//完成队列里的上传 +function queueComplete(numFilesUploaded) +{ + +} + +function userStartUpload(file_id) +{ + swfu.startUpload(file_id); +} + + + + + +function fileQueueError(file, errorCode, message) +{ + switch(errorCode){ + case -100: + //alert("Over 100 books"); + case -110: + //alert("One of books is over 500MB"); + break; + case -120: + //alert("One of books is 0KB"); + break; + } +} +//入列完毕 +function fileDialogComplete(numFilesSelected, numFilesQueued) +{ + if (numFilesSelected > 0) + { + this.startUpload() + } +} +//开始上传 +function uploadStart(file) +{ + return true; +} + +//上传出错 +function uploadError(file, errorCode, message) +{ + switch (errorCode) { + case SWFUpload.UPLOAD_ERROR.HTTP_ERROR: + errorMessage = "Error"; + break; + case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED: + errorMessage = "Failed"; + break; + case SWFUpload.UPLOAD_ERROR.IO_ERROR: + errorMessage = "Please open wifi upload page"; + break; + case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR: + errorMessage = "Security error"; + break; + case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED: + errorMessage = "Security error"; + break; + case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED: + errorMessage = "Unable to verify. Skip "; + break; + default: + errorMessage = "Unhandled error"; + break; + } + + //从上传队列中移除 + removeFileFromFilesUpload(filesUpload, file.id) + + errorMessage = jsonLang.t8; + + $("#handle_button_"+file.id).replaceWith("
    "+errorMessage+"
    ") +} + + +var tmp = 0; +var errorFile = 0; +var errorMsgs = []; + +function swfFileQueued(file){ + + + //本次上传选中的文件个数 + if(swfSelectCount==0) swfSelectCount = this.getStats().files_queued + //检测文件 + msg = checkFile(file) + + + //文件可以通过 + if(!msg){ + //添加全局的队列 + filesUpload.push(file); + //在页面进行展示 + fileQueued(file, 0) + }else{ + //从上传队列移除,验证失败的文件 + this.cancelUpload(file.id, false) + errorMsgs.push(msg) + } + + + + //队列选择完毕,初始化所有的数据 + if(++tmp == swfSelectCount){ + + if(errorMsgs.length>0){ + //只选择做一个进行上传 + if(swfSelectCount==1){ + alert(errorMsgs[0]); + }else{ + a1=swfSelectCount; + a2=swfSelectCount - errorMsgs.length; + + var replaceArr = new Array(a1,a2); + alert(stringReplace(jsonLang.t7,replaceArr)); + } + } + + tmp = 0; + errorFile = 0; + swfSelectCount = 0; + errorMsgs = [] + } + + +} + + + +var SWFFuns = { + cancelUpload : function(fid){ + swfu.cancelUpload(fid, false); + } + +} \ No newline at end of file diff --git a/app/src/main/assets/web/uploadBook/js/swfupload.js b/app/src/main/assets/web/uploadBook/js/swfupload.js new file mode 100644 index 000000000..776d3b0a4 --- /dev/null +++ b/app/src/main/assets/web/uploadBook/js/swfupload.js @@ -0,0 +1,1146 @@ +/** + * SWFUpload: http://www.swfupload.org, http://swfupload.googlecode.com + * + * mmSWFUpload 1.0: Flash upload dialog - http://profandesign.se/swfupload/, http://www.vinterwebb.se/ + * + * SWFUpload is (c) 2006-2007 Lars Huring, Olov Nilz�n and Mammon Media and is released under the MIT License: + * http://www.opensource.org/licenses/mit-license.php + * + * SWFUpload 2 is (c) 2007-2008 Jake Roberts and is released under the MIT License: + * http://www.opensource.org/licenses/mit-license.php + * + * SWFObject v2.2 + * is released under the MIT License + */ + + + +/* ******************* */ +/* Constructor & Init */ +/* ******************* */ +var SWFUpload; +var swfobject; + +if (SWFUpload == undefined) { + SWFUpload = function (settings) { + this.initSWFUpload(settings); + }; +} + +SWFUpload.prototype.initSWFUpload = function (userSettings) { + try { + this.customSettings = {}; // A container where developers can place their own settings associated with this instance. + this.settings = {}; + this.eventQueue = []; + this.movieName = "SWFUpload_" + SWFUpload.movieCount++; + this.movieElement = null; + + + // Setup global control tracking + SWFUpload.instances[this.movieName] = this; + + // Load the settings. Load the Flash movie. + this.initSettings(userSettings); + this.loadSupport(); + if (this.swfuploadPreload()) { + this.loadFlash(); + } + + this.displayDebugInfo(); + } catch (ex) { + delete SWFUpload.instances[this.movieName]; + throw ex; + } +}; + +/* *************** */ +/* Static Members */ +/* *************** */ +SWFUpload.instances = {}; +SWFUpload.movieCount = 0; +SWFUpload.version = "2.5.0 2010-01-15 Beta 2"; +SWFUpload.QUEUE_ERROR = { + QUEUE_LIMIT_EXCEEDED : -100, + FILE_EXCEEDS_SIZE_LIMIT : -110, + ZERO_BYTE_FILE : -120, + INVALID_FILETYPE : -130 +}; +SWFUpload.UPLOAD_ERROR = { + HTTP_ERROR : -200, + MISSING_UPLOAD_URL : -210, + IO_ERROR : -220, + SECURITY_ERROR : -230, + UPLOAD_LIMIT_EXCEEDED : -240, + UPLOAD_FAILED : -250, + SPECIFIED_FILE_ID_NOT_FOUND : -260, + FILE_VALIDATION_FAILED : -270, + FILE_CANCELLED : -280, + UPLOAD_STOPPED : -290, + RESIZE : -300 +}; +SWFUpload.FILE_STATUS = { + QUEUED : -1, + IN_PROGRESS : -2, + ERROR : -3, + COMPLETE : -4, + CANCELLED : -5 +}; +SWFUpload.UPLOAD_TYPE = { + NORMAL : -1, + RESIZED : -2 +}; + +SWFUpload.BUTTON_ACTION = { + SELECT_FILE : -100, + SELECT_FILES : -110, + START_UPLOAD : -120, + JAVASCRIPT : -130, // DEPRECATED + NONE : -130 +}; +SWFUpload.CURSOR = { + ARROW : -1, + HAND : -2 +}; +SWFUpload.WINDOW_MODE = { + WINDOW : "window", + TRANSPARENT : "transparent", + OPAQUE : "opaque" +}; + +SWFUpload.RESIZE_ENCODING = { + JPEG : -1, + PNG : -2 +}; + +// Private: takes a URL, determines if it is relative and converts to an absolute URL +// using the current site. Only processes the URL if it can, otherwise returns the URL untouched +SWFUpload.completeURL = function (url) { + try { + var path = "", indexSlash = -1; + if (typeof(url) !== "string" || url.match(/^https?:\/\//i) || url.match(/^\//) || url === "") { + return url; + } + + indexSlash = window.location.pathname.lastIndexOf("/"); + if (indexSlash <= 0) { + path = "/"; + } else { + path = window.location.pathname.substr(0, indexSlash) + "/"; + } + + return path + url; + } catch (ex) { + return url; + } +}; + +// Public: assign a new function to onload to use swfobject's domLoad functionality +SWFUpload.onload = function () {}; + + +/* ******************** */ +/* Instance Members */ +/* ******************** */ + +// Private: initSettings ensures that all the +// settings are set, getting a default value if one was not assigned. +SWFUpload.prototype.initSettings = function (userSettings) { + this.ensureDefault = function (settingName, defaultValue) { + var setting = userSettings[settingName]; + if (setting != undefined) { + this.settings[settingName] = setting; + } else { + this.settings[settingName] = defaultValue; + } + }; + + // Upload backend settings + this.ensureDefault("upload_url", ""); + this.ensureDefault("preserve_relative_urls", false); + this.ensureDefault("file_post_name", "Filedata"); + this.ensureDefault("post_params", {}); + this.ensureDefault("use_query_string", false); + this.ensureDefault("requeue_on_error", false); + this.ensureDefault("http_success", []); + this.ensureDefault("assume_success_timeout", 0); + + // File Settings + this.ensureDefault("file_types", "*.*"); + this.ensureDefault("file_types_description", "All Files"); + this.ensureDefault("file_size_limit", 0); // Default zero means "unlimited" + this.ensureDefault("file_upload_limit", 0); + this.ensureDefault("file_queue_limit", 0); + + // Flash Settings + this.ensureDefault("flash_url", "swfupload.swf"); + this.ensureDefault("flash9_url", "swfupload_fp9.swf"); + this.ensureDefault("prevent_swf_caching", true); + + // Button Settings + this.ensureDefault("button_image_url", ""); + this.ensureDefault("button_width", 1); + this.ensureDefault("button_height", 1); + this.ensureDefault("button_text", ""); + this.ensureDefault("button_text_style", "color: #000000; font-size: 16pt;"); + this.ensureDefault("button_text_top_padding", 0); + this.ensureDefault("button_text_left_padding", 0); + this.ensureDefault("button_action", SWFUpload.BUTTON_ACTION.SELECT_FILES); + this.ensureDefault("button_disabled", false); + this.ensureDefault("button_placeholder_id", ""); + this.ensureDefault("button_placeholder", null); + this.ensureDefault("button_cursor", SWFUpload.CURSOR.ARROW); + this.ensureDefault("button_window_mode", SWFUpload.WINDOW_MODE.TRANSPARENT); + + // Debug Settings + this.ensureDefault("debug", false); + this.settings.debug_enabled = this.settings.debug; // Here to maintain v2 API + + // Event Handlers + this.settings.return_upload_start_handler = this.returnUploadStart; + this.ensureDefault("swfupload_preload_handler", null); + this.ensureDefault("swfupload_load_failed_handler", null); + this.ensureDefault("swfupload_loaded_handler", null); + this.ensureDefault("file_dialog_start_handler", null); + this.ensureDefault("file_queued_handler", null); + this.ensureDefault("file_queue_error_handler", null); + this.ensureDefault("file_dialog_complete_handler", null); + + this.ensureDefault("upload_resize_start_handler", null); + this.ensureDefault("upload_start_handler", null); + this.ensureDefault("upload_progress_handler", null); + this.ensureDefault("upload_error_handler", null); + this.ensureDefault("upload_success_handler", null); + this.ensureDefault("upload_complete_handler", null); + + this.ensureDefault("mouse_click_handler", null); + this.ensureDefault("mouse_out_handler", null); + this.ensureDefault("mouse_over_handler", null); + + this.ensureDefault("debug_handler", this.debugMessage); + + this.ensureDefault("custom_settings", {}); + + // Other settings + this.customSettings = this.settings.custom_settings; + + // Update the flash url if needed + if (!!this.settings.prevent_swf_caching) { + this.settings.flash_url = this.settings.flash_url + (this.settings.flash_url.indexOf("?") < 0 ? "?" : "&") + "preventswfcaching=" + new Date().getTime(); + this.settings.flash9_url = this.settings.flash9_url + (this.settings.flash9_url.indexOf("?") < 0 ? "?" : "&") + "preventswfcaching=" + new Date().getTime(); + } + + if (!this.settings.preserve_relative_urls) { + this.settings.upload_url = SWFUpload.completeURL(this.settings.upload_url); + this.settings.button_image_url = SWFUpload.completeURL(this.settings.button_image_url); + } + + delete this.ensureDefault; +}; + +// Initializes the supported functionality based the Flash Player version, state, and event that occur during initialization +SWFUpload.prototype.loadSupport = function () { + this.support = { + loading : swfobject.hasFlashPlayerVersion("9.0.28"), + imageResize : swfobject.hasFlashPlayerVersion("10.0.0") + }; + +}; + +// Private: loadFlash replaces the button_placeholder element with the flash movie. +SWFUpload.prototype.loadFlash = function () { + var targetElement, tempParent, wrapperType, flashHTML, els; + + if (!this.support.loading) { + this.queueEvent("swfupload_load_failed_handler", ["Flash Player doesn't support SWFUpload"]); + return; + } + + // Make sure an element with the ID we are going to use doesn't already exist + if (document.getElementById(this.movieName) !== null) { + this.support.loading = false; + this.queueEvent("swfupload_load_failed_handler", ["Element ID already in use"]); + return; + } + + // Get the element where we will be placing the flash movie + targetElement = document.getElementById(this.settings.button_placeholder_id) || this.settings.button_placeholder; + + if (targetElement == undefined) { + this.support.loading = false; + this.queueEvent("swfupload_load_failed_handler", ["button place holder not found"]); + return; + } + + wrapperType = (targetElement.currentStyle && targetElement.currentStyle["display"] || window.getComputedStyle && document.defaultView.getComputedStyle(targetElement, null).getPropertyValue("display")) !== "block" ? "span" : "div"; + + // Append the container and load the flash + tempParent = document.createElement(wrapperType); + + flashHTML = this.getFlashHTML(); + + try { + tempParent.innerHTML = flashHTML; // Using innerHTML is non-standard but the only sensible way to dynamically add Flash in IE (and maybe other browsers) + } catch (ex) { + this.support.loading = false; + this.queueEvent("swfupload_load_failed_handler", ["Exception loading Flash HTML into placeholder"]); + return; + } + + // Try to get the movie element immediately + els = tempParent.getElementsByTagName("object"); + if (!els || els.length > 1 || els.length === 0) { + this.support.loading = false; + this.queueEvent("swfupload_load_failed_handler", ["Unable to find movie after adding to DOM"]); + return; + } else if (els.length === 1) { + this.movieElement = els[0]; + } + + targetElement.parentNode.replaceChild(tempParent.firstChild, targetElement); + + // Fix IE Flash/Form bug + if (window[this.movieName] == undefined) { + window[this.movieName] = this.getMovieElement(); + } +}; + +// Private: getFlashHTML generates the object tag needed to embed the flash in to the document +SWFUpload.prototype.getFlashHTML = function (flashVersion) { + // Flash Satay object syntax: http://www.alistapart.com/articles/flashsatay + + var classid = ""; + //�����IE9,10 ������calssid + if (window.ActiveXObject){ + try{ + if (+navigator.userAgent.toLowerCase().match(/msie ([\d.]+)/)[1].substring(0, 1) >= 9) + classid = ' classid = "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '; + }catch(e){ + classid = "" + } + } + + + + return ['', + '', + '', + '', + '', + '', + ''].join(""); +}; + +// Private: getFlashVars builds the parameter string that will be passed +// to flash in the flashvars param. +SWFUpload.prototype.getFlashVars = function () { + // Build a string from the post param object + var httpSuccessString, paramString; + + paramString = this.buildParamString(); + httpSuccessString = this.settings.http_success.join(","); + + // Build the parameter string + return ["movieName=", encodeURIComponent(this.movieName), + "&uploadURL=", encodeURIComponent(this.settings.upload_url), + "&useQueryString=", encodeURIComponent(this.settings.use_query_string), + "&requeueOnError=", encodeURIComponent(this.settings.requeue_on_error), + "&httpSuccess=", encodeURIComponent(httpSuccessString), + "&assumeSuccessTimeout=", encodeURIComponent(this.settings.assume_success_timeout), + "&params=", encodeURIComponent(paramString), + "&filePostName=", encodeURIComponent(this.settings.file_post_name), + "&fileTypes=", encodeURIComponent(this.settings.file_types), + "&fileTypesDescription=", encodeURIComponent(this.settings.file_types_description), + "&fileSizeLimit=", encodeURIComponent(this.settings.file_size_limit), + "&fileUploadLimit=", encodeURIComponent(this.settings.file_upload_limit), + "&fileQueueLimit=", encodeURIComponent(this.settings.file_queue_limit), + "&debugEnabled=", encodeURIComponent(this.settings.debug_enabled), + "&buttonImageURL=", encodeURIComponent(this.settings.button_image_url), + "&buttonWidth=", encodeURIComponent(this.settings.button_width), + "&buttonHeight=", encodeURIComponent(this.settings.button_height), + "&buttonText=", encodeURIComponent(this.settings.button_text), + "&buttonTextTopPadding=", encodeURIComponent(this.settings.button_text_top_padding), + "&buttonTextLeftPadding=", encodeURIComponent(this.settings.button_text_left_padding), + "&buttonTextStyle=", encodeURIComponent(this.settings.button_text_style), + "&buttonAction=", encodeURIComponent(this.settings.button_action), + "&buttonDisabled=", encodeURIComponent(this.settings.button_disabled), + "&buttonCursor=", encodeURIComponent(this.settings.button_cursor) + ].join(""); +}; + +// Public: get retrieves the DOM reference to the Flash element added by SWFUpload +// The element is cached after the first lookup +SWFUpload.prototype.getMovieElement = function () { + if (this.movieElement == undefined) { + this.movieElement = document.getElementById(this.movieName); + } + + if (this.movieElement === null) { + throw "Could not find Flash element"; + } + + return this.movieElement; +}; + +// Private: buildParamString takes the name/value pairs in the post_params setting object +// and joins them up in to a string formatted "name=value&name=value" +SWFUpload.prototype.buildParamString = function () { + var name, postParams, paramStringPairs = []; + + postParams = this.settings.post_params; + + if (typeof(postParams) === "object") { + for (name in postParams) { + if (postParams.hasOwnProperty(name)) { + paramStringPairs.push(encodeURIComponent(name.toString()) + "=" + encodeURIComponent(postParams[name].toString())); + } + } + } + + return paramStringPairs.join("&"); +}; + +// Public: Used to remove a SWFUpload instance from the page. This method strives to remove +// all references to the SWF, and other objects so memory is properly freed. +// Returns true if everything was destroyed. Returns a false if a failure occurs leaving SWFUpload in an inconsistant state. +// Credits: Major improvements provided by steffen +SWFUpload.prototype.destroy = function () { + var movieElement; + + try { + // Make sure Flash is done before we try to remove it + this.cancelUpload(null, false); + + movieElement = this.cleanUp(); + + // Remove the SWFUpload DOM nodes + if (movieElement) { + // Remove the Movie Element from the page + try { + movieElement.parentNode.removeChild(movieElement); + } catch (ex) {} + } + + // Remove IE form fix reference + window[this.movieName] = null; + + // Destroy other references + SWFUpload.instances[this.movieName] = null; + delete SWFUpload.instances[this.movieName]; + + this.movieElement = null; + this.settings = null; + this.customSettings = null; + this.eventQueue = null; + this.movieName = null; + + + return true; + } catch (ex2) { + return false; + } +}; + + +// Public: displayDebugInfo prints out settings and configuration +// information about this SWFUpload instance. +// This function (and any references to it) can be deleted when placing +// SWFUpload in production. +SWFUpload.prototype.displayDebugInfo = function () { + this.debug( + [ + "---SWFUpload Instance Info---\n", + "Version: ", SWFUpload.version, "\n", + "Movie Name: ", this.movieName, "\n", + "Settings:\n", + "\t", "upload_url: ", this.settings.upload_url, "\n", + "\t", "flash_url: ", this.settings.flash_url, "\n", + "\t", "flash9_url: ", this.settings.flash9_url, "\n", + "\t", "use_query_string: ", this.settings.use_query_string.toString(), "\n", + "\t", "requeue_on_error: ", this.settings.requeue_on_error.toString(), "\n", + "\t", "http_success: ", this.settings.http_success.join(", "), "\n", + "\t", "assume_success_timeout: ", this.settings.assume_success_timeout, "\n", + "\t", "file_post_name: ", this.settings.file_post_name, "\n", + "\t", "post_params: ", this.settings.post_params.toString(), "\n", + "\t", "file_types: ", this.settings.file_types, "\n", + "\t", "file_types_description: ", this.settings.file_types_description, "\n", + "\t", "file_size_limit: ", this.settings.file_size_limit, "\n", + "\t", "file_upload_limit: ", this.settings.file_upload_limit, "\n", + "\t", "file_queue_limit: ", this.settings.file_queue_limit, "\n", + "\t", "debug: ", this.settings.debug.toString(), "\n", + + "\t", "prevent_swf_caching: ", this.settings.prevent_swf_caching.toString(), "\n", + + "\t", "button_placeholder_id: ", this.settings.button_placeholder_id.toString(), "\n", + "\t", "button_placeholder: ", (this.settings.button_placeholder ? "Set" : "Not Set"), "\n", + "\t", "button_image_url: ", this.settings.button_image_url.toString(), "\n", + "\t", "button_width: ", this.settings.button_width.toString(), "\n", + "\t", "button_height: ", this.settings.button_height.toString(), "\n", + "\t", "button_text: ", this.settings.button_text.toString(), "\n", + "\t", "button_text_style: ", this.settings.button_text_style.toString(), "\n", + "\t", "button_text_top_padding: ", this.settings.button_text_top_padding.toString(), "\n", + "\t", "button_text_left_padding: ", this.settings.button_text_left_padding.toString(), "\n", + "\t", "button_action: ", this.settings.button_action.toString(), "\n", + "\t", "button_cursor: ", this.settings.button_cursor.toString(), "\n", + "\t", "button_disabled: ", this.settings.button_disabled.toString(), "\n", + + "\t", "custom_settings: ", this.settings.custom_settings.toString(), "\n", + "Event Handlers:\n", + "\t", "swfupload_preload_handler assigned: ", (typeof this.settings.swfupload_preload_handler === "function").toString(), "\n", + "\t", "swfupload_load_failed_handler assigned: ", (typeof this.settings.swfupload_load_failed_handler === "function").toString(), "\n", + "\t", "swfupload_loaded_handler assigned: ", (typeof this.settings.swfupload_loaded_handler === "function").toString(), "\n", + "\t", "mouse_click_handler assigned: ", (typeof this.settings.mouse_click_handler === "function").toString(), "\n", + "\t", "mouse_over_handler assigned: ", (typeof this.settings.mouse_over_handler === "function").toString(), "\n", + "\t", "mouse_out_handler assigned: ", (typeof this.settings.mouse_out_handler === "function").toString(), "\n", + "\t", "file_dialog_start_handler assigned: ", (typeof this.settings.file_dialog_start_handler === "function").toString(), "\n", + "\t", "file_queued_handler assigned: ", (typeof this.settings.file_queued_handler === "function").toString(), "\n", + "\t", "file_queue_error_handler assigned: ", (typeof this.settings.file_queue_error_handler === "function").toString(), "\n", + "\t", "upload_resize_start_handler assigned: ", (typeof this.settings.upload_resize_start_handler === "function").toString(), "\n", + "\t", "upload_start_handler assigned: ", (typeof this.settings.upload_start_handler === "function").toString(), "\n", + "\t", "upload_progress_handler assigned: ", (typeof this.settings.upload_progress_handler === "function").toString(), "\n", + "\t", "upload_error_handler assigned: ", (typeof this.settings.upload_error_handler === "function").toString(), "\n", + "\t", "upload_success_handler assigned: ", (typeof this.settings.upload_success_handler === "function").toString(), "\n", + "\t", "upload_complete_handler assigned: ", (typeof this.settings.upload_complete_handler === "function").toString(), "\n", + "\t", "debug_handler assigned: ", (typeof this.settings.debug_handler === "function").toString(), "\n", + + "Support:\n", + "\t", "Load: ", (this.support.loading ? "Yes" : "No"), "\n", + "\t", "Image Resize: ", (this.support.imageResize ? "Yes" : "No"), "\n" + + ].join("") + ); +}; + +/* Note: addSetting and getSetting are no longer used by SWFUpload but are included + the maintain v2 API compatibility +*/ +// Public: (Deprecated) addSetting adds a setting value. If the value given is undefined or null then the default_value is used. +SWFUpload.prototype.addSetting = function (name, value, default_value) { + if (value == undefined) { + return (this.settings[name] = default_value); + } else { + return (this.settings[name] = value); + } +}; + +// Public: (Deprecated) getSetting gets a setting. Returns an empty string if the setting was not found. +SWFUpload.prototype.getSetting = function (name) { + if (this.settings[name] != undefined) { + return this.settings[name]; + } + + return ""; +}; + + + +// Private: callFlash handles function calls made to the Flash element. +// Calls are made with a setTimeout for some functions to work around +// bugs in the ExternalInterface library. +SWFUpload.prototype.callFlash = function (functionName, argumentArray) { + var movieElement, returnValue, returnString; + + argumentArray = argumentArray || []; + movieElement = this.getMovieElement(); + + // Flash's method if calling ExternalInterface methods (code adapted from MooTools). + try { + if (movieElement != undefined) { + returnString = movieElement.CallFunction('' + __flash__argumentsToXML(argumentArray, 0) + ''); + returnValue = eval(returnString); + } else { + this.debug("Can't call flash because the movie wasn't found."); + } + } catch (ex) { + this.debug("Exception calling flash function '" + functionName + "': " + ex.message); + } + + // Unescape file post param values + if (returnValue != undefined && typeof returnValue.post === "object") { + returnValue = this.unescapeFilePostParams(returnValue); + } + + return returnValue; +}; + +/* ***************************** + -- Flash control methods -- + Your UI should use these + to operate SWFUpload + ***************************** */ + +// WARNING: this function does not work in Flash Player 10 +// Public: selectFile causes a File Selection Dialog window to appear. This +// dialog only allows 1 file to be selected. +SWFUpload.prototype.selectFile = function () { + this.callFlash("SelectFile"); +}; + +// WARNING: this function does not work in Flash Player 10 +// Public: selectFiles causes a File Selection Dialog window to appear/ This +// dialog allows the user to select any number of files +// Flash Bug Warning: Flash limits the number of selectable files based on the combined length of the file names. +// If the selection name length is too long the dialog will fail in an unpredictable manner. There is no work-around +// for this bug. +SWFUpload.prototype.selectFiles = function () { + this.callFlash("SelectFiles"); +}; + + +// Public: startUpload starts uploading the first file in the queue unless +// the optional parameter 'fileID' specifies the ID +SWFUpload.prototype.startUpload = function (fileID) { + this.callFlash("StartUpload", [fileID]); +}; + +// Public: startUpload starts uploading the first file in the queue unless +// the optional parameter 'fileID' specifies the ID +SWFUpload.prototype.startResizedUpload = function (fileID, width, height, encoding, quality, allowEnlarging) { + this.callFlash("StartUpload", [fileID, { "width": width, "height" : height, "encoding" : encoding, "quality" : quality, "allowEnlarging" : allowEnlarging }]); +}; + +// Public: cancelUpload cancels any queued file. The fileID parameter may be the file ID or index. +// If you do not specify a fileID the current uploading file or first file in the queue is cancelled. +// If you do not want the uploadError event to trigger you can specify false for the triggerErrorEvent parameter. +SWFUpload.prototype.cancelUpload = function (fileID, triggerErrorEvent) { + if (triggerErrorEvent !== false) { + triggerErrorEvent = true; + } + this.callFlash("CancelUpload", [fileID, triggerErrorEvent]); +}; + +// Public: stopUpload stops the current upload and requeues the file at the beginning of the queue. +// If nothing is currently uploading then nothing happens. +SWFUpload.prototype.stopUpload = function () { + this.callFlash("StopUpload"); +}; + + +// Public: requeueUpload requeues any file. If the file is requeued or already queued true is returned. +// If the file is not found or is currently uploading false is returned. Requeuing a file bypasses the +// file size, queue size, upload limit and other queue checks. Certain files can't be requeued (e.g, invalid or zero bytes files). +SWFUpload.prototype.requeueUpload = function (indexOrFileID) { + return this.callFlash("RequeueUpload", [indexOrFileID]); +}; + + +/* ************************ + * Settings methods + * These methods change the SWFUpload settings. + * SWFUpload settings should not be changed directly on the settings object + * since many of the settings need to be passed to Flash in order to take + * effect. + * *********************** */ + +// Public: getStats gets the file statistics object. +SWFUpload.prototype.getStats = function () { + return this.callFlash("GetStats"); +}; + +// Public: setStats changes the SWFUpload statistics. You shouldn't need to +// change the statistics but you can. Changing the statistics does not +// affect SWFUpload accept for the successful_uploads count which is used +// by the upload_limit setting to determine how many files the user may upload. +SWFUpload.prototype.setStats = function (statsObject) { + this.callFlash("SetStats", [statsObject]); +}; + +// Public: getFile retrieves a File object by ID or Index. If the file is +// not found then 'null' is returned. +SWFUpload.prototype.getFile = function (fileID) { + if (typeof(fileID) === "number") { + return this.callFlash("GetFileByIndex", [fileID]); + } else { + return this.callFlash("GetFile", [fileID]); + } +}; + +// Public: getFileFromQueue retrieves a File object by ID or Index. If the file is +// not found then 'null' is returned. +SWFUpload.prototype.getQueueFile = function (fileID) { + if (typeof(fileID) === "number") { + return this.callFlash("GetFileByQueueIndex", [fileID]); + } else { + return this.callFlash("GetFile", [fileID]); + } +}; + + +// Public: addFileParam sets a name/value pair that will be posted with the +// file specified by the Files ID. If the name already exists then the +// exiting value will be overwritten. +SWFUpload.prototype.addFileParam = function (fileID, name, value) { + return this.callFlash("AddFileParam", [fileID, name, value]); +}; + +// Public: removeFileParam removes a previously set (by addFileParam) name/value +// pair from the specified file. +SWFUpload.prototype.removeFileParam = function (fileID, name) { + this.callFlash("RemoveFileParam", [fileID, name]); +}; + +// Public: setUploadUrl changes the upload_url setting. +SWFUpload.prototype.setUploadURL = function (url) { + this.settings.upload_url = url.toString(); + this.callFlash("SetUploadURL", [url]); +}; + +// Public: setPostParams changes the post_params setting +SWFUpload.prototype.setPostParams = function (paramsObject) { + this.settings.post_params = paramsObject; + this.callFlash("SetPostParams", [paramsObject]); +}; + +// Public: addPostParam adds post name/value pair. Each name can have only one value. +SWFUpload.prototype.addPostParam = function (name, value) { + this.settings.post_params[name] = value; + this.callFlash("SetPostParams", [this.settings.post_params]); +}; + +// Public: removePostParam deletes post name/value pair. +SWFUpload.prototype.removePostParam = function (name) { + delete this.settings.post_params[name]; + this.callFlash("SetPostParams", [this.settings.post_params]); +}; + +// Public: setFileTypes changes the file_types setting and the file_types_description setting +SWFUpload.prototype.setFileTypes = function (types, description) { + this.settings.file_types = types; + this.settings.file_types_description = description; + this.callFlash("SetFileTypes", [types, description]); +}; + +// Public: setFileSizeLimit changes the file_size_limit setting +SWFUpload.prototype.setFileSizeLimit = function (fileSizeLimit) { + this.settings.file_size_limit = fileSizeLimit; + this.callFlash("SetFileSizeLimit", [fileSizeLimit]); +}; + +// Public: setFileUploadLimit changes the file_upload_limit setting +SWFUpload.prototype.setFileUploadLimit = function (fileUploadLimit) { + this.settings.file_upload_limit = fileUploadLimit; + this.callFlash("SetFileUploadLimit", [fileUploadLimit]); +}; + +// Public: setFileQueueLimit changes the file_queue_limit setting +SWFUpload.prototype.setFileQueueLimit = function (fileQueueLimit) { + this.settings.file_queue_limit = fileQueueLimit; + this.callFlash("SetFileQueueLimit", [fileQueueLimit]); +}; + +// Public: setFilePostName changes the file_post_name setting +SWFUpload.prototype.setFilePostName = function (filePostName) { + this.settings.file_post_name = filePostName; + this.callFlash("SetFilePostName", [filePostName]); +}; + +// Public: setUseQueryString changes the use_query_string setting +SWFUpload.prototype.setUseQueryString = function (useQueryString) { + this.settings.use_query_string = useQueryString; + this.callFlash("SetUseQueryString", [useQueryString]); +}; + +// Public: setRequeueOnError changes the requeue_on_error setting +SWFUpload.prototype.setRequeueOnError = function (requeueOnError) { + this.settings.requeue_on_error = requeueOnError; + this.callFlash("SetRequeueOnError", [requeueOnError]); +}; + +// Public: setHTTPSuccess changes the http_success setting +SWFUpload.prototype.setHTTPSuccess = function (http_status_codes) { + if (typeof http_status_codes === "string") { + http_status_codes = http_status_codes.replace(" ", "").split(","); + } + + this.settings.http_success = http_status_codes; + this.callFlash("SetHTTPSuccess", [http_status_codes]); +}; + +// Public: setHTTPSuccess changes the http_success setting +SWFUpload.prototype.setAssumeSuccessTimeout = function (timeout_seconds) { + this.settings.assume_success_timeout = timeout_seconds; + this.callFlash("SetAssumeSuccessTimeout", [timeout_seconds]); +}; + +// Public: setDebugEnabled changes the debug_enabled setting +SWFUpload.prototype.setDebugEnabled = function (debugEnabled) { + this.settings.debug_enabled = debugEnabled; + this.callFlash("SetDebugEnabled", [debugEnabled]); +}; + +// Public: setButtonImageURL loads a button image sprite +SWFUpload.prototype.setButtonImageURL = function (buttonImageURL) { + if (buttonImageURL == undefined) { + buttonImageURL = ""; + } + + this.settings.button_image_url = buttonImageURL; + this.callFlash("SetButtonImageURL", [buttonImageURL]); +}; + +// Public: setButtonDimensions resizes the Flash Movie and button +SWFUpload.prototype.setButtonDimensions = function (width, height) { + this.settings.button_width = width; + this.settings.button_height = height; + + var movie = this.getMovieElement(); + if (movie != undefined) { + movie.style.width = width + "px"; + movie.style.height = height + "px"; + } + + this.callFlash("SetButtonDimensions", [width, height]); +}; +// Public: setButtonText Changes the text overlaid on the button +SWFUpload.prototype.setButtonText = function (html) { + this.settings.button_text = html; + this.callFlash("SetButtonText", [html]); +}; +// Public: setButtonTextPadding changes the top and left padding of the text overlay +SWFUpload.prototype.setButtonTextPadding = function (left, top) { + this.settings.button_text_top_padding = top; + this.settings.button_text_left_padding = left; + this.callFlash("SetButtonTextPadding", [left, top]); +}; + +// Public: setButtonTextStyle changes the CSS used to style the HTML/Text overlaid on the button +SWFUpload.prototype.setButtonTextStyle = function (css) { + this.settings.button_text_style = css; + this.callFlash("SetButtonTextStyle", [css]); +}; +// Public: setButtonDisabled disables/enables the button +SWFUpload.prototype.setButtonDisabled = function (isDisabled) { + this.settings.button_disabled = isDisabled; + this.callFlash("SetButtonDisabled", [isDisabled]); +}; +// Public: setButtonAction sets the action that occurs when the button is clicked +SWFUpload.prototype.setButtonAction = function (buttonAction) { + this.settings.button_action = buttonAction; + this.callFlash("SetButtonAction", [buttonAction]); +}; + +// Public: setButtonCursor changes the mouse cursor displayed when hovering over the button +SWFUpload.prototype.setButtonCursor = function (cursor) { + this.settings.button_cursor = cursor; + this.callFlash("SetButtonCursor", [cursor]); +}; + +/* ******************************* + Flash Event Interfaces + These functions are used by Flash to trigger the various + events. + + All these functions a Private. + + Because the ExternalInterface library is buggy the event calls + are added to a queue and the queue then executed by a setTimeout. + This ensures that events are executed in a determinate order and that + the ExternalInterface bugs are avoided. +******************************* */ + +SWFUpload.prototype.queueEvent = function (handlerName, argumentArray) { + // Warning: Don't call this.debug inside here or you'll create an infinite loop + var self = this; + + if (argumentArray == undefined) { + argumentArray = []; + } else if (!(argumentArray instanceof Array)) { + argumentArray = [argumentArray]; + } + + if (typeof this.settings[handlerName] === "function") { + // Queue the event + this.eventQueue.push(function () { + this.settings[handlerName].apply(this, argumentArray); + }); + + // Execute the next queued event + setTimeout(function () { + self.executeNextEvent(); + }, 0); + + } else if (this.settings[handlerName] !== null) { + throw "Event handler " + handlerName + " is unknown or is not a function"; + } +}; + +// Private: Causes the next event in the queue to be executed. Since events are queued using a setTimeout +// we must queue them in order to garentee that they are executed in order. +SWFUpload.prototype.executeNextEvent = function () { + // Warning: Don't call this.debug inside here or you'll create an infinite loop + + var f = this.eventQueue ? this.eventQueue.shift() : null; + if (typeof(f) === "function") { + f.apply(this); + } +}; + +// Private: unescapeFileParams is part of a workaround for a flash bug where objects passed through ExternalInterface cannot have +// properties that contain characters that are not valid for JavaScript identifiers. To work around this +// the Flash Component escapes the parameter names and we must unescape again before passing them along. +SWFUpload.prototype.unescapeFilePostParams = function (file) { + var reg = /[$]([0-9a-f]{4})/i, unescapedPost = {}, uk, k, match; + + if (file != undefined) { + for (k in file.post) { + if (file.post.hasOwnProperty(k)) { + uk = k; + while ((match = reg.exec(uk)) !== null) { + uk = uk.replace(match[0], String.fromCharCode(parseInt("0x" + match[1], 16))); + } + unescapedPost[uk] = file.post[k]; + } + } + + file.post = unescapedPost; + } + + return file; +}; + +// Private: This event is called by SWFUpload Init after we've determined what the user's Flash Player supports. +// Use the swfupload_preload_handler event setting to execute custom code when SWFUpload has loaded. +// Return false to prevent SWFUpload from loading and allow your script to do something else if your required feature is +// not supported +SWFUpload.prototype.swfuploadPreload = function () { + var returnValue; + if (typeof this.settings.swfupload_preload_handler === "function") { + returnValue = this.settings.swfupload_preload_handler.call(this); + } else if (this.settings.swfupload_preload_handler != undefined) { + throw "upload_start_handler must be a function"; + } + + // Convert undefined to true so if nothing is returned from the upload_start_handler it is + // interpretted as 'true'. + if (returnValue === undefined) { + returnValue = true; + } + + return !!returnValue; +} + +// Private: This event is called by Flash when it has finished loading. Don't modify this. +// Use the swfupload_loaded_handler event setting to execute custom code when SWFUpload has loaded. +SWFUpload.prototype.flashReady = function () { + // Check that the movie element is loaded correctly with its ExternalInterface methods defined + var movieElement = this.cleanUp(); + + if (!movieElement) { + this.debug("Flash called back ready but the flash movie can't be found."); + return; + } + + this.queueEvent("swfupload_loaded_handler"); +}; + +// Private: removes Flash added fuctions to the DOM node to prevent memory leaks in IE. +// This function is called by Flash each time the ExternalInterface functions are created. +SWFUpload.prototype.cleanUp = function () { + var key, movieElement = this.getMovieElement(); + + // Pro-actively unhook all the Flash functions + try { + if (movieElement && typeof(movieElement.CallFunction) === "unknown") { // We only want to do this in IE + this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)"); + for (key in movieElement) { + try { + if (typeof(movieElement[key]) === "function") { + movieElement[key] = null; + } + } catch (ex) { + } + } + } + } catch (ex1) { + + } + + // Fix Flashes own cleanup code so if the SWF Movie was removed from the page + // it doesn't display errors. + window["__flash__removeCallback"] = function (instance, name) { + try { + if (instance) { + instance[name] = null; + } + } catch (flashEx) { + + } + }; + + return movieElement; +}; + +/* When the button_action is set to None this event gets fired and executes the mouse_click_handler */ +SWFUpload.prototype.mouseClick = function () { + this.queueEvent("mouse_click_handler"); +}; +SWFUpload.prototype.mouseOver = function () { + this.queueEvent("mouse_over_handler"); +}; +SWFUpload.prototype.mouseOut = function () { + this.queueEvent("mouse_out_handler"); +}; + +/* This is a chance to do something before the browse window opens */ +SWFUpload.prototype.fileDialogStart = function () { + this.queueEvent("file_dialog_start_handler"); +}; + + +/* Called when a file is successfully added to the queue. */ +SWFUpload.prototype.fileQueued = function (file) { + file = this.unescapeFilePostParams(file); + this.queueEvent("file_queued_handler", file); +}; + + +/* Handle errors that occur when an attempt to queue a file fails. */ +SWFUpload.prototype.fileQueueError = function (file, errorCode, message) { + file = this.unescapeFilePostParams(file); + this.queueEvent("file_queue_error_handler", [file, errorCode, message]); +}; + +/* Called after the file dialog has closed and the selected files have been queued. + You could call startUpload here if you want the queued files to begin uploading immediately. */ +SWFUpload.prototype.fileDialogComplete = function (numFilesSelected, numFilesQueued, numFilesInQueue) { + this.queueEvent("file_dialog_complete_handler", [numFilesSelected, numFilesQueued, numFilesInQueue]); +}; + +SWFUpload.prototype.uploadResizeStart = function (file, resizeSettings) { + file = this.unescapeFilePostParams(file); + this.queueEvent("upload_resize_start_handler", [file, resizeSettings.width, resizeSettings.height, resizeSettings.encoding, resizeSettings.quality]); +}; + +SWFUpload.prototype.uploadStart = function (file) { + file = this.unescapeFilePostParams(file); + this.queueEvent("return_upload_start_handler", file); +}; + +SWFUpload.prototype.returnUploadStart = function (file) { + var returnValue; + if (typeof this.settings.upload_start_handler === "function") { + file = this.unescapeFilePostParams(file); + returnValue = this.settings.upload_start_handler.call(this, file); + } else if (this.settings.upload_start_handler != undefined) { + throw "upload_start_handler must be a function"; + } + + // Convert undefined to true so if nothing is returned from the upload_start_handler it is + // interpretted as 'true'. + if (returnValue === undefined) { + returnValue = true; + } + + returnValue = !!returnValue; + + this.callFlash("ReturnUploadStart", [returnValue]); +}; + + + +SWFUpload.prototype.uploadProgress = function (file, bytesComplete, bytesTotal) { + file = this.unescapeFilePostParams(file); + this.queueEvent("upload_progress_handler", [file, bytesComplete, bytesTotal]); +}; + +SWFUpload.prototype.uploadError = function (file, errorCode, message) { + file = this.unescapeFilePostParams(file); + this.queueEvent("upload_error_handler", [file, errorCode, message]); +}; + +SWFUpload.prototype.uploadSuccess = function (file, serverData, responseReceived) { + file = this.unescapeFilePostParams(file); + this.queueEvent("upload_success_handler", [file, serverData, responseReceived]); +}; + +SWFUpload.prototype.uploadComplete = function (file) { + file = this.unescapeFilePostParams(file); + this.queueEvent("upload_complete_handler", file); +}; + +/* Called by SWFUpload JavaScript and Flash functions when debug is enabled. By default it writes messages to the + internal debug console. You can override this event and have messages written where you want. */ +SWFUpload.prototype.debug = function (message) { + this.queueEvent("debug_handler", message); +}; + + +/* ********************************** + Debug Console + The debug console is a self contained, in page location + for debug message to be sent. The Debug Console adds + itself to the body if necessary. + + The console is automatically scrolled as messages appear. + + If you are using your own debug handler or when you deploy to production and + have debug disabled you can remove these functions to reduce the file size + and complexity. +********************************** */ + +// Private: debugMessage is the default debug_handler. If you want to print debug messages +// call the debug() function. When overriding the function your own function should +// check to see if the debug setting is true before outputting debug information. +SWFUpload.prototype.debugMessage = function (message) { + var exceptionMessage, exceptionValues, key; + + if (this.settings.debug) { + exceptionValues = []; + + // Check for an exception object and print it nicely + if (typeof message === "object" && typeof message.name === "string" && typeof message.message === "string") { + for (key in message) { + if (message.hasOwnProperty(key)) { + exceptionValues.push(key + ": " + message[key]); + } + } + exceptionMessage = exceptionValues.join("\n") || ""; + exceptionValues = exceptionMessage.split("\n"); + exceptionMessage = "EXCEPTION: " + exceptionValues.join("\nEXCEPTION: "); + SWFUpload.Console.writeLine(exceptionMessage); + } else { + SWFUpload.Console.writeLine(message); + } + } +}; + +SWFUpload.Console = {}; +SWFUpload.Console.writeLine = function (message) { + var console, documentForm; + + try { + console = document.getElementById("SWFUpload_Console"); + + if (!console) { + documentForm = document.createElement("form"); + document.getElementsByTagName("body")[0].appendChild(documentForm); + + console = document.createElement("textarea"); + console.id = "SWFUpload_Console"; + console.style.fontFamily = "monospace"; + console.setAttribute("wrap", "off"); + console.wrap = "off"; + console.style.overflow = "auto"; + console.style.width = "700px"; + console.style.height = "350px"; + console.style.margin = "5px"; + documentForm.appendChild(console); + } + + console.value += message + "\n"; + + console.scrollTop = console.scrollHeight - console.clientHeight; + } catch (ex) { + alert("Exception: " + ex.name + " Message: " + ex.message); + } +}; + + +/* SWFObject v2.2 + is released under the MIT License +*/ +swfobject = function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y0){for(var af=0;af0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad'}}aa.outerHTML='"+af+"";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab): Any { - val ctx = this.enterContext() - ctx.optimizationLevel = -1 - ctx.setClassShutter { - when { - it.startsWith("java.io") -> false - else -> true - } - } - val scope: Scriptable = ctx.initStandardObjects() - for (name in scriptObjects.keys) { - val obj = scriptObjects[name] - if (obj is Boolean) { - scope.put(name, scope, obj) - } else if (obj != null) { - val jsArgs = Context.toObject(obj, scope) - scope.put(name, scope, jsArgs) - } - } - scope.delete("Packages") - return try { - ctx.evaluateString(scope, jsStr, null, 1, null) - } catch (e: RhinoException) { - e.printStackTrace() - e.toString() - } finally { - Context.exit() - } -} - -class SandboxNativeJavaObject(scope: Scriptable?, javaObject: Any?, staticType: Class<*>?) : - NativeJavaObject(scope, javaObject, staticType) { - override fun get(name: String, start: Scriptable): Any { - return when (name) { - "getClass", "delete" -> NOT_FOUND - else -> super.get(name, start) - } - } -} - -class SandboxWrapFactory : WrapFactory() { - override fun wrapAsJavaObject( - cx: Context?, - scope: Scriptable?, - javaObject: Any?, - staticType: Class<*>? - ): Scriptable { - return SandboxNativeJavaObject(scope, javaObject, staticType) - } -} - -class SandboxContextFactory : ContextFactory() { - override fun makeContext(): Context { - val cx = super.makeContext() - cx.wrapFactory = SandboxWrapFactory() - return cx - } -} \ No newline at end of file