@lingxiteam/lcdp-ueditor-react 1.0.3-alpha.8 → 1.0.3-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/ueditor-resource/dialogs/anchor/anchor.html +1 -1
- package/ueditor-resource/dialogs/attachment/attachment.html +3 -3
- package/ueditor-resource/dialogs/attachment/attachment.js +1 -1
- package/ueditor-resource/dialogs/audio/audio.js +1 -1
- package/ueditor-resource/dialogs/background/background.html +2 -2
- package/ueditor-resource/dialogs/background/background.js +1 -1
- package/ueditor-resource/dialogs/contentimport/contentimport.html +3 -3
- package/ueditor-resource/dialogs/contentimport/contentimport.js +1 -1
- package/ueditor-resource/dialogs/emotion/emotion.html +2 -2
- package/ueditor-resource/dialogs/emotion/emotion.js +1 -1
- package/ueditor-resource/dialogs/formula/formula.html +4 -4
- package/ueditor-resource/dialogs/formula/formula.js +1 -1
- package/ueditor-resource/dialogs/help/help.html +2 -2
- package/ueditor-resource/dialogs/help/help.js +1 -1
- package/ueditor-resource/dialogs/image/image.js +1 -1
- package/ueditor-resource/dialogs/insertframe/insertframe.html +1 -1
- package/ueditor-resource/dialogs/internal.js +1 -1
- package/ueditor-resource/dialogs/preview/preview.html +2 -2
- package/ueditor-resource/dialogs/scrawl/scrawl.html +2 -2
- package/ueditor-resource/dialogs/scrawl/scrawl.js +1 -1
- package/ueditor-resource/dialogs/searchreplace/searchreplace.html +2 -2
- package/ueditor-resource/dialogs/searchreplace/searchreplace.js +1 -1
- package/ueditor-resource/dialogs/spechars/spechars.html +2 -2
- package/ueditor-resource/dialogs/spechars/spechars.js +1 -1
- package/ueditor-resource/dialogs/table/edittable.html +2 -2
- package/ueditor-resource/dialogs/table/edittable.js +1 -1
- package/ueditor-resource/dialogs/table/edittd.html +1 -1
- package/ueditor-resource/dialogs/table/edittip.html +1 -1
- package/ueditor-resource/dialogs/template/template.html +2 -2
- package/ueditor-resource/dialogs/template/template.js +1 -1
- package/ueditor-resource/dialogs/video/video.js +1 -1
- package/ueditor-resource/dialogs/wordimage/wordimage.html +4 -4
- package/ueditor-resource/dialogs/wordimage/wordimage.js +1 -1
- package/ueditor-resource/plugins/browser-image-compression.js +9 -0
- package/ueditor-resource/plugins/demo/demo.js +3 -1
- package/ueditor-resource/third-party/SyntaxHighlighter/shCore.js +3 -3
- package/ueditor-resource/third-party/clipboard/clipboard.js +1 -1
- package/ueditor-resource/third-party/codemirror/codemirror.js +3 -2
- package/ueditor-resource/third-party/jquery-3.5.1.js +3 -3
- package/ueditor-resource/third-party/jquery-3.5.1_1.js +3 -3
- package/ueditor-resource/ueditor.all.js +22 -19
- package/ueditor-resource/ueditor.config.js +1 -1
- package/ueditor-resource/ueditor.parse.js +1 -1
package/package.json
CHANGED
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
<div class="content">
|
|
38
38
|
<span><var id="lang_input_anchorName"></var></span><input id="anchorName" value=""/>
|
|
39
39
|
</div>
|
|
40
|
-
<script type="text/javascript" src="../internal.js?
|
|
40
|
+
<script type="text/javascript" src="../internal.js?b983a808"></script>
|
|
41
41
|
<script type="text/javascript">
|
|
42
42
|
var anchorInput = $G('anchorName'),
|
|
43
43
|
node = editor.selection.getRange().getClosedNode();
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
5
|
<title>ueditor图片对话框</title>
|
|
6
|
-
<script type="text/javascript" src="../internal.js?
|
|
6
|
+
<script type="text/javascript" src="../internal.js?b983a808"></script>
|
|
7
7
|
|
|
8
8
|
<!-- jquery -->
|
|
9
|
-
<script type="text/javascript" src="../../third-party/jquery-3.5.1.js?
|
|
9
|
+
<script type="text/javascript" src="../../third-party/jquery-3.5.1.js?cdb3992e"></script>
|
|
10
10
|
|
|
11
11
|
<!-- webuploader -->
|
|
12
12
|
<script src="../../third-party/webuploader/webuploader.js?5e398948"></script>
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
|
|
56
56
|
</div>
|
|
57
57
|
</div>
|
|
58
|
-
<script type="text/javascript" src="attachment.js?
|
|
58
|
+
<script type="text/javascript" src="attachment.js?5f0b87d6"></script>
|
|
59
59
|
|
|
60
60
|
</body>
|
|
61
61
|
</html>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! UEditorPlus v2.0.0*/
|
|
2
|
-
!function(){function initTabs(){$G("tabhead").querySelector('[data-content-id="online"]').style.display="none";for(var a=$G("tabhead").children,b=0;b<a.length;b++)domUtils.on(a[b],"click",function(a){var b=a.target||a.srcElement;setTabFocus(b.getAttribute("data-content-id"))});setTabFocus("upload")}function setTabFocus(a){if(a){var b,c,d=$G("tabhead").children;for(b=0;b<d.length;b++)c=d[b].getAttribute("data-content-id"),c==a?(domUtils.addClass(d[b],"focus"),domUtils.addClass($G(c),"focus")):(domUtils.removeClasses(d[b],"focus"),domUtils.removeClasses($G(c),"focus"));switch(a){case"upload":uploadFile=uploadFile||new UploadFile("queueList");break;case"online":onlineFile=onlineFile||new OnlineFile("fileList")}}}function initButtons(){dialog.onok=function(){for(var a,b=[],c=$G("tabhead").children,d=0;d<c.length;d++)if(domUtils.hasClass(c[d],"focus")){a=c[d].getAttribute("data-content-id");break}switch(a){case"upload":b=uploadFile.getInsertList();var e=uploadFile.getQueueCount();if(e)return $(".info","#queueList").html('<span style="color:red;">'+"还有2个未上传文件".replace(/[\d]/,e)+"</span>"),!1;break;case"online":b=onlineFile.getInsertList()}editor.execCommand("insertfile",b)}}function UploadFile(a){this.$wrap=a.constructor==String?$("#"+a):$(a),this.init()}function OnlineFile(a){this.container=utils.isString(a)?document.getElementById(a):a,this.init()}var uploadFile,onlineFile;window.onload=function(){initTabs(),initButtons()},UploadFile.prototype={init:function(){this.fileList=[],this.initContainer(),this.initUploader()},initContainer:function(){this.$queue=this.$wrap.find(".filelist")},initUploader:function(){function a(a){var b=h('<li id="'+a.id+'"><p class="title">'+a.name+'</p><p class="imgWrap"></p><p class="progress"><span></span></p></li>'),c=h('<div class="file-panel"><span class="cancel">'+lang.uploadDelete+'</span><span class="rotateRight">'+lang.uploadTurnRight+'</span><span class="rotateLeft">'+lang.uploadTurnLeft+"</span></div>").appendTo(b),d=b.find("p.progress span"),e=b.find("p.imgWrap"),g=h('<p class="error"></p>').hide().appendTo(b),i=function(a){switch(a){case"exceed_size":text=lang.errorExceedSize;break;case"interrupt":text=lang.errorInterrupt;break;case"http":text=lang.errorHttp;break;case"not_allow_type":text=lang.errorFileType;break;default:text=lang.errorUploadRetry}g.text(text).show()};"invalid"===a.getStatus()?i(a.statusText):(e.text(lang.uploadPreview),"|png|jpg|jpeg|bmp|gif|".indexOf("|"+a.ext.toLowerCase()+"|")==-1?e.empty().addClass("notimage").append('<i class="file-preview file-type-'+a.ext.toLowerCase()+'"></i><span class="file-title" title="'+a.name+'">'+a.name+"</span>"):browser.ie&&browser.version<=7?e.text(lang.uploadNoPreview):f.makeThumb(a,function(a,b){if(a||!b)e.text(lang.uploadNoPreview);else{var c=h('<img src="'+b+'">');e.empty().append(c),c.on("error",function(){e.text(lang.uploadNoPreview)})}},t,u),w[a.id]=[a.size,0],a.rotation=0,a.ext&&A.indexOf(a.ext.toLowerCase())!=-1||(i("not_allow_type"),f.removeFile(a))),a.on("statuschange",function(e,f){"progress"===f?d.hide().width(0):"queued"===f&&(b.off("mouseenter mouseleave"),c.remove()),"error"===e||"invalid"===e?(i(a.statusText),w[a.id][1]=1):"interrupt"===e?i("interrupt"):"queued"===e?w[a.id][1]=0:"progress"===e&&(g.hide(),d.css("display","block")),b.removeClass("state-"+f).addClass("state-"+e)}),b.on("mouseenter",function(){c.stop().animate({height:30})}),b.on("mouseleave",function(){c.stop().animate({height:0})}),c.on("click","span",function(){var b,c=h(this).index();switch(c){case 0:return void f.removeFile(a);case 1:a.rotation+=90;break;case 2:a.rotation-=90}x?(b="rotate("+a.rotation+"deg)",e.css({"-webkit-transform":b,"-mos-transform":b,"-o-transform":b,transform:b})):e.css("filter","progid:DXImageTransform.Microsoft.BasicImage(rotation="+~~(a.rotation/90%4+4)%4+")")}),b.insertBefore(n)}function b(a){var b=h("#"+a.id);delete w[a.id],c(),b.off().find(".file-panel").off().end().remove()}function c(){var a,b=0,c=0,d=p.children();h.each(w,function(a,d){c+=d[0],b+=d[0]*d[1]}),a=c?b/c:0,d.eq(0).text(Math.round(100*a)+"%"),d.eq(1).css("width",Math.round(100*a)+"%"),e()}function d(a,b){if(a!=v){var c=f.getStats();switch(m.removeClass("state-"+v),m.addClass("state-"+a),a){case"pedding":j.addClass("element-invisible"),k.addClass("element-invisible"),o.removeClass("element-invisible"),p.hide(),l.hide(),f.refresh();break;case"ready":o.addClass("element-invisible"),j.removeClass("element-invisible"),k.removeClass("element-invisible"),p.hide(),l.show(),m.text(lang.uploadStart),f.refresh();break;case"uploading":p.show(),l.hide(),m.text(lang.uploadPause);break;case"paused":p.show(),l.hide(),m.text(lang.uploadContinue);break;case"confirm":if(p.show(),l.hide(),m.text(lang.uploadStart),c=f.getStats(),c.successNum&&!c.uploadFailNum)return void d("finish");break;case"finish":p.hide(),l.show(),c.uploadFailNum?m.text(lang.uploadRetry):m.text(lang.uploadStart)}v=a,e()}g.getQueueCount()?m.removeClass("disabled"):m.addClass("disabled")}function e(){var a,b="";"ready"===v?b=lang.updateStatusReady.replace("_",q).replace("_KB",WebUploader.formatSize(r)):"confirm"===v?(a=f.getStats(),a.uploadFailNum&&(b=lang.updateStatusConfirm.replace("_",a.successNum).replace("_",a.successNum))):(a=f.getStats(),b=lang.updateStatusFinish.replace("_",q).replace("_KB",WebUploader.formatSize(r)).replace("_",a.successNum),a.uploadFailNum&&(b+=lang.updateStatusError.replace("_",a.uploadFailNum))),l.html(b)}var f,g=this,h=jQuery,i=g.$wrap,j=i.find(".filelist"),k=i.find(".statusBar"),l=k.find(".info"),m=i.find(".uploadBtn"),n=(i.find(".filePickerBtn"),i.find(".filePickerBlock")),o=i.find(".placeholder"),p=k.find(".progress").hide(),q=0,r=0,s=window.devicePixelRatio||1,t=113*s,u=113*s,v="",w={},x=function(){var a=document.createElement("p").style,b="transition"in a||"WebkitTransition"in a||"MozTransition"in a||"msTransition"in a||"OTransition"in a;return a=null,b}(),y=editor.getActionUrl(editor.getOpt("fileActionName")),z=editor.getOpt("fileMaxSize"),A=(editor.getOpt("fileAllowFiles")||[]).join("").replace(/\./g,",").replace(/^[,]/,"");return m.hide(),WebUploader.Uploader.support()?(!editor.getOpt("fileActionName"),f=g.uploader=WebUploader.create({pick:{id:"#filePickerReady",label:lang.uploadSelectFile},swf:"../../third-party/webuploader/Uploader.swf",server:y,fileVal:editor.getOpt("fileFieldName"),duplicate:!0,fileSingleSizeLimit:z,headers:editor.getOpt("serverHeaders")||{},compress:!1}),f.addButton({id:"#filePickerBlock"}),f.addButton({id:"#filePickerBtn",label:lang.uploadAddFile}),d("pedding"),f.on("beforeFileQueued",function(a){return!!(a.ext&&A.indexOf(a.ext.toLowerCase())!=-1&&a.size<=z)}),f.on("fileQueued",function(b){b.ext&&A.indexOf(b.ext.toLowerCase())!=-1&&b.size<=z&&(q++,r+=b.size),1===q&&(o.addClass("element-invisible"),k.show()),a(b);var c=editor.getOpt("uploadFunction");"function"==typeof c&&("ready"===v?d("uploading"):(d("ready"),d("uploading")),b.setStatus("progress"),f.trigger("uploadProgress",b,0),c(b.source.source).then(function(a){f.trigger("uploadProgress",b,1),b.setStatus("complete"),d("finish"),f.trigger("uploadSuccess",b,a),f.trigger("uploadComplete",b)}))}),f.on("fileDequeued",function(a){a.ext&&A.indexOf(a.ext.toLowerCase())!=-1&&a.size<=z&&(q--,r-=a.size),b(a),c()}),f.on("filesQueued",function(a){f.isInProgress()||"pedding"!=v&&"finish"!=v&&"confirm"!=v&&"ready"!=v||d("ready"),c()}),f.on("all",function(a,b){switch(a){case"uploadFinished":d("confirm",b);break;case"startUpload":var c=utils.serializeParam(editor.queryCommandValue("serverparam"))||"",e=utils.formatUrl(y+(y.indexOf("?")==-1?"?":"&")+"encode=utf-8&"+c);f.option("server",e),d("uploading",b);break;case"stopUpload":d("paused",b)}}),f.on("uploadBeforeSend",function(a,b,c){y.toLowerCase().indexOf("jsp")!=-1&&(c.X_Requested_With="XMLHttpRequest")}),f.on("uploadProgress",function(a,b){var d=h("#"+a.id),e=d.find(".progress span");e.css("width",100*b+"%"),w[a.id][1]=b,c()}),f.on("uploadSuccess",function(a,b){var c=h("#"+a.id);try{"SUCCESS"==b.state?(g.fileList.push(b),c.append('<span class="success"></span>'),editor.fireEvent("uploadsuccess",{res:b,type:"file"})):c.find(".error").text(b.state).show()}catch(d){c.find(".error").text(lang.errorServerUpload).show()}}),f.on("uploadError",function(a,b){}),f.on("error",function(b,c){"Q_TYPE_DENIED"!=b&&"F_EXCEED_SIZE"!=b||a(c)}),f.on("uploadComplete",function(a,b){}),m.on("click",function(){return!h(this).hasClass("disabled")&&void("ready"===v?f.upload():"paused"===v?f.upload():"uploading"===v&&f.stop())}),m.addClass("state-"+v),void c()):void h("#filePickerReady").after(h("<div>").html(lang.errorNotSupport)).hide()},getQueueCount:function(){var a,b,c,d=0,e=this.uploader.getFiles();for(b=0;a=e[b++];)c=a.getStatus(),"queued"!=c&&"uploading"!=c&&"progress"!=c||d++;return d},getInsertList:function(){var a,b,c,d=[],e=editor.getOpt("fileUrlPrefix");for(a=0;a<this.fileList.length;a++)c=this.fileList[a],b=c.url,d.push({title:c.original||b.substr(b.lastIndexOf("/")+1),url:e+b});return d}},OnlineFile.prototype={init:function(){this.initContainer(),this.initEvents(),this.initData()},initContainer:function(){this.container.innerHTML="",this.list=document.createElement("ul"),this.clearFloat=document.createElement("li"),domUtils.addClass(this.list,"list"),domUtils.addClass(this.clearFloat,"clearFloat"),this.list.appendChild(this.clearFloat),this.container.appendChild(this.list)},initEvents:function(){var a=this;domUtils.on($G("fileList"),"scroll",function(b){var c=this;c.scrollHeight-(c.offsetHeight+c.scrollTop)<10&&a.getFileData()}),domUtils.on(this.list,"click",function(a){var b=a.target||a.srcElement,c=b.parentNode;"li"==c.tagName.toLowerCase()&&(domUtils.hasClass(c,"selected")?domUtils.removeClasses(c,"selected"):domUtils.addClass(c,"selected"))})},initData:function(){this.state=0,this.listSize=editor.getOpt("fileManagerListSize"),this.listIndex=0,this.listEnd=!1,this.getFileData()},getFileData:function(){var _this=this;_this.listEnd||this.isLoadingData||(this.isLoadingData=!0,ajax.request(editor.getActionUrl(editor.getOpt("fileManagerActionName")),{timeout:1e5,data:utils.extend({start:this.listIndex,size:this.listSize},editor.queryCommandValue("serverparam")),headers:editor.options.serverHeaders||{},method:"get",onsuccess:function(r){try{var json=eval("("+r.responseText+")");"SUCCESS"==json.state&&(_this.pushData(json.list),_this.listIndex=parseInt(json.start)+parseInt(json.list.length),_this.listIndex>=json.total&&(_this.listEnd=!0),_this.isLoadingData=!1)}catch(e){if(r.responseText.indexOf("ue_separate_ue")!=-1){var list=r.responseText.split(r.responseText);_this.pushData(list),_this.listIndex=parseInt(list.length),_this.listEnd=!0,_this.isLoadingData=!1}}},onerror:function(){_this.isLoadingData=!1}}))},pushData:function(a){var b,c,d,e,f,g=this,h=editor.getOpt("fileManagerUrlPrefix");for(b=0;b<a.length;b++)if(a[b]&&a[b].url){if(c=document.createElement("li"),f=document.createElement("span"),d=a[b].url.substr(a[b].url.lastIndexOf(".")+1),"png|jpg|jpeg|gif|bmp".indexOf(d)!=-1)e=document.createElement("img"),domUtils.on(e,"load",function(a){return function(){g.scale(a,a.parentNode.offsetWidth,a.parentNode.offsetHeight)}}(e)),e.width=113,e.setAttribute("src",h+a[b].url+(a[b].url.indexOf("?")==-1?"?noCache=":"&noCache=")+(+new Date).toString(36));else{var i=document.createElement("i"),j=document.createElement("span");j.innerHTML=a[b].original||a[b].url.substr(a[b].url.lastIndexOf("/")+1),e=document.createElement("div"),e.appendChild(i),e.appendChild(j),domUtils.addClass(e,"file-wrapper"),domUtils.addClass(j,"file-title"),domUtils.addClass(i,"file-type-"+d),domUtils.addClass(i,"file-preview")}domUtils.addClass(f,"icon"),c.setAttribute("data-url",h+a[b].url),a[b].original&&c.setAttribute("data-title",a[b].original),c.appendChild(e),c.appendChild(f),this.list.insertBefore(c,this.clearFloat)}},scale:function(a,b,c,d){var e=a.width,f=a.height;"justify"==d?e>=f?(a.width=b,a.height=c*f/e,a.style.marginLeft="-"+parseInt((a.width-b)/2)+"px"):(a.width=b*e/f,a.height=c,a.style.marginTop="-"+parseInt((a.height-c)/2)+"px"):e>=f?(a.width=b*e/f,a.height=c,a.style.marginLeft="-"+parseInt((a.width-b)/2)+"px"):(a.width=b,a.height=c*f/e,a.style.marginTop="-"+parseInt((a.height-c)/2)+"px")},getInsertList:function(){var a,b=this.list.children,c=[];for(a=0;a<b.length;a++)if(domUtils.hasClass(b[a],"selected")){var d=b[a].getAttribute("data-url"),e=b[a].getAttribute("data-title")||d.substr(d.lastIndexOf("/")+1);c.push({title:e,url:d})}return c}}}();
|
|
2
|
+
!function(){function initTabs(){$G("tabhead").querySelector('[data-content-id="online"]').style.display="none";for(var tabs=$G("tabhead").children,i=0;i<tabs.length;i++)domUtils.on(tabs[i],"click",function(e){var target=e.target||e.srcElement;setTabFocus(target.getAttribute("data-content-id"))});setTabFocus("upload")}function setTabFocus(id){if(id){var i,bodyId,tabs=$G("tabhead").children;for(i=0;i<tabs.length;i++)bodyId=tabs[i].getAttribute("data-content-id"),bodyId==id?(domUtils.addClass(tabs[i],"focus"),domUtils.addClass($G(bodyId),"focus")):(domUtils.removeClasses(tabs[i],"focus"),domUtils.removeClasses($G(bodyId),"focus"));switch(id){case"upload":uploadFile=uploadFile||new UploadFile("queueList");break;case"online":onlineFile=onlineFile||new OnlineFile("fileList")}}}function initButtons(){dialog.onok=function(){for(var id,list=[],tabs=$G("tabhead").children,i=0;i<tabs.length;i++)if(domUtils.hasClass(tabs[i],"focus")){id=tabs[i].getAttribute("data-content-id");break}switch(id){case"upload":list=uploadFile.getInsertList();var count=uploadFile.getQueueCount();if(count)return $(".info","#queueList").html('<span style="color:red;">'+"还有2个未上传文件".replace(/[\d]/,count)+"</span>"),!1;break;case"online":list=onlineFile.getInsertList()}editor.execCommand("insertfile",list)}}function UploadFile(target){this.$wrap=target.constructor==String?$("#"+target):$(target),this.init()}function OnlineFile(target){this.container=utils.isString(target)?document.getElementById(target):target,this.init()}var uploadFile,onlineFile;window.onload=function(){initTabs(),initButtons()},UploadFile.prototype={init:function(){this.fileList=[],this.initContainer(),this.initUploader()},initContainer:function(){this.$queue=this.$wrap.find(".filelist")},initUploader:function(){function addFile(file){var $li=$('<li id="'+file.id+'"><p class="title">'+file.name+'</p><p class="imgWrap"></p><p class="progress"><span></span></p></li>'),$btns=$('<div class="file-panel"><span class="cancel">'+lang.uploadDelete+'</span><span class="rotateRight">'+lang.uploadTurnRight+'</span><span class="rotateLeft">'+lang.uploadTurnLeft+"</span></div>").appendTo($li),$prgress=$li.find("p.progress span"),$wrap=$li.find("p.imgWrap"),$info=$('<p class="error"></p>').hide().appendTo($li),showError=function(code){switch(code){case"exceed_size":text=lang.errorExceedSize;break;case"interrupt":text=lang.errorInterrupt;break;case"http":text=lang.errorHttp;break;case"not_allow_type":text=lang.errorFileType;break;default:text=lang.errorUploadRetry}$info.text(text).show()};"invalid"===file.getStatus()?showError(file.statusText):($wrap.text(lang.uploadPreview),"|png|jpg|jpeg|bmp|gif|".indexOf("|"+file.ext.toLowerCase()+"|")==-1?$wrap.empty().addClass("notimage").append('<i class="file-preview file-type-'+file.ext.toLowerCase()+'"></i><span class="file-title" title="'+file.name+'">'+file.name+"</span>"):browser.ie&&browser.version<=7?$wrap.text(lang.uploadNoPreview):uploader.makeThumb(file,function(error,src){if(error||!src)$wrap.text(lang.uploadNoPreview);else{var $img=$('<img src="'+src+'">');$wrap.empty().append($img),$img.on("error",function(){$wrap.text(lang.uploadNoPreview)})}},thumbnailWidth,thumbnailHeight),percentages[file.id]=[file.size,0],file.rotation=0,file.ext&&acceptExtensions.indexOf(file.ext.toLowerCase())!=-1||(showError("not_allow_type"),uploader.removeFile(file))),file.on("statuschange",function(cur,prev){"progress"===prev?$prgress.hide().width(0):"queued"===prev&&($li.off("mouseenter mouseleave"),$btns.remove()),"error"===cur||"invalid"===cur?(showError(file.statusText),percentages[file.id][1]=1):"interrupt"===cur?showError("interrupt"):"queued"===cur?percentages[file.id][1]=0:"progress"===cur&&($info.hide(),$prgress.css("display","block")),$li.removeClass("state-"+prev).addClass("state-"+cur)}),$li.on("mouseenter",function(){$btns.stop().animate({height:30})}),$li.on("mouseleave",function(){$btns.stop().animate({height:0})}),$btns.on("click","span",function(){var deg,index=$(this).index();switch(index){case 0:return void uploader.removeFile(file);case 1:file.rotation+=90;break;case 2:file.rotation-=90}supportTransition?(deg="rotate("+file.rotation+"deg)",$wrap.css({"-webkit-transform":deg,"-mos-transform":deg,"-o-transform":deg,transform:deg})):$wrap.css("filter","progid:DXImageTransform.Microsoft.BasicImage(rotation="+~~(file.rotation/90%4+4)%4+")")}),$li.insertBefore($filePickerBlock)}function removeFile(file){var $li=$("#"+file.id);delete percentages[file.id],updateTotalProgress(),$li.off().find(".file-panel").off().end().remove()}function updateTotalProgress(){var percent,loaded=0,total=0,spans=$progress.children();$.each(percentages,function(k,v){total+=v[0],loaded+=v[0]*v[1]}),percent=total?loaded/total:0,spans.eq(0).text(Math.round(100*percent)+"%"),spans.eq(1).css("width",Math.round(100*percent)+"%"),updateStatus()}function setState(val,files){if(val!=state){var stats=uploader.getStats();switch($upload.removeClass("state-"+state),$upload.addClass("state-"+val),val){case"pedding":$queue.addClass("element-invisible"),$statusBar.addClass("element-invisible"),$placeHolder.removeClass("element-invisible"),$progress.hide(),$info.hide(),uploader.refresh();break;case"ready":$placeHolder.addClass("element-invisible"),$queue.removeClass("element-invisible"),$statusBar.removeClass("element-invisible"),$progress.hide(),$info.show(),$upload.text(lang.uploadStart),uploader.refresh();break;case"uploading":$progress.show(),$info.hide(),$upload.text(lang.uploadPause);break;case"paused":$progress.show(),$info.hide(),$upload.text(lang.uploadContinue);break;case"confirm":if($progress.show(),$info.hide(),$upload.text(lang.uploadStart),stats=uploader.getStats(),stats.successNum&&!stats.uploadFailNum)return void setState("finish");break;case"finish":$progress.hide(),$info.show(),stats.uploadFailNum?$upload.text(lang.uploadRetry):$upload.text(lang.uploadStart)}state=val,updateStatus()}_this.getQueueCount()?$upload.removeClass("disabled"):$upload.addClass("disabled")}function updateStatus(){var stats,text="";"ready"===state?text=lang.updateStatusReady.replace("_",fileCount).replace("_KB",WebUploader.formatSize(fileSize)):"confirm"===state?(stats=uploader.getStats(),stats.uploadFailNum&&(text=lang.updateStatusConfirm.replace("_",stats.successNum).replace("_",stats.successNum))):(stats=uploader.getStats(),text=lang.updateStatusFinish.replace("_",fileCount).replace("_KB",WebUploader.formatSize(fileSize)).replace("_",stats.successNum),stats.uploadFailNum&&(text+=lang.updateStatusError.replace("_",stats.uploadFailNum))),$info.html(text)}var uploader,_this=this,$=jQuery,$wrap=_this.$wrap,$queue=$wrap.find(".filelist"),$statusBar=$wrap.find(".statusBar"),$info=$statusBar.find(".info"),$upload=$wrap.find(".uploadBtn"),$filePickerBlock=($wrap.find(".filePickerBtn"),$wrap.find(".filePickerBlock")),$placeHolder=$wrap.find(".placeholder"),$progress=$statusBar.find(".progress").hide(),fileCount=0,fileSize=0,ratio=window.devicePixelRatio||1,thumbnailWidth=113*ratio,thumbnailHeight=113*ratio,state="",percentages={},supportTransition=function(){var s=document.createElement("p").style,r="transition"in s||"WebkitTransition"in s||"MozTransition"in s||"msTransition"in s||"OTransition"in s;return s=null,r}(),actionUrl=editor.getActionUrl(editor.getOpt("fileActionName")),fileMaxSize=editor.getOpt("fileMaxSize"),acceptExtensions=(editor.getOpt("fileAllowFiles")||[]).join("").replace(/\./g,",").replace(/^[,]/,"");return $upload.hide(),WebUploader.Uploader.support()?(!editor.getOpt("fileActionName"),uploader=_this.uploader=WebUploader.create({pick:{id:"#filePickerReady",label:lang.uploadSelectFile},swf:"../../third-party/webuploader/Uploader.swf",server:actionUrl,fileVal:editor.getOpt("fileFieldName"),duplicate:!0,fileSingleSizeLimit:fileMaxSize,headers:editor.getOpt("serverHeaders")||{},compress:!1}),uploader.addButton({id:"#filePickerBlock"}),uploader.addButton({id:"#filePickerBtn",label:lang.uploadAddFile}),setState("pedding"),uploader.on("beforeFileQueued",function(file){return!!(file.ext&&acceptExtensions.indexOf(file.ext.toLowerCase())!=-1&&file.size<=fileMaxSize)}),uploader.on("fileQueued",function(file){file.ext&&acceptExtensions.indexOf(file.ext.toLowerCase())!=-1&&file.size<=fileMaxSize&&(fileCount++,fileSize+=file.size),1===fileCount&&($placeHolder.addClass("element-invisible"),$statusBar.show()),addFile(file);var uploadFunc=editor.getOpt("uploadFunction");"function"==typeof uploadFunc&&("ready"===state?setState("uploading"):(setState("ready"),setState("uploading")),file.setStatus("progress"),uploader.trigger("uploadProgress",file,0),uploadFunc(file.source.source).then(function(response){uploader.trigger("uploadProgress",file,1),file.setStatus("complete"),setState("finish"),uploader.trigger("uploadSuccess",file,response),uploader.trigger("uploadComplete",file)}))}),uploader.on("fileDequeued",function(file){file.ext&&acceptExtensions.indexOf(file.ext.toLowerCase())!=-1&&file.size<=fileMaxSize&&(fileCount--,fileSize-=file.size),removeFile(file),updateTotalProgress()}),uploader.on("filesQueued",function(file){uploader.isInProgress()||"pedding"!=state&&"finish"!=state&&"confirm"!=state&&"ready"!=state||setState("ready"),updateTotalProgress()}),uploader.on("all",function(type,files){switch(type){case"uploadFinished":setState("confirm",files);break;case"startUpload":var params=utils.serializeParam(editor.queryCommandValue("serverparam"))||"",url=utils.formatUrl(actionUrl+(actionUrl.indexOf("?")==-1?"?":"&")+"encode=utf-8&"+params);uploader.option("server",url),setState("uploading",files);break;case"stopUpload":setState("paused",files)}}),uploader.on("uploadBeforeSend",function(file,data,header){actionUrl.toLowerCase().indexOf("jsp")!=-1&&(header.X_Requested_With="XMLHttpRequest")}),uploader.on("uploadProgress",function(file,percentage){var $li=$("#"+file.id),$percent=$li.find(".progress span");$percent.css("width",100*percentage+"%"),percentages[file.id][1]=percentage,updateTotalProgress()}),uploader.on("uploadSuccess",function(file,json){var $file=$("#"+file.id);try{"SUCCESS"==json.state?(_this.fileList.push(json),$file.append('<span class="success"></span>'),editor.fireEvent("uploadsuccess",{res:json,type:"file"})):$file.find(".error").text(json.state).show()}catch(e){$file.find(".error").text(lang.errorServerUpload).show()}}),uploader.on("uploadError",function(file,code){}),uploader.on("error",function(code,file){"Q_TYPE_DENIED"!=code&&"F_EXCEED_SIZE"!=code||addFile(file)}),uploader.on("uploadComplete",function(file,ret){}),$upload.on("click",function(){return!$(this).hasClass("disabled")&&void("ready"===state?uploader.upload():"paused"===state?uploader.upload():"uploading"===state&&uploader.stop())}),$upload.addClass("state-"+state),void updateTotalProgress()):void $("#filePickerReady").after($("<div>").html(lang.errorNotSupport)).hide()},getQueueCount:function(){var file,i,status,readyFile=0,files=this.uploader.getFiles();for(i=0;file=files[i++];)status=file.getStatus(),"queued"!=status&&"uploading"!=status&&"progress"!=status||readyFile++;return readyFile},getInsertList:function(){var i,link,data,list=[],prefix=editor.getOpt("fileUrlPrefix");for(i=0;i<this.fileList.length;i++)data=this.fileList[i],link=data.url,list.push({title:data.original||link.substr(link.lastIndexOf("/")+1),url:prefix+link});return list}},OnlineFile.prototype={init:function(){this.initContainer(),this.initEvents(),this.initData()},initContainer:function(){this.container.innerHTML="",this.list=document.createElement("ul"),this.clearFloat=document.createElement("li"),domUtils.addClass(this.list,"list"),domUtils.addClass(this.clearFloat,"clearFloat"),this.list.appendChild(this.clearFloat),this.container.appendChild(this.list)},initEvents:function(){var _this=this;domUtils.on($G("fileList"),"scroll",function(e){var panel=this;panel.scrollHeight-(panel.offsetHeight+panel.scrollTop)<10&&_this.getFileData()}),domUtils.on(this.list,"click",function(e){var target=e.target||e.srcElement,li=target.parentNode;"li"==li.tagName.toLowerCase()&&(domUtils.hasClass(li,"selected")?domUtils.removeClasses(li,"selected"):domUtils.addClass(li,"selected"))})},initData:function(){this.state=0,this.listSize=editor.getOpt("fileManagerListSize"),this.listIndex=0,this.listEnd=!1,this.getFileData()},getFileData:function(){var _this=this;_this.listEnd||this.isLoadingData||(this.isLoadingData=!0,ajax.request(editor.getActionUrl(editor.getOpt("fileManagerActionName")),{timeout:1e5,data:utils.extend({start:this.listIndex,size:this.listSize},editor.queryCommandValue("serverparam")),headers:editor.options.serverHeaders||{},method:"get",onsuccess:function(r){try{var json=eval("("+r.responseText+")");"SUCCESS"==json.state&&(_this.pushData(json.list),_this.listIndex=parseInt(json.start)+parseInt(json.list.length),_this.listIndex>=json.total&&(_this.listEnd=!0),_this.isLoadingData=!1)}catch(e){if(r.responseText.indexOf("ue_separate_ue")!=-1){var list=r.responseText.split(r.responseText);_this.pushData(list),_this.listIndex=parseInt(list.length),_this.listEnd=!0,_this.isLoadingData=!1}}},onerror:function(){_this.isLoadingData=!1}}))},pushData:function(list){var i,item,filetype,preview,icon,_this=this,urlPrefix=editor.getOpt("fileManagerUrlPrefix");for(i=0;i<list.length;i++)if(list[i]&&list[i].url){if(item=document.createElement("li"),icon=document.createElement("span"),filetype=list[i].url.substr(list[i].url.lastIndexOf(".")+1),"png|jpg|jpeg|gif|bmp".indexOf(filetype)!=-1)preview=document.createElement("img"),domUtils.on(preview,"load",function(image){return function(){_this.scale(image,image.parentNode.offsetWidth,image.parentNode.offsetHeight)}}(preview)),preview.width=113,preview.setAttribute("src",urlPrefix+list[i].url+(list[i].url.indexOf("?")==-1?"?noCache=":"&noCache=")+(+new Date).toString(36));else{var ic=document.createElement("i"),textSpan=document.createElement("span");textSpan.innerHTML=list[i].original||list[i].url.substr(list[i].url.lastIndexOf("/")+1),preview=document.createElement("div"),preview.appendChild(ic),preview.appendChild(textSpan),domUtils.addClass(preview,"file-wrapper"),domUtils.addClass(textSpan,"file-title"),domUtils.addClass(ic,"file-type-"+filetype),domUtils.addClass(ic,"file-preview")}domUtils.addClass(icon,"icon"),item.setAttribute("data-url",urlPrefix+list[i].url),list[i].original&&item.setAttribute("data-title",list[i].original),item.appendChild(preview),item.appendChild(icon),this.list.insertBefore(item,this.clearFloat)}},scale:function(img,w,h,type){var ow=img.width,oh=img.height;"justify"==type?ow>=oh?(img.width=w,img.height=h*oh/ow,img.style.marginLeft="-"+parseInt((img.width-w)/2)+"px"):(img.width=w*ow/oh,img.height=h,img.style.marginTop="-"+parseInt((img.height-h)/2)+"px"):ow>=oh?(img.width=w*ow/oh,img.height=h,img.style.marginLeft="-"+parseInt((img.width-w)/2)+"px"):(img.width=w,img.height=h*oh/ow,img.style.marginTop="-"+parseInt((img.height-h)/2)+"px")},getInsertList:function(){var i,lis=this.list.children,list=[];for(i=0;i<lis.length;i++)if(domUtils.hasClass(lis[i],"selected")){var url=lis[i].getAttribute("data-url"),title=lis[i].getAttribute("data-title")||url.substr(url.lastIndexOf("/")+1);list.push({title:title,url:url})}return list}}}();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! UEditorPlus v2.0.0*/
|
|
2
|
-
!function(){function a(){for(var a=$G("tabHeads").children,b=0;b<a.length;b++)domUtils.on(a[b],"click",function(b){var c,d,e=b.target||b.srcElement;for(c=0;c<a.length;c++)d=a[c].getAttribute("data-content-id"),a[c]==e?(domUtils.addClass(a[c],"focus"),domUtils.addClass($G(d),"focus")):(domUtils.removeClasses(a[c],"focus"),domUtils.removeClasses($G(d),"focus"))});r.disableUpload||($G("tabHeads").querySelector('[data-content-id="upload"]').style.display="inline-block"),r.selectCallback&&($G("audioSelect").style.display="inline-block",domUtils.on($G("audioSelect"),"click",function(a){r.selectCallback(editor,function(a){a&&($G("audioUrl").value=a.path,k(a.path))})}))}function b(){g(["audioFloat","upload_alignment"]),i($G("audioUrl")),c(),function(){var a,b=editor.selection.getRange().getClosedNode();if(b&&b.className){var c="edui-faked-audio"==b.className,e=b.className.indexOf("edui-upload-audio")!=-1;if(c||e){$G("audioUrl").value=a=b.getAttribute("_url");var f=domUtils.getComputedStyle(b,"float"),g=domUtils.getComputedStyle(b.parentNode,"text-align");d("center"===g?"center":f)}e&&(q=!0)}k(a)}()}function c(){dialog.onok=function(){$G("preview").innerHTML="";var a=f("tabHeads","tabSrc");switch(a){case"audio":return e();case"upload":return l()}},dialog.oncancel=function(){$G("preview").innerHTML=""}}function d(a){for(var b,c=$G("audioFloat").children,d=0;b=c[d++];)b.getAttribute("name")==a?"focus"!=b.className&&(b.className="focus"):"focus"==b.className&&(b.className="")}function e(){var a=$G("audioUrl").value;f("audioFloat","name");return!!a&&void editor.execCommand("insertaudio",{url:a},q?"upload":null)}function f(a,b){for(var c,d,e=$G(a).children,f=0;d=e[f++];)if("focus"==d.className){c=d.getAttribute(b);break}return c}function g(a){for(var b,c=0;b=a[c++];){var d=$G(b),e={none:lang["default"],left:lang.floatLeft,right:lang.floatRight,center:lang.block};for(var f in e){var g=document.createElement("div");g.setAttribute("name",f),"none"==f?(g.className="focus",g.style.cssText="background-image:url(icon/"+f+"-active.png);"):g.style.cssText="background-image:url(icon/"+f+".png);",g.setAttribute("title",e[f]),d.appendChild(g)}h(b)}}function h(a){for(var b,c=$G(a).children,d=0;b=c[d++];)domUtils.on(b,"click",function(){for(var a,b=0;a=c[b++];)a.className="",a.style.cssText="background-image:url(icon/"+a.getAttribute("name")+".png);",a.removeAttribute&&a.removeAttribute("class");this.className="focus",this.style.cssText="background-image:url(icon/"+this.getAttribute("name")+"-active.png);"})}function i(a){browser.ie?a.onpropertychange=function(){k(this.value)}:a.addEventListener("input",function(){k(this.value)},!1)}function j(a,b){b=b||{};var c=["<audio",b.id?' id="'+b.id+'"':"",b.cls?' class="'+b.cls+'"':""," controls >",'<source src="'+a+'" type="audio/mpeg" />',"</audio>"];return c.join("")}function k(a){a&&($G("preview").innerHTML='<div class="previewMsg"><span>'+lang.urlError+'</span></div><div style="position: absolute; inset: 0; background: #FFF; text-align: center; display: flex; justify-items: center; align-items: center;"><div style="text-align:center;flex-grow:1;">'+j(a)+"</div></div>")}function l(){var a=[],b=editor.getOpt("audioUrlPrefix"),c=f("upload_alignment","name")||"none";for(var d in p){var e=p[d];a.push({url:b+e.url,align:c})}var g=o.getQueueCount();return g?($(".info","#queueList").html('<span style="color:red;">'+"还有2个未上传文件".replace(/[\d]/,g)+"</span>"),!1):void editor.execCommand("insertaudio",a,"upload")}function m(){o=new n("queueList")}function n(a){this.$wrap=a.constructor==String?$("#"+a):$(a),this.init()}var o,p=[],q=!1,r={};window.onload=function(){r=editor.getOpt("audioConfig"),$focus($G("audioUrl")),a(),b(),m()},n.prototype={init:function(){this.fileList=[],this.initContainer(),this.initUploader()},initContainer:function(){this.$queue=this.$wrap.find(".filelist")},initUploader:function(){function a(a){var b=h('<li id="'+a.id+'"><p class="title">'+a.name+'</p><p class="imgWrap"></p><p class="progress"><span></span></p></li>'),c=h('<div class="file-panel"><span class="cancel">'+lang.uploadDelete+'</span><span class="rotateRight">'+lang.uploadTurnRight+'</span><span class="rotateLeft">'+lang.uploadTurnLeft+"</span></div>").appendTo(b),d=b.find("p.progress span"),e=b.find("p.imgWrap"),g=h('<p class="error"></p>').hide().appendTo(b),i=function(a){switch(a){case"exceed_size":text=lang.errorExceedSize;break;case"interrupt":text=lang.errorInterrupt;break;case"http":text=lang.errorHttp;break;case"not_allow_type":text=lang.errorFileType;break;default:text=lang.errorUploadRetry}g.text(text).show()};"invalid"===a.getStatus()?i(a.statusText):(e.text(lang.uploadPreview),"|png|jpg|jpeg|bmp|gif|".indexOf("|"+a.ext.toLowerCase()+"|")==-1?e.empty().addClass("notimage").append('<i class="file-preview file-type-'+a.ext.toLowerCase()+'"></i><span class="file-title">'+a.name+"</span>"):browser.ie&&browser.version<=7?e.text(lang.uploadNoPreview):f.makeThumb(a,function(a,b){if(a||!b||/^data:/.test(b)&&browser.ie&&browser.version<=7)e.text(lang.uploadNoPreview);else{var c=h('<img src="'+b+'">');e.empty().append(c),c.on("error",function(){e.text(lang.uploadNoPreview)})}},u,v),x[a.id]=[a.size,0],a.rotation=0,a.ext&&B.indexOf(a.ext.toLowerCase())!=-1||(i("not_allow_type"),f.removeFile(a))),a.on("statuschange",function(e,f){"progress"===f?d.hide().width(0):"queued"===f&&(b.off("mouseenter mouseleave"),c.remove()),"error"===e||"invalid"===e?(i(a.statusText),x[a.id][1]=1):"interrupt"===e?i("interrupt"):"queued"===e?x[a.id][1]=0:"progress"===e&&(g.hide(),d.css("display","block")),b.removeClass("state-"+f).addClass("state-"+e)}),b.on("mouseenter",function(){c.stop().animate({height:30})}),b.on("mouseleave",function(){c.stop().animate({height:0})}),c.on("click","span",function(){var b,c=h(this).index();switch(c){case 0:return void f.removeFile(a);case 1:a.rotation+=90;break;case 2:a.rotation-=90}y?(b="rotate("+a.rotation+"deg)",e.css({"-webkit-transform":b,"-mos-transform":b,"-o-transform":b,transform:b})):e.css("filter","progid:DXImageTransform.Microsoft.BasicImage(rotation="+~~(a.rotation/90%4+4)%4+")")}),b.insertBefore(n)}function b(a){var b=h("#"+a.id);delete x[a.id],c(),b.off().find(".file-panel").off().end().remove()}function c(){var a,b=0,c=0,d=q.children();h.each(x,function(a,d){c+=d[0],b+=d[0]*d[1]}),a=c?b/c:0,d.eq(0).text(Math.round(100*a)+"%"),d.eq(1).css("width",Math.round(100*a)+"%"),e()}function d(a,b){if(a!=w){var c=f.getStats();switch(m.removeClass("state-"+w),m.addClass("state-"+a),a){case"pedding":j.addClass("element-invisible"),k.addClass("element-invisible"),o.removeClass("element-invisible"),q.hide(),l.hide(),f.refresh();break;case"ready":o.addClass("element-invisible"),j.removeClass("element-invisible"),k.removeClass("element-invisible"),q.hide(),l.show(),m.text(lang.uploadStart),f.refresh();break;case"uploading":q.show(),l.hide(),m.text(lang.uploadPause);break;case"paused":q.show(),l.hide(),m.text(lang.uploadContinue);break;case"confirm":if(q.show(),l.hide(),m.text(lang.uploadStart),c=f.getStats(),c.successNum&&!c.uploadFailNum)return void d("finish");break;case"finish":q.hide(),l.show(),c.uploadFailNum?m.text(lang.uploadRetry):m.text(lang.uploadStart)}w=a,e()}g.getQueueCount()?m.removeClass("disabled"):m.addClass("disabled")}function e(){var a,b="";"ready"===w?b=lang.updateStatusReady.replace("_",r).replace("_KB",WebUploader.formatSize(s)):"confirm"===w?(a=f.getStats(),a.uploadFailNum&&(b=lang.updateStatusConfirm.replace("_",a.successNum).replace("_",a.successNum))):(a=f.getStats(),b=lang.updateStatusFinish.replace("_",r).replace("_KB",WebUploader.formatSize(s)).replace("_",a.successNum),a.uploadFailNum&&(b+=lang.updateStatusError.replace("_",a.uploadFailNum))),l.html(b)}var f,g=this,h=jQuery,i=g.$wrap,j=i.find(".filelist"),k=i.find(".statusBar"),l=k.find(".info"),m=i.find(".uploadBtn"),n=(i.find(".filePickerBtn"),i.find(".filePickerBlock")),o=i.find(".placeholder"),q=k.find(".progress").hide(),r=0,s=0,t=window.devicePixelRatio||1,u=113*t,v=113*t,w="",x={},y=function(){var a=document.createElement("p").style,b="transition"in a||"WebkitTransition"in a||"MozTransition"in a||"msTransition"in a||"OTransition"in a;return a=null,b}(),z=editor.getActionUrl(editor.getOpt("audioActionName")),A=editor.getOpt("audioMaxSize"),B=(editor.getOpt("audioAllowFiles")||[]).join("").replace(/\./g,",").replace(/^[,]/,"");return m.hide(),WebUploader.Uploader.support()?editor.getOpt("audioActionName")?(f=g.uploader=WebUploader.create({pick:{id:"#filePickerReady",label:lang.uploadSelectFile},swf:"../../third-party/webuploader/Uploader.swf",server:z,fileVal:editor.getOpt("audioFieldName"),duplicate:!0,fileSingleSizeLimit:A,headers:editor.getOpt("serverHeaders")||{},compress:!1}),f.addButton({id:"#filePickerBlock"}),f.addButton({id:"#filePickerBtn",label:lang.uploadAddFile}),d("pedding"),f.on("beforeFileQueued",function(a){return!(!a.ext||B.indexOf(a.ext.toLowerCase())==-1)}),f.on("fileQueued",function(b){r++,s+=b.size,1===r&&(o.addClass("element-invisible"),k.show()),a(b);const c=editor.getOpt("uploadFunction");"function"==typeof c&&("ready"===w?d("uploading"):"pedding"===w&&(d("ready"),d("uploading")),b.setStatus("progress"),f.trigger("uploadProgress",b,0),c(b.source.source).then(function(a){f.trigger("uploadProgress",b,1),b.setStatus("complete"),d("finish"),f.trigger("uploadSuccess",b,a),f.trigger("uploadComplete",b)}))}),f.on("fileDequeued",function(a){r--,s-=a.size,b(a),c()}),f.on("filesQueued",function(a){f.isInProgress()||"pedding"!=w&&"finish"!=w&&"confirm"!=w&&"ready"!=w||d("ready"),c()}),f.on("all",function(a,b){switch(a){case"uploadFinished":d("confirm",b);break;case"startUpload":var c=utils.serializeParam(editor.queryCommandValue("serverparam"))||"",e=utils.formatUrl(z+(z.indexOf("?")==-1?"?":"&")+"encode=utf-8&"+c);f.option("server",e),d("uploading",b);break;case"stopUpload":d("paused",b)}}),f.on("uploadBeforeSend",function(a,b,c){z.toLowerCase().indexOf("jsp")!=-1&&(c.X_Requested_With="XMLHttpRequest")}),f.on("uploadProgress",function(a,b){var d=h("#"+a.id),e=d.find(".progress span");e.css("width",100*b+"%"),x[a.id][1]=b,c()}),f.on("uploadSuccess",function(a,b){var c=h("#"+a.id);try{"SUCCESS"==b.state?(p.push({url:b.url,type:b.type,original:b.original}),c.append('<span class="success"></span>')):c.find(".error").text(b.state).show()}catch(d){c.find(".error").text(lang.errorServerUpload).show()}}),f.on("uploadError",function(a,b){}),f.on("error",function(b,c){"Q_TYPE_DENIED"!=b&&"F_EXCEED_SIZE"!=b||a(c)}),f.on("uploadComplete",function(a,b){}),m.on("click",function(){return!h(this).hasClass("disabled")&&void("ready"===w?f.upload():"paused"===w?f.upload():"uploading"===w&&f.stop())}),m.addClass("state-"+w),void c()):void h("#filePickerReady").after(h("<div>").html(lang.errorLoadConfig)).hide():void h("#filePickerReady").after(h("<div>").html(lang.errorNotSupport)).hide()},getQueueCount:function(){var a,b,c,d=0,e=this.uploader.getFiles();for(b=0;a=e[b++];)c=a.getStatus(),"queued"!=c&&"uploading"!=c&&"progress"!=c||d++;return d},refresh:function(){this.uploader.refresh()}}}();
|
|
2
|
+
!function(){function initTabs(){for(var tabs=$G("tabHeads").children,i=0;i<tabs.length;i++)domUtils.on(tabs[i],"click",function(e){var j,bodyId,target=e.target||e.srcElement;for(j=0;j<tabs.length;j++)bodyId=tabs[j].getAttribute("data-content-id"),tabs[j]==target?(domUtils.addClass(tabs[j],"focus"),domUtils.addClass($G(bodyId),"focus")):(domUtils.removeClasses(tabs[j],"focus"),domUtils.removeClasses($G(bodyId),"focus"))});editorOpt.disableUpload||($G("tabHeads").querySelector('[data-content-id="upload"]').style.display="inline-block"),editorOpt.selectCallback&&($G("audioSelect").style.display="inline-block",domUtils.on($G("audioSelect"),"click",function(e){editorOpt.selectCallback(editor,function(info){info&&($G("audioUrl").value=info.path,createPreview(info.path))})}))}function initAudio(){createAlignButton(["audioFloat","upload_alignment"]),addUrlChangeListener($G("audioUrl")),addOkListener(),function(){var url,img=editor.selection.getRange().getClosedNode();if(img&&img.className){var hasFakedClass="edui-faked-audio"==img.className,hasUploadClass=img.className.indexOf("edui-upload-audio")!=-1;if(hasFakedClass||hasUploadClass){$G("audioUrl").value=url=img.getAttribute("_url");var align=domUtils.getComputedStyle(img,"float"),parentAlign=domUtils.getComputedStyle(img.parentNode,"text-align");updateAlignButton("center"===parentAlign?"center":align)}hasUploadClass&&(isModifyUploadaudio=!0)}createPreview(url)}()}function addOkListener(){dialog.onok=function(){$G("preview").innerHTML="";var currentTab=findFocus("tabHeads","tabSrc");switch(currentTab){case"audio":return insertSingle();case"upload":return insertUpload()}},dialog.oncancel=function(){$G("preview").innerHTML=""}}function updateAlignButton(align){for(var ci,aligns=$G("audioFloat").children,i=0;ci=aligns[i++];)ci.getAttribute("name")==align?"focus"!=ci.className&&(ci.className="focus"):"focus"==ci.className&&(ci.className="")}function insertSingle(){var url=$G("audioUrl").value;findFocus("audioFloat","name");return!!url&&void editor.execCommand("insertaudio",{url:url},isModifyUploadaudio?"upload":null)}function findFocus(id,returnProperty){for(var property,ci,tabs=$G(id).children,i=0;ci=tabs[i++];)if("focus"==ci.className){property=ci.getAttribute(returnProperty);break}return property}function createAlignButton(ids){for(var ci,i=0;ci=ids[i++];){var floatContainer=$G(ci),nameMaps={none:lang["default"],left:lang.floatLeft,right:lang.floatRight,center:lang.block};for(var j in nameMaps){var div=document.createElement("div");div.setAttribute("name",j),"none"==j?(div.className="focus",div.style.cssText="background-image:url(icon/"+j+"-active.png);"):div.style.cssText="background-image:url(icon/"+j+".png);",div.setAttribute("title",nameMaps[j]),floatContainer.appendChild(div)}switchSelect(ci)}}function switchSelect(selectParentId){for(var ci,selects=$G(selectParentId).children,i=0;ci=selects[i++];)domUtils.on(ci,"click",function(){for(var cj,j=0;cj=selects[j++];)cj.className="",cj.style.cssText="background-image:url(icon/"+cj.getAttribute("name")+".png);",cj.removeAttribute&&cj.removeAttribute("class");this.className="focus",this.style.cssText="background-image:url(icon/"+this.getAttribute("name")+"-active.png);"})}function addUrlChangeListener(url){browser.ie?url.onpropertychange=function(){createPreview(this.value)}:url.addEventListener("input",function(){createPreview(this.value)},!1)}function createAudioHtml(url,param){param=param||{};var str=["<audio",param.id?' id="'+param.id+'"':"",param.cls?' class="'+param.cls+'"':""," controls >",'<source src="'+url+'" type="audio/mpeg" />',"</audio>"];return str.join("")}function createPreview(url){url&&($G("preview").innerHTML='<div class="previewMsg"><span>'+lang.urlError+'</span></div><div style="position: absolute; inset: 0; background: #FFF; text-align: center; display: flex; justify-items: center; align-items: center;"><div style="text-align:center;flex-grow:1;">'+createAudioHtml(url)+"</div></div>")}function insertUpload(){var audioObjs=[],uploadDir=editor.getOpt("audioUrlPrefix"),align=findFocus("upload_alignment","name")||"none";for(var key in uploadaudioList){var file=uploadaudioList[key];audioObjs.push({url:uploadDir+file.url,align:align})}var count=uploadFile.getQueueCount();return count?($(".info","#queueList").html('<span style="color:red;">'+"还有2个未上传文件".replace(/[\d]/,count)+"</span>"),!1):void editor.execCommand("insertaudio",audioObjs,"upload")}function initUpload(){uploadFile=new UploadFile("queueList")}function UploadFile(target){this.$wrap=target.constructor==String?$("#"+target):$(target),this.init()}var uploadFile,uploadaudioList=[],isModifyUploadaudio=!1,editorOpt={};window.onload=function(){editorOpt=editor.getOpt("audioConfig"),$focus($G("audioUrl")),initTabs(),initAudio(),initUpload()},UploadFile.prototype={init:function(){this.fileList=[],this.initContainer(),this.initUploader()},initContainer:function(){this.$queue=this.$wrap.find(".filelist")},initUploader:function(){function addFile(file){var $li=$('<li id="'+file.id+'"><p class="title">'+file.name+'</p><p class="imgWrap"></p><p class="progress"><span></span></p></li>'),$btns=$('<div class="file-panel"><span class="cancel">'+lang.uploadDelete+'</span><span class="rotateRight">'+lang.uploadTurnRight+'</span><span class="rotateLeft">'+lang.uploadTurnLeft+"</span></div>").appendTo($li),$prgress=$li.find("p.progress span"),$wrap=$li.find("p.imgWrap"),$info=$('<p class="error"></p>').hide().appendTo($li),showError=function(code){switch(code){case"exceed_size":text=lang.errorExceedSize;break;case"interrupt":text=lang.errorInterrupt;break;case"http":text=lang.errorHttp;break;case"not_allow_type":text=lang.errorFileType;break;default:text=lang.errorUploadRetry}$info.text(text).show()};"invalid"===file.getStatus()?showError(file.statusText):($wrap.text(lang.uploadPreview),"|png|jpg|jpeg|bmp|gif|".indexOf("|"+file.ext.toLowerCase()+"|")==-1?$wrap.empty().addClass("notimage").append('<i class="file-preview file-type-'+file.ext.toLowerCase()+'"></i><span class="file-title">'+file.name+"</span>"):browser.ie&&browser.version<=7?$wrap.text(lang.uploadNoPreview):uploader.makeThumb(file,function(error,src){if(error||!src||/^data:/.test(src)&&browser.ie&&browser.version<=7)$wrap.text(lang.uploadNoPreview);else{var $img=$('<img src="'+src+'">');$wrap.empty().append($img),$img.on("error",function(){$wrap.text(lang.uploadNoPreview)})}},thumbnailWidth,thumbnailHeight),percentages[file.id]=[file.size,0],file.rotation=0,file.ext&&acceptExtensions.indexOf(file.ext.toLowerCase())!=-1||(showError("not_allow_type"),uploader.removeFile(file))),file.on("statuschange",function(cur,prev){"progress"===prev?$prgress.hide().width(0):"queued"===prev&&($li.off("mouseenter mouseleave"),$btns.remove()),"error"===cur||"invalid"===cur?(showError(file.statusText),percentages[file.id][1]=1):"interrupt"===cur?showError("interrupt"):"queued"===cur?percentages[file.id][1]=0:"progress"===cur&&($info.hide(),$prgress.css("display","block")),$li.removeClass("state-"+prev).addClass("state-"+cur)}),$li.on("mouseenter",function(){$btns.stop().animate({height:30})}),$li.on("mouseleave",function(){$btns.stop().animate({height:0})}),$btns.on("click","span",function(){var deg,index=$(this).index();switch(index){case 0:return void uploader.removeFile(file);case 1:file.rotation+=90;break;case 2:file.rotation-=90}supportTransition?(deg="rotate("+file.rotation+"deg)",$wrap.css({"-webkit-transform":deg,"-mos-transform":deg,"-o-transform":deg,transform:deg})):$wrap.css("filter","progid:DXImageTransform.Microsoft.BasicImage(rotation="+~~(file.rotation/90%4+4)%4+")")}),$li.insertBefore($filePickerBlock)}function removeFile(file){var $li=$("#"+file.id);delete percentages[file.id],updateTotalProgress(),$li.off().find(".file-panel").off().end().remove()}function updateTotalProgress(){var percent,loaded=0,total=0,spans=$progress.children();$.each(percentages,function(k,v){total+=v[0],loaded+=v[0]*v[1]}),percent=total?loaded/total:0,spans.eq(0).text(Math.round(100*percent)+"%"),spans.eq(1).css("width",Math.round(100*percent)+"%"),updateStatus()}function setState(val,files){if(val!=state){var stats=uploader.getStats();switch($upload.removeClass("state-"+state),$upload.addClass("state-"+val),val){case"pedding":$queue.addClass("element-invisible"),$statusBar.addClass("element-invisible"),$placeHolder.removeClass("element-invisible"),$progress.hide(),$info.hide(),uploader.refresh();break;case"ready":$placeHolder.addClass("element-invisible"),$queue.removeClass("element-invisible"),$statusBar.removeClass("element-invisible"),$progress.hide(),$info.show(),$upload.text(lang.uploadStart),uploader.refresh();break;case"uploading":$progress.show(),$info.hide(),$upload.text(lang.uploadPause);break;case"paused":$progress.show(),$info.hide(),$upload.text(lang.uploadContinue);break;case"confirm":if($progress.show(),$info.hide(),$upload.text(lang.uploadStart),stats=uploader.getStats(),stats.successNum&&!stats.uploadFailNum)return void setState("finish");break;case"finish":$progress.hide(),$info.show(),stats.uploadFailNum?$upload.text(lang.uploadRetry):$upload.text(lang.uploadStart)}state=val,updateStatus()}_this.getQueueCount()?$upload.removeClass("disabled"):$upload.addClass("disabled")}function updateStatus(){var stats,text="";"ready"===state?text=lang.updateStatusReady.replace("_",fileCount).replace("_KB",WebUploader.formatSize(fileSize)):"confirm"===state?(stats=uploader.getStats(),stats.uploadFailNum&&(text=lang.updateStatusConfirm.replace("_",stats.successNum).replace("_",stats.successNum))):(stats=uploader.getStats(),text=lang.updateStatusFinish.replace("_",fileCount).replace("_KB",WebUploader.formatSize(fileSize)).replace("_",stats.successNum),stats.uploadFailNum&&(text+=lang.updateStatusError.replace("_",stats.uploadFailNum))),$info.html(text)}var uploader,_this=this,$=jQuery,$wrap=_this.$wrap,$queue=$wrap.find(".filelist"),$statusBar=$wrap.find(".statusBar"),$info=$statusBar.find(".info"),$upload=$wrap.find(".uploadBtn"),$filePickerBlock=($wrap.find(".filePickerBtn"),$wrap.find(".filePickerBlock")),$placeHolder=$wrap.find(".placeholder"),$progress=$statusBar.find(".progress").hide(),fileCount=0,fileSize=0,ratio=window.devicePixelRatio||1,thumbnailWidth=113*ratio,thumbnailHeight=113*ratio,state="",percentages={},supportTransition=function(){var s=document.createElement("p").style,r="transition"in s||"WebkitTransition"in s||"MozTransition"in s||"msTransition"in s||"OTransition"in s;return s=null,r}(),actionUrl=editor.getActionUrl(editor.getOpt("audioActionName")),fileMaxSize=editor.getOpt("audioMaxSize"),acceptExtensions=(editor.getOpt("audioAllowFiles")||[]).join("").replace(/\./g,",").replace(/^[,]/,"");return $upload.hide(),WebUploader.Uploader.support()?editor.getOpt("audioActionName")?(uploader=_this.uploader=WebUploader.create({pick:{id:"#filePickerReady",label:lang.uploadSelectFile},swf:"../../third-party/webuploader/Uploader.swf",server:actionUrl,fileVal:editor.getOpt("audioFieldName"),duplicate:!0,fileSingleSizeLimit:fileMaxSize,headers:editor.getOpt("serverHeaders")||{},compress:!1}),uploader.addButton({id:"#filePickerBlock"}),uploader.addButton({id:"#filePickerBtn",label:lang.uploadAddFile}),setState("pedding"),uploader.on("beforeFileQueued",function(file){return!(!file.ext||acceptExtensions.indexOf(file.ext.toLowerCase())==-1)}),uploader.on("fileQueued",function(file){fileCount++,fileSize+=file.size,1===fileCount&&($placeHolder.addClass("element-invisible"),$statusBar.show()),addFile(file);const uploadFunc=editor.getOpt("uploadFunction");"function"==typeof uploadFunc&&("ready"===state?setState("uploading"):"pedding"===state&&(setState("ready"),setState("uploading")),file.setStatus("progress"),uploader.trigger("uploadProgress",file,0),uploadFunc(file.source.source).then(function(response){uploader.trigger("uploadProgress",file,1),file.setStatus("complete"),setState("finish"),uploader.trigger("uploadSuccess",file,response),uploader.trigger("uploadComplete",file)}))}),uploader.on("fileDequeued",function(file){fileCount--,fileSize-=file.size,removeFile(file),updateTotalProgress()}),uploader.on("filesQueued",function(file){uploader.isInProgress()||"pedding"!=state&&"finish"!=state&&"confirm"!=state&&"ready"!=state||setState("ready"),updateTotalProgress()}),uploader.on("all",function(type,files){switch(type){case"uploadFinished":setState("confirm",files);break;case"startUpload":var params=utils.serializeParam(editor.queryCommandValue("serverparam"))||"",url=utils.formatUrl(actionUrl+(actionUrl.indexOf("?")==-1?"?":"&")+"encode=utf-8&"+params);uploader.option("server",url),setState("uploading",files);break;case"stopUpload":setState("paused",files)}}),uploader.on("uploadBeforeSend",function(file,data,header){actionUrl.toLowerCase().indexOf("jsp")!=-1&&(header.X_Requested_With="XMLHttpRequest")}),uploader.on("uploadProgress",function(file,percentage){var $li=$("#"+file.id),$percent=$li.find(".progress span");$percent.css("width",100*percentage+"%"),percentages[file.id][1]=percentage,updateTotalProgress()}),uploader.on("uploadSuccess",function(file,json){var $file=$("#"+file.id);try{"SUCCESS"==json.state?(uploadaudioList.push({url:json.url,type:json.type,original:json.original}),$file.append('<span class="success"></span>')):$file.find(".error").text(json.state).show()}catch(e){$file.find(".error").text(lang.errorServerUpload).show()}}),uploader.on("uploadError",function(file,code){}),uploader.on("error",function(code,file){"Q_TYPE_DENIED"!=code&&"F_EXCEED_SIZE"!=code||addFile(file)}),uploader.on("uploadComplete",function(file,ret){}),$upload.on("click",function(){return!$(this).hasClass("disabled")&&void("ready"===state?uploader.upload():"paused"===state?uploader.upload():"uploading"===state&&uploader.stop())}),$upload.addClass("state-"+state),void updateTotalProgress()):void $("#filePickerReady").after($("<div>").html(lang.errorLoadConfig)).hide():void $("#filePickerReady").after($("<div>").html(lang.errorNotSupport)).hide()},getQueueCount:function(){var file,i,status,readyFile=0,files=this.uploader.getFiles();for(i=0;file=files[i++];)status=file.getStatus(),"queued"!=status&&"uploading"!=status&&"progress"!=status||readyFile++;return readyFile},refresh:function(){this.uploader.refresh()}}}();
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
4
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
|
|
5
|
-
<script type="text/javascript" src="../internal.js?
|
|
5
|
+
<script type="text/javascript" src="../internal.js?b983a808"></script>
|
|
6
6
|
<link rel="stylesheet" type="text/css" href="background.css?982ee6c2">
|
|
7
7
|
</head>
|
|
8
8
|
<body>
|
|
@@ -54,6 +54,6 @@
|
|
|
54
54
|
</div>
|
|
55
55
|
</div>
|
|
56
56
|
</div>
|
|
57
|
-
<script type="text/javascript" src="background.js?
|
|
57
|
+
<script type="text/javascript" src="background.js?8ab58061"></script>
|
|
58
58
|
</body>
|
|
59
59
|
</html>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! UEditorPlus v2.0.0*/
|
|
2
|
-
!function(){function initTabs(){for(var
|
|
2
|
+
!function(){function initTabs(){for(var tabs=$G("tabHeads").children,i=0;i<tabs.length;i++)domUtils.on(tabs[i],"click",function(e){for(var target=e.target||e.srcElement,j=0;j<tabs.length;j++)if(tabs[j]==target){tabs[j].className="focus";var contentId=tabs[j].getAttribute("data-content-id");$G(contentId).style.display="block"}else tabs[j].className="",$G(tabs[j].getAttribute("data-content-id")).style.display="none"})}function initColorSelector(){var obj=editor.queryCommandValue("background");if(obj){var color=obj["background-color"],repeat=obj["background-repeat"]||"repeat",image=obj["background-image"]||"",position=obj["background-position"]||"center center",pos=position.split(" "),x=parseInt(pos[0])||0,y=parseInt(pos[1])||0;"no-repeat"==repeat&&(x||y)&&(repeat="self"),image=image.match(/url[\s]*\(([^\)]*)\)/),image=image?image[1]:"",updateFormState("colored",color,image,repeat,x,y)}else updateFormState();var updateHandler=function(){updateFormState(),updateBackground()};domUtils.on($G("nocolorRadio"),"click",updateBackground),domUtils.on($G("coloredRadio"),"click",updateHandler),domUtils.on($G("url"),"keyup",function(){$G("url").value&&"none"==$G("alignment").style.display&&utils.each($G("repeatType").children,function(item){item.selected="repeat"==item.getAttribute("value")&&"selected"}),updateHandler()}),domUtils.on($G("repeatType"),"change",updateHandler),domUtils.on($G("x"),"keyup",updateBackground),domUtils.on($G("y"),"keyup",updateBackground),initColorPicker()}function initColorPicker(){var me=editor,cp=$G("colorPicker"),popup=new UE.ui.Popup({content:new UE.ui.ColorPicker({noColorText:me.getLang("clearColor"),editor:me,onpickcolor:function(t,color){updateFormState("colored",color),updateBackground(),UE.ui.Popup.postHide()},onpicknocolor:function(t,color){updateFormState("colored","transparent"),updateBackground(),UE.ui.Popup.postHide()}}),editor:me,onhide:function(){}});domUtils.on(cp,"click",function(){popup.showAnchor(this)}),domUtils.on(document,"mousedown",function(evt){var el=evt.target||evt.srcElement;UE.ui.Popup.postHide(el)}),domUtils.on(window,"scroll",function(){UE.ui.Popup.postHide()})}function updateFormState(radio,color,url,align,x,y){var nocolorRadio=$G("nocolorRadio"),coloredRadio=$G("coloredRadio");if(radio&&(nocolorRadio.checked="colored"!=radio&&"checked",coloredRadio.checked="colored"==radio&&"checked"),color&&domUtils.setStyle($G("colorPicker"),"background-color",color),url&&/^\//.test(url)){var a=document.createElement("a");a.href=url,browser.ie&&(a.href=a.href),url=browser.ie?a.href:a.protocol+"//"+a.host+a.pathname+a.search+a.hash}(url||""===url)&&($G("url").value=url),align&&utils.each($G("repeatType").children,function(item){item.selected=align==item.getAttribute("value")&&"selected"}),(x||y)&&($G("x").value=parseInt(x)||0,$G("y").value=parseInt(y)||0),$G("alignment").style.display=coloredRadio.checked&&$G("url").value?"":"none",$G("custom").style.display=coloredRadio.checked&&$G("url").value&&"self"==$G("repeatType").value?"":"none"}function updateBackground(){if($G("coloredRadio").checked){var color=domUtils.getStyle($G("colorPicker"),"background-color"),bgimg=$G("url").value,align=$G("repeatType").value,backgroundObj={"background-repeat":"no-repeat","background-position":"center center"};color&&(backgroundObj["background-color"]=color),bgimg&&(backgroundObj["background-image"]="url("+bgimg+")"),"self"==align?backgroundObj["background-position"]=$G("x").value+"px "+$G("y").value+"px":"repeat-x"!=align&&"repeat-y"!=align&&"repeat"!=align||(backgroundObj["background-repeat"]=align),editor.execCommand("background",backgroundObj)}else editor.execCommand("background",null)}function OnlineImage(target){this.container=utils.isString(target)?document.getElementById(target):target,this.init()}var onlineImage,backupStyle=editor.queryCommandValue("background");window.onload=function(){initTabs(),initColorSelector()},OnlineImage.prototype={init:function(){this.reset(),this.initEvents()},initContainer:function(){this.container.innerHTML="",this.list=document.createElement("ul"),this.clearFloat=document.createElement("li"),domUtils.addClass(this.list,"list"),domUtils.addClass(this.clearFloat,"clearFloat"),this.list.id="imageListUl",this.list.appendChild(this.clearFloat),this.container.appendChild(this.list)},initEvents:function(){var _this=this;domUtils.on($G("imageList"),"scroll",function(e){var panel=this;panel.scrollHeight-(panel.offsetHeight+panel.scrollTop)<10&&_this.getImageData()}),domUtils.on(this.container,"click",function(e){var target=e.target||e.srcElement,li=target.parentNode,nodes=$G("imageListUl").childNodes;if("li"==li.tagName.toLowerCase()){updateFormState("nocolor",null,"");for(var node,i=0;node=nodes[i++];)node!=li||domUtils.hasClass(node,"selected")?domUtils.removeClasses(node,"selected"):(domUtils.addClass(node,"selected"),updateFormState("colored",null,li.firstChild.getAttribute("_src"),"repeat"));updateBackground()}})},initData:function(){this.state=0,this.listSize=editor.getOpt("imageManagerListSize"),this.listIndex=0,this.listEnd=!1,this.getImageData()},reset:function(){this.initContainer(),this.initData()},getImageData:function(){var _this=this;if(!_this.listEnd&&!this.isLoadingData){this.isLoadingData=!0;var url=editor.getActionUrl(editor.getOpt("imageManagerActionName")),isJsonp=utils.isCrossDomainUrl(url);ajax.request(url,{timeout:1e5,dataType:isJsonp?"jsonp":"",data:utils.extend({start:this.listIndex,size:this.listSize},editor.queryCommandValue("serverparam")),headers:editor.options.serverHeaders||{},method:"get",onsuccess:function(r){try{var json=isJsonp?r:eval("("+r.responseText+")");"SUCCESS"==json.state&&(_this.pushData(json.list),_this.listIndex=parseInt(json.start)+parseInt(json.list.length),_this.listIndex>=json.total&&(_this.listEnd=!0),_this.isLoadingData=!1)}catch(e){if(r.responseText.indexOf("ue_separate_ue")!=-1){var list=r.responseText.split(r.responseText);_this.pushData(list),_this.listIndex=parseInt(list.length),_this.listEnd=!0,_this.isLoadingData=!1}}},onerror:function(){_this.isLoadingData=!1}})}},pushData:function(list){var i,item,img,icon,_this=this,urlPrefix=editor.getOpt("imageManagerUrlPrefix");for(i=0;i<list.length;i++)list[i]&&list[i].url&&(item=document.createElement("li"),img=document.createElement("img"),icon=document.createElement("span"),domUtils.on(img,"load",function(image){return function(){_this.scale(image,image.parentNode.offsetWidth,image.parentNode.offsetHeight)}}(img)),img.width=113,img.setAttribute("src",urlPrefix+list[i].url+(list[i].url.indexOf("?")==-1?"?noCache=":"&noCache=")+(+new Date).toString(36)),img.setAttribute("_src",urlPrefix+list[i].url),domUtils.addClass(icon,"icon"),item.appendChild(img),item.appendChild(icon),this.list.insertBefore(item,this.clearFloat))},scale:function(img,w,h,type){var ow=img.width,oh=img.height;"justify"==type?ow>=oh?(img.width=w,img.height=h*oh/ow,img.style.marginLeft="-"+parseInt((img.width-w)/2)+"px"):(img.width=w*ow/oh,img.height=h,img.style.marginTop="-"+parseInt((img.height-h)/2)+"px"):ow>=oh?(img.width=w*ow/oh,img.height=h,img.style.marginLeft="-"+parseInt((img.width-w)/2)+"px"):(img.width=w,img.height=h*oh/ow,img.style.marginTop="-"+parseInt((img.height-h)/2)+"px")},getInsertList:function(){var i,lis=this.list.children,list=[],align=getAlign();for(i=0;i<lis.length;i++)if(domUtils.hasClass(lis[i],"selected")){var img=lis[i].firstChild,src=img.getAttribute("_src");list.push({src:src,_src:src,floatStyle:align})}return list}},dialog.onok=function(){updateBackground(),editor.fireEvent("saveScene")},dialog.oncancel=function(){editor.execCommand("background",backupStyle)}}();
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<head>
|
|
3
3
|
<title></title>
|
|
4
4
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
|
|
5
|
-
<script type="text/javascript" src="../internal.js?
|
|
5
|
+
<script type="text/javascript" src="../internal.js?b983a808"></script>
|
|
6
6
|
<style type="text/css">
|
|
7
7
|
.wrapper {
|
|
8
8
|
width: 600px;
|
|
@@ -161,10 +161,10 @@
|
|
|
161
161
|
</div>
|
|
162
162
|
</div>
|
|
163
163
|
</div>
|
|
164
|
-
<script src="../../third-party/jquery-3.5.1.js?
|
|
164
|
+
<script src="../../third-party/jquery-3.5.1.js?cdb3992e"></script>
|
|
165
165
|
<script src="https://cdn.bootcdn.net/ajax/libs/mammoth/1.6.0/mammoth.browser.min.js"></script>
|
|
166
166
|
<script src="https://cdn.bootcdn.net/ajax/libs/showdown/2.1.0/showdown.min.js"></script>
|
|
167
|
-
<script type="text/javascript" src="contentimport.js?
|
|
167
|
+
<script type="text/javascript" src="contentimport.js?e0504ca5"></script>
|
|
168
168
|
<script type="text/javascript">
|
|
169
169
|
utils.domReady(function () {
|
|
170
170
|
var options = {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! UEditorPlus v2.0.0*/
|
|
2
|
-
function processWord(
|
|
2
|
+
function processWord(file){$(".file-tip").html("正在转换Word文件,请稍后..."),$(".file-result").html("").hide();var reader=new FileReader;reader.onload=function(loadEvent){mammoth.convertToHtml({arrayBuffer:loadEvent.target.result}).then(function(result){$(".file-tip").html("转换成功"),contentImport.data.result=result.value,$(".file-result").html(result.value).show()},function(error){$(".file-tip").html("Word文件转换失败:"+error)})},reader.onerror=function(loadEvent){$(".file-tip").html("Word文件转换失败:"+loadEvent)},reader.readAsArrayBuffer(file)}function processMarkdown(markdown){var converter=new showdown.Converter,html=converter.makeHtml(markdown);$(".file-tip").html("转换成功"),contentImport.data.result=html,$(".file-result").html(html).show()}function processMarkdownFile(file){$(".file-tip").html("正在转换Markdown文件,请稍后..."),$(".file-result").html("").hide();var reader=new FileReader;reader.onload=function(loadEvent){processMarkdown(loadEvent.target.result)},reader.onerror=function(loadEvent){$(".file-tip").html("Markdown文件转换失败:"+loadEvent)},reader.readAsText(file,"UTF-8")}function addUploadButtonListener(){g("contentImport").addEventListener("change",function(){const file=this.files[0],fileName=file.name,fileExt=fileName.substring(fileName.lastIndexOf(".")+1).toLowerCase();switch(fileExt){case"docx":case"doc":processWord(file);break;case"md":processMarkdownFile(file);break;default:$(".file-tip").html("不支持的文件格式:"+fileExt)}}),g("fileInputConfirm").addEventListener("click",function(){processMarkdown(g("fileInputContent").value),$(".file-input").hide()})}function addOkListener(){dialog.onok=function(){return contentImport.data.result?(editor.fireEvent("saveScene"),editor.execCommand("inserthtml",contentImport.data.result),void editor.fireEvent("saveScene")):(alert("请先上传文件识别内容"),!1)},dialog.oncancel=function(){}}var contentImport={},g=$G;contentImport.data={result:null},contentImport.init=function(opt,callbacks){addUploadButtonListener(),addOkListener()};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<title></title>
|
|
5
5
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
|
6
6
|
<meta name="robots" content="noindex, nofollow"/>
|
|
7
|
-
<script type="text/javascript" src="../internal.js?
|
|
7
|
+
<script type="text/javascript" src="../internal.js?b983a808"></script>
|
|
8
8
|
<link rel="stylesheet" type="text/css" href="emotion.css?f71063c6">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
<div id="tabIconReview">
|
|
32
32
|
<img id='faceReview' class='review' src="../../themes/default/images/spacer.gif"/>
|
|
33
33
|
</div>
|
|
34
|
-
<script type="text/javascript" src="emotion.js?
|
|
34
|
+
<script type="text/javascript" src="emotion.js?ce619d40"></script>
|
|
35
35
|
<script type="text/javascript">
|
|
36
36
|
var emotion = {
|
|
37
37
|
tabNum: 7, //切换面板数量
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! UEditorPlus v2.0.0*/
|
|
2
|
-
function initImgName(){for(var
|
|
2
|
+
function initImgName(){for(var pro in emotion.SmilmgName){var tempName=emotion.SmilmgName[pro],tempBox=emotion.SmileyBox[pro],tempStr="";if(tempBox.length)return;for(var i=1;i<=tempName[1];i++)tempStr=tempName[0],i<10&&(tempStr+="0"),tempStr=tempStr+i+".gif",tempBox.push(tempStr)}}function initEvtHandler(conId){for(var tabHeads=$G(conId),i=0,j=0;i<tabHeads.childNodes.length;i++){var tabObj=tabHeads.childNodes[i];1==tabObj.nodeType&&(domUtils.on(tabObj,"click",function(index){return function(){switchTab(index)}}(j)),j++)}switchTab(0),$G("tabIconReview").style.display="none"}function InsertSmiley(url,evt){var obj={src:editor.options.emotionLocalization?editor.options.UEDITOR_HOME_URL+"dialogs/emotion/"+url:url};obj._src=obj.src,editor.execCommand("insertimage",obj),evt.ctrlKey||dialog.popup.hide()}function switchTab(index){autoHeight(index),0==emotion.tabExist[index]&&(emotion.tabExist[index]=1,createTab("tab"+index));for(var tabHeads=$G("tabHeads").getElementsByTagName("span"),tabBodys=$G("tabBodys").getElementsByTagName("div"),i=0,L=tabHeads.length;i<L;i++)tabHeads[i].className="",tabBodys[i].style.display="none";tabHeads[index].className="focus",tabBodys[index].style.display="block"}function autoHeight(index){var iframe=dialog.getDom("iframe"),parent=iframe.parentNode.parentNode;switch(index){case 0:iframe.style.height="380px",parent.style.height="392px";break;case 1:iframe.style.height="220px",parent.style.height="232px";break;case 2:iframe.style.height="260px",parent.style.height="272px";break;case 3:iframe.style.height="300px",parent.style.height="312px";break;case 4:iframe.style.height="140px",parent.style.height="152px";break;case 5:iframe.style.height="260px",parent.style.height="272px";break;case 6:iframe.style.height="230px",parent.style.height="242px"}}function createTab(tabName){for(var faceImage,sUrl,realUrl,posflag,offset,infor,faceVersion="?v=1.1",tab=$G(tabName),imagePath=emotion.SmileyPath+emotion.imageFolders[tabName],positionLine=5.5,iWidth=iHeight=35,iColWidth=3,tableCss=emotion.imageCss[tabName],cssOffset=emotion.imageCssOffset[tabName],textHTML=['<table class="smileytable">'],i=0,imgNum=emotion.SmileyBox[tabName].length,imgColNum=11;i<imgNum;){textHTML.push("<tr>");for(var j=0;j<imgColNum;j++,i++)faceImage=emotion.SmileyBox[tabName][i],faceImage?(sUrl=imagePath+faceImage+faceVersion,realUrl=imagePath+faceImage,posflag=j<positionLine?0:1,offset=cssOffset*i*-1-1,infor=emotion.SmileyInfor[tabName][i],textHTML.push('<td class="'+tableCss+'" border="1" width="'+iColWidth+'%" style="border-collapse:collapse;" align="center" bgcolor="transparent" onclick="InsertSmiley(\''+realUrl.replace(/'/g,"\\'")+"',event)\" onmouseover=\"over(this,'"+sUrl+"','"+posflag+'\')" onmouseout="out(this)">'),textHTML.push("<span>"),textHTML.push('<img style="background-position:left '+offset+'px;" title="'+infor+'" src="'+emotion.SmileyPath+(editor.options.emotionLocalization?'0.gif" width="':'default/0.gif" width="')+iWidth+'" height="'+iHeight+'"></img>'),textHTML.push("</span>")):textHTML.push('<td width="'+iColWidth+'%" bgcolor="#FFFFFF">'),textHTML.push("</td>");textHTML.push("</tr>")}textHTML.push("</table>"),textHTML=textHTML.join(""),tab.innerHTML=textHTML}function over(td,srcPath,posFlag){td.style.backgroundColor="#ACCD3C",$G("faceReview").style.backgroundImage="url("+srcPath+")",1==posFlag&&($G("tabIconReview").className="show"),$G("tabIconReview").style.display="block"}function out(td){td.style.backgroundColor="transparent";var tabIconRevew=$G("tabIconReview");tabIconRevew.className="",tabIconRevew.style.display="none"}function createTabList(tabNum){for(var obj={},i=0;i<tabNum;i++)obj["tab"+i]=[];return obj}function createArr(tabNum){for(var arr=[],i=0;i<tabNum;i++)arr[i]=0;return arr}window.onload=function(){editor.setOpt({emotionLocalization:!1}),emotion.SmileyPath=editor.options.emotionLocalization===!0?"images/":"http://img.baidu.com/hi/",emotion.SmileyBox=createTabList(emotion.tabNum),emotion.tabExist=createArr(emotion.tabNum),initImgName(),initEvtHandler("tabHeads")};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<title></title>
|
|
5
5
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
|
|
6
|
-
<script type="text/javascript" src="../internal.js?
|
|
6
|
+
<script type="text/javascript" src="../internal.js?b983a808"></script>
|
|
7
7
|
<style type="text/css">
|
|
8
8
|
.wrapper {
|
|
9
9
|
box-sizing: border-box;
|
|
@@ -86,9 +86,9 @@
|
|
|
86
86
|
</div>
|
|
87
87
|
|
|
88
88
|
</div>
|
|
89
|
-
<script src="../../third-party/jquery-3.5.1.js?
|
|
90
|
-
<script type="text/javascript" src="../../third-party/clipboard/clipboard.js?
|
|
91
|
-
<script type="text/javascript" src="formula.js?
|
|
89
|
+
<script src="../../third-party/jquery-3.5.1.js?cdb3992e"></script>
|
|
90
|
+
<script type="text/javascript" src="../../third-party/clipboard/clipboard.js?2e8a80b8"></script>
|
|
91
|
+
<script type="text/javascript" src="formula.js?6e50ec34"></script>
|
|
92
92
|
<script type="text/javascript">
|
|
93
93
|
utils.domReady(function () {
|
|
94
94
|
Formula.init();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! UEditorPlus v2.0.0*/
|
|
2
|
-
function preg_quote(
|
|
2
|
+
function preg_quote(str,delimiter){return(str+"").replace(new RegExp("[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\"+(delimiter||"")+"-]","g"),"\\$&")}function loadScript(url,cb){var script;script=document.createElement("script"),script.src=url,script.onload=function(){cb&&cb({isNew:!0})},document.getElementsByTagName("head")[0].appendChild(script)}var Formula={mode:"plain",latexeasy:null,init:function(){Formula.initMode(),Formula.initEvent(),Formula.initSubmit()},renderPlain:function(){var $preview=$("#preview"),value=$("#editor").val();if(!value)return void $preview.hide();value=encodeURIComponent(value);var formulaConfig=editor.getOpt("formulaConfig"),src=formulaConfig.imageUrlTemplate.replace(/\{\}/,value);$("#previewImage").attr("src",src),$preview.show()},setValuePlain:function(value){$("#editor").val(value),Formula.renderPlain()},setValueLive:function(value){return Formula.latexeasy?void Formula.latexeasy.call("set.latex",{latex:value}):void setTimeout(function(){Formula.setValueLive(value)},100)},initMode:function(){var formulaConfig=editor.getOpt("formulaConfig");"live"===formulaConfig.editorMode?($("#liveEditor").attr("src",formulaConfig.editorLiveServer+"/editor"),$("#modeLive").show(),Formula.mode="live"):($("#modePlain").show(),Formula.mode="plain");var img=editor.selection.getRange().getClosedNode();if(img&&null!==img.getAttribute("data-formula-image")){var value=img.getAttribute("data-formula-image");value&&Formula.setValue(decodeURIComponent(value))}},setValue:function(value){switch(Formula.mode){case"plain":Formula.setValuePlain(value);break;case"live":Formula.setValueLive(value)}},getValue:function(cb){switch(Formula.mode){case"plain":cb($.trim($("#editor").val()));break;case"live":Formula.latexeasy.call("get.latex",{},function(data){cb(data.latex)})}},initEvent:function(){var le,changeTimer=null;switch(Formula.mode){case"plain":$("#editor").on("change keypress",function(){changeTimer&&clearTimeout(changeTimer),changeTimer=setTimeout(function(){Formula.renderPlain()},1e3)}),$("#inputDemo").on("click",function(){$("#editor").val("f(a) = \\frac{1}{2\\pi i} \\oint\\frac{f(z)}{z-a}dz"),Formula.renderPlain()});break;case"live":var formulaConfig=editor.getOpt("formulaConfig");loadScript(formulaConfig.editorLiveServer+"/vendor/LatexEasyEditor/editor/sdk.js",function(){le=new window.LatexEasy(document.getElementById("liveEditor")),le.on("ready",function(){Formula.latexeasy=le}),le.init()})}},initSubmit:function(){dialog.onclose=function(t,ok){return!ok||(Formula.getValue(function(value){editor.execCommand("formula",value),editor.fireEvent("saveScene"),dialog.close(!1)}),!1)}}};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<head>
|
|
5
5
|
<title>帮助</title>
|
|
6
6
|
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
|
|
7
|
-
<script type="text/javascript" src="../internal.js?
|
|
7
|
+
<script type="text/javascript" src="../internal.js?b983a808"></script>
|
|
8
8
|
<link rel="stylesheet" type="text/css" href="help.css?94b325b2">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
@@ -77,6 +77,6 @@
|
|
|
77
77
|
</div>
|
|
78
78
|
</div>
|
|
79
79
|
</div>
|
|
80
|
-
<script type="text/javascript" src="help.js?
|
|
80
|
+
<script type="text/javascript" src="help.js?849c7ba6"></script>
|
|
81
81
|
</body>
|
|
82
82
|
</html>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! UEditorPlus v2.0.0*/
|
|
2
|
-
function clickHandler(
|
|
2
|
+
function clickHandler(tabHeads,tabBodys,obj){for(var k=0,len=tabHeads.length;k<len;k++)tabHeads[k].className="";obj.className="focus";for(var tabSrc=obj.getAttribute("tabSrc"),j=0,length=tabBodys.length;j<length;j++){var body=tabBodys[j],id=body.getAttribute("id");body.onclick=function(){this.style.zoom=1},id!=tabSrc?body.style.zIndex=1:body.style.zIndex=200}}function switchTab(tabParentId){for(var tabElements=$G(tabParentId).children,tabHeads=tabElements[0].children,tabBodys=tabElements[1].children,i=0,length=tabHeads.length;i<length;i++){var head=tabHeads[i];"focus"===head.className&&clickHandler(tabHeads,tabBodys,head),head.onclick=function(){clickHandler(tabHeads,tabBodys,this)}}}switchTab("helptab"),document.getElementById("version").innerHTML=parent.UE.version;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! UEditorPlus v2.0.0*/
|
|
2
|
-
!function(){function initTabs(){for(var a=$G("tabhead").children,b=0;b<a.length;b++)domUtils.on(a[b],"click",function(a){var b=a.target||a.srcElement;setTabFocus(b.getAttribute("data-content-id"))});editorOpt.disableUpload||($G("tabhead").querySelector('[data-content-id="upload"]').style.display="inline-block"),editorOpt.disableOnline||($G("tabhead").querySelector('[data-content-id="online"]').style.display="inline-block"),editorOpt.selectCallback&&($G("imageSelect").style.display="inline-block",domUtils.on($G("imageSelect"),"click",function(a){editorOpt.selectCallback(editor,function(a){if(a){$G("url").value=a.path,$G("title").value=a.name;var b=new Image;b.onload=function(){$G("width").value=b.width,$G("height").value=b.height,remoteImage.setPreview()},b.onerror=function(){remoteImage.setPreview()},b.src=a.path}})}));var c=editor.selection.getRange().getClosedNode();setTabFocus((c&&c.tagName&&"img"==c.tagName.toLowerCase(),"remote"))}function setTabFocus(a){if(a){var b,c,d=$G("tabhead").children;for(b=0;b<d.length;b++)c=d[b].getAttribute("data-content-id"),c==a?(domUtils.addClass(d[b],"focus"),domUtils.addClass($G(c),"focus")):(domUtils.removeClasses(d[b],"focus"),domUtils.removeClasses($G(c),"focus"));switch(a){case"remote":remoteImage=remoteImage||new RemoteImage;break;case"upload":setAlign(editor.getOpt("imageInsertAlign")),uploadImage=uploadImage||new UploadImage("queueList");break;case"online":setAlign(editor.getOpt("imageManagerInsertAlign")),onlineImage=onlineImage||new OnlineImage("imageList"),onlineImage.reset()}}}function initButtons(){dialog.onok=function(){for(var a,b=!1,c=[],d=$G("tabhead").children,e=0;e<d.length;e++)if(domUtils.hasClass(d[e],"focus")){a=d[e].getAttribute("data-content-id");break}switch(a){case"remote":c=remoteImage.getInsertList();break;case"upload":c=uploadImage.getInsertList();var f=uploadImage.getQueueCount();if(f)return $(".info","#queueList").html('<span style="color:red;">'+"还有2个未上传文件".replace(/[\d]/,f)+"</span>"),!1;break;case"online":c=onlineImage.getInsertList()}c&&(editor.execCommand("insertimage",c),b&&editor.fireEvent("catchRemoteImage"))}}function initAlign(){domUtils.on($G("alignIcon"),"click",function(a){var b=a.target||a.srcElement;b.className&&b.className.indexOf("-align")!=-1&&setAlign(b.getAttribute("data-align"))})}function setAlign(a){a=a||"none";var b=$G("alignIcon").children;for(i=0;i<b.length;i++)b[i].getAttribute("data-align")==a?(domUtils.addClass(b[i],"focus"),$G("align").value=b[i].getAttribute("data-align")):domUtils.removeClasses(b[i],"focus")}function getAlign(){var a=$G("align").value||"none";return"none"==a?"":a}function RemoteImage(a){this.container=utils.isString(a)?document.getElementById(a):a,this.init()}function UploadImage(a){this.$wrap=a.constructor==String?$("#"+a):$(a),this.init()}function OnlineImage(a){this.container=utils.isString(a)?document.getElementById(a):a,this.init()}var remoteImage,uploadImage,onlineImage,editorOpt={};window.onload=function(){editorOpt=editor.getOpt("imageConfig"),initTabs(),initAlign(),initButtons()},RemoteImage.prototype={init:function(){this.initContainer(),this.initEvents()},initContainer:function(){this.dom={url:$G("url"),width:$G("width"),height:$G("height"),border:$G("border"),vhSpace:$G("vhSpace"),title:$G("title"),align:$G("align")};var a=editor.selection.getRange().getClosedNode();a&&this.setImage(a)},initEvents:function(){function a(){b.setPreview()}var b=this,c={};domUtils.on($G("url"),"keyup",a),domUtils.on($G("border"),"keyup",a),domUtils.on($G("title"),"keyup",a),domUtils.on($G("width"),"keyup",function(){if(c.checked){var d=c.getAttribute("data-proportion");$G("height").value=Math.round(this.value/d)}else b.updateLocker();a()}),domUtils.on($G("height"),"keyup",function(){if(c.checked){var d=c.getAttribute("data-proportion");$G("width").value=Math.round(this.value*d)}else b.updateLocker();a()})},updateLocker:function(){var a=$G("width").value,b=$G("height").value,c={};a&&b&&a==parseInt(a)&&b==parseInt(b)?(c.disabled=!1,c.title=""):(c.checked=!1,c.disabled="disabled",c.title=lang.remoteLockError)},setImage:function(a){if(a.tagName&&("img"==a.tagName.toLowerCase()||a.getAttribute("src"))&&a.src){var b=a.getAttribute("data-word-image"),c=b?b.replace("&","&"):a.getAttribute("_src")||a.getAttribute("src",2).replace("&","&"),d=editor.queryCommandValue("imageFloat");c!==$G("url").value&&($G("url").value=c),c&&($G("width").value=a.width||"",$G("height").value=a.height||"",$G("border").value=a.getAttribute("border")||"0",$G("vhSpace").value=a.getAttribute("vspace")||"0",$G("title").value=a.title||a.alt||"",setAlign(d),this.setPreview(),this.updateLocker())}},getData:function(){var a={};for(var b in this.dom)a[b]=this.dom[b].value;return a},setPreview:function(){var a,b,c=$G("url").value,d=$G("width").value,e=$G("height").value,f=$G("border").value,g=$G("title").value,h=$G("preview");a=d&&e?Math.min(d,h.offsetWidth):h.offsetWidth,a=a+2*f>h.offsetWidth?a:h.offsetWidth-2*f,b=d&&e?a*e/d:"";const i=window.parent.location,j=i.protocol+"//"+i.host+i.pathname;c&&(h.innerHTML='<img src="'+encodeURI(j+c)+'" width="'+a+'" height="'+b+'" border="'+f+'px solid #000" title="'+g+'" />')},getInsertList:function(){var a=this.getData();if(a.url){var b={src:a.url,_src:a.url};return b._propertyDelete=[],b.style=[],a.width?(b.width=a.width,b.style.push("width:"+a.width+"px")):b._propertyDelete.push("width"),a.height?(b.height=a.height,b.style.push("height:"+a.height+"px")):b._propertyDelete.push("height"),a.border?b.border=a.border:b._propertyDelete.push("border"),a.align?b.floatStyle=a.align:b._propertyDelete.push("floatStyle"),a.vhSpace?b.vspace=a.vhSpace:b._propertyDelete.push("vspace"),a.title?b.alt=a.title:b._propertyDelete.push("alt"),b.style.length>0?b.style=b.style.join(";"):b._propertyDelete.push("style"),[b]}return[]}},UploadImage.prototype={init:function(){this.imageList=[],this.initContainer(),this.initUploader()},initContainer:function(){this.$queue=this.$wrap.find(".filelist")},initUploader:function(){function a(a){var b=h('<li id="'+a.id+'"><p class="title">'+a.name+'</p><p class="imgWrap"></p><p class="progress"><span></span></p></li>'),c=h('<div class="file-panel"><span class="cancel">'+lang.uploadDelete+'</span><span class="rotateRight">'+lang.uploadTurnRight+'</span><span class="rotateLeft">'+lang.uploadTurnLeft+"</span></div>").appendTo(b),d=b.find("p.progress span"),e=b.find("p.imgWrap"),g=h('<p class="error"></p>').hide().appendTo(b),i=function(a){switch(a){case"exceed_size":text=lang.errorExceedSize;break;case"interrupt":text=lang.errorInterrupt;break;case"http":text=lang.errorHttp;break;case"not_allow_type":text=lang.errorFileType;break;default:text=lang.errorUploadRetry}g.text(text).show()};"invalid"===a.getStatus()?i(a.statusText):(e.text(lang.uploadPreview),browser.ie&&browser.version<=7?e.text(lang.uploadNoPreview):f.makeThumb(a,function(a,b){if(a||!b)e.text(lang.uploadNoPreview);else{var c=h('<img src="'+b+'">');e.empty().append(c),c.on("error",function(){e.text(lang.uploadNoPreview)})}},t,u),w[a.id]=[a.size,0],a.rotation=0,a.ext&&z.indexOf(a.ext.toLowerCase())!=-1||(i("not_allow_type"),f.removeFile(a))),a.on("statuschange",function(e,f){"progress"===f?d.hide().width(0):"queued"===f&&(b.off("mouseenter mouseleave"),c.remove()),"error"===e||"invalid"===e?(i(a.statusText),w[a.id][1]=1):"interrupt"===e?i("interrupt"):"queued"===e?w[a.id][1]=0:"progress"===e&&(g.hide(),d.css("display","block")),b.removeClass("state-"+f).addClass("state-"+e)}),b.on("mouseenter",function(){c.stop().animate({height:30})}),b.on("mouseleave",function(){c.stop().animate({height:0})}),c.on("click","span",function(){var b,c=h(this).index();switch(c){case 0:return void f.removeFile(a);case 1:a.rotation+=90;break;case 2:a.rotation-=90}x?(b="rotate("+a.rotation+"deg)",e.css({"-webkit-transform":b,"-mos-transform":b,"-o-transform":b,transform:b})):e.css("filter","progid:DXImageTransform.Microsoft.BasicImage(rotation="+~~(a.rotation/90%4+4)%4+")")}),b.insertBefore(n)}function b(a){var b=h("#"+a.id);delete w[a.id],c(),b.off().find(".file-panel").off().end().remove()}function c(){var a,b=0,c=0,d=p.children();h.each(w,function(a,d){c+=d[0],b+=d[0]*d[1]}),a=c?b/c:0,d.eq(0).text(Math.round(100*a)+"%"),d.eq(1).css("width",Math.round(100*a)+"%"),e()}function d(a,b){if(a!==v){var c=f.getStats();switch(m.removeClass("state-"+v),m.addClass("state-"+a),a){case"pedding":j.addClass("element-invisible"),k.addClass("element-invisible"),o.removeClass("element-invisible"),p.hide(),l.hide(),f.refresh();break;case"ready":o.addClass("element-invisible"),j.removeClass("element-invisible"),k.removeClass("element-invisible"),p.hide(),l.show(),m.text(lang.uploadStart),f.refresh();break;case"uploading":p.show(),l.hide(),m.text(lang.uploadPause);break;case"paused":p.show(),l.hide(),m.text(lang.uploadContinue);break;case"confirm":if(p.show(),l.hide(),m.text(lang.uploadStart),c=f.getStats(),c.successNum&&!c.uploadFailNum)return void d("finish");break;case"finish":p.hide(),l.show(),c.uploadFailNum?m.text(lang.uploadRetry):m.text(lang.uploadStart)}v=a,e()}g.getQueueCount()?m.removeClass("disabled"):m.addClass("disabled")}function e(){var a,b="";"ready"===v?b=lang.updateStatusReady.replace("_",q).replace("_KB",WebUploader.formatSize(r)):"confirm"===v?(a=f.getStats(),a.uploadFailNum&&(b=lang.updateStatusConfirm.replace("_",a.successNum).replace("_",a.successNum))):(a=f.getStats(),b=lang.updateStatusFinish.replace("_",q).replace("_KB",WebUploader.formatSize(r)).replace("_",a.successNum),a.uploadFailNum&&(b+=lang.updateStatusError.replace("_",a.uploadFailNum))),l.html(b)}var f,g=this,h=jQuery,i=g.$wrap,j=i.find(".filelist"),k=i.find(".statusBar"),l=k.find(".info"),m=i.find(".uploadBtn"),n=(i.find(".filePickerBtn"),i.find(".filePickerBlock")),o=i.find(".placeholder"),p=k.find(".progress").hide(),q=0,r=0,s=window.devicePixelRatio||1,t=113*s,u=113*s,v="",w={},x=function(){var a=document.createElement("p").style,b="transition"in a||"WebkitTransition"in a||"MozTransition"in a||"msTransition"in a||"OTransition"in a;return a=null,b}(),y=editor.getActionUrl(editor.getOpt("imageActionName")),z=(editor.getOpt("imageAllowFiles")||[]).join("").replace(/\./g,",").replace(/^[,]/,""),A=editor.getOpt("imageMaxSize"),B=editor.getOpt("imageCompressBorder");return m.hide(),WebUploader.Uploader.support()?editor.getOpt("imageActionName")?(f=g.uploader=WebUploader.create({pick:{id:"#filePickerReady",label:lang.uploadSelectFile},accept:{title:"Images",extensions:z,mimeTypes:"image/*"},swf:"../../third-party/webuploader/Uploader.swf",server:"",fileVal:editor.getOpt("imageFieldName"),duplicate:!0,fileSingleSizeLimit:A,threads:1,headers:editor.getOpt("serverHeaders")||{},compress:!!editor.getOpt("imageCompressEnable")&&{enable:editor.getOpt("imageCompressEnable"),maxWidthOrHeight:B,maxSize:A}}),f.addButton({id:"#filePickerBlock"}),f.addButton({id:"#filePickerBtn",label:lang.uploadAddFile}),d("pedding"),f.on("beforeFileQueued",function(a){return!(!a.ext||z.indexOf(a.ext.toLowerCase())==-1)}),f.on("fileQueued",function(b){q++,r+=b.size,1===q&&(o.addClass("element-invisible"),k.show()),a(b);const c=editor.getOpt("uploadFunction");"function"==typeof c&&("ready"===v?d("uploading"):"pedding"===v&&(d("ready"),d("uploading")),b.setStatus("progress"),f.trigger("uploadProgress",b,0),c(b.source.source,"image").then(function(a){f.trigger("uploadProgress",b,1),b.setStatus("complete"),d("finish"),f.trigger("uploadSuccess",b,a),f.trigger("uploadComplete",b)}))}),f.on("fileDequeued",function(a){a.ext&&z.indexOf(a.ext.toLowerCase())!=-1&&a.size<=A&&(q--,r-=a.size),b(a),c()}),f.on("filesQueued",function(a){f.isInProgress()||"pedding"!=v&&"finish"!=v&&"confirm"!=v&&"ready"!=v||d("ready"),c()}),f.on("all",function(a,b){switch(a){case"uploadFinished":d("confirm",b);break;case"startUpload":var c=utils.serializeParam(editor.queryCommandValue("serverparam"))||"",e=utils.formatUrl(y+(y.indexOf("?")==-1?"?":"&")+"encode=utf-8&"+c);f.option("server",e),d("uploading",b);break;case"stopUpload":d("paused",b)}}),f.on("uploadBeforeSend",function(a,b,c){return y.toLowerCase().indexOf("jsp")!=-1&&(c["X-Requested-With"]="XMLHttpRequest"),!1}),f.on("uploadProgress",function(a,b){var d=h("#"+a.id),e=d.find(".progress span");e.css("width",100*b+"%"),w[a.id][1]=b,c()}),f.on("uploadSuccess",function(a,b){var d=h("#"+a.id);try{"SUCCESS"==b.state?(g.imageList.push(b),d.append('<span class="success"></span>'),editor.fireEvent("uploadsuccess",{res:b,type:"image"})):d.find(".error").text(b.state).show()}catch(e){d.find(".error").text(lang.errorServerUpload).show()}c()}),f.on("uploadError",function(a,b){}),f.on("error",function(b,c){"Q_TYPE_DENIED"!=b&&"F_EXCEED_SIZE"!=b||a(c)}),f.on("uploadComplete",function(a,b){}),m.on("click",function(){return!h(this).hasClass("disabled")&&void("ready"===v?f.upload():"paused"===v?f.upload():"uploading"===v&&f.stop())}),m.addClass("state-"+v),void c()):void h("#filePickerReady").after(h("<div>").html(lang.errorLoadConfig)).hide():void h("#filePickerReady").after(h("<div>").html(lang.errorNotSupport)).hide()},getQueueCount:function(){var a,b,c,d=0,e=this.uploader.getFiles();for(b=0;a=e[b++];)c=a.getStatus(),"queued"!=c&&"uploading"!=c&&"progress"!=c||d++;return d},destroy:function(){this.$wrap.remove()},getInsertList:function(){var a,b,c=[],d=getAlign();for(a=0;a<this.imageList.length;a++)b=this.imageList[a],c.push({src:b.url,_src:b.url,alt:b.original,floatStyle:d});return c}},OnlineImage.prototype={init:function(){this.reset(),this.initEvents()},initContainer:function(){this.container.innerHTML="",this.list=document.createElement("ul"),this.clearFloat=document.createElement("li"),domUtils.addClass(this.list,"list"),domUtils.addClass(this.clearFloat,"clearFloat"),this.list.appendChild(this.clearFloat),this.container.appendChild(this.list)},initEvents:function(){var a=this;domUtils.on($G("imageList"),"scroll",function(b){var c=this;c.scrollHeight-(c.offsetHeight+c.scrollTop)<10&&a.getImageData()}),domUtils.on(this.container,"click",function(a){var b=a.target||a.srcElement,c=b.parentNode;"li"==c.tagName.toLowerCase()&&(domUtils.hasClass(c,"selected")?domUtils.removeClasses(c,"selected"):domUtils.addClass(c,"selected"))})},initData:function(){this.state=0,this.listSize=editor.getOpt("imageManagerListSize"),this.listIndex=0,this.listEnd=!1,this.getImageData()},reset:function(){this.initContainer(),this.initData()},getImageData:function(){var _this=this;if(!_this.listEnd&&!this.isLoadingData){this.isLoadingData=!0;var url=editor.getActionUrl(editor.getOpt("imageManagerActionName")),isJsonp=utils.isCrossDomainUrl(url);ajax.request(url,{timeout:1e5,dataType:isJsonp?"jsonp":"",headers:editor.options.serverHeaders||{},data:utils.extend({start:this.listIndex,size:this.listSize},editor.queryCommandValue("serverparam")),method:"get",onsuccess:function(r){try{var json=isJsonp?r:eval("("+r.responseText+")");"SUCCESS"===json.state&&(_this.pushData(json.list),_this.listIndex=parseInt(json.start)+parseInt(json.list.length),_this.listIndex>=json.total&&(_this.listEnd=!0),_this.isLoadingData=!1)}catch(e){if(r.responseText.indexOf("ue_separate_ue")!=-1){var list=r.responseText.split(r.responseText);_this.pushData(list),_this.listIndex=parseInt(list.length),_this.listEnd=!0,_this.isLoadingData=!1}}},onerror:function(){_this.isLoadingData=!1}})}},pushData:function(a){var b,c,d,e,f=this;for(b=0;b<a.length;b++)a[b]&&a[b].url&&(c=document.createElement("li"),d=document.createElement("img"),e=document.createElement("span"),domUtils.on(d,"load",function(a){return function(){f.scale(a,a.parentNode.offsetWidth,a.parentNode.offsetHeight)}}(d)),d.width=113,d.setAttribute("src",a[b].url+(a[b].url.indexOf("?")==-1?"?noCache=":"&noCache=")+(+new Date).toString(36)),d.setAttribute("_src",a[b].url),domUtils.addClass(e,"icon"),c.appendChild(d),c.appendChild(e),this.list.insertBefore(c,this.clearFloat))},scale:function(a,b,c,d){var e=a.width,f=a.height;"justify"==d?e>=f?(a.width=b,a.height=c*f/e,a.style.marginLeft="-"+parseInt((a.width-b)/2)+"px"):(a.width=b*e/f,a.height=c,a.style.marginTop="-"+parseInt((a.height-c)/2)+"px"):e>=f?(a.width=b*e/f,a.height=c,a.style.marginLeft="-"+parseInt((a.width-b)/2)+"px"):(a.width=b,a.height=c*f/e,a.style.marginTop="-"+parseInt((a.height-c)/2)+"px")},getInsertList:function(){var a,b=this.list.children,c=[],d=getAlign();for(a=0;a<b.length;a++)if(domUtils.hasClass(b[a],"selected")){var e=b[a].firstChild,f=e.getAttribute("_src");c.push({src:f,_src:f,alt:f.substr(f.lastIndexOf("/")+1),floatStyle:d})}return c}}}();
|
|
2
|
+
!function(){function initTabs(){for(var tabs=$G("tabhead").children,i=0;i<tabs.length;i++)domUtils.on(tabs[i],"click",function(e){var target=e.target||e.srcElement;setTabFocus(target.getAttribute("data-content-id"))});editorOpt.disableUpload||($G("tabhead").querySelector('[data-content-id="upload"]').style.display="inline-block"),editorOpt.disableOnline||($G("tabhead").querySelector('[data-content-id="online"]').style.display="inline-block"),editorOpt.selectCallback&&($G("imageSelect").style.display="inline-block",domUtils.on($G("imageSelect"),"click",function(e){editorOpt.selectCallback(editor,function(info){if(info){$G("url").value=info.path,$G("title").value=info.name;var img=new Image;img.onload=function(){$G("width").value=img.width,$G("height").value=img.height,remoteImage.setPreview()},img.onerror=function(){remoteImage.setPreview()},img.src=info.path}})}));var img=editor.selection.getRange().getClosedNode();setTabFocus((img&&img.tagName&&"img"==img.tagName.toLowerCase(),"remote"))}function setTabFocus(id){if(id){var i,bodyId,tabs=$G("tabhead").children;for(i=0;i<tabs.length;i++)bodyId=tabs[i].getAttribute("data-content-id"),bodyId==id?(domUtils.addClass(tabs[i],"focus"),domUtils.addClass($G(bodyId),"focus")):(domUtils.removeClasses(tabs[i],"focus"),domUtils.removeClasses($G(bodyId),"focus"));switch(id){case"remote":remoteImage=remoteImage||new RemoteImage;break;case"upload":setAlign(editor.getOpt("imageInsertAlign")),uploadImage=uploadImage||new UploadImage("queueList");break;case"online":setAlign(editor.getOpt("imageManagerInsertAlign")),onlineImage=onlineImage||new OnlineImage("imageList"),onlineImage.reset()}}}function initButtons(){dialog.onok=function(){for(var id,remote=!1,list=[],tabs=$G("tabhead").children,i=0;i<tabs.length;i++)if(domUtils.hasClass(tabs[i],"focus")){id=tabs[i].getAttribute("data-content-id");break}switch(id){case"remote":list=remoteImage.getInsertList();break;case"upload":list=uploadImage.getInsertList();var count=uploadImage.getQueueCount();if(count)return $(".info","#queueList").html('<span style="color:red;">'+"还有2个未上传文件".replace(/[\d]/,count)+"</span>"),!1;break;case"online":list=onlineImage.getInsertList()}list&&(editor.execCommand("insertimage",list),remote&&editor.fireEvent("catchRemoteImage"))}}function initAlign(){domUtils.on($G("alignIcon"),"click",function(e){var target=e.target||e.srcElement;target.className&&target.className.indexOf("-align")!=-1&&setAlign(target.getAttribute("data-align"))})}function setAlign(align){align=align||"none";var aligns=$G("alignIcon").children;for(i=0;i<aligns.length;i++)aligns[i].getAttribute("data-align")==align?(domUtils.addClass(aligns[i],"focus"),$G("align").value=aligns[i].getAttribute("data-align")):domUtils.removeClasses(aligns[i],"focus")}function getAlign(){var align=$G("align").value||"none";return"none"==align?"":align}function RemoteImage(target){this.container=utils.isString(target)?document.getElementById(target):target,this.init()}function UploadImage(target){this.$wrap=target.constructor==String?$("#"+target):$(target),this.init()}function OnlineImage(target){this.container=utils.isString(target)?document.getElementById(target):target,this.init()}var remoteImage,uploadImage,onlineImage,editorOpt={};window.onload=function(){editorOpt=editor.getOpt("imageConfig"),initTabs(),initAlign(),initButtons()},RemoteImage.prototype={init:function(){this.initContainer(),this.initEvents()},initContainer:function(){this.dom={url:$G("url"),width:$G("width"),height:$G("height"),border:$G("border"),vhSpace:$G("vhSpace"),title:$G("title"),align:$G("align")};var img=editor.selection.getRange().getClosedNode();img&&this.setImage(img)},initEvents:function(){function updatePreview(){_this.setPreview()}var _this=this,locker={};domUtils.on($G("url"),"keyup",updatePreview),domUtils.on($G("border"),"keyup",updatePreview),domUtils.on($G("title"),"keyup",updatePreview),domUtils.on($G("width"),"keyup",function(){if(locker.checked){var proportion=locker.getAttribute("data-proportion");$G("height").value=Math.round(this.value/proportion)}else _this.updateLocker();updatePreview()}),domUtils.on($G("height"),"keyup",function(){if(locker.checked){var proportion=locker.getAttribute("data-proportion");$G("width").value=Math.round(this.value*proportion)}else _this.updateLocker();updatePreview()})},updateLocker:function(){var width=$G("width").value,height=$G("height").value,locker={};width&&height&&width==parseInt(width)&&height==parseInt(height)?(locker.disabled=!1,locker.title=""):(locker.checked=!1,locker.disabled="disabled",locker.title=lang.remoteLockError)},setImage:function(img){if(img.tagName&&("img"==img.tagName.toLowerCase()||img.getAttribute("src"))&&img.src){var wordImgFlag=img.getAttribute("data-word-image"),src=wordImgFlag?wordImgFlag.replace("&","&"):img.getAttribute("_src")||img.getAttribute("src",2).replace("&","&"),align=editor.queryCommandValue("imageFloat");src!==$G("url").value&&($G("url").value=src),src&&($G("width").value=img.width||"",$G("height").value=img.height||"",$G("border").value=img.getAttribute("border")||"0",$G("vhSpace").value=img.getAttribute("vspace")||"0",$G("title").value=img.title||img.alt||"",setAlign(align),this.setPreview(),this.updateLocker())}},getData:function(){var data={};for(var k in this.dom)data[k]=this.dom[k].value;return data},setPreview:function(){var width,height,url=$G("url").value,ow=$G("width").value,oh=$G("height").value,border=$G("border").value,title=$G("title").value,preview=$G("preview");width=ow&&oh?Math.min(ow,preview.offsetWidth):preview.offsetWidth,width=width+2*border>preview.offsetWidth?width:preview.offsetWidth-2*border,height=ow&&oh?width*oh/ow:"";const location=window.parent.location,host=location.protocol+"//"+location.host+location.pathname;url&&(preview.innerHTML='<img src="'+encodeURI(host+url)+'" width="'+width+'" height="'+height+'" border="'+border+'px solid #000" title="'+title+'" />')},getInsertList:function(){var data=this.getData();if(data.url){var img={src:data.url,_src:data.url};return img._propertyDelete=[],img.style=[],data.width?(img.width=data.width,img.style.push("width:"+data.width+"px")):img._propertyDelete.push("width"),data.height?(img.height=data.height,img.style.push("height:"+data.height+"px")):img._propertyDelete.push("height"),data.border?img.border=data.border:img._propertyDelete.push("border"),data.align?img.floatStyle=data.align:img._propertyDelete.push("floatStyle"),data.vhSpace?img.vspace=data.vhSpace:img._propertyDelete.push("vspace"),data.title?img.alt=data.title:img._propertyDelete.push("alt"),img.style.length>0?img.style=img.style.join(";"):img._propertyDelete.push("style"),[img]}return[]}},UploadImage.prototype={init:function(){this.imageList=[],this.initContainer(),this.initUploader()},initContainer:function(){this.$queue=this.$wrap.find(".filelist")},initUploader:function(){function addFile(file){var $li=$('<li id="'+file.id+'"><p class="title">'+file.name+'</p><p class="imgWrap"></p><p class="progress"><span></span></p></li>'),$btns=$('<div class="file-panel"><span class="cancel">'+lang.uploadDelete+'</span><span class="rotateRight">'+lang.uploadTurnRight+'</span><span class="rotateLeft">'+lang.uploadTurnLeft+"</span></div>").appendTo($li),$prgress=$li.find("p.progress span"),$wrap=$li.find("p.imgWrap"),$info=$('<p class="error"></p>').hide().appendTo($li),showError=function(code){switch(code){case"exceed_size":text=lang.errorExceedSize;break;case"interrupt":text=lang.errorInterrupt;break;case"http":text=lang.errorHttp;break;case"not_allow_type":text=lang.errorFileType;break;default:text=lang.errorUploadRetry}$info.text(text).show()};"invalid"===file.getStatus()?showError(file.statusText):($wrap.text(lang.uploadPreview),browser.ie&&browser.version<=7?$wrap.text(lang.uploadNoPreview):uploader.makeThumb(file,function(error,src){if(error||!src)$wrap.text(lang.uploadNoPreview);else{var $img=$('<img src="'+src+'">');$wrap.empty().append($img),$img.on("error",function(){$wrap.text(lang.uploadNoPreview)})}},thumbnailWidth,thumbnailHeight),percentages[file.id]=[file.size,0],file.rotation=0,file.ext&&acceptExtensions.indexOf(file.ext.toLowerCase())!=-1||(showError("not_allow_type"),uploader.removeFile(file))),file.on("statuschange",function(cur,prev){"progress"===prev?$prgress.hide().width(0):"queued"===prev&&($li.off("mouseenter mouseleave"),$btns.remove()),"error"===cur||"invalid"===cur?(showError(file.statusText),percentages[file.id][1]=1):"interrupt"===cur?showError("interrupt"):"queued"===cur?percentages[file.id][1]=0:"progress"===cur&&($info.hide(),$prgress.css("display","block")),$li.removeClass("state-"+prev).addClass("state-"+cur)}),$li.on("mouseenter",function(){$btns.stop().animate({height:30})}),$li.on("mouseleave",function(){$btns.stop().animate({height:0})}),$btns.on("click","span",function(){var deg,index=$(this).index();switch(index){case 0:return void uploader.removeFile(file);case 1:file.rotation+=90;break;case 2:file.rotation-=90}supportTransition?(deg="rotate("+file.rotation+"deg)",$wrap.css({"-webkit-transform":deg,"-mos-transform":deg,"-o-transform":deg,transform:deg})):$wrap.css("filter","progid:DXImageTransform.Microsoft.BasicImage(rotation="+~~(file.rotation/90%4+4)%4+")")}),$li.insertBefore($filePickerBlock)}function removeFile(file){var $li=$("#"+file.id);delete percentages[file.id],updateTotalProgress(),$li.off().find(".file-panel").off().end().remove()}function updateTotalProgress(){var percent,loaded=0,total=0,spans=$progress.children();$.each(percentages,function(k,v){total+=v[0],loaded+=v[0]*v[1]}),percent=total?loaded/total:0,spans.eq(0).text(Math.round(100*percent)+"%"),spans.eq(1).css("width",Math.round(100*percent)+"%"),updateStatus()}function setState(val,files){if(val!==state){var stats=uploader.getStats();switch($upload.removeClass("state-"+state),$upload.addClass("state-"+val),val){case"pedding":$queue.addClass("element-invisible"),$statusBar.addClass("element-invisible"),$placeHolder.removeClass("element-invisible"),$progress.hide(),$info.hide(),uploader.refresh();break;case"ready":$placeHolder.addClass("element-invisible"),$queue.removeClass("element-invisible"),$statusBar.removeClass("element-invisible"),$progress.hide(),$info.show(),$upload.text(lang.uploadStart),uploader.refresh();break;case"uploading":$progress.show(),$info.hide(),$upload.text(lang.uploadPause);break;case"paused":$progress.show(),$info.hide(),$upload.text(lang.uploadContinue);break;case"confirm":if($progress.show(),$info.hide(),$upload.text(lang.uploadStart),stats=uploader.getStats(),stats.successNum&&!stats.uploadFailNum)return void setState("finish");break;case"finish":$progress.hide(),$info.show(),stats.uploadFailNum?$upload.text(lang.uploadRetry):$upload.text(lang.uploadStart)}state=val,updateStatus()}_this.getQueueCount()?$upload.removeClass("disabled"):$upload.addClass("disabled")}function updateStatus(){var stats,text="";"ready"===state?text=lang.updateStatusReady.replace("_",fileCount).replace("_KB",WebUploader.formatSize(fileSize)):"confirm"===state?(stats=uploader.getStats(),stats.uploadFailNum&&(text=lang.updateStatusConfirm.replace("_",stats.successNum).replace("_",stats.successNum))):(stats=uploader.getStats(),text=lang.updateStatusFinish.replace("_",fileCount).replace("_KB",WebUploader.formatSize(fileSize)).replace("_",stats.successNum),stats.uploadFailNum&&(text+=lang.updateStatusError.replace("_",stats.uploadFailNum))),$info.html(text)}var uploader,_this=this,$=jQuery,$wrap=_this.$wrap,$queue=$wrap.find(".filelist"),$statusBar=$wrap.find(".statusBar"),$info=$statusBar.find(".info"),$upload=$wrap.find(".uploadBtn"),$filePickerBlock=($wrap.find(".filePickerBtn"),$wrap.find(".filePickerBlock")),$placeHolder=$wrap.find(".placeholder"),$progress=$statusBar.find(".progress").hide(),fileCount=0,fileSize=0,ratio=window.devicePixelRatio||1,thumbnailWidth=113*ratio,thumbnailHeight=113*ratio,state="",percentages={},supportTransition=function(){var s=document.createElement("p").style,r="transition"in s||"WebkitTransition"in s||"MozTransition"in s||"msTransition"in s||"OTransition"in s;return s=null,r}(),actionUrl=editor.getActionUrl(editor.getOpt("imageActionName")),acceptExtensions=(editor.getOpt("imageAllowFiles")||[]).join("").replace(/\./g,",").replace(/^[,]/,""),imageMaxSize=editor.getOpt("imageMaxSize"),imageCompressBorder=editor.getOpt("imageCompressBorder");return $upload.hide(),WebUploader.Uploader.support()?editor.getOpt("imageActionName")?(uploader=_this.uploader=WebUploader.create({pick:{id:"#filePickerReady",label:lang.uploadSelectFile},accept:{title:"Images",extensions:acceptExtensions,mimeTypes:"image/*"},swf:"../../third-party/webuploader/Uploader.swf",server:"",fileVal:editor.getOpt("imageFieldName"),duplicate:!0,fileSingleSizeLimit:imageMaxSize,threads:1,headers:editor.getOpt("serverHeaders")||{},compress:!!editor.getOpt("imageCompressEnable")&&{enable:editor.getOpt("imageCompressEnable"),maxWidthOrHeight:imageCompressBorder,maxSize:imageMaxSize}}),uploader.addButton({id:"#filePickerBlock"}),uploader.addButton({id:"#filePickerBtn",label:lang.uploadAddFile}),setState("pedding"),uploader.on("beforeFileQueued",function(file){return!(!file.ext||acceptExtensions.indexOf(file.ext.toLowerCase())==-1)}),uploader.on("fileQueued",function(file){fileCount++,fileSize+=file.size,1===fileCount&&($placeHolder.addClass("element-invisible"),$statusBar.show()),addFile(file);const uploadFunc=editor.getOpt("uploadFunction");"function"==typeof uploadFunc&&("ready"===state?setState("uploading"):"pedding"===state&&(setState("ready"),setState("uploading")),file.setStatus("progress"),uploader.trigger("uploadProgress",file,0),uploadFunc(file.source.source,"image").then(function(response){uploader.trigger("uploadProgress",file,1),file.setStatus("complete"),setState("finish"),uploader.trigger("uploadSuccess",file,response),uploader.trigger("uploadComplete",file)}))}),uploader.on("fileDequeued",function(file){file.ext&&acceptExtensions.indexOf(file.ext.toLowerCase())!=-1&&file.size<=imageMaxSize&&(fileCount--,fileSize-=file.size),removeFile(file),updateTotalProgress()}),uploader.on("filesQueued",function(file){uploader.isInProgress()||"pedding"!=state&&"finish"!=state&&"confirm"!=state&&"ready"!=state||setState("ready"),updateTotalProgress()}),uploader.on("all",function(type,files){switch(type){case"uploadFinished":setState("confirm",files);break;case"startUpload":var params=utils.serializeParam(editor.queryCommandValue("serverparam"))||"",url=utils.formatUrl(actionUrl+(actionUrl.indexOf("?")==-1?"?":"&")+"encode=utf-8&"+params);uploader.option("server",url),setState("uploading",files);break;case"stopUpload":setState("paused",files)}}),uploader.on("uploadBeforeSend",function(file,data,header){return actionUrl.toLowerCase().indexOf("jsp")!=-1&&(header["X-Requested-With"]="XMLHttpRequest"),!1}),uploader.on("uploadProgress",function(file,percentage){var $li=$("#"+file.id),$percent=$li.find(".progress span");$percent.css("width",100*percentage+"%"),percentages[file.id][1]=percentage,updateTotalProgress()}),uploader.on("uploadSuccess",function(file,json){var $file=$("#"+file.id);try{"SUCCESS"==json.state?(_this.imageList.push(json),$file.append('<span class="success"></span>'),editor.fireEvent("uploadsuccess",{res:json,type:"image"})):$file.find(".error").text(json.state).show()}catch(e){$file.find(".error").text(lang.errorServerUpload).show()}updateTotalProgress()}),uploader.on("uploadError",function(file,code){}),uploader.on("error",function(code,file){"Q_TYPE_DENIED"!=code&&"F_EXCEED_SIZE"!=code||addFile(file)}),uploader.on("uploadComplete",function(file,ret){}),$upload.on("click",function(){return!$(this).hasClass("disabled")&&void("ready"===state?uploader.upload():"paused"===state?uploader.upload():"uploading"===state&&uploader.stop())}),$upload.addClass("state-"+state),void updateTotalProgress()):void $("#filePickerReady").after($("<div>").html(lang.errorLoadConfig)).hide():void $("#filePickerReady").after($("<div>").html(lang.errorNotSupport)).hide()},getQueueCount:function(){var file,i,status,readyFile=0,files=this.uploader.getFiles();for(i=0;file=files[i++];)status=file.getStatus(),"queued"!=status&&"uploading"!=status&&"progress"!=status||readyFile++;return readyFile},destroy:function(){this.$wrap.remove()},getInsertList:function(){var i,data,list=[],align=getAlign();for(i=0;i<this.imageList.length;i++)data=this.imageList[i],list.push({src:data.url,_src:data.url,alt:data.original,floatStyle:align});return list}},OnlineImage.prototype={init:function(){this.reset(),this.initEvents()},initContainer:function(){this.container.innerHTML="",this.list=document.createElement("ul"),this.clearFloat=document.createElement("li"),domUtils.addClass(this.list,"list"),domUtils.addClass(this.clearFloat,"clearFloat"),this.list.appendChild(this.clearFloat),this.container.appendChild(this.list)},initEvents:function(){var _this=this;domUtils.on($G("imageList"),"scroll",function(e){var panel=this;panel.scrollHeight-(panel.offsetHeight+panel.scrollTop)<10&&_this.getImageData()}),domUtils.on(this.container,"click",function(e){var target=e.target||e.srcElement,li=target.parentNode;"li"==li.tagName.toLowerCase()&&(domUtils.hasClass(li,"selected")?domUtils.removeClasses(li,"selected"):domUtils.addClass(li,"selected"))})},initData:function(){this.state=0,this.listSize=editor.getOpt("imageManagerListSize"),this.listIndex=0,this.listEnd=!1,this.getImageData()},reset:function(){this.initContainer(),this.initData()},getImageData:function(){var _this=this;if(!_this.listEnd&&!this.isLoadingData){this.isLoadingData=!0;var url=editor.getActionUrl(editor.getOpt("imageManagerActionName")),isJsonp=utils.isCrossDomainUrl(url);ajax.request(url,{timeout:1e5,dataType:isJsonp?"jsonp":"",headers:editor.options.serverHeaders||{},data:utils.extend({start:this.listIndex,size:this.listSize},editor.queryCommandValue("serverparam")),method:"get",onsuccess:function(r){try{var json=isJsonp?r:eval("("+r.responseText+")");"SUCCESS"===json.state&&(_this.pushData(json.list),_this.listIndex=parseInt(json.start)+parseInt(json.list.length),_this.listIndex>=json.total&&(_this.listEnd=!0),_this.isLoadingData=!1)}catch(e){if(r.responseText.indexOf("ue_separate_ue")!=-1){var list=r.responseText.split(r.responseText);_this.pushData(list),_this.listIndex=parseInt(list.length),_this.listEnd=!0,_this.isLoadingData=!1}}},onerror:function(){_this.isLoadingData=!1}})}},pushData:function(list){var i,item,img,icon,_this=this;for(i=0;i<list.length;i++)list[i]&&list[i].url&&(item=document.createElement("li"),img=document.createElement("img"),icon=document.createElement("span"),domUtils.on(img,"load",function(image){return function(){_this.scale(image,image.parentNode.offsetWidth,image.parentNode.offsetHeight)}}(img)),img.width=113,img.setAttribute("src",list[i].url+(list[i].url.indexOf("?")==-1?"?noCache=":"&noCache=")+(+new Date).toString(36)),img.setAttribute("_src",list[i].url),domUtils.addClass(icon,"icon"),item.appendChild(img),item.appendChild(icon),this.list.insertBefore(item,this.clearFloat))},scale:function(img,w,h,type){var ow=img.width,oh=img.height;"justify"==type?ow>=oh?(img.width=w,img.height=h*oh/ow,img.style.marginLeft="-"+parseInt((img.width-w)/2)+"px"):(img.width=w*ow/oh,img.height=h,img.style.marginTop="-"+parseInt((img.height-h)/2)+"px"):ow>=oh?(img.width=w*ow/oh,img.height=h,img.style.marginLeft="-"+parseInt((img.width-w)/2)+"px"):(img.width=w,img.height=h*oh/ow,img.style.marginTop="-"+parseInt((img.height-h)/2)+"px")},getInsertList:function(){var i,lis=this.list.children,list=[],align=getAlign();for(i=0;i<lis.length;i++)if(domUtils.hasClass(lis[i],"selected")){var img=lis[i].firstChild,src=img.getAttribute("_src");list.push({src:src,_src:src,alt:src.substr(src.lastIndexOf("/")+1),floatStyle:align})}return list}}}();
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
|
5
5
|
<title></title>
|
|
6
|
-
<script type="text/javascript" src="../internal.js?
|
|
6
|
+
<script type="text/javascript" src="../internal.js?b983a808"></script>
|
|
7
7
|
<link rel="stylesheet" href="../../themes/default/dialog.css?c473027a">
|
|
8
8
|
<style type="text/css">
|
|
9
9
|
.warp {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! UEditorPlus v2.0.0*/
|
|
2
|
-
!function(){var
|
|
2
|
+
!function(){var parent=window.parent;dialog=parent.$EDITORUI[window.frameElement.id.replace(/_iframe$/,"")],editor=dialog.editor,UE=parent.UE,domUtils=UE.dom.domUtils,utils=UE.utils,browser=UE.browser,ajax=UE.ajax,$G=function(id){return document.getElementById(id)},$focus=function(node){setTimeout(function(){if(browser.ie){var r=node.createTextRange();r.collapse(!1),r.select()}else node.focus()},0)},utils.loadFile(document,{href:editor.options.themePath+editor.options.theme+"/dialogbase.css?cache="+Math.random(),tag:"link",type:"text/css",rel:"stylesheet"}),lang=editor.getLang(dialog.className.split("-")[2]),lang&&domUtils.on(window,"load",function(){var langImgPath=editor.options.langPath+editor.options.lang+"/images/";for(var i in lang["static"]){var dom=$G(i);if(dom){var tagName=dom.tagName,content=lang["static"][i];switch(content.src&&(content=utils.extend({},content,!1),content.src=langImgPath+content.src),content.style&&(content=utils.extend({},content,!1),content.style=content.style.replace(/url\s*\(/g,"url("+langImgPath)),tagName.toLowerCase()){case"var":dom.parentNode.replaceChild(document.createTextNode(content),dom);break;case"select":for(var oj,ops=dom.options,j=0;oj=ops[j];)oj.innerHTML=content.options[j++];for(var p in content)"options"!=p&&dom.setAttribute(p,content[p]);break;default:domUtils.setAttributes(dom,content)}}}})}();
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
font-size: 16px;
|
|
24
24
|
}
|
|
25
25
|
</style>
|
|
26
|
-
<script type="text/javascript" src="../internal.js?
|
|
27
|
-
<script src="../../ueditor.parse.js?
|
|
26
|
+
<script type="text/javascript" src="../internal.js?b983a808"></script>
|
|
27
|
+
<script src="../../ueditor.parse.js?14b51f70"></script>
|
|
28
28
|
<title></title>
|
|
29
29
|
</head>
|
|
30
30
|
<body class="view">
|