From 22a2672788a62268fd35f9bb2b521cdb1139eeaf Mon Sep 17 00:00:00 2001 From: ModStart Date: Sun, 3 Nov 2024 10:04:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9A=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E5=BD=93=E5=89=8D=E7=AD=9B=E9=80=89=E7=BB=93=E6=9E=9C=E7=AD=9B?= =?UTF-8?q?=E9=80=89=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/Blog/Api/Controller/BlogController.php | 2 +- .../Admin/Controller/SecurityController.php | 2 +- .../QuickRun/ImageDesign/ImageDesignUtil.php | 2 +- module/Vendor/Tecmz/TecmzUtil.php | 4 +- module/Vendor/Traits/SecurityTrait.php | 2 +- .../VisitStatisticItemController.php | 2 +- module/VisitStatistic/Docs/module/demo.md | 3 - module/VisitStatistic/Docs/release.md | 6 + module/VisitStatistic/config.json | 4 +- .../modstart/modstart/asset/common/editor.js | 2 +- .../modstart/asset/common/photoswipe.js | 2 +- .../modstart/modstart/asset/common/share.js | 2 +- .../dialogs/attachment/attachment.html | 2 +- .../ueditor/dialogs/attachment/attachment.js | 2 +- .../vendor/ueditor/dialogs/audio/audio.html | 2 +- .../vendor/ueditor/dialogs/audio/audio.js | 2 +- .../vendor/ueditor/dialogs/image/image.html | 2 +- .../vendor/ueditor/dialogs/image/image.js | 2 +- .../vendor/ueditor/dialogs/scrawl/scrawl.html | 2 +- .../vendor/ueditor/dialogs/scrawl/scrawl.js | 2 +- .../vendor/ueditor/dialogs/video/video.html | 2 +- .../vendor/ueditor/dialogs/video/video.js | 2 +- .../asset/vendor/ueditor/ueditor.all.js | 2 +- .../asset/vendor/ueditor/ueditor.config.js | 2 +- vendor/modstart/modstart/config/modstart.php | 2 +- vendor/modstart/modstart/lang/zh/base.php | 489 +++++++++--------- .../dialogs/attachment/attachment.html | 2 +- .../ueditor/dialogs/attachment/attachment.js | 24 +- .../vendor/ueditor/dialogs/audio/audio.html | 2 +- .../src/vendor/ueditor/dialogs/audio/audio.js | 24 +- .../vendor/ueditor/dialogs/image/image.html | 2 +- .../src/vendor/ueditor/dialogs/image/image.js | 23 +- .../vendor/ueditor/dialogs/scrawl/scrawl.html | 2 +- .../vendor/ueditor/dialogs/scrawl/scrawl.js | 51 +- .../vendor/ueditor/dialogs/video/video.html | 2 +- .../src/vendor/ueditor/dialogs/video/video.js | 23 +- .../asset/src/vendor/ueditor/ueditor.all.js | 138 +++-- .../src/vendor/ueditor/ueditor.config.js | 39 +- .../modstart/src/Admin/Config/AdminMenu.php | 6 + .../modstart/src/Command/InitCommand.php | 47 ++ .../modstart/src/Core/Util/ExceptionUtil.php | 51 ++ .../modstart/src/Core/Util/HtmlUtil.php | 12 +- .../modstart/src/Core/Util/RandomUtil.php | 9 + .../modstart/src/Core/Util/TreeUtil.php | 26 + .../modstart/src/Field/AbstractField.php | 19 +- .../modstart/src/Field/ComplexFieldsList.php | 1 + .../modstart/src/Field/SelectRemote.php | 14 + vendor/modstart/modstart/src/Form/Form.php | 3 + .../modstart/src/ModStartServiceProvider.php | 1 + .../src/Repository/EloquentRepository.php | 37 +- vendor/modstart/modstart/src/helpers.php | 186 ++++--- .../modstart/views/admin/frame.blade.php | 6 +- .../modstart/views/admin/login.blade.php | 2 +- .../core/field/complexFieldsList.blade.php | 5 + .../core/grid/filter/eq-select.blade.php | 113 +++- .../modstart/views/core/grid/index.blade.php | 2 +- 56 files changed, 941 insertions(+), 479 deletions(-) delete mode 100644 module/VisitStatistic/Docs/module/demo.md create mode 100644 vendor/modstart/modstart/src/Command/InitCommand.php create mode 100644 vendor/modstart/modstart/src/Core/Util/ExceptionUtil.php diff --git a/module/Blog/Api/Controller/BlogController.php b/module/Blog/Api/Controller/BlogController.php index 9109fc29..ed008696 100644 --- a/module/Blog/Api/Controller/BlogController.php +++ b/module/Blog/Api/Controller/BlogController.php @@ -260,7 +260,7 @@ public function visitPasswordVerify() if (!in_array($record['id'], $visitVerifiedIds)) { $visitVerifiedIds[] = $record['id']; } - Session::set('Blog_VisitVerifiedIds', $visitVerifiedIds); + Session::put('Blog_VisitVerifiedIds', $visitVerifiedIds); return Response::generate(0, '验证成功', null, UrlUtil::blog($record)); } } diff --git a/module/Vendor/Admin/Controller/SecurityController.php b/module/Vendor/Admin/Controller/SecurityController.php index ca3f2237..20bca10c 100644 --- a/module/Vendor/Admin/Controller/SecurityController.php +++ b/module/Vendor/Admin/Controller/SecurityController.php @@ -34,7 +34,7 @@ public function secondVerify(AdminPage $page) $password = $data['password']; $passwordCorrectMd5 = modstart_config('Vendor_SecuritySecondVerifyPassword'); BizException::throwsIf('密码不正确', md5($password) != $passwordCorrectMd5); - Session::set('Vendor_SecuritySecondVerifyTime', time() + 3600); + Session::put('Vendor_SecuritySecondVerifyTime', time() + 3600); return Response::send(0, null, null, $redirect); }); } diff --git a/module/Vendor/QuickRun/ImageDesign/ImageDesignUtil.php b/module/Vendor/QuickRun/ImageDesign/ImageDesignUtil.php index 305e5434..ddadc461 100644 --- a/module/Vendor/QuickRun/ImageDesign/ImageDesignUtil.php +++ b/module/Vendor/QuickRun/ImageDesign/ImageDesignUtil.php @@ -63,7 +63,7 @@ public static function configSaveCheck($imageConfig) BizException::throwsIfEmpty('imageConfig 为空', $imageConfig); BizException::throwsIfEmpty('宽度为空', $imageConfig['width']); BizException::throwsIfEmpty('高度为空', $imageConfig['height']); - BizException::throwsIfEmpty('背景图和背景色同时为空', empty($imageConfig['backgroundImage']) && empty($imageConfig['backgroundColor'])); + BizException::throwsIf('背景图和背景色同时为空', empty($imageConfig['backgroundImage']) && empty($imageConfig['backgroundColor'])); } public static function render($imageConfig, $variables = []) diff --git a/module/Vendor/Tecmz/TecmzUtil.php b/module/Vendor/Tecmz/TecmzUtil.php index bab8e85a..92e58c32 100644 --- a/module/Vendor/Tecmz/TecmzUtil.php +++ b/module/Vendor/Tecmz/TecmzUtil.php @@ -5,9 +5,9 @@ class TecmzUtil { - public static function url() + public static function url($module = null) { - return 'https://api.tecmz.com'; + return 'https://api.tecmz.com' . ($module ? '/m/' . $module : ''); } /** diff --git a/module/Vendor/Traits/SecurityTrait.php b/module/Vendor/Traits/SecurityTrait.php index 5e9d11ce..6c3647b4 100644 --- a/module/Vendor/Traits/SecurityTrait.php +++ b/module/Vendor/Traits/SecurityTrait.php @@ -24,6 +24,6 @@ private function checkSecuritySecondVerify() ])); exit(); } - Session::set('Vendor_SecuritySecondVerifyTime', time() + 3600); + Session::put('Vendor_SecuritySecondVerifyTime', time() + 3600); } } diff --git a/module/VisitStatistic/Admin/Controller/VisitStatisticItemController.php b/module/VisitStatistic/Admin/Controller/VisitStatisticItemController.php index 47019e0b..89765a83 100644 --- a/module/VisitStatistic/Admin/Controller/VisitStatisticItemController.php +++ b/module/VisitStatistic/Admin/Controller/VisitStatisticItemController.php @@ -17,7 +17,7 @@ class VisitStatisticItemController extends Controller use HasAdminQuickCRUD; public static $PermitMethodMap = [ - 'index' => '\\Module\\VisitStatistic\\Admin\\Controller\\VisitStatisticReportController@index' + '*' => '\\Module\\VisitStatistic\\Admin\\Controller\\VisitStatisticReportController@index' ]; public function __construct() diff --git a/module/VisitStatistic/Docs/module/demo.md b/module/VisitStatistic/Docs/module/demo.md deleted file mode 100644 index 9e210d45..00000000 --- a/module/VisitStatistic/Docs/module/demo.md +++ /dev/null @@ -1,3 +0,0 @@ -## 网站访问记录演示说明 - -暂无演示 diff --git a/module/VisitStatistic/Docs/release.md b/module/VisitStatistic/Docs/release.md index 12fc078c..2f7174ce 100644 --- a/module/VisitStatistic/Docs/release.md +++ b/module/VisitStatistic/Docs/release.md @@ -1,3 +1,9 @@ +## 1.2.1 运营报表-网站访问-明细-删除提示无权限问题 + +- 修复:运营报表-网站访问-明细-删除提示无权限问题 + +--- + ## 1.2.0 运营报表页面,实时数据优化 - 新增:运营报表-网站访问页面,合并设置和详细页面 diff --git a/module/VisitStatistic/config.json b/module/VisitStatistic/config.json index 1dd9775c..8458117e 100644 --- a/module/VisitStatistic/config.json +++ b/module/VisitStatistic/config.json @@ -14,10 +14,10 @@ "Vendor:>=3.8.0" ], "suggest": [], - "version": "1.2.0", + "version": "1.2.1", "modstartVersion": ">=3.9.0", "author": "ModStart", "description": "提供内置的网站访问记录功能", "providers": [], "config": {} -} \ No newline at end of file +} diff --git a/vendor/modstart/modstart/asset/common/editor.js b/vendor/modstart/modstart/asset/common/editor.js index 05622599..4b2d8380 100644 --- a/vendor/modstart/modstart/asset/common/editor.js +++ b/vendor/modstart/modstart/asset/common/editor.js @@ -1 +1 @@ -!function(n){var i={};function o(e){if(i[e])return i[e].exports;var t=i[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.m=n,o.c=i,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)o.d(n,i,function(e){return t[e]}.bind(null,i));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="/asset//",o(o.s=372)}({12:function(e,t,o){"use strict";var n,i,r=(i={},function(e){if(void 0===i[e]){var t=document.querySelector(e);if(window.HTMLIFrameElement&&t instanceof window.HTMLIFrameElement)try{t=t.contentDocument.head}catch(e){t=null}i[e]=t}return i[e]}),d=[];function c(e){for(var t=-1,n=0;n'

').join("\n"))}}).show():alert("Missing Config : window.__selectorDialogServer"),!0;case"attachment":return window.__selectorDialogServer?window.__selectorDialog=new window.api.selectorDialog({server:window.__selectorDialogServer+"/file",callback:function(e){t.execCommand("insertFile",e.map(e=>({url:e.path,title:e.filename})))}}).show():alert("Missing Config : window.__selectorDialogServer"),!0}},imageConfig:{disableUpload:!0,disableOnline:!0,selectCallback:function(e,t){window.__selectorDialog=new window.api.selectorDialog({server:window.__selectorDialogServer+"/image",callback:function(e){e.length&&t({path:e[0].path,name:e[0].filename})}}).show()}},videoConfig:{disableUpload:!0,selectCallback:function(e,t){window.__selectorDialog=new window.api.selectorDialog({server:window.__selectorDialogServer+"/video",callback:function(e){e.length&&t({path:e[0].path,name:e[0].filename})}}).show()}},audioConfig:{disableUpload:!0,selectCallback:function(e,t){window.__selectorDialog=new window.api.selectorDialog({server:window.__selectorDialogServer+"/audio",callback:function(e){e.length&&t({path:e[0].path,name:e[0].filename})}}).show()}}};function a(){var e={formulaConfig:{imageUrlTemplate:"https://latex.codecogs.com/svg.image?{}"}};return window.__editorFormulaConfig&&window.__editorFormulaConfig.imageUrlTemplate&&(e.formulaConfig.imageUrlTemplate=window.__editorFormulaConfig.imageUrlTemplate),e}var e={basic:function(e,t,n){var i=o.extend({server:"",width:null,height:100,ready:function(){}},t),t=["fullscreen","source","autotypeset","selectall","undo","redo","removeformat","paragraph","fontsize","forecolor","backcolor","|","insertimage","uploadimage","insertvideo","insertaudio","attachment","bold","italic","underline","strikethrough","superscript","subscript","blockquote","insertorderedlist","insertunorderedlist","rowspacingtop","rowspacingbottom","lineheight","indent","justifyleft","justifycenter","justifyright","justifyjustify","|","link","unlink","insertcode","formula","attachment","imagenone","imageleft","imageright","imagecenter","|","inserttable","deletetable","insertparagraphbeforetable","insertrow","deleterow","insertcol","deletecol","mergecells","mergeright","mergedown","splittocells","splittorows","splittocols","|","contentimport"];window.__editorBasicToolBars&&(t=window.__editorBasicToolBars),window.__editorBasicToolBarsExtra&&(t=t.concat(window.__editorBasicToolBarsExtra));n=o.extend({toolbars:[t],serverUrl:i.server,wordCount:!1,elementPathEnabled:!1,initialFrameHeight:i.height,initialFrameWidth:i.width,enableAutoSave:!1,pasteplain:!1,autoHeightEnabled:!0,focus:!1},r,n,a()),n=UE.getEditor(e,n);return n.ready(function(){i.ready()}),n},simple:function(e,t,n){var i=o.extend({server:"",width:null,height:100,ready:function(){}},t),t=["fontsize","forecolor","insertimage","uploadimage","bold","italic","underline","strikethrough","insertcode","contentimport"];window.__editorSimpleToolBars&&(t=window.__editorSimpleToolBars),window.__editorSimpleToolBarsExtra&&(t=t.concat(window.__editorSimpleToolBarsExtra));n=o.extend({toolbars:[t],serverUrl:i.server,wordCount:!1,elementPathEnabled:!1,initialFrameHeight:i.height,initialFrameWidth:i.width,enableAutoSave:!1,pasteplain:!1,retainOnlyLabelPasted:!0,autoHeightEnabled:!0,focus:!1},r,n,a()),n=UE.getEditor(e,n);return n.ready(function(){i.ready()}),n},raw:UE};"api"in window||(window.api={}),window.api.editor=e,"MS"in window||(window.MS={}),window.MS.editor=e,window.MS.editorUploadConfig=r}.call(this,n(8))},373:function(e,t){function n(e,t){return e=e||self.document.URL||self.location.href,t=t||(n=document.getElementsByTagName("script"))[n.length-1].src,/^(\/|\\\\)/.test(n=t)?n=/^.+?\w(\/|\\\\)/.exec(e)[0]+t.replace(/^(\/|\\\\)/,""):/^[a-z]+:/i.test(t)||(n=(e=e.split("#")[0].split("?")[0].replace(/[^\\\/]+$/,""))+""+t),function(e){var t,n=/^[a-z]+:\/\//.exec(e)[0],i=[];for((e=(e=e.replace(n,"").split("?")[0].split("#")[0]).replace(/\\/g,"/").split(/\//))[e.length-1]="";e.length;)".."===(t=e.shift())?i.pop():"."!==t&&i.push(t);return n+i.join("/")}(n);var n}var i,o;i=window.UEDITOR_HOME_URL||(window.__msCDN?window.__msCDN+"asset/vendor/ueditor/":window.__msRoot?window.__msRoot+"asset/vendor/ueditor/":n()),o=window.UEDITOR_CORS_URL||(window.__msRoot?window.__msRoot+"asset/vendor/ueditor/":window.UEDITOR_HOME_URL||n()),window.UEDITOR_CONFIG={UEDITOR_HOME_URL:i,UEDITOR_CORS_URL:o,debug:!1,serverUrl:"/ueditor-plus/_demo_server/handle.php",loadConfigFromServer:!0,serverHeaders:{},serverResponsePrepare:function(e){return e},toolbars:[["fullscreen","source","|","undo","redo","|","bold","italic","underline","fontborder","strikethrough","superscript","subscript","removeformat","formatmatch","autotypeset","blockquote","pasteplain","|","forecolor","backcolor","insertorderedlist","insertunorderedlist","selectall","cleardoc","|","rowspacingtop","rowspacingbottom","lineheight","|","customstyle","paragraph","fontfamily","fontsize","|","directionalityltr","directionalityrtl","indent","|","justifyleft","justifycenter","justifyright","justifyjustify","|","touppercase","tolowercase","|","link","unlink","anchor","|","imagenone","imageleft","imagecenter","imageright","|","simpleupload","insertimage","emotion","scrawl","insertvideo","insertaudio","attachment","insertframe","insertcode","pagebreak","template","background","formula","|","horizontal","date","time","spechars","wordimage","|","inserttable","deletetable","insertparagraphbeforetable","insertrow","deleterow","insertcol","deletecol","mergecells","mergeright","mergedown","splittocells","splittorows","splittocols","|","print","preview","searchreplace","|","contentimport","help"]],toolbarCallback:function(e,t){},imageConfig:{disableUpload:!1,disableOnline:!1,selectCallback:null},videoConfig:{disableUpload:!1,selectCallback:null},audioConfig:{disableUpload:!1,selectCallback:null},formulaConfig:{imageUrlTemplate:"https://r.latexeasy.com/image.svg?{}",editorMode:"live",editorLiveServer:"https://latexeasy.com"},autoSaveEnable:!0,autoSaveRestore:!1,autoSaveKey:null,initialContent:"",focus:!1,initialStyle:"",indentValue:"2em",readonly:!1,autoClearEmptyNode:!0,fullscreen:!1,allHtmlEnabled:!1,enableContextMenu:!0,shortcutMenu:["bold","italic","underline","strikethrough","fontborder","forecolor","backcolor","imagenone","imageleft","imagecenter","imageright","insertimage","formula"],elementPathEnabled:!0,wordCount:!0,maximumWords:1e4,maxUndoCount:20,maxInputCount:1,autoHeightEnabled:!0,minFrameHeight:220,autoFloatEnabled:!0,topOffset:0,toolbarTopOffset:0,catchRemoteImageEnable:!0,autotypeset:{mergeEmptyline:!0,removeClass:!0,removeEmptyline:!1,textAlign:"left",imageBlockLine:"center",pasteFilter:!1,clearFontSize:!1,clearFontFamily:!1,removeEmptyNode:!1,removeTagNames:{div:1},indent:!1,indentValue:"2em",bdc2sb:!1,tobdc:!1},allowDivTransToP:!0,rgb2Hex:!0,tipError:function(e,t){window&&window.MS&&window.MS.dialog?window.MS.dialog.tipError(e):alert(e)}},window.UE={getUEBasePath:n}},374:function(module,exports,__webpack_require__){!function(global,Buffer){!function(){UEDITOR_CONFIG=window.UEDITOR_CONFIG||{};var baidu=window.baidu||{};window.baidu=baidu,window.UE=baidu.editor={plugins:{},commands:{},instants:{},I18N:{},_customizeUI:{},version:"4.1.0-beta",constants:{STATEFUL:{DISABLED:-1,OFF:0,ON:1}}};var dom=UE.dom={},browser=UE.browser=function(){var e=navigator.userAgent.toLowerCase(),t=window.opera,n={ie:/(msie\s|trident.*rv:)([\w.]+)/i.test(e),opera:!!t&&t.version,webkit:-1{this.isObject(n[e])&&e in t?i[e]=this.merge(t[e],n[e]):Object.assign(i,{[e]:n[e]})}),i},extend:function(e,t,n){if(t)for(var i in t)n&&e.hasOwnProperty(i)||(e[i]=t[i]);return e},extend2:function(e){for(var t=arguments,n=1;n'](?:(amp|lt|ldquo|rdquo|quot|gt|#39|nbsp|#\d+);)?/g,function(e,t){return t?e:{"<":"<","&":"&",'"':""","“":"“","”":"”",">":">","'":"'"}[e]}):""},html:function(e){return e?e.replace(/&((g|l|quo|ldquo|rdquo)t|amp|#39|nbsp);/g,function(e){return{"<":"<","&":"&",""":'"',"“":"“","”":"”",">":">","'":"'"," ":" "}[e]}):""},cssStyleToDomStyle:(test=document.createElement("div").style,cache={float:void 0!==test.cssFloat?"cssFloat":void 0!==test.styleFloat?"styleFloat":"float"},function(e){return cache[e]||(cache[e]=e.toLowerCase().replace(/-./g,function(e){return e.charAt(1).toUpperCase()}))}),loadFile:(c1=[],function(t,n,e){var i=d1(t,n);if(i)i.ready?e&&e():i.funs.push(e);else if(c1.push({doc:t,url:n.src||n.href,funs:[e]}),t.body){if(!n.id||!t.getElementById(n.id)){var o=t.createElement(n.tag);for(r in delete n.tag,n)o.setAttribute(r,n[r]);o.onload=o.onreadystatechange=function(){if(!this.readyState||/loaded|complete/.test(this.readyState)){if(0<(i=d1(t,n)).funs.length){i.ready=1;for(var e;e=i.funs.pop();)e()}o.onload=o.onreadystatechange=null}},o.onerror=function(){throw Error("The load "+(n.href||n.src)+" fails,check the url settings of file ueditor.config.js ")},t.getElementsByTagName("head")[0].appendChild(o)}}else{var r,a=[];for(r in n)"tag"!=r&&a.push(r+'="'+n[r]+'"');t.write("<"+n.tag+" "+a.join(" ")+" >")}}),isEmptyObject:function(e){if(null==e)return!0;if(this.isArray(e)||this.isString(e))return 0===e.length;for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},fixColor:function(e,t){if(/color/i.test(e)&&/rgba?/.test(t)){var n=t.split(",");if(3/.test(e.outerHTML):0==e.attributes.length},isCustomeNode:function(e){return 1==e.nodeType&&e.getAttribute("_ue_custom_node_")},isTagNode:function(e,t){return 1==e.nodeType&&new RegExp("\\b"+e.tagName+"\\b","i").test(t)},filterNodeList:function(e,t,n){var i,o=[];return utils.isFunction(t)||(i=t,t=function(e){return-1!=utils.indexOf(utils.isArray(i)?i:i.split(" "),e.tagName.toLowerCase())}),utils.each(e,function(e){t(e)&&o.push(e)}),0==o.length?null:1!=o.length&&n?o:o[0]},isInNodeEndBoundary:function(e,t){var n=e.startContainer;if(3==n.nodeType&&e.startOffset!=n.nodeValue.length)return 0;if(1==n.nodeType&&e.startOffset!=n.childNodes.length)return 0;for(;n!==t;){if(n.nextSibling)return 0;n=n.parentNode}return 1},isBoundaryNode:function(e,t){for(;!domUtils.isBody(e);)if(e!==(e=e.parentNode)[t])return!1;return!0},fillHtml:browser.ie11below?" ":"
",loadScript:function(e,t){var n;(n=document.createElement("script")).src=e,n.onload=function(){t&&t({isNew:!0})},document.getElementsByTagName("head")[0].appendChild(n)}},fillCharReg=new RegExp(domUtils.fillChar,"g"),axios,imageCompression,M7,N7,Q7,_f,a5,b5,f5;function O7(e,t){var n;t.options.textarea&&((n=(n=!(n=t.textarea)?domUtils.getElementsByTagName(e,"textarea",function(e){return e.id==="ueditor_textarea_"+t.options.textarea})[0]:n)||domUtils.getElementsByTagName(e,"textarea",function(e){return e.name===t.options.textarea})[0])||e.appendChild(n=domUtils.createElement(document,"textarea",{name:t.options.textarea,id:"ueditor_textarea_"+t.options.textarea,style:"display:none"})),n&&!t.textarea&&(t.textarea=n),n.getAttribute("name")||n.setAttribute("name",t.options.textarea),n.value=t.hasContents()?t.options.allHtmlEnabled?t.getAllHtml():t.getContent(null,null,!0):"")}function P7(e){e.langIsReady=!0,e.fireEvent("langReady")}function nj(){var e=this;e.document.getElementById("initContent")&&(e.body.innerHTML="

"+(ie?"":"
")+"

",e.removeListener("firstBeforeExecCommand focus",nj),setTimeout(function(){e.focus(),e._selectionChange()},0))}function Ph(e,t){var n=domUtils.getNodeIndex;(e=e.duplicate()).collapse(t);var i=e.parentElement();if(!i.hasChildNodes())return{container:i,offset:0};for(var o,r,a=i.children,s=e.duplicate(),l=0,d=a.length-1,c=-1;l<=d;){o=a[c=Math.floor((l+d)/2)],s.moveToElementText(o);var u=s.compareEndPoints("StartToStart",e);if(0=n.nodeValue.length?this.setStartAfter(n):(t=domUtils.split(n,i),n===r?this.setEnd(t,this.endOffset-i):n.parentNode===r&&(this.endOffset+=1),this.setStartBefore(t)),o))return this.collapse(!0);return e||(i=this.endOffset,3==(r=this.endContainer).nodeType&&(0==i?this.setEndBefore(r):(i=n.nodeValue.length&&e["set"+t.replace(/(\w)/,function(e){return e.toUpperCase()})+"After"](n):e["set"+t.replace(/(\w)/,function(e){return e.toUpperCase()})+"Before"](n))}return!e&&this.collapsed||(t(this,"start"),t(this,"end")),this},insertNode:function(e){var t=e,n=1;11==e.nodeType&&(t=e.firstChild,n=e.childNodes.length),this.trimBoundary(!0);var i=this.startContainer,o=this.startOffset,o=i.childNodes[o];return o?i.insertBefore(e,o):i.appendChild(e),t.parentNode===this.endContainer&&(this.endOffset=this.endOffset+n),this.setStartBefore(t)},setCursor:function(e,t){return this.collapse(!e).select(t)},createBookmark:function(e,t){var n,i=this.document.createElement("span");return i.style.cssText="display:none;line-height:0px;",i.appendChild(this.document.createTextNode("‍")),i.id="_baidu_bookmark_start_"+(t?"":a5++),this.collapsed||((n=i.cloneNode(!0)).id="_baidu_bookmark_end_"+(t?"":a5++)),this.insertNode(i),n&&this.collapse().insertNode(n).setEndBefore(n),this.setStartAfter(i),{start:e?i.id:i,end:n?e?n.id:n:null,id:e}},moveToBookmark:function(e){var t=e.id?this.document.getElementById(e.start):e.start,e=e.end&&e.id?this.document.getElementById(e.end):e.end;return this.setStartBefore(t),domUtils.remove(t),e?(this.setEndBefore(e),domUtils.remove(e)):this.collapse(!0),this},enlarge:function(e,t){var n,i,o=domUtils.isBody,r=this.document.createTextNode("");if(e){for(n=1==(i=this.startContainer).nodeType?i=i.childNodes[this.startOffset]||(i.appendChild(r),r):i;;){if(domUtils.isBlockElm(i)){for(i=n;(n=i.previousSibling)&&!domUtils.isBlockElm(n);)i=n;this.setStartBefore(i);break}i=(n=i).parentNode}for(n=1==(i=this.endContainer).nodeType?((n=i.childNodes[this.endOffset])?i.insertBefore(r,n):i.appendChild(r),i=r):i;;){if(domUtils.isBlockElm(i)){for(i=n;(n=i.nextSibling)&&!domUtils.isBlockElm(n);)i=n;this.setEndAfter(i);break}i=(n=i).parentNode}r.parentNode===this.endContainer&&this.endOffset--,domUtils.remove(r)}if(!this.collapsed){for(;!(0!=this.startOffset||t&&t(this.startContainer)||o(this.startContainer));)this.setStartBefore(this.startContainer);for(;!(this.endOffset!=(1==this.endContainer.nodeType?this.endContainer.childNodes:this.endContainer.nodeValue).length||t&&t(this.endContainer)||o(this.endContainer));)this.setEndAfter(this.endContainer)}return this},enlargeToBlockElm:function(e){for(;!domUtils.isBlockElm(this.startContainer);)this.setStartBefore(this.startContainer);if(!e)for(;!domUtils.isBlockElm(this.endContainer);)this.setEndAfter(this.endContainer);return this},adjustmentBoundary:function(){if(!this.collapsed){for(;!domUtils.isBody(this.startContainer)&&this.startOffset==this.startContainer[3==this.startContainer.nodeType?"nodeValue":"childNodes"].length&&this.startContainer[3==this.startContainer.nodeType?"nodeValue":"childNodes"].length;)this.setStartAfter(this.startContainer);for(;!domUtils.isBody(this.endContainer)&&!this.endOffset&&this.endContainer[3==this.endContainer.nodeType?"nodeValue":"childNodes"].length;)this.setEndBefore(this.endContainer)}return this},applyInlineStyle:function(t,n,e){if(this.collapsed)return this;this.trimBoundary().enlarge(!1,function(e){return 1==e.nodeType&&domUtils.isBlockElm(e)}).adjustmentBoundary();function i(e){return 1==e.nodeType?"br"!=e.tagName.toLowerCase():!domUtils.isWhitespace(e)}for(var o,r,a=this.createBookmark(),s=a.end,l=domUtils.getNextDomNode(a.start,!1,i),d=this.cloneRange();l&&domUtils.getPosition(l,s)&domUtils.POSITION_PRECEDING;)if(3==l.nodeType||dtd[t][l.tagName]){for(d.setStartBefore(l),o=l;o&&(3==o.nodeType||dtd[t][o.tagName])&&o!==s;)r=o,o=domUtils.getNextDomNode(o,1==o.nodeType,null,function(e){return dtd[t][e.tagName]});var c,u,m=d.setEndAfter(r).extractContents();if(e&&0");n=(ie&&browser.version<9?"":"")+""+(e.iframeCssUrl?"":"")+(e.initialStyle?"":"")+o.join("")+" + diff --git a/vendor/modstart/modstart/asset/vendor/ueditor/dialogs/attachment/attachment.js b/vendor/modstart/modstart/asset/vendor/ueditor/dialogs/attachment/attachment.js index a58a5944..b2c797c7 100644 --- a/vendor/modstart/modstart/asset/vendor/ueditor/dialogs/attachment/attachment.js +++ b/vendor/modstart/modstart/asset/vendor/ueditor/dialogs/attachment/attachment.js @@ -1 +1 @@ -!function(){var uploadFile,onlineFile;function initTabs(){for(var e=$G("tabhead").children,t=0;t'+"还有2个未上传文件".replace(/[\d]/,a)+""),!1;break;case"online":t=onlineFile.getInsertList()}editor.execCommand("insertfile",t)}}function UploadFile(e){this.$wrap=e.constructor==String?$("#"+e):$(e),this.init()}function OnlineFile(e){this.container=utils.isString(e)?document.getElementById(e):e,this.init()}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(){var d,a=this,u=jQuery,e=a.$wrap,i=e.find(".filelist"),s=e.find(".statusBar"),n=s.find(".info"),r=e.find(".uploadBtn"),t=(e.find(".filePickerBtn"),e.find(".filePickerBlock")),o=e.find(".placeholder"),l=s.find(".progress").hide(),p=0,c=0,f=window.devicePixelRatio||1,h=113*f,g=113*f,m="",v={},x=(f="transition"in(e=document.createElement("p").style)||"WebkitTransition"in e||"MozTransition"in e||"msTransition"in e||"OTransition"in e,e=null,f),C=editor.getActionUrl(editor.getOpt("fileActionName")),b=editor.getOpt("fileMaxSize"),w=(editor.getOpt("fileAllowFiles")||[]).join("").replace(/\./g,",").replace(/^[,]/,"");function F(i){function s(e){switch(e){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}l.text(text).show()}var a=u('
  • '+i.name+'

  • '),n=u('
    '+lang.uploadDelete+''+lang.uploadTurnRight+''+lang.uploadTurnLeft+"
    ").appendTo(a),r=a.find("p.progress span"),o=a.find("p.imgWrap"),l=u('

    ').hide().appendTo(a);"invalid"===i.getStatus()?s(i.statusText):(o.text(lang.uploadPreview),-1=="|png|jpg|jpeg|bmp|gif|".indexOf("|"+i.ext.toLowerCase()+"|")?o.empty().addClass("notimage").append(''+i.name+""):browser.ie&&browser.version<=7?o.text(lang.uploadNoPreview):d.makeThumb(i,function(e,t){e||!t?o.text(lang.uploadNoPreview):(t=u(''),o.empty().append(t),t.on("error",function(){o.text(lang.uploadNoPreview)}))},h,g),v[i.id]=[i.size,0],i.rotation=0,i.ext&&-1!=w.indexOf(i.ext.toLowerCase())||(s("not_allow_type"),d.removeFile(i))),i.on("statuschange",function(e,t){"progress"===t?r.hide().width(0):"queued"===t&&(a.off("mouseenter mouseleave"),n.remove()),"error"===e||"invalid"===e?(s(i.statusText),v[i.id][1]=1):"interrupt"===e?s("interrupt"):"queued"===e?v[i.id][1]=0:"progress"===e&&(l.hide(),r.css("display","block")),a.removeClass("state-"+t).addClass("state-"+e)}),a.on("mouseenter",function(){n.stop().animate({height:30})}),a.on("mouseleave",function(){n.stop().animate({height:0})}),n.on("click","span",function(){var e;switch(u(this).index()){case 0:return void d.removeFile(i);case 1:i.rotation+=90;break;case 2:i.rotation-=90}x?(e="rotate("+i.rotation+"deg)",o.css({"-webkit-transform":e,"-mos-transform":e,"-o-transform":e,transform:e})):o.css("filter","progid:DXImageTransform.Microsoft.BasicImage(rotation="+~~(i.rotation/90%4+4)%4+")")}),a.insertBefore(t)}function U(){var e,i=0,s=0,t=l.children();u.each(v,function(e,t){s+=t[0],i+=t[0]*t[1]}),e=s?i/s:0,t.eq(0).text(Math.round(100*e)+"%"),t.eq(1).css("width",Math.round(100*e)+"%"),y()}function S(e){if(e!=m){var t=d.getStats();switch(r.removeClass("state-"+m),r.addClass("state-"+e),e){case"pedding":i.addClass("element-invisible"),s.addClass("element-invisible"),o.removeClass("element-invisible"),l.hide(),n.hide(),d.refresh();break;case"ready":o.addClass("element-invisible"),i.removeClass("element-invisible"),s.removeClass("element-invisible"),l.hide(),n.show(),r.text(lang.uploadStart),d.refresh();break;case"uploading":l.show(),n.hide(),r.text(lang.uploadPause);break;case"paused":l.show(),n.hide(),r.text(lang.uploadContinue);break;case"confirm":if(l.show(),n.hide(),r.text(lang.uploadStart),(t=d.getStats()).successNum&&!t.uploadFailNum)return void S("finish");break;case"finish":l.hide(),n.show(),t.uploadFailNum?r.text(lang.uploadRetry):r.text(lang.uploadStart)}m=e,y()}a.getQueueCount()?r.removeClass("disabled"):r.addClass("disabled")}function y(){var e,t="";"ready"===m?t=lang.updateStatusReady.replace("_",p).replace("_KB",WebUploader.formatSize(c)):"confirm"===m?(e=d.getStats()).uploadFailNum&&(t=lang.updateStatusConfirm.replace("_",e.successNum).replace("_",e.successNum)):(e=d.getStats(),t=lang.updateStatusFinish.replace("_",p).replace("_KB",WebUploader.formatSize(c)).replace("_",e.successNum),e.uploadFailNum&&(t+=lang.updateStatusError.replace("_",e.uploadFailNum))),n.html(t)}WebUploader.Uploader.support()?editor.getOpt("fileActionName")?((d=a.uploader=WebUploader.create({pick:{id:"#filePickerReady",label:lang.uploadSelectFile},swf:"../../third-party/webuploader/Uploader.swf",server:C,fileVal:editor.getOpt("fileFieldName"),duplicate:!0,fileSingleSizeLimit:b,headers:editor.getOpt("serverHeaders")||{},compress:!1})).addButton({id:"#filePickerBlock"}),d.addButton({id:"#filePickerBtn",label:lang.uploadAddFile}),S("pedding"),d.on("fileQueued",function(e){e.ext&&-1!=w.indexOf(e.ext.toLowerCase())&&e.size<=b&&(p++,c+=e.size),1===p&&(o.addClass("element-invisible"),s.show()),F(e)}),d.on("fileDequeued",function(e){var t;e.ext&&-1!=w.indexOf(e.ext.toLowerCase())&&e.size<=b&&(p--,c-=e.size),e=u("#"+(t=e).id),delete v[t.id],U(),e.off().find(".file-panel").off().end().remove(),U()}),d.on("filesQueued",function(e){d.isInProgress()||"pedding"!=m&&"finish"!=m&&"confirm"!=m&&"ready"!=m||S("ready"),U()}),d.on("all",function(e,t){switch(e){case"uploadFinished":S("confirm");break;case"startUpload":var i=utils.serializeParam(editor.queryCommandValue("serverparam"))||"",i=utils.formatUrl(C+(-1==C.indexOf("?")?"?":"&")+"encode=utf-8&"+i);d.option("server",i),S("uploading");break;case"stopUpload":S("paused")}}),d.on("uploadBeforeSend",function(e,t,i){-1!=C.toLowerCase().indexOf("jsp")&&(i.X_Requested_With="XMLHttpRequest")}),d.on("uploadProgress",function(e,t){u("#"+e.id).find(".progress span").css("width",100*t+"%"),v[e.id][1]=t,U()}),d.on("uploadSuccess",function(t,e){t=u("#"+t.id);try{var i=e._raw||e,s=utils.str2json(i);"SUCCESS"==(s=editor.getOpt("serverResponsePrepare")(s)).state?(a.fileList.push(s),t.append(''),editor.fireEvent("uploadsuccess",{res:s,type:"file"})):t.find(".error").text(s.state).show()}catch(e){t.find(".error").text(lang.errorServerUpload).show()}}),d.on("uploadError",function(e,t){}),d.on("error",function(e,t,i){"F_EXCEED_SIZE"===e?editor.getOpt("tipError")(lang.errorExceedSize+" "+(t/1024/1024).toFixed(1)+"MB"):console.log("error",e,t,i)}),d.on("uploadComplete",function(e,t){}),r.on("click",function(){return!u(this).hasClass("disabled")&&void("ready"===m||"paused"===m?d.upload():"uploading"===m&&d.stop())}),r.addClass("state-"+m),U()):u("#filePickerReady").after(u("
    ").html(lang.errorLoadConfig)).hide():u("#filePickerReady").after(u("
    ").html(lang.errorNotSupport)).hide()},getQueueCount:function(){for(var e,t=0,i=this.uploader.getFiles(),s=0;e=i[s++];)"queued"!=(e=e.getStatus())&&"uploading"!=e&&"progress"!=e||t++;return t},getInsertList:function(){for(var e,t,i=[],s=editor.getOpt("fileUrlPrefix"),a=0;a=json.total&&(_this.listEnd=!0),_this.isLoadingData=!1)}catch(e){var list;-1!=r.responseText.indexOf("ue_separate_ue")&&(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(e){for(var t,i,s,a,n,r,o=this,l=editor.getOpt("fileManagerUrlPrefix"),d=0;d'+"还有2个未上传文件".replace(/[\d]/,a)+""),!1;break;case"online":t=onlineFile.getInsertList()}editor.execCommand("insertfile",t)}}function UploadFile(e){this.$wrap=e.constructor==String?$("#"+e):$(e),this.init()}function OnlineFile(e){this.container=utils.isString(e)?document.getElementById(e):e,this.init()}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(){var d,a=this,u=jQuery,e=a.$wrap,i=e.find(".filelist"),s=e.find(".statusBar"),n=s.find(".info"),r=e.find(".uploadBtn"),t=(e.find(".filePickerBtn"),e.find(".filePickerBlock")),o=e.find(".placeholder"),l=s.find(".progress").hide(),p=0,c=0,f=window.devicePixelRatio||1,h=113*f,g=113*f,m="",v={},x=(f="transition"in(e=document.createElement("p").style)||"WebkitTransition"in e||"MozTransition"in e||"msTransition"in e||"OTransition"in e,e=null,f),C=editor.getActionUrl(editor.getOpt("fileActionName")),b=editor.getOpt("fileMaxSize"),w=(editor.getOpt("fileAllowFiles")||[]).join("").replace(/\./g,",").replace(/^[,]/,"");function U(i){function s(e){switch(e){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}l.text(text).show()}var a=u('
  • '+i.name+'

  • '),n=u('
    '+lang.uploadDelete+''+lang.uploadTurnRight+''+lang.uploadTurnLeft+"
    ").appendTo(a),r=a.find("p.progress span"),o=a.find("p.imgWrap"),l=u('

    ').hide().appendTo(a);"invalid"===i.getStatus()?s(i.statusText):(o.text(lang.uploadPreview),-1=="|png|jpg|jpeg|bmp|gif|".indexOf("|"+i.ext.toLowerCase()+"|")?o.empty().addClass("notimage").append(''+i.name+""):browser.ie&&browser.version<=7?o.text(lang.uploadNoPreview):d.makeThumb(i,function(e,t){e||!t?o.text(lang.uploadNoPreview):(t=u(''),o.empty().append(t),t.on("error",function(){o.text(lang.uploadNoPreview)}))},h,g),v[i.id]=[i.size,0],i.rotation=0,i.ext&&-1!=w.indexOf(i.ext.toLowerCase())||(s("not_allow_type"),d.removeFile(i))),i.on("statuschange",function(e,t){"progress"===t?r.hide().width(0):"queued"===t&&(a.off("mouseenter mouseleave"),n.remove()),"error"===e||"invalid"===e?(s(i.statusText),v[i.id][1]=1):"interrupt"===e?s("interrupt"):"queued"===e?v[i.id][1]=0:"progress"===e&&(l.hide(),r.css("display","block")),a.removeClass("state-"+t).addClass("state-"+e)}),a.on("mouseenter",function(){n.stop().animate({height:30})}),a.on("mouseleave",function(){n.stop().animate({height:0})}),n.on("click","span",function(){var e;switch(u(this).index()){case 0:return void d.removeFile(i);case 1:i.rotation+=90;break;case 2:i.rotation-=90}x?(e="rotate("+i.rotation+"deg)",o.css({"-webkit-transform":e,"-mos-transform":e,"-o-transform":e,transform:e})):o.css("filter","progid:DXImageTransform.Microsoft.BasicImage(rotation="+~~(i.rotation/90%4+4)%4+")")}),a.insertBefore(t)}function F(){var e,i=0,s=0,t=l.children();u.each(v,function(e,t){s+=t[0],i+=t[0]*t[1]}),e=s?i/s:0,t.eq(0).text(Math.round(100*e)+"%"),t.eq(1).css("width",Math.round(100*e)+"%"),y()}function S(e){if(e!=m){var t=d.getStats();switch(r.removeClass("state-"+m),r.addClass("state-"+e),e){case"pedding":i.addClass("element-invisible"),s.addClass("element-invisible"),o.removeClass("element-invisible"),l.hide(),n.hide(),d.refresh();break;case"ready":o.addClass("element-invisible"),i.removeClass("element-invisible"),s.removeClass("element-invisible"),l.hide(),n.show(),r.text(lang.uploadStart),d.refresh();break;case"uploading":l.show(),n.hide(),r.text(lang.uploadPause);break;case"paused":l.show(),n.hide(),r.text(lang.uploadContinue);break;case"confirm":if(l.show(),n.hide(),r.text(lang.uploadStart),(t=d.getStats()).successNum&&!t.uploadFailNum)return void S("finish");break;case"finish":l.hide(),n.show(),t.uploadFailNum?r.text(lang.uploadRetry):r.text(lang.uploadStart)}m=e,y()}a.getQueueCount()?r.removeClass("disabled"):r.addClass("disabled")}function y(){var e,t="";"ready"===m?t=lang.updateStatusReady.replace("_",p).replace("_KB",WebUploader.formatSize(c)):"confirm"===m?(e=d.getStats()).uploadFailNum&&(t=lang.updateStatusConfirm.replace("_",e.successNum).replace("_",e.successNum)):(e=d.getStats(),t=lang.updateStatusFinish.replace("_",p).replace("_KB",WebUploader.formatSize(c)).replace("_",e.successNum),e.uploadFailNum&&(t+=lang.updateStatusError.replace("_",e.uploadFailNum))),n.html(t)}WebUploader.Uploader.support()?editor.getOpt("fileActionName")?(f={pick:{id:"#filePickerReady",label:lang.uploadSelectFile},swf:"../../third-party/webuploader/Uploader.swf",server:C,fileVal:editor.getOpt("fileFieldName"),duplicate:!0,fileSingleSizeLimit:b,headers:editor.getOpt("serverHeaders")||{},compress:!1},editor.getOpt("uploadServiceEnable")&&(f.customUpload=function(t,i){editor.getOpt("uploadServiceUpload")("attachment",t,{success:function(e){i.onSuccess(t,{_raw:JSON.stringify(e)})},error:function(e){i.onError(t,e)},progress:function(e){i.onProgress(t,e)}},{from:"attachment"})}),(d=a.uploader=WebUploader.create(f)).addButton({id:"#filePickerBlock"}),d.addButton({id:"#filePickerBtn",label:lang.uploadAddFile}),S("pedding"),d.on("fileQueued",function(e){e.ext&&-1!=w.indexOf(e.ext.toLowerCase())&&e.size<=b&&(p++,c+=e.size),1===p&&(o.addClass("element-invisible"),s.show()),U(e)}),d.on("fileDequeued",function(e){var t;e.ext&&-1!=w.indexOf(e.ext.toLowerCase())&&e.size<=b&&(p--,c-=e.size),e=u("#"+(t=e).id),delete v[t.id],F(),e.off().find(".file-panel").off().end().remove(),F()}),d.on("filesQueued",function(e){d.isInProgress()||"pedding"!=m&&"finish"!=m&&"confirm"!=m&&"ready"!=m||S("ready"),F()}),d.on("all",function(e,t){switch(e){case"uploadFinished":S("confirm");break;case"startUpload":var i=utils.serializeParam(editor.queryCommandValue("serverparam"))||"",i=utils.formatUrl(C+(-1==C.indexOf("?")?"?":"&")+"encode=utf-8&"+i);d.option("server",i),S("uploading");break;case"stopUpload":S("paused")}}),d.on("uploadBeforeSend",function(e,t,i){-1!=C.toLowerCase().indexOf("jsp")&&(i.X_Requested_With="XMLHttpRequest")}),d.on("uploadProgress",function(e,t){u("#"+e.id).find(".progress span").css("width",100*t+"%"),v[e.id][1]=t,F()}),d.on("uploadSuccess",function(t,e){t=u("#"+t.id);try{var i=e._raw||e,s=utils.str2json(i);"SUCCESS"==(s=editor.getOpt("serverResponsePrepare")(s)).state?(a.fileList.push(s),t.append(''),editor.fireEvent("uploadsuccess",{res:s,type:"file"})):t.find(".error").text(s.state).show()}catch(e){t.find(".error").text(lang.errorServerUpload).show()}}),d.on("uploadError",function(e,t){}),d.on("error",function(e,t,i){"F_EXCEED_SIZE"===e?editor.getOpt("tipError")(lang.errorExceedSize+" "+(t/1024/1024).toFixed(1)+"MB"):console.log("error",e,t,i)}),d.on("uploadComplete",function(e,t){}),r.on("click",function(){return!u(this).hasClass("disabled")&&void("ready"===m||"paused"===m?d.upload():"uploading"===m&&d.stop())}),r.addClass("state-"+m),F()):u("#filePickerReady").after(u("
    ").html(lang.errorLoadConfig)).hide():u("#filePickerReady").after(u("
    ").html(lang.errorNotSupport)).hide()},getQueueCount:function(){for(var e,t=0,i=this.uploader.getFiles(),s=0;e=i[s++];)"queued"!=(e=e.getStatus())&&"uploading"!=e&&"progress"!=e||t++;return t},getInsertList:function(){for(var e,t,i=[],s=editor.getOpt("fileUrlPrefix"),a=0;a=json.total&&(_this.listEnd=!0),_this.isLoadingData=!1)}catch(e){var list;-1!=r.responseText.indexOf("ue_separate_ue")&&(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(e){for(var t,i,s,a,n,r,o=this,l=editor.getOpt("fileManagerUrlPrefix"),d=0;d - + diff --git a/vendor/modstart/modstart/asset/vendor/ueditor/dialogs/audio/audio.js b/vendor/modstart/modstart/asset/vendor/ueditor/dialogs/audio/audio.js index d4ea9a7f..88cd8089 100644 --- a/vendor/modstart/modstart/asset/vendor/ueditor/dialogs/audio/audio.js +++ b/vendor/modstart/modstart/asset/vendor/ueditor/dialogs/audio/audio.js @@ -1 +1 @@ -!function(){var r,U=[],o=!1,t={};function s(e,t){for(var a,i,o=$G(e).children,n=0;i=o[n++];)if("focus"==i.className){a=i.getAttribute(t);break}return a}function n(e){var t;e&&($G("preview").innerHTML='
    '+lang.urlError+'
    '+["",'',""].join("")+"
    ")}function e(e){this.$wrap=e.constructor==String?$("#"+e):$(e),this.init()}window.onload=function(){t=editor.getOpt("audioConfig"),$focus($G("audioUrl")),function(){for(var o=$G("tabHeads").children,e=0;e'+"还有2个未上传文件".replace(/[\d]/,n)+""),!1;editor.execCommand("insertaudio",t,"upload")}}()}},dialog.oncancel=function(){$G("preview").innerHTML=""},function(){var e,t,a,i=editor.selection.getRange().getClosedNode();i&&i.className&&(a="edui-faked-audio"==i.className,t=-1!=i.className.indexOf("edui-upload-audio"),(a||t)&&($G("audioUrl").value=e=i.getAttribute("_url"),a=domUtils.getComputedStyle(i,"float"),function(e){for(var t,a=$G("audioFloat").children,i=0;t=a[i++];)t.getAttribute("name")==e?"focus"!=t.className&&(t.className="focus"):"focus"==t.className&&(t.className="")}("center"===domUtils.getComputedStyle(i.parentNode,"text-align")?"center":a)),t&&(o=!0)),n(e)}(),r=new e("queueList")},e.prototype={init:function(){this.fileList=[],this.initContainer(),this.initUploader()},initContainer:function(){this.$queue=this.$wrap.find(".filelist")},initUploader:function(){var d,a=this,u=jQuery,e=a.$wrap,i=e.find(".filelist"),o=e.find(".statusBar"),n=o.find(".info"),r=e.find(".uploadBtn"),t=(e.find(".filePickerBtn"),e.find(".filePickerBlock")),s=e.find(".placeholder"),l=o.find(".progress").hide(),c=0,p=0,f=window.devicePixelRatio||1,g=113*f,m=113*f,h="",v={},b=(f="transition"in(e=document.createElement("p").style)||"WebkitTransition"in e||"MozTransition"in e||"msTransition"in e||"OTransition"in e,e=null,f),w=editor.getActionUrl(editor.getOpt("audioActionName")),f=editor.getOpt("audioMaxSize"),x=(editor.getOpt("audioAllowFiles")||[]).join("").replace(/\./g,",").replace(/^[,]/,"");function C(a){function i(e){switch(e){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}l.text(text).show()}var o=u('
  • '+a.name+'

  • '),n=u('
    '+lang.uploadDelete+''+lang.uploadTurnRight+''+lang.uploadTurnLeft+"
    ").appendTo(o),r=o.find("p.progress span"),s=o.find("p.imgWrap"),l=u('

    ').hide().appendTo(o);"invalid"===a.getStatus()?i(a.statusText):(s.text(lang.uploadPreview),-1=="|png|jpg|jpeg|bmp|gif|".indexOf("|"+a.ext.toLowerCase()+"|")?s.empty().addClass("notimage").append(''+a.name+""):browser.ie&&browser.version<=7?s.text(lang.uploadNoPreview):d.makeThumb(a,function(e,t){e||!t||/^data:/.test(t)&&browser.ie&&browser.version<=7?s.text(lang.uploadNoPreview):(t=u(''),s.empty().append(t),t.on("error",function(){s.text(lang.uploadNoPreview)}))},g,m),v[a.id]=[a.size,0],a.rotation=0,a.ext&&-1!=x.indexOf(a.ext.toLowerCase())||(i("not_allow_type"),d.removeFile(a))),a.on("statuschange",function(e,t){"progress"===t?r.hide().width(0):"queued"===t&&(o.off("mouseenter mouseleave"),n.remove()),"error"===e||"invalid"===e?(i(a.statusText),v[a.id][1]=1):"interrupt"===e?i("interrupt"):"queued"===e?v[a.id][1]=0:"progress"===e&&(l.hide(),r.css("display","block")),o.removeClass("state-"+t).addClass("state-"+e)}),o.on("mouseenter",function(){n.stop().animate({height:30})}),o.on("mouseleave",function(){n.stop().animate({height:0})}),n.on("click","span",function(){var e;switch(u(this).index()){case 0:return void d.removeFile(a);case 1:a.rotation+=90;break;case 2:a.rotation-=90}b?(e="rotate("+a.rotation+"deg)",s.css({"-webkit-transform":e,"-mos-transform":e,"-o-transform":e,transform:e})):s.css("filter","progid:DXImageTransform.Microsoft.BasicImage(rotation="+~~(a.rotation/90%4+4)%4+")")}),o.insertBefore(t)}function k(){var e,a=0,i=0,t=l.children();u.each(v,function(e,t){i+=t[0],a+=t[0]*t[1]}),e=i?a/i:0,t.eq(0).text(Math.round(100*e)+"%"),t.eq(1).css("width",Math.round(100*e)+"%"),S()}function y(e){if(e!=h){var t=d.getStats();switch(r.removeClass("state-"+h),r.addClass("state-"+e),e){case"pedding":i.addClass("element-invisible"),o.addClass("element-invisible"),s.removeClass("element-invisible"),l.hide(),n.hide(),d.refresh();break;case"ready":s.addClass("element-invisible"),i.removeClass("element-invisible"),o.removeClass("element-invisible"),l.hide(),n.show(),r.text(lang.uploadStart),d.refresh();break;case"uploading":l.show(),n.hide(),r.text(lang.uploadPause);break;case"paused":l.show(),n.hide(),r.text(lang.uploadContinue);break;case"confirm":if(l.show(),n.hide(),r.text(lang.uploadStart),(t=d.getStats()).successNum&&!t.uploadFailNum)return void y("finish");break;case"finish":l.hide(),n.show(),t.uploadFailNum?r.text(lang.uploadRetry):r.text(lang.uploadStart)}h=e,S()}a.getQueueCount()?r.removeClass("disabled"):r.addClass("disabled")}function S(){var e,t="";"ready"===h?t=lang.updateStatusReady.replace("_",c).replace("_KB",WebUploader.formatSize(p)):"confirm"===h?(e=d.getStats()).uploadFailNum&&(t=lang.updateStatusConfirm.replace("_",e.successNum).replace("_",e.successNum)):(e=d.getStats(),t=lang.updateStatusFinish.replace("_",c).replace("_KB",WebUploader.formatSize(p)).replace("_",e.successNum),e.uploadFailNum&&(t+=lang.updateStatusError.replace("_",e.uploadFailNum))),n.html(t)}WebUploader.Uploader.support()?editor.getOpt("audioActionName")?((d=a.uploader=WebUploader.create({pick:{id:"#filePickerReady",label:lang.uploadSelectFile},swf:"../../third-party/webuploader/Uploader.swf",server:w,fileVal:editor.getOpt("audioFieldName"),duplicate:!0,fileSingleSizeLimit:f,headers:editor.getOpt("serverHeaders")||{},compress:!1})).addButton({id:"#filePickerBlock"}),d.addButton({id:"#filePickerBtn",label:lang.uploadAddFile}),y("pedding"),d.on("fileQueued",function(e){c++,p+=e.size,1===c&&(s.addClass("element-invisible"),o.show()),C(e)}),d.on("fileDequeued",function(e){var t;c--,p-=e.size,e=u("#"+(t=e).id),delete v[t.id],k(),e.off().find(".file-panel").off().end().remove(),k()}),d.on("filesQueued",function(e){d.isInProgress()||"pedding"!=h&&"finish"!=h&&"confirm"!=h&&"ready"!=h||y("ready"),k()}),d.on("all",function(e,t){switch(e){case"uploadFinished":y("confirm");break;case"startUpload":var a=utils.serializeParam(editor.queryCommandValue("serverparam"))||"",a=utils.formatUrl(w+(-1==w.indexOf("?")?"?":"&")+"encode=utf-8&"+a);d.option("server",a),y("uploading");break;case"stopUpload":y("paused")}}),d.on("uploadBeforeSend",function(e,t,a){-1!=w.toLowerCase().indexOf("jsp")&&(a.X_Requested_With="XMLHttpRequest")}),d.on("uploadProgress",function(e,t){u("#"+e.id).find(".progress span").css("width",100*t+"%"),v[e.id][1]=t,k()}),d.on("uploadSuccess",function(t,e){t=u("#"+t.id);try{var a=e._raw||e,i=utils.str2json(a);"SUCCESS"==(i=editor.getOpt("serverResponsePrepare")(i)).state?(U.push({url:i.url,type:i.type,original:i.original}),t.append('')):t.find(".error").text(i.state).show()}catch(e){t.find(".error").text(lang.errorServerUpload).show()}}),d.on("uploadError",function(e,t){}),d.on("error",function(e,t,a){"F_EXCEED_SIZE"===e?editor.getOpt("tipError")(lang.errorExceedSize+" "+(t/1024/1024).toFixed(1)+"MB"):console.log("error",e,t,a)}),d.on("uploadComplete",function(e,t){}),r.on("click",function(){return!u(this).hasClass("disabled")&&void("ready"===h||"paused"===h?d.upload():"uploading"===h&&d.stop())}),r.addClass("state-"+h),k()):u("#filePickerReady").after(u("
    ").html(lang.errorLoadConfig)).hide():u("#filePickerReady").after(u("
    ").html(lang.errorNotSupport)).hide()},getQueueCount:function(){for(var e,t=0,a=this.uploader.getFiles(),i=0;e=a[i++];)"queued"!=(e=e.getStatus())&&"uploading"!=e&&"progress"!=e||t++;return t},refresh:function(){this.uploader.refresh()}}}(); \ No newline at end of file +!function(){var n,U=[],o=!1,t={};function s(e,t){for(var a,i,o=$G(e).children,r=0;i=o[r++];)if("focus"==i.className){a=i.getAttribute(t);break}return a}function r(e){var t;e&&($G("preview").innerHTML='
    '+lang.urlError+'
    '+["",'',""].join("")+"
    ")}function e(e){this.$wrap=e.constructor==String?$("#"+e):$(e),this.init()}window.onload=function(){t=editor.getOpt("audioConfig"),$focus($G("audioUrl")),function(){for(var o=$G("tabHeads").children,e=0;e'+"还有2个未上传文件".replace(/[\d]/,r)+""),!1;editor.execCommand("insertaudio",t,"upload")}}()}},dialog.oncancel=function(){$G("preview").innerHTML=""},function(){var e,t,a,i=editor.selection.getRange().getClosedNode();i&&i.className&&(a="edui-faked-audio"==i.className,t=-1!=i.className.indexOf("edui-upload-audio"),(a||t)&&($G("audioUrl").value=e=i.getAttribute("_url"),a=domUtils.getComputedStyle(i,"float"),function(e){for(var t,a=$G("audioFloat").children,i=0;t=a[i++];)t.getAttribute("name")==e?"focus"!=t.className&&(t.className="focus"):"focus"==t.className&&(t.className="")}("center"===domUtils.getComputedStyle(i.parentNode,"text-align")?"center":a)),t&&(o=!0)),r(e)}(),n=new e("queueList")},e.prototype={init:function(){this.fileList=[],this.initContainer(),this.initUploader()},initContainer:function(){this.$queue=this.$wrap.find(".filelist")},initUploader:function(){var d,a=this,u=jQuery,e=a.$wrap,i=e.find(".filelist"),o=e.find(".statusBar"),r=o.find(".info"),n=e.find(".uploadBtn"),t=(e.find(".filePickerBtn"),e.find(".filePickerBlock")),s=e.find(".placeholder"),l=o.find(".progress").hide(),c=0,p=0,f=window.devicePixelRatio||1,g=113*f,m=113*f,h="",v={},b=(f="transition"in(e=document.createElement("p").style)||"WebkitTransition"in e||"MozTransition"in e||"msTransition"in e||"OTransition"in e,e=null,f),w=editor.getActionUrl(editor.getOpt("audioActionName")),f=editor.getOpt("audioMaxSize"),x=(editor.getOpt("audioAllowFiles")||[]).join("").replace(/\./g,",").replace(/^[,]/,"");function C(a){function i(e){switch(e){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}l.text(text).show()}var o=u('
  • '+a.name+'

  • '),r=u('
    '+lang.uploadDelete+''+lang.uploadTurnRight+''+lang.uploadTurnLeft+"
    ").appendTo(o),n=o.find("p.progress span"),s=o.find("p.imgWrap"),l=u('

    ').hide().appendTo(o);"invalid"===a.getStatus()?i(a.statusText):(s.text(lang.uploadPreview),-1=="|png|jpg|jpeg|bmp|gif|".indexOf("|"+a.ext.toLowerCase()+"|")?s.empty().addClass("notimage").append(''+a.name+""):browser.ie&&browser.version<=7?s.text(lang.uploadNoPreview):d.makeThumb(a,function(e,t){e||!t||/^data:/.test(t)&&browser.ie&&browser.version<=7?s.text(lang.uploadNoPreview):(t=u(''),s.empty().append(t),t.on("error",function(){s.text(lang.uploadNoPreview)}))},g,m),v[a.id]=[a.size,0],a.rotation=0,a.ext&&-1!=x.indexOf(a.ext.toLowerCase())||(i("not_allow_type"),d.removeFile(a))),a.on("statuschange",function(e,t){"progress"===t?n.hide().width(0):"queued"===t&&(o.off("mouseenter mouseleave"),r.remove()),"error"===e||"invalid"===e?(i(a.statusText),v[a.id][1]=1):"interrupt"===e?i("interrupt"):"queued"===e?v[a.id][1]=0:"progress"===e&&(l.hide(),n.css("display","block")),o.removeClass("state-"+t).addClass("state-"+e)}),o.on("mouseenter",function(){r.stop().animate({height:30})}),o.on("mouseleave",function(){r.stop().animate({height:0})}),r.on("click","span",function(){var e;switch(u(this).index()){case 0:return void d.removeFile(a);case 1:a.rotation+=90;break;case 2:a.rotation-=90}b?(e="rotate("+a.rotation+"deg)",s.css({"-webkit-transform":e,"-mos-transform":e,"-o-transform":e,transform:e})):s.css("filter","progid:DXImageTransform.Microsoft.BasicImage(rotation="+~~(a.rotation/90%4+4)%4+")")}),o.insertBefore(t)}function y(){var e,a=0,i=0,t=l.children();u.each(v,function(e,t){i+=t[0],a+=t[0]*t[1]}),e=i?a/i:0,t.eq(0).text(Math.round(100*e)+"%"),t.eq(1).css("width",Math.round(100*e)+"%"),S()}function k(e){if(e!=h){var t=d.getStats();switch(n.removeClass("state-"+h),n.addClass("state-"+e),e){case"pedding":i.addClass("element-invisible"),o.addClass("element-invisible"),s.removeClass("element-invisible"),l.hide(),r.hide(),d.refresh();break;case"ready":s.addClass("element-invisible"),i.removeClass("element-invisible"),o.removeClass("element-invisible"),l.hide(),r.show(),n.text(lang.uploadStart),d.refresh();break;case"uploading":l.show(),r.hide(),n.text(lang.uploadPause);break;case"paused":l.show(),r.hide(),n.text(lang.uploadContinue);break;case"confirm":if(l.show(),r.hide(),n.text(lang.uploadStart),(t=d.getStats()).successNum&&!t.uploadFailNum)return void k("finish");break;case"finish":l.hide(),r.show(),t.uploadFailNum?n.text(lang.uploadRetry):n.text(lang.uploadStart)}h=e,S()}a.getQueueCount()?n.removeClass("disabled"):n.addClass("disabled")}function S(){var e,t="";"ready"===h?t=lang.updateStatusReady.replace("_",c).replace("_KB",WebUploader.formatSize(p)):"confirm"===h?(e=d.getStats()).uploadFailNum&&(t=lang.updateStatusConfirm.replace("_",e.successNum).replace("_",e.successNum)):(e=d.getStats(),t=lang.updateStatusFinish.replace("_",c).replace("_KB",WebUploader.formatSize(p)).replace("_",e.successNum),e.uploadFailNum&&(t+=lang.updateStatusError.replace("_",e.uploadFailNum))),r.html(t)}WebUploader.Uploader.support()?editor.getOpt("audioActionName")?(f={pick:{id:"#filePickerReady",label:lang.uploadSelectFile},swf:"../../third-party/webuploader/Uploader.swf",server:w,fileVal:editor.getOpt("audioFieldName"),duplicate:!0,fileSingleSizeLimit:f,headers:editor.getOpt("serverHeaders")||{},compress:!1},editor.getOpt("uploadServiceEnable")&&(f.customUpload=function(t,a){editor.getOpt("uploadServiceUpload")("audio",t,{success:function(e){a.onSuccess(t,{_raw:JSON.stringify(e)})},error:function(e){a.onError(t,e)},progress:function(e){a.onProgress(t,e)}},{from:"audio"})}),(d=a.uploader=WebUploader.create(f)).addButton({id:"#filePickerBlock"}),d.addButton({id:"#filePickerBtn",label:lang.uploadAddFile}),k("pedding"),d.on("fileQueued",function(e){c++,p+=e.size,1===c&&(s.addClass("element-invisible"),o.show()),C(e)}),d.on("fileDequeued",function(e){var t;c--,p-=e.size,e=u("#"+(t=e).id),delete v[t.id],y(),e.off().find(".file-panel").off().end().remove(),y()}),d.on("filesQueued",function(e){d.isInProgress()||"pedding"!=h&&"finish"!=h&&"confirm"!=h&&"ready"!=h||k("ready"),y()}),d.on("all",function(e,t){switch(e){case"uploadFinished":k("confirm");break;case"startUpload":var a=utils.serializeParam(editor.queryCommandValue("serverparam"))||"",a=utils.formatUrl(w+(-1==w.indexOf("?")?"?":"&")+"encode=utf-8&"+a);d.option("server",a),k("uploading");break;case"stopUpload":k("paused")}}),d.on("uploadBeforeSend",function(e,t,a){-1!=w.toLowerCase().indexOf("jsp")&&(a.X_Requested_With="XMLHttpRequest")}),d.on("uploadProgress",function(e,t){u("#"+e.id).find(".progress span").css("width",100*t+"%"),v[e.id][1]=t,y()}),d.on("uploadSuccess",function(t,e){t=u("#"+t.id);try{var a=e._raw||e,i=utils.str2json(a);"SUCCESS"==(i=editor.getOpt("serverResponsePrepare")(i)).state?(U.push({url:i.url,type:i.type,original:i.original}),t.append('')):t.find(".error").text(i.state).show()}catch(e){t.find(".error").text(lang.errorServerUpload).show()}}),d.on("uploadError",function(e,t){}),d.on("error",function(e,t,a){"F_EXCEED_SIZE"===e?editor.getOpt("tipError")(lang.errorExceedSize+" "+(t/1024/1024).toFixed(1)+"MB"):console.log("error",e,t,a)}),d.on("uploadComplete",function(e,t){}),n.on("click",function(){return!u(this).hasClass("disabled")&&void("ready"===h||"paused"===h?d.upload():"uploading"===h&&d.stop())}),n.addClass("state-"+h),y()):u("#filePickerReady").after(u("
    ").html(lang.errorLoadConfig)).hide():u("#filePickerReady").after(u("
    ").html(lang.errorNotSupport)).hide()},getQueueCount:function(){for(var e,t=0,a=this.uploader.getFiles(),i=0;e=a[i++];)"queued"!=(e=e.getStatus())&&"uploading"!=e&&"progress"!=e||t++;return t},refresh:function(){this.uploader.refresh()}}}(); \ No newline at end of file diff --git a/vendor/modstart/modstart/asset/vendor/ueditor/dialogs/image/image.html b/vendor/modstart/modstart/asset/vendor/ueditor/dialogs/image/image.html index 1b56bb6b..e7d513fc 100644 --- a/vendor/modstart/modstart/asset/vendor/ueditor/dialogs/image/image.html +++ b/vendor/modstart/modstart/asset/vendor/ueditor/dialogs/image/image.html @@ -120,6 +120,6 @@
    - + diff --git a/vendor/modstart/modstart/asset/vendor/ueditor/dialogs/image/image.js b/vendor/modstart/modstart/asset/vendor/ueditor/dialogs/image/image.js index 8ca43151..33e6835f 100644 --- a/vendor/modstart/modstart/asset/vendor/ueditor/dialogs/image/image.js +++ b/vendor/modstart/modstart/asset/vendor/ueditor/dialogs/image/image.js @@ -1 +1 @@ -!function(){var remoteImage,uploadImage,onlineImage,editorOpt={};function initTabs(){for(var e=$G("tabhead").children,t=0;t'+"还有2个未上传文件".replace(/[\d]/,s)+""),!1;break;case"online":t=onlineImage.getInsertList()}t&&editor.execCommand("insertimage",t)}}function initAlign(){domUtils.on($G("alignIcon"),"click",function(e){e=e.target||e.srcElement;e.className&&-1!=e.className.indexOf("-align")&&setAlign(e.getAttribute("data-align"))})}function setAlign(e){e=e||"none";var t=$G("alignIcon").children;for(i=0;in.offsetWidth?r:n.offsetWidth-2*a,e&&(n.innerHTML='')},getInsertList:function(){var e=this.getData();if(e.url){var t={src:e.url,_src:e.url,_propertyDelete:[],style:[]};return e.width?(t.width=e.width,t.style.push("width:"+e.width+"px")):t._propertyDelete.push("width"),e.height?(t.height=e.height,t.style.push("height:"+e.height+"px")):t._propertyDelete.push("height"),e.border?t.border=e.border:t._propertyDelete.push("border"),e.align?t.floatStyle=e.align:t._propertyDelete.push("floatStyle"),e.vhSpace?t.vspace=e.vhSpace:t._propertyDelete.push("vspace"),e.title?t.alt=e.title:t._propertyDelete.push("alt"),0

    '+i.name+'

    '),n=u('
    '+lang.uploadDelete+''+lang.uploadTurnRight+''+lang.uploadTurnLeft+"
    ").appendTo(s),r=s.find("p.progress span"),o=s.find("p.imgWrap"),l=u('

    ').hide().appendTo(s);"invalid"===i.getStatus()?a(i.statusText):(o.text(lang.uploadPreview),browser.ie&&browser.version<=7?o.text(lang.uploadNoPreview):d.makeThumb(i,function(e,t){e||!t?o.text(lang.uploadNoPreview):(t=u(''),o.empty().append(t),t.on("error",function(){o.text(lang.uploadNoPreview)}))},g,m),v[i.id]=[i.size,0],i.rotation=0,i.ext&&-1!=C.indexOf(i.ext.toLowerCase())||(a("not_allow_type"),d.removeFile(i))),i.on("statuschange",function(e,t){"progress"===t?r.hide().width(0):"queued"===t&&(s.off("mouseenter mouseleave"),n.remove()),"error"===e||"invalid"===e?(a(i.statusText),v[i.id][1]=1):"interrupt"===e?a("interrupt"):"queued"===e?v[i.id][1]=0:"progress"===e&&(l.hide(),r.css("display","block")),s.removeClass("state-"+t).addClass("state-"+e)}),s.on("mouseenter",function(){n.stop().animate({height:30})}),s.on("mouseleave",function(){n.stop().animate({height:0})}),n.on("click","span",function(){var e;switch(u(this).index()){case 0:return void d.removeFile(i);case 1:i.rotation+=90;break;case 2:i.rotation-=90}b?(e="rotate("+i.rotation+"deg)",o.css({"-webkit-transform":e,"-mos-transform":e,"-o-transform":e,transform:e})):o.css("filter","progid:DXImageTransform.Microsoft.BasicImage(rotation="+~~(i.rotation/90%4+4)%4+")")}),s.insertBefore(t)}function I(){var e,i=0,a=0,t=l.children();u.each(v,function(e,t){a+=t[0],i+=t[0]*t[1]}),e=a?i/a:0,t.eq(0).text(Math.round(100*e)+"%"),t.eq(1).css("width",Math.round(100*e)+"%"),k()}function $(e){if(e!==f){var t=d.getStats();switch(r.removeClass("state-"+f),r.addClass("state-"+e),e){case"pedding":i.addClass("element-invisible"),a.addClass("element-invisible"),o.removeClass("element-invisible"),l.hide(),n.hide(),d.refresh();break;case"ready":o.addClass("element-invisible"),i.removeClass("element-invisible"),a.removeClass("element-invisible"),l.hide(),n.show(),r.text(lang.uploadStart),d.refresh();break;case"uploading":l.show(),n.hide(),r.text(lang.uploadPause);break;case"paused":l.show(),n.hide(),r.text(lang.uploadContinue);break;case"confirm":if(l.show(),n.hide(),r.text(lang.uploadStart),(t=d.getStats()).successNum&&!t.uploadFailNum)return void $("finish");break;case"finish":l.hide(),n.show(),t.uploadFailNum?r.text(lang.uploadRetry):r.text(lang.uploadStart)}f=e,k()}s.getQueueCount()?r.removeClass("disabled"):r.addClass("disabled")}function k(){var e,t="";"ready"===f?t=lang.updateStatusReady.replace("_",c).replace("_KB",WebUploader.formatSize(p)):"confirm"===f?(e=d.getStats()).uploadFailNum&&(t=lang.updateStatusConfirm.replace("_",e.successNum).replace("_",e.successNum)):(e=d.getStats(),t=lang.updateStatusFinish.replace("_",c).replace("_KB",WebUploader.formatSize(p)).replace("_",e.successNum),e.uploadFailNum&&(t+=lang.updateStatusError.replace("_",e.uploadFailNum))),n.html(t)}WebUploader.Uploader.support()?editor.getOpt("imageActionName")?((d=s.uploader=WebUploader.create({pick:{id:"#filePickerReady",label:lang.uploadSelectFile},accept:{title:"Images",extensions:C,mimeTypes:"image/*"},swf:"../../third-party/webuploader/Uploader.swf",server:w,fileVal:editor.getOpt("imageFieldName"),duplicate:!0,fileSingleSizeLimit:y,threads:1,headers:editor.getOpt("serverHeaders")||{},compress:!!editor.getOpt("imageCompressEnable")&&{enable:editor.getOpt("imageCompressEnable"),maxWidthOrHeight:h,maxSize:y}})).addButton({id:"#filePickerBlock"}),d.addButton({id:"#filePickerBtn",label:lang.uploadAddFile}),$("pedding"),d.on("fileQueued",function(e){c++,p+=e.size,1===c&&(o.addClass("element-invisible"),a.show()),x(e)}),d.on("fileDequeued",function(e){var t;e.ext&&-1!=C.indexOf(e.ext.toLowerCase())&&e.size<=y&&(c--,p-=e.size),e=u("#"+(t=e).id),delete v[t.id],I(),e.off().find(".file-panel").off().end().remove(),I()}),d.on("filesQueued",function(e){d.isInProgress()||"pedding"!=f&&"finish"!=f&&"confirm"!=f&&"ready"!=f||$("ready"),I()}),d.on("all",function(e,t){switch(e){case"uploadFinished":$("confirm");break;case"startUpload":var i=utils.serializeParam(editor.queryCommandValue("serverparam"))||"",i=utils.formatUrl(w+(-1==w.indexOf("?")?"?":"&")+"encode=utf-8&"+i);d.option("server",i),$("uploading");break;case"stopUpload":$("paused")}}),d.on("uploadBeforeSend",function(e,t,i){-1!=w.toLowerCase().indexOf("jsp")&&(i["X-Requested-With"]="XMLHttpRequest")}),d.on("uploadProgress",function(e,t){u("#"+e.id).find(".progress span").css("width",100*t+"%"),v[e.id][1]=t,I()}),d.on("uploadSuccess",function(t,e){t=u("#"+t.id);try{var i=e._raw||e,a=utils.str2json(i);"SUCCESS"==(a=editor.options.serverResponsePrepare(a)).state?(s.imageList.push(a),t.append(''),editor.fireEvent("uploadsuccess",{res:a,type:"image"})):t.find(".error").text(a.state).show()}catch(e){t.find(".error").text(lang.errorServerUpload).show()}}),d.on("uploadError",function(e,t){}),d.on("error",function(e,t,i){"F_EXCEED_SIZE"===e?editor.getOpt("tipError")(lang.errorExceedSize+" "+(t/1024/1024).toFixed(1)+"MB"):console.log("error",e,t,i)}),d.on("uploadComplete",function(e,t){}),r.on("click",function(){return!u(this).hasClass("disabled")&&void("ready"===f||"paused"===f?d.upload():"uploading"===f&&d.stop())}),r.addClass("state-"+f),I()):u("#filePickerReady").after(u("
    ").html(lang.errorLoadConfig)).hide():u("#filePickerReady").after(u("
    ").html(lang.errorNotSupport)).hide()},getQueueCount:function(){for(var e,t=0,i=this.uploader.getFiles(),a=0;e=i[a++];)"queued"!=(e=e.getStatus())&&"uploading"!=e&&"progress"!=e||t++;return t},destroy:function(){this.$wrap.remove()},getInsertList:function(){for(var e,t=[],i=getAlign(),a=editor.getOpt("imageUrlPrefix"),s=0;s=json.total&&(_this.listEnd=!0),_this.isLoadingData=!1)}catch(e){var list;-1!=r.responseText.indexOf("ue_separate_ue")&&(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(e){for(var t,i,a,s=this,n=editor.getOpt("imageManagerUrlPrefix"),r=0;r'+"还有2个未上传文件".replace(/[\d]/,s)+""),!1;break;case"online":t=onlineImage.getInsertList()}t&&editor.execCommand("insertimage",t)}}function initAlign(){domUtils.on($G("alignIcon"),"click",function(e){e=e.target||e.srcElement;e.className&&-1!=e.className.indexOf("-align")&&setAlign(e.getAttribute("data-align"))})}function setAlign(e){e=e||"none";var t=$G("alignIcon").children;for(i=0;in.offsetWidth?r:n.offsetWidth-2*a,e&&(n.innerHTML='')},getInsertList:function(){var e=this.getData();if(e.url){var t={src:e.url,_src:e.url,_propertyDelete:[],style:[]};return e.width?(t.width=e.width,t.style.push("width:"+e.width+"px")):t._propertyDelete.push("width"),e.height?(t.height=e.height,t.style.push("height:"+e.height+"px")):t._propertyDelete.push("height"),e.border?t.border=e.border:t._propertyDelete.push("border"),e.align?t.floatStyle=e.align:t._propertyDelete.push("floatStyle"),e.vhSpace?t.vspace=e.vhSpace:t._propertyDelete.push("vspace"),e.title?t.alt=e.title:t._propertyDelete.push("alt"),0

    '+i.name+'

    '),n=u('
    '+lang.uploadDelete+''+lang.uploadTurnRight+''+lang.uploadTurnLeft+"
    ").appendTo(s),r=s.find("p.progress span"),o=s.find("p.imgWrap"),l=u('

    ').hide().appendTo(s);"invalid"===i.getStatus()?a(i.statusText):(o.text(lang.uploadPreview),browser.ie&&browser.version<=7?o.text(lang.uploadNoPreview):d.makeThumb(i,function(e,t){e||!t?o.text(lang.uploadNoPreview):(t=u(''),o.empty().append(t),t.on("error",function(){o.text(lang.uploadNoPreview)}))},h,m),v[i.id]=[i.size,0],i.rotation=0,i.ext&&-1!=C.indexOf(i.ext.toLowerCase())||(a("not_allow_type"),d.removeFile(i))),i.on("statuschange",function(e,t){"progress"===t?r.hide().width(0):"queued"===t&&(s.off("mouseenter mouseleave"),n.remove()),"error"===e||"invalid"===e?(a(i.statusText),v[i.id][1]=1):"interrupt"===e?a("interrupt"):"queued"===e?v[i.id][1]=0:"progress"===e&&(l.hide(),r.css("display","block")),s.removeClass("state-"+t).addClass("state-"+e)}),s.on("mouseenter",function(){n.stop().animate({height:30})}),s.on("mouseleave",function(){n.stop().animate({height:0})}),n.on("click","span",function(){var e;switch(u(this).index()){case 0:return void d.removeFile(i);case 1:i.rotation+=90;break;case 2:i.rotation-=90}b?(e="rotate("+i.rotation+"deg)",o.css({"-webkit-transform":e,"-mos-transform":e,"-o-transform":e,transform:e})):o.css("filter","progid:DXImageTransform.Microsoft.BasicImage(rotation="+~~(i.rotation/90%4+4)%4+")")}),s.insertBefore(t)}function I(){var e,i=0,a=0,t=l.children();u.each(v,function(e,t){a+=t[0],i+=t[0]*t[1]}),e=a?i/a:0,t.eq(0).text(Math.round(100*e)+"%"),t.eq(1).css("width",Math.round(100*e)+"%"),k()}function $(e){if(e!==f){var t=d.getStats();switch(r.removeClass("state-"+f),r.addClass("state-"+e),e){case"pedding":i.addClass("element-invisible"),a.addClass("element-invisible"),o.removeClass("element-invisible"),l.hide(),n.hide(),d.refresh();break;case"ready":o.addClass("element-invisible"),i.removeClass("element-invisible"),a.removeClass("element-invisible"),l.hide(),n.show(),r.text(lang.uploadStart),d.refresh();break;case"uploading":l.show(),n.hide(),r.text(lang.uploadPause);break;case"paused":l.show(),n.hide(),r.text(lang.uploadContinue);break;case"confirm":if(l.show(),n.hide(),r.text(lang.uploadStart),(t=d.getStats()).successNum&&!t.uploadFailNum)return void $("finish");break;case"finish":l.hide(),n.show(),t.uploadFailNum?r.text(lang.uploadRetry):r.text(lang.uploadStart)}f=e,k()}s.getQueueCount()?r.removeClass("disabled"):r.addClass("disabled")}function k(){var e,t="";"ready"===f?t=lang.updateStatusReady.replace("_",c).replace("_KB",WebUploader.formatSize(p)):"confirm"===f?(e=d.getStats()).uploadFailNum&&(t=lang.updateStatusConfirm.replace("_",e.successNum).replace("_",e.successNum)):(e=d.getStats(),t=lang.updateStatusFinish.replace("_",c).replace("_KB",WebUploader.formatSize(p)).replace("_",e.successNum),e.uploadFailNum&&(t+=lang.updateStatusError.replace("_",e.uploadFailNum))),n.html(t)}WebUploader.Uploader.support()?editor.getOpt("imageActionName")?(g={pick:{id:"#filePickerReady",label:lang.uploadSelectFile},accept:{title:"Images",extensions:C,mimeTypes:"image/*"},swf:"../../third-party/webuploader/Uploader.swf",server:w,fileVal:editor.getOpt("imageFieldName"),duplicate:!0,fileSingleSizeLimit:y,threads:1,headers:editor.getOpt("serverHeaders")||{},compress:!!editor.getOpt("imageCompressEnable")&&{enable:editor.getOpt("imageCompressEnable"),maxWidthOrHeight:g,maxSize:y}},editor.getOpt("uploadServiceEnable")&&(g.customUpload=function(t,i){editor.getOpt("uploadServiceUpload")("image",t,{success:function(e){i.onSuccess(t,{_raw:JSON.stringify(e)})},error:function(e){i.onError(t,e)},progress:function(e){i.onProgress(t,e)}},{from:"image"})}),(d=s.uploader=WebUploader.create(g)).addButton({id:"#filePickerBlock"}),d.addButton({id:"#filePickerBtn",label:lang.uploadAddFile}),$("pedding"),d.on("fileQueued",function(e){c++,p+=e.size,1===c&&(o.addClass("element-invisible"),a.show()),x(e)}),d.on("fileDequeued",function(e){var t;e.ext&&-1!=C.indexOf(e.ext.toLowerCase())&&e.size<=y&&(c--,p-=e.size),e=u("#"+(t=e).id),delete v[t.id],I(),e.off().find(".file-panel").off().end().remove(),I()}),d.on("filesQueued",function(e){d.isInProgress()||"pedding"!=f&&"finish"!=f&&"confirm"!=f&&"ready"!=f||$("ready"),I()}),d.on("all",function(e,t){switch(e){case"uploadFinished":$("confirm");break;case"startUpload":var i=utils.serializeParam(editor.queryCommandValue("serverparam"))||"",i=utils.formatUrl(w+(-1==w.indexOf("?")?"?":"&")+"encode=utf-8&"+i);d.option("server",i),$("uploading");break;case"stopUpload":$("paused")}}),d.on("uploadBeforeSend",function(e,t,i){-1!=w.toLowerCase().indexOf("jsp")&&(i["X-Requested-With"]="XMLHttpRequest")}),d.on("uploadProgress",function(e,t){u("#"+e.id).find(".progress span").css("width",100*t+"%"),v[e.id][1]=t,I()}),d.on("uploadSuccess",function(t,e){t=u("#"+t.id);try{var i=e._raw||e,a=utils.str2json(i);"SUCCESS"==(a=editor.options.serverResponsePrepare(a)).state?(s.imageList.push(a),t.append(''),editor.fireEvent("uploadsuccess",{res:a,type:"image"})):t.find(".error").text(a.state).show()}catch(e){t.find(".error").text(lang.errorServerUpload).show()}}),d.on("uploadError",function(e,t){}),d.on("error",function(e,t,i){"F_EXCEED_SIZE"===e?editor.getOpt("tipError")(lang.errorExceedSize+" "+(t/1024/1024).toFixed(1)+"MB"):console.log("error",e,t,i)}),d.on("uploadComplete",function(e,t){}),r.on("click",function(){return!u(this).hasClass("disabled")&&void("ready"===f||"paused"===f?d.upload():"uploading"===f&&d.stop())}),r.addClass("state-"+f),I()):u("#filePickerReady").after(u("
    ").html(lang.errorLoadConfig)).hide():u("#filePickerReady").after(u("
    ").html(lang.errorNotSupport)).hide()},getQueueCount:function(){for(var e,t=0,i=this.uploader.getFiles(),a=0;e=i[a++];)"queued"!=(e=e.getStatus())&&"uploading"!=e&&"progress"!=e||t++;return t},destroy:function(){this.$wrap.remove()},getInsertList:function(){for(var e,t=[],i=getAlign(),a=editor.getOpt("imageUrlPrefix"),s=0;s=json.total&&(_this.listEnd=!0),_this.isLoadingData=!1)}catch(e){var list;-1!=r.responseText.indexOf("ue_separate_ue")&&(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(e){for(var t,i,a,s=this,n=editor.getOpt("imageManagerUrlPrefix"),r=0;r
    - + + diff --git a/vendor/modstart/modstart/asset/vendor/ueditor/dialogs/video/video.js b/vendor/modstart/modstart/asset/vendor/ueditor/dialogs/video/video.js index 6368725c..6b05809c 100644 --- a/vendor/modstart/modstart/asset/vendor/ueditor/dialogs/video/video.js +++ b/vendor/modstart/modstart/asset/vendor/ueditor/dialogs/video/video.js @@ -1 +1 @@ -!function(){var l,S=[],o=!1,t={};function d(e,t){for(var i,a,o=$G(e).children,r=0;a=o[r++];)if("focus"==a.className){i=a.getAttribute(t);break}return i}function r(e){return e?e=utils.trim(e).replace(/v\.youku\.com\/v_show\/id_([\w\-=]+)\.html/i,"player.youku.com/embed/$1").replace(/v\.qq\.com\/x\/cover\/[\w]+\/([\w]+)\.html/i,"v.qq.com/iframe/player.html?vid=$1&tiny=0&auto=0").replace(/v\.qq\.com\/x\/page\/([\w]+)\.html/i,"v.qq.com/iframe/player.html?vid=$1&tiny=0&auto=0").replace(/www\.bilibili\.com\/video\/([a-zA-Z0-9]+)\/?.*$/i,"player.bilibili.com/player.html?bvid=$1"):""}function n(e){e&&(e=r(e),e=utils.unhtml(e),$G("preview").innerHTML='
    '+lang.urlError+'
    ')}function e(e){this.$wrap=e.constructor==String?$("#"+e):$(e),this.init()}window.onload=function(){t=editor.getOpt("videoConfig"),$focus($G("videoUrl")),function(){for(var o=$G("tabHeads").children,e=0;e'+"还有2个未上传文件".replace(/[\d]/,s)+""),!1;editor.execCommand("insertvideo",t,"upload")}}()}},dialog.oncancel=function(){$G("preview").innerHTML=""},function(){var e,t,i,a=editor.selection.getRange().getClosedNode();a&&a.className&&(i="edui-faked-video"==a.className,t=-1!=a.className.indexOf("edui-upload-video"),(i||t)&&($G("videoUrl").value=e=a.getAttribute("_url"),$G("videoWidth").value=a.width,$G("videoHeight").value=a.height,i=domUtils.getComputedStyle(a,"float"),function(e){for(var t,i=$G("videoFloat").children,a=0;t=i[a++];)t.getAttribute("name")==e?"focus"!=t.className&&(t.className="focus"):"focus"==t.className&&(t.className="")}("center"===domUtils.getComputedStyle(a.parentNode,"text-align")?"center":i)),t&&(o=!0)),n(e)}(),l=new e("queueList")},e.prototype={init:function(){this.fileList=[],this.initContainer(),this.initUploader()},initContainer:function(){this.$queue=this.$wrap.find(".filelist")},initUploader:function(){var d,i=this,u=jQuery,e=i.$wrap,a=e.find(".filelist"),o=e.find(".statusBar"),r=o.find(".info"),n=e.find(".uploadBtn"),t=(e.find(".filePickerBtn"),e.find(".filePickerBlock")),s=e.find(".placeholder"),l=o.find(".progress").hide(),c=0,p=0,f=window.devicePixelRatio||1,m=113*f,v=113*f,g="",h={},b=(f="transition"in(e=document.createElement("p").style)||"WebkitTransition"in e||"MozTransition"in e||"msTransition"in e||"OTransition"in e,e=null,f),w=editor.getActionUrl(editor.getOpt("videoActionName")),f=editor.getOpt("videoMaxSize"),y=(editor.getOpt("videoAllowFiles")||[]).join("").replace(/\./g,",").replace(/^[,]/,"");function C(i){function a(e){switch(e){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}l.text(text).show()}var o=u('
  • '+i.name+'

  • '),r=u('
    '+lang.uploadDelete+''+lang.uploadTurnRight+''+lang.uploadTurnLeft+"
    ").appendTo(o),n=o.find("p.progress span"),s=o.find("p.imgWrap"),l=u('

    ').hide().appendTo(o);"invalid"===i.getStatus()?a(i.statusText):(s.text(lang.uploadPreview),-1=="|png|jpg|jpeg|bmp|gif|".indexOf("|"+i.ext.toLowerCase()+"|")?s.empty().addClass("notimage").append(''+i.name+""):browser.ie&&browser.version<=7?s.text(lang.uploadNoPreview):d.makeThumb(i,function(e,t){e||!t||/^data:/.test(t)&&browser.ie&&browser.version<=7?s.text(lang.uploadNoPreview):(t=u(''),s.empty().append(t),t.on("error",function(){s.text(lang.uploadNoPreview)}))},m,v),h[i.id]=[i.size,0],i.rotation=0,i.ext&&-1!=y.indexOf(i.ext.toLowerCase())||(a("not_allow_type"),d.removeFile(i))),i.on("statuschange",function(e,t){"progress"===t?n.hide().width(0):"queued"===t&&(o.off("mouseenter mouseleave"),r.remove()),"error"===e||"invalid"===e?(a(i.statusText),h[i.id][1]=1):"interrupt"===e?a("interrupt"):"queued"===e?h[i.id][1]=0:"progress"===e&&(l.hide(),n.css("display","block")),o.removeClass("state-"+t).addClass("state-"+e)}),o.on("mouseenter",function(){r.stop().animate({height:30})}),o.on("mouseleave",function(){r.stop().animate({height:0})}),r.on("click","span",function(){var e;switch(u(this).index()){case 0:return void d.removeFile(i);case 1:i.rotation+=90;break;case 2:i.rotation-=90}b?(e="rotate("+i.rotation+"deg)",s.css({"-webkit-transform":e,"-mos-transform":e,"-o-transform":e,transform:e})):s.css("filter","progid:DXImageTransform.Microsoft.BasicImage(rotation="+~~(i.rotation/90%4+4)%4+")")}),o.insertBefore(t)}function x(){var e,i=0,a=0,t=l.children();u.each(h,function(e,t){a+=t[0],i+=t[0]*t[1]}),e=a?i/a:0,t.eq(0).text(Math.round(100*e)+"%"),t.eq(1).css("width",Math.round(100*e)+"%"),$()}function k(e){if(e!=g){var t=d.getStats();switch(n.removeClass("state-"+g),n.addClass("state-"+e),e){case"pedding":a.addClass("element-invisible"),o.addClass("element-invisible"),s.removeClass("element-invisible"),l.hide(),r.hide(),d.refresh();break;case"ready":s.addClass("element-invisible"),a.removeClass("element-invisible"),o.removeClass("element-invisible"),l.hide(),r.show(),n.text(lang.uploadStart),d.refresh();break;case"uploading":l.show(),r.hide(),n.text(lang.uploadPause);break;case"paused":l.show(),r.hide(),n.text(lang.uploadContinue);break;case"confirm":if(l.show(),r.hide(),n.text(lang.uploadStart),(t=d.getStats()).successNum&&!t.uploadFailNum)return void k("finish");break;case"finish":l.hide(),r.show(),t.uploadFailNum?n.text(lang.uploadRetry):n.text(lang.uploadStart)}g=e,$()}i.getQueueCount()?n.removeClass("disabled"):n.addClass("disabled")}function $(){var e,t="";"ready"===g?t=lang.updateStatusReady.replace("_",c).replace("_KB",WebUploader.formatSize(p)):"confirm"===g?(e=d.getStats()).uploadFailNum&&(t=lang.updateStatusConfirm.replace("_",e.successNum).replace("_",e.successNum)):(e=d.getStats(),t=lang.updateStatusFinish.replace("_",c).replace("_KB",WebUploader.formatSize(p)).replace("_",e.successNum),e.uploadFailNum&&(t+=lang.updateStatusError.replace("_",e.uploadFailNum))),r.html(t)}WebUploader.Uploader.support()?editor.getOpt("videoActionName")?((d=i.uploader=WebUploader.create({pick:{id:"#filePickerReady",label:lang.uploadSelectFile},swf:"../../third-party/webuploader/Uploader.swf",server:w,fileVal:editor.getOpt("videoFieldName"),duplicate:!0,fileSingleSizeLimit:f,headers:editor.getOpt("serverHeaders")||{},compress:!1})).addButton({id:"#filePickerBlock"}),d.addButton({id:"#filePickerBtn",label:lang.uploadAddFile}),k("pedding"),d.on("fileQueued",function(e){c++,p+=e.size,1===c&&(s.addClass("element-invisible"),o.show()),C(e)}),d.on("fileDequeued",function(e){var t;c--,p-=e.size,e=u("#"+(t=e).id),delete h[t.id],x(),e.off().find(".file-panel").off().end().remove(),x()}),d.on("filesQueued",function(e){d.isInProgress()||"pedding"!=g&&"finish"!=g&&"confirm"!=g&&"ready"!=g||k("ready"),x()}),d.on("all",function(e,t){switch(e){case"uploadFinished":k("confirm");break;case"startUpload":var i=utils.serializeParam(editor.queryCommandValue("serverparam"))||"",i=utils.formatUrl(w+(-1==w.indexOf("?")?"?":"&")+"encode=utf-8&"+i);d.option("server",i),k("uploading");break;case"stopUpload":k("paused")}}),d.on("uploadBeforeSend",function(e,t,i){-1!=w.toLowerCase().indexOf("jsp")&&(i.X_Requested_With="XMLHttpRequest")}),d.on("uploadProgress",function(e,t){u("#"+e.id).find(".progress span").css("width",100*t+"%"),h[e.id][1]=t,x()}),d.on("uploadSuccess",function(t,e){t=u("#"+t.id);try{var i=e._raw||e,a=utils.str2json(i);"SUCCESS"==(a=editor.getOpt("serverResponsePrepare")(a)).state?(S.push({url:a.url,type:a.type,original:a.original}),t.append(''),editor.fireEvent("uploadsuccess",{res:a,type:"video"})):t.find(".error").text(a.state).show()}catch(e){t.find(".error").text(lang.errorServerUpload).show()}}),d.on("uploadError",function(e,t){}),d.on("error",function(e,t,i){"F_EXCEED_SIZE"===e?editor.getOpt("tipError")(lang.errorExceedSize+" "+(t/1024/1024).toFixed(1)+"MB"):console.log("error",e,t,i)}),d.on("uploadComplete",function(e,t){}),n.on("click",function(){return!u(this).hasClass("disabled")&&void("ready"===g||"paused"===g?d.upload():"uploading"===g&&d.stop())}),n.addClass("state-"+g),x()):u("#filePickerReady").after(u("
    ").html(lang.errorLoadConfig)).hide():u("#filePickerReady").after(u("
    ").html(lang.errorNotSupport)).hide()},getQueueCount:function(){for(var e,t=0,i=this.uploader.getFiles(),a=0;e=i[a++];)"queued"!=(e=e.getStatus())&&"uploading"!=e&&"progress"!=e||t++;return t},refresh:function(){this.uploader.refresh()}}}(); \ No newline at end of file +!function(){var l,U=[],o=!1,t={};function d(e,t){for(var i,a,o=$G(e).children,r=0;a=o[r++];)if("focus"==a.className){i=a.getAttribute(t);break}return i}function r(e){return e?e=utils.trim(e).replace(/v\.youku\.com\/v_show\/id_([\w\-=]+)\.html/i,"player.youku.com/embed/$1").replace(/v\.qq\.com\/x\/cover\/[\w]+\/([\w]+)\.html/i,"v.qq.com/iframe/player.html?vid=$1&tiny=0&auto=0").replace(/v\.qq\.com\/x\/page\/([\w]+)\.html/i,"v.qq.com/iframe/player.html?vid=$1&tiny=0&auto=0").replace(/www\.bilibili\.com\/video\/([a-zA-Z0-9]+)\/?.*$/i,"player.bilibili.com/player.html?bvid=$1"):""}function n(e){e&&(e=r(e),e=utils.unhtml(e),$G("preview").innerHTML='
    '+lang.urlError+'
    ')}function e(e){this.$wrap=e.constructor==String?$("#"+e):$(e),this.init()}window.onload=function(){t=editor.getOpt("videoConfig"),$focus($G("videoUrl")),function(){for(var o=$G("tabHeads").children,e=0;e'+"还有2个未上传文件".replace(/[\d]/,s)+""),!1;editor.execCommand("insertvideo",t,"upload")}}()}},dialog.oncancel=function(){$G("preview").innerHTML=""},function(){var e,t,i,a=editor.selection.getRange().getClosedNode();a&&a.className&&(i="edui-faked-video"==a.className,t=-1!=a.className.indexOf("edui-upload-video"),(i||t)&&($G("videoUrl").value=e=a.getAttribute("_url"),$G("videoWidth").value=a.width,$G("videoHeight").value=a.height,i=domUtils.getComputedStyle(a,"float"),function(e){for(var t,i=$G("videoFloat").children,a=0;t=i[a++];)t.getAttribute("name")==e?"focus"!=t.className&&(t.className="focus"):"focus"==t.className&&(t.className="")}("center"===domUtils.getComputedStyle(a.parentNode,"text-align")?"center":i)),t&&(o=!0)),n(e)}(),l=new e("queueList")},e.prototype={init:function(){this.fileList=[],this.initContainer(),this.initUploader()},initContainer:function(){this.$queue=this.$wrap.find(".filelist")},initUploader:function(){var d,i=this,u=jQuery,e=i.$wrap,a=e.find(".filelist"),o=e.find(".statusBar"),r=o.find(".info"),n=e.find(".uploadBtn"),t=(e.find(".filePickerBtn"),e.find(".filePickerBlock")),s=e.find(".placeholder"),l=o.find(".progress").hide(),c=0,p=0,f=window.devicePixelRatio||1,m=113*f,v=113*f,g="",h={},b=(f="transition"in(e=document.createElement("p").style)||"WebkitTransition"in e||"MozTransition"in e||"msTransition"in e||"OTransition"in e,e=null,f),w=editor.getActionUrl(editor.getOpt("videoActionName")),f=editor.getOpt("videoMaxSize"),y=(editor.getOpt("videoAllowFiles")||[]).join("").replace(/\./g,",").replace(/^[,]/,"");function C(i){function a(e){switch(e){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}l.text(text).show()}var o=u('
  • '+i.name+'

  • '),r=u('
    '+lang.uploadDelete+''+lang.uploadTurnRight+''+lang.uploadTurnLeft+"
    ").appendTo(o),n=o.find("p.progress span"),s=o.find("p.imgWrap"),l=u('

    ').hide().appendTo(o);"invalid"===i.getStatus()?a(i.statusText):(s.text(lang.uploadPreview),-1=="|png|jpg|jpeg|bmp|gif|".indexOf("|"+i.ext.toLowerCase()+"|")?s.empty().addClass("notimage").append(''+i.name+""):browser.ie&&browser.version<=7?s.text(lang.uploadNoPreview):d.makeThumb(i,function(e,t){e||!t||/^data:/.test(t)&&browser.ie&&browser.version<=7?s.text(lang.uploadNoPreview):(t=u(''),s.empty().append(t),t.on("error",function(){s.text(lang.uploadNoPreview)}))},m,v),h[i.id]=[i.size,0],i.rotation=0,i.ext&&-1!=y.indexOf(i.ext.toLowerCase())||(a("not_allow_type"),d.removeFile(i))),i.on("statuschange",function(e,t){"progress"===t?n.hide().width(0):"queued"===t&&(o.off("mouseenter mouseleave"),r.remove()),"error"===e||"invalid"===e?(a(i.statusText),h[i.id][1]=1):"interrupt"===e?a("interrupt"):"queued"===e?h[i.id][1]=0:"progress"===e&&(l.hide(),n.css("display","block")),o.removeClass("state-"+t).addClass("state-"+e)}),o.on("mouseenter",function(){r.stop().animate({height:30})}),o.on("mouseleave",function(){r.stop().animate({height:0})}),r.on("click","span",function(){var e;switch(u(this).index()){case 0:return void d.removeFile(i);case 1:i.rotation+=90;break;case 2:i.rotation-=90}b?(e="rotate("+i.rotation+"deg)",s.css({"-webkit-transform":e,"-mos-transform":e,"-o-transform":e,transform:e})):s.css("filter","progid:DXImageTransform.Microsoft.BasicImage(rotation="+~~(i.rotation/90%4+4)%4+")")}),o.insertBefore(t)}function x(){var e,i=0,a=0,t=l.children();u.each(h,function(e,t){a+=t[0],i+=t[0]*t[1]}),e=a?i/a:0,t.eq(0).text(Math.round(100*e)+"%"),t.eq(1).css("width",Math.round(100*e)+"%"),S()}function k(e){if(e!=g){var t=d.getStats();switch(n.removeClass("state-"+g),n.addClass("state-"+e),e){case"pedding":a.addClass("element-invisible"),o.addClass("element-invisible"),s.removeClass("element-invisible"),l.hide(),r.hide(),d.refresh();break;case"ready":s.addClass("element-invisible"),a.removeClass("element-invisible"),o.removeClass("element-invisible"),l.hide(),r.show(),n.text(lang.uploadStart),d.refresh();break;case"uploading":l.show(),r.hide(),n.text(lang.uploadPause);break;case"paused":l.show(),r.hide(),n.text(lang.uploadContinue);break;case"confirm":if(l.show(),r.hide(),n.text(lang.uploadStart),(t=d.getStats()).successNum&&!t.uploadFailNum)return void k("finish");break;case"finish":l.hide(),r.show(),t.uploadFailNum?n.text(lang.uploadRetry):n.text(lang.uploadStart)}g=e,S()}i.getQueueCount()?n.removeClass("disabled"):n.addClass("disabled")}function S(){var e,t="";"ready"===g?t=lang.updateStatusReady.replace("_",c).replace("_KB",WebUploader.formatSize(p)):"confirm"===g?(e=d.getStats()).uploadFailNum&&(t=lang.updateStatusConfirm.replace("_",e.successNum).replace("_",e.successNum)):(e=d.getStats(),t=lang.updateStatusFinish.replace("_",c).replace("_KB",WebUploader.formatSize(p)).replace("_",e.successNum),e.uploadFailNum&&(t+=lang.updateStatusError.replace("_",e.uploadFailNum))),r.html(t)}WebUploader.Uploader.support()?editor.getOpt("videoActionName")?(f={pick:{id:"#filePickerReady",label:lang.uploadSelectFile},swf:"../../third-party/webuploader/Uploader.swf",server:w,fileVal:editor.getOpt("videoFieldName"),duplicate:!0,fileSingleSizeLimit:f,headers:editor.getOpt("serverHeaders")||{},compress:!1},editor.getOpt("uploadServiceEnable")&&(f.customUpload=function(t,i){editor.getOpt("uploadServiceUpload")("video",t,{success:function(e){i.onSuccess(t,{_raw:JSON.stringify(e)})},error:function(e){i.onError(t,e)},progress:function(e){i.onProgress(t,e)}},{from:"video"})}),(d=i.uploader=WebUploader.create(f)).addButton({id:"#filePickerBlock"}),d.addButton({id:"#filePickerBtn",label:lang.uploadAddFile}),k("pedding"),d.on("fileQueued",function(e){c++,p+=e.size,1===c&&(s.addClass("element-invisible"),o.show()),C(e)}),d.on("fileDequeued",function(e){var t;c--,p-=e.size,e=u("#"+(t=e).id),delete h[t.id],x(),e.off().find(".file-panel").off().end().remove(),x()}),d.on("filesQueued",function(e){d.isInProgress()||"pedding"!=g&&"finish"!=g&&"confirm"!=g&&"ready"!=g||k("ready"),x()}),d.on("all",function(e,t){switch(e){case"uploadFinished":k("confirm");break;case"startUpload":var i=utils.serializeParam(editor.queryCommandValue("serverparam"))||"",i=utils.formatUrl(w+(-1==w.indexOf("?")?"?":"&")+"encode=utf-8&"+i);d.option("server",i),k("uploading");break;case"stopUpload":k("paused")}}),d.on("uploadBeforeSend",function(e,t,i){-1!=w.toLowerCase().indexOf("jsp")&&(i.X_Requested_With="XMLHttpRequest")}),d.on("uploadProgress",function(e,t){u("#"+e.id).find(".progress span").css("width",100*t+"%"),h[e.id][1]=t,x()}),d.on("uploadSuccess",function(t,e){t=u("#"+t.id);try{var i=e._raw||e,a=utils.str2json(i);"SUCCESS"==(a=editor.getOpt("serverResponsePrepare")(a)).state?(U.push({url:a.url,type:a.type,original:a.original}),t.append(''),editor.fireEvent("uploadsuccess",{res:a,type:"video"})):t.find(".error").text(a.state).show()}catch(e){t.find(".error").text(lang.errorServerUpload).show()}}),d.on("uploadError",function(e,t){}),d.on("error",function(e,t,i){"F_EXCEED_SIZE"===e?editor.getOpt("tipError")(lang.errorExceedSize+" "+(t/1024/1024).toFixed(1)+"MB"):console.log("error",e,t,i)}),d.on("uploadComplete",function(e,t){}),n.on("click",function(){return!u(this).hasClass("disabled")&&void("ready"===g||"paused"===g?d.upload():"uploading"===g&&d.stop())}),n.addClass("state-"+g),x()):u("#filePickerReady").after(u("
    ").html(lang.errorLoadConfig)).hide():u("#filePickerReady").after(u("
    ").html(lang.errorNotSupport)).hide()},getQueueCount:function(){for(var e,t=0,i=this.uploader.getFiles(),a=0;e=i[a++];)"queued"!=(e=e.getStatus())&&"uploading"!=e&&"progress"!=e||t++;return t},refresh:function(){this.uploader.refresh()}}}(); \ No newline at end of file diff --git a/vendor/modstart/modstart/asset/vendor/ueditor/ueditor.all.js b/vendor/modstart/modstart/asset/vendor/ueditor/ueditor.all.js index 95f5b791..86d6587f 100644 --- a/vendor/modstart/modstart/asset/vendor/ueditor/ueditor.all.js +++ b/vendor/modstart/modstart/asset/vendor/ueditor/ueditor.all.js @@ -1 +1 @@ -!function(){UEDITOR_CONFIG=window.UEDITOR_CONFIG||{};var baidu=window.baidu||{};window.baidu=baidu,window.UE=baidu.editor={plugins:{},commands:{},instants:{},I18N:{},_customizeUI:{},version:"4.1.0-beta",constants:{STATEFUL:{DISABLED:-1,OFF:0,ON:1}}};var dom=UE.dom={},browser=UE.browser=function(){var e=navigator.userAgent.toLowerCase(),t=window.opera,n={ie:/(msie\s|trident.*rv:)([\w.]+)/i.test(e),opera:!!t&&t.version,webkit:-1{this.isObject(n[e])&&e in t?i[e]=this.merge(t[e],n[e]):Object.assign(i,{[e]:n[e]})}),i},extend:function(e,t,n){if(t)for(var i in t)n&&e.hasOwnProperty(i)||(e[i]=t[i]);return e},extend2:function(e){for(var t=arguments,n=1;n'](?:(amp|lt|ldquo|rdquo|quot|gt|#39|nbsp|#\d+);)?/g,function(e,t){return t?e:{"<":"<","&":"&",'"':""","“":"“","”":"”",">":">","'":"'"}[e]}):""},html:function(e){return e?e.replace(/&((g|l|quo|ldquo|rdquo)t|amp|#39|nbsp);/g,function(e){return{"<":"<","&":"&",""":'"',"“":"“","”":"”",">":">","'":"'"," ":" "}[e]}):""},cssStyleToDomStyle:(ia=document.createElement("div").style,ja={float:void 0!==ia.cssFloat?"cssFloat":void 0!==ia.styleFloat?"styleFloat":"float"},function(e){return ja[e]||(ja[e]=e.toLowerCase().replace(/-./g,function(e){return e.charAt(1).toUpperCase()}))}),loadFile:(ma=[],function(t,n,e){var i=na(t,n);if(i)i.ready?e&&e():i.funs.push(e);else if(ma.push({doc:t,url:n.src||n.href,funs:[e]}),t.body){if(!n.id||!t.getElementById(n.id)){var o=t.createElement(n.tag);for(r in delete n.tag,n)o.setAttribute(r,n[r]);o.onload=o.onreadystatechange=function(){if(!this.readyState||/loaded|complete/.test(this.readyState)){if(0<(i=na(t,n)).funs.length){i.ready=1;for(var e;e=i.funs.pop();)e()}o.onload=o.onreadystatechange=null}},o.onerror=function(){throw Error("The load "+(n.href||n.src)+" fails,check the url settings of file ueditor.config.js ")},t.getElementsByTagName("head")[0].appendChild(o)}}else{var r,a=[];for(r in n)"tag"!=r&&a.push(r+'="'+n[r]+'"');t.write("<"+n.tag+" "+a.join(" ")+" >")}}),isEmptyObject:function(e){if(null==e)return!0;if(this.isArray(e)||this.isString(e))return 0===e.length;for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},fixColor:function(e,t){if(/color/i.test(e)&&/rgba?/.test(t)){var n=t.split(",");if(3/.test(e.outerHTML):0==e.attributes.length},isCustomeNode:function(e){return 1==e.nodeType&&e.getAttribute("_ue_custom_node_")},isTagNode:function(e,t){return 1==e.nodeType&&new RegExp("\\b"+e.tagName+"\\b","i").test(t)},filterNodeList:function(e,t,n){var i,o=[];return utils.isFunction(t)||(i=t,t=function(e){return-1!=utils.indexOf(utils.isArray(i)?i:i.split(" "),e.tagName.toLowerCase())}),utils.each(e,function(e){t(e)&&o.push(e)}),0==o.length?null:1!=o.length&&n?o:o[0]},isInNodeEndBoundary:function(e,t){var n=e.startContainer;if(3==n.nodeType&&e.startOffset!=n.nodeValue.length)return 0;if(1==n.nodeType&&e.startOffset!=n.childNodes.length)return 0;for(;n!==t;){if(n.nextSibling)return 0;n=n.parentNode}return 1},isBoundaryNode:function(e,t){for(;!domUtils.isBody(e);)if(e!==(e=e.parentNode)[t])return!1;return!0},fillHtml:browser.ie11below?" ":"
    ",loadScript:function(e,t){var n=document.createElement("script");n.src=e,n.onload=function(){t&&t({isNew:!0})},document.getElementsByTagName("head")[0].appendChild(n)}},fillCharReg=new RegExp(domUtils.fillChar,"g"),we,ue,ve,Be,r6,q6,w6,N8,vu;function ye(e){return!e.collapsed&&1===e.startContainer.nodeType&&e.startContainer===e.endContainer&&e.endOffset-e.startOffset==1}function ze(e,t,n,i){return 1===t.nodeType&&(dtd.$empty[t.tagName]||dtd.$nonChild[t.tagName])&&(n=domUtils.getNodeIndex(t)+(e?0:1),t=t.parentNode),e?(i.startContainer=t,i.startOffset=n,i.endContainer||i.collapse(!0)):(i.endContainer=t,i.endOffset=n,i.startContainer||i.collapse(!1)),(n=i).collapsed=n.startContainer&&n.endContainer&&n.startContainer===n.endContainer&&n.startOffset===n.endOffset,i}function Ae(e,t){var n,i,o=e.startContainer,r=e.endContainer,a=e.startOffset,s=e.endOffset,l=e.document,d=l.createDocumentFragment();if((o=1==o.nodeType?o.childNodes[a]||(n=o.appendChild(l.createTextNode(""))):o)===(r=1==r.nodeType?r.childNodes[s]||(i=r.appendChild(l.createTextNode(""))):r)&&3==o.nodeType)return d.appendChild(l.createTextNode(o.substringData(a,s-a))),t&&(o.deleteData(a,s-a),e.collapse(!0)),d;for(var c,u,m=d,f=domUtils.findParents(o,!0),h=domUtils.findParents(r,!0),p=0;f[p]==h[p];)p++;for(var g,b=p;g=f[b];b++){for(c=g.nextSibling,g==o?n||(3==e.startContainer.nodeType?(m.appendChild(l.createTextNode(o.nodeValue.slice(a))),t&&o.deleteData(a,o.nodeValue.length-a)):m.appendChild(t?o:o.cloneNode(!0))):(u=g.cloneNode(!1),m.appendChild(u));c&&c!==r&&c!==h[b];)g=c.nextSibling,m.appendChild(t?c:c.cloneNode(!0)),c=g;m=u}m=d,f[p]||(m.appendChild(f[p-1].cloneNode(!1)),m=m.firstChild);for(var v,b=p;v=h[b];b++){if(c=v.previousSibling,v==r?i||3!=e.endContainer.nodeType||(m.appendChild(l.createTextNode(r.substringData(0,s))),t&&r.deleteData(0,s)):(u=v.cloneNode(!1),m.appendChild(u)),b!=p||!f[p])for(;c&&c!==o;)v=c.previousSibling,m.insertBefore(t?c:c.cloneNode(!0),m.firstChild),c=v;m=u}return t&&e.setStartBefore(h[p]?f[p]?h[p]:f[p-1]:h[p-1]).collapse(!0),n&&domUtils.remove(n),i&&domUtils.remove(i),d}function Ce(e,t){try{if(we&&domUtils.inDoc(we,e))if(we.nodeValue.replace(fillCharReg,"").length)we.nodeValue=we.nodeValue.replace(fillCharReg,"");else{var n=we.parentNode;for(domUtils.remove(we);n&&domUtils.isEmptyInlineElement(n)&&(browser.safari?!(domUtils.getPosition(n,t)&domUtils.POSITION_CONTAINS):!n.contains(t));)we=n.parentNode,domUtils.remove(n),n=we}}catch(e){}}function De(e,t){var n;for(e=e[t];e&&domUtils.isFillChar(e);)n=e[t],domUtils.remove(e),e=n}function ng(e,t){var n=domUtils.getNodeIndex;(e=e.duplicate()).collapse(t);var i=e.parentElement();if(!i.hasChildNodes())return{container:i,offset:0};for(var o,r=i.children,a=e.duplicate(),s=0,l=r.length-1,d=-1;s<=l;){m=r[d=Math.floor((s+l)/2)],a.moveToElementText(m);var c=a.compareEndPoints("StartToStart",e);if(0"+(ie?"":"
    ")+"

    ",e.removeListener("firstBeforeExecCommand focus",hi),setTimeout(function(){e.focus(),e._selectionChange()},0))}ue=0,ve=domUtils.fillChar,Be=dom.Range=function(e){var t=this;t.startContainer=t.startOffset=t.endContainer=t.endOffset=null,t.document=e,t.collapsed=!0},Be.prototype={cloneContents:function(){return this.collapsed?null:Ae(this,0)},deleteContents:function(){var e;return this.collapsed||Ae(this,1),browser.webkit&&(3!=(e=this.startContainer).nodeType||e.nodeValue.length||(this.setStartBefore(e).collapse(!0),domUtils.remove(e))),this},extractContents:function(){return this.collapsed?null:Ae(this,2)},setStart:function(e,t){return ze(!0,e,t,this)},setEnd:function(e,t){return ze(!1,e,t,this)},setStartAfter:function(e){return this.setStart(e.parentNode,domUtils.getNodeIndex(e)+1)},setStartBefore:function(e){return this.setStart(e.parentNode,domUtils.getNodeIndex(e))},setEndAfter:function(e){return this.setEnd(e.parentNode,domUtils.getNodeIndex(e)+1)},setEndBefore:function(e){return this.setEnd(e.parentNode,domUtils.getNodeIndex(e))},setStartAtFirst:function(e){return this.setStart(e,0)},setStartAtLast:function(e){return this.setStart(e,(3==e.nodeType?e.nodeValue:e.childNodes).length)},setEndAtFirst:function(e){return this.setEnd(e,0)},setEndAtLast:function(e){return this.setEnd(e,(3==e.nodeType?e.nodeValue:e.childNodes).length)},selectNode:function(e){return this.setStartBefore(e).setEndAfter(e)},selectNodeContents:function(e){return this.setStart(e,0).setEndAtLast(e)},cloneRange:function(){var e=this;return new Be(e.document).setStart(e.startContainer,e.startOffset).setEnd(e.endContainer,e.endOffset)},collapse:function(e){var t=this;return e?(t.endContainer=t.startContainer,t.endOffset=t.startOffset):(t.startContainer=t.endContainer,t.startOffset=t.endOffset),t.collapsed=!0,t},shrinkBoundary:function(e){var t,n=this,i=n.collapsed;function o(e){return 1==e.nodeType&&!domUtils.isBookmarkNode(e)&&!dtd.$empty[e.tagName]&&!dtd.$nonChild[e.tagName]}for(;1==n.startContainer.nodeType&&(t=n.startContainer.childNodes[n.startOffset])&&o(t);)n.setStart(t,0);if(i)return n.collapse(!0);if(!e)for(;1==n.endContainer.nodeType&&0=n.nodeValue.length?this.setStartAfter(n):(t=domUtils.split(n,i),n===r?this.setEnd(t,this.endOffset-i):n.parentNode===r&&(this.endOffset+=1),this.setStartBefore(t)),o))return this.collapse(!0);return e||(i=this.endOffset,3==(r=this.endContainer).nodeType&&(0==i?this.setEndBefore(r):(i=n.nodeValue.length&&e["set"+t.replace(/(\w)/,function(e){return e.toUpperCase()})+"After"](n):e["set"+t.replace(/(\w)/,function(e){return e.toUpperCase()})+"Before"](n))}return!e&&this.collapsed||(t(this,"start"),t(this,"end")),this},insertNode:function(e){var t=e,n=1;11==e.nodeType&&(t=e.firstChild,n=e.childNodes.length),this.trimBoundary(!0);var i=this.startContainer,o=this.startOffset,o=i.childNodes[o];return o?i.insertBefore(e,o):i.appendChild(e),t.parentNode===this.endContainer&&(this.endOffset=this.endOffset+n),this.setStartBefore(t)},setCursor:function(e,t){return this.collapse(!e).select(t)},createBookmark:function(e,t){var n,i=this.document.createElement("span");return i.style.cssText="display:none;line-height:0px;",i.appendChild(this.document.createTextNode("‍")),i.id="_baidu_bookmark_start_"+(t?"":ue++),this.collapsed||((n=i.cloneNode(!0)).id="_baidu_bookmark_end_"+(t?"":ue++)),this.insertNode(i),n&&this.collapse().insertNode(n).setEndBefore(n),this.setStartAfter(i),{start:e?i.id:i,end:n?e?n.id:n:null,id:e}},moveToBookmark:function(e){var t=e.id?this.document.getElementById(e.start):e.start,e=e.end&&e.id?this.document.getElementById(e.end):e.end;return this.setStartBefore(t),domUtils.remove(t),e?(this.setEndBefore(e),domUtils.remove(e)):this.collapse(!0),this},enlarge:function(e,t){var n,i,o=domUtils.isBody,r=this.document.createTextNode("");if(e){for(n=1==(i=this.startContainer).nodeType?i=i.childNodes[this.startOffset]||(i.appendChild(r),r):i;;){if(domUtils.isBlockElm(i)){for(i=n;(n=i.previousSibling)&&!domUtils.isBlockElm(n);)i=n;this.setStartBefore(i);break}i=(n=i).parentNode}for(n=1==(i=this.endContainer).nodeType?((n=i.childNodes[this.endOffset])?i.insertBefore(r,n):i.appendChild(r),i=r):i;;){if(domUtils.isBlockElm(i)){for(i=n;(n=i.nextSibling)&&!domUtils.isBlockElm(n);)i=n;this.setEndAfter(i);break}i=(n=i).parentNode}r.parentNode===this.endContainer&&this.endOffset--,domUtils.remove(r)}if(!this.collapsed){for(;!(0!=this.startOffset||t&&t(this.startContainer)||o(this.startContainer));)this.setStartBefore(this.startContainer);for(;!(this.endOffset!=(1==this.endContainer.nodeType?this.endContainer.childNodes:this.endContainer.nodeValue).length||t&&t(this.endContainer)||o(this.endContainer));)this.setEndAfter(this.endContainer)}return this},enlargeToBlockElm:function(e){for(;!domUtils.isBlockElm(this.startContainer);)this.setStartBefore(this.startContainer);if(!e)for(;!domUtils.isBlockElm(this.endContainer);)this.setEndAfter(this.endContainer);return this},adjustmentBoundary:function(){if(!this.collapsed){for(;!domUtils.isBody(this.startContainer)&&this.startOffset==this.startContainer[3==this.startContainer.nodeType?"nodeValue":"childNodes"].length&&this.startContainer[3==this.startContainer.nodeType?"nodeValue":"childNodes"].length;)this.setStartAfter(this.startContainer);for(;!domUtils.isBody(this.endContainer)&&!this.endOffset&&this.endContainer[3==this.endContainer.nodeType?"nodeValue":"childNodes"].length;)this.setEndBefore(this.endContainer)}return this},applyInlineStyle:function(t,n,e){if(this.collapsed)return this;this.trimBoundary().enlarge(!1,function(e){return 1==e.nodeType&&domUtils.isBlockElm(e)}).adjustmentBoundary();function i(e){return 1==e.nodeType?"br"!=e.tagName.toLowerCase():!domUtils.isWhitespace(e)}for(var o,r,a=this.createBookmark(),s=a.end,l=domUtils.getNextDomNode(a.start,!1,i),d=this.cloneRange();l&&domUtils.getPosition(l,s)&domUtils.POSITION_PRECEDING;)if(3==l.nodeType||dtd[t][l.tagName]){for(d.setStartBefore(l),o=l;o&&(3==o.nodeType||dtd[t][o.tagName])&&o!==s;)r=o,o=domUtils.getNextDomNode(o,1==o.nodeType,null,function(e){return dtd[t][e.tagName]});var c,u,m=d.setEndAfter(r).extractContents();if(e&&0");n=(ie&&browser.version<9?"":"")+""+(e.iframeCssUrl?"":"")+(e.initialStyle?"":"")+o.join("")+" + diff --git a/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/dialogs/attachment/attachment.js b/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/dialogs/attachment/attachment.js index 560e911c..10d31be4 100644 --- a/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/dialogs/attachment/attachment.js +++ b/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/dialogs/attachment/attachment.js @@ -157,7 +157,7 @@ return; } - uploader = _this.uploader = WebUploader.create({ + var uploaderOption = { pick: { id: '#filePickerReady', label: lang.uploadSelectFile @@ -169,7 +169,27 @@ fileSingleSizeLimit: fileMaxSize, headers: editor.getOpt('serverHeaders') || {}, compress: false - }); + }; + if(editor.getOpt('uploadServiceEnable')) { + uploaderOption.customUpload = function (file, callback) { + editor.getOpt('uploadServiceUpload')('attachment', file, { + success: function( res ) { + callback.onSuccess(file, {_raw:JSON.stringify(res)}); + }, + error: function( err ) { + callback.onError(file, err); + }, + progress: function( percent ) { + callback.onProgress(file, percent); + } + }, { + from: 'attachment' + }); + }; + } + + + uploader = _this.uploader = WebUploader.create(uploaderOption); uploader.addButton({ id: '#filePickerBlock' }); diff --git a/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/dialogs/audio/audio.html b/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/dialogs/audio/audio.html index e48cf8f1..61fc7cf4 100644 --- a/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/dialogs/audio/audio.html +++ b/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/dialogs/audio/audio.html @@ -78,6 +78,6 @@ - + diff --git a/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/dialogs/audio/audio.js b/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/dialogs/audio/audio.js index 0746de92..07edcf91 100644 --- a/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/dialogs/audio/audio.js +++ b/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/dialogs/audio/audio.js @@ -370,7 +370,7 @@ return; } - uploader = _this.uploader = WebUploader.create({ + var uploaderOption = { pick: { id: '#filePickerReady', label: lang.uploadSelectFile @@ -382,7 +382,27 @@ fileSingleSizeLimit: fileMaxSize, headers: editor.getOpt('serverHeaders') || {}, compress: false - }); + }; + + if(editor.getOpt('uploadServiceEnable')) { + uploaderOption.customUpload = function (file, callback) { + editor.getOpt('uploadServiceUpload')('audio', file, { + success: function( res ) { + callback.onSuccess(file, {_raw:JSON.stringify(res)}); + }, + error: function( err ) { + callback.onError(file, err); + }, + progress: function( percent ) { + callback.onProgress(file, percent); + } + }, { + from: 'audio' + }); + }; + } + + uploader = _this.uploader = WebUploader.create(uploaderOption); uploader.addButton({ id: '#filePickerBlock' }); diff --git a/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/dialogs/image/image.html b/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/dialogs/image/image.html index 1b56bb6b..e7d513fc 100644 --- a/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/dialogs/image/image.html +++ b/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/dialogs/image/image.html @@ -120,6 +120,6 @@
    - + diff --git a/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/dialogs/image/image.js b/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/dialogs/image/image.js index 83c571a3..418cfe00 100644 --- a/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/dialogs/image/image.js +++ b/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/dialogs/image/image.js @@ -411,7 +411,7 @@ return; } - uploader = _this.uploader = WebUploader.create({ + var uploaderOption = { pick: { id: '#filePickerReady', label: lang.uploadSelectFile @@ -433,7 +433,26 @@ maxWidthOrHeight: imageCompressBorder, maxSize: imageMaxSize, } : false - }); + }; + if(editor.getOpt('uploadServiceEnable')) { + uploaderOption.customUpload = function (file, callback) { + editor.getOpt('uploadServiceUpload')('image', file, { + success: function( res ) { + callback.onSuccess(file, {_raw:JSON.stringify(res)}); + }, + error: function( err ) { + callback.onError(file, err); + }, + progress: function( percent ) { + callback.onProgress(file, percent); + } + }, { + from: 'image' + }); + }; + } + + uploader = _this.uploader = WebUploader.create(uploaderOption); uploader.addButton({ id: '#filePickerBlock' }); diff --git a/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/dialogs/scrawl/scrawl.html b/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/dialogs/scrawl/scrawl.html index 6c27867e..ab676878 100644 --- a/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/dialogs/scrawl/scrawl.html +++ b/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/dialogs/scrawl/scrawl.html @@ -70,7 +70,7 @@
    - + + diff --git a/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/dialogs/video/video.js b/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/dialogs/video/video.js index 50ce7481..2ce6cf2e 100644 --- a/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/dialogs/video/video.js +++ b/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/dialogs/video/video.js @@ -424,7 +424,7 @@ return; } - uploader = _this.uploader = WebUploader.create({ + var uploaderOption = { pick: { id: '#filePickerReady', label: lang.uploadSelectFile @@ -436,7 +436,26 @@ fileSingleSizeLimit: fileMaxSize, headers: editor.getOpt('serverHeaders') || {}, compress: false - }); + }; + if(editor.getOpt('uploadServiceEnable')) { + uploaderOption.customUpload = function (file, callback) { + editor.getOpt('uploadServiceUpload')('video', file, { + success: function( res ) { + callback.onSuccess(file, {_raw:JSON.stringify(res)}); + }, + error: function( err ) { + callback.onError(file, err); + }, + progress: function( percent ) { + callback.onProgress(file, percent); + } + }, { + from: 'video' + }); + }; + } + + uploader = _this.uploader = WebUploader.create(uploaderOption); uploader.addButton({ id: '#filePickerBlock' }); diff --git a/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/ueditor.all.js b/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/ueditor.all.js index f3c7d715..6a372a71 100644 --- a/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/ueditor.all.js +++ b/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/ueditor.all.js @@ -17,7 +17,7 @@ window.UE = baidu.editor = { instants: {}, I18N: {}, _customizeUI: {}, - version: "4.1.0-beta", + version: "4.2.0-beta", constants: { STATEFUL: { DISABLED: -1, @@ -1394,6 +1394,24 @@ var utils = (UE.utils = { return new Function("return " + utils.trim(s || ""))(); } }, + base64toBlob: function (base64Data, contentType) { + contentType = contentType || ""; + var sliceSize = 1024; + var byteCharacters = atob(base64Data); + var bytesLength = byteCharacters.length; + var slicesCount = Math.ceil(bytesLength / sliceSize); + var byteArrays = new Array(slicesCount); + for (var sliceIndex = 0; sliceIndex < slicesCount; ++sliceIndex) { + var begin = sliceIndex * sliceSize; + var end = Math.min(begin + sliceSize, bytesLength); + var bytes = new Array(end - begin); + for (var offset = begin, i = 0; offset < end; ++i, ++offset) { + bytes[i] = byteCharacters[offset].charCodeAt(0); + } + byteArrays[sliceIndex] = new Uint8Array(bytes); + } + return new Blob(byteArrays, { type: contentType }); + }, json2str: (function () { if (window.JSON) { return JSON.stringify; @@ -19582,7 +19600,7 @@ UE.plugins["paste"] = function () { var txtContent, htmlContent, address; function getPureHtml(html) { - return html.replace(/<(\/?)([\w\-]+)([^>]*)>/gi, function ( + var result = html.replace(/<(\/?)([\w\-]+)([^>]*)>/gi, function ( a, b, tagName, @@ -19615,9 +19633,12 @@ UE.plugins["paste"] = function () { ) { return ""; } else { - return "<" + b + tagName + " " + utils.trim(attrs) + ">"; + attrs = utils.trim(attrs); + return "<" + b + tagName + (attrs? (" " + attrs): '') + ">"; } }); + result = result.replace(/<\/p >/g, '

    '); + return result; } function filter(div) { @@ -29943,14 +29964,30 @@ UE.plugin.register("autoupload", function () { } var upload = function (file) { - const formData = new FormData(); + if(me.getOpt('uploadServiceEnable')){ + me.getOpt('uploadServiceUpload')('image', file, { + success: function( res ) { + successHandler( res ); + }, + error: function( err ) { + errorHandler(me.getLang("autoupload.loadError") + ' : ' + err); + }, + progress: function( percent ) { + + } + }, { + from: 'paste' + }); + return; + } + var formData = new FormData(); formData.append(fieldName, file, file.name); UE.api.requestAction(me, me.getOpt(filetype + "ActionName"), { data: formData }).then(function (res) { - successHandler(res.data); + successHandler(me.getOpt('serverResponsePrepare')( res.data )); }).catch(function (err) { - errorHandler(me.getLang("autoupload.loadError")); + errorHandler(me.getLang("autoupload.loadError") + ' : ' + err); }); }; @@ -30006,12 +30043,16 @@ UE.plugin.register("autoupload", function () { } function getPasteImage(e) { - return e.clipboardData && - e.clipboardData.items && - e.clipboardData.items.length == 1 && - /^image\//.test(e.clipboardData.items[0].type) - ? e.clipboardData.items - : null; + var images = [] + if (e.clipboardData && e.clipboardData.items) { + var items = e.clipboardData.items + for (let i = 0; i < items.length; i++) { + if (items[i].type.indexOf('image') !== -1) { + images.push(items[i]) + } + } + } + return images; } function getDropImage(e) { @@ -30045,7 +30086,7 @@ UE.plugin.register("autoupload", function () { var hasImg = false, items; //获取粘贴板文件列表或者拖放文件列表 - items = e.type == "paste" ? getPasteImage(e) : getDropImage(e); + items = e.type === "paste" ? getPasteImage(e) : getDropImage(e); if (items) { var len = items.length, file; @@ -30471,35 +30512,58 @@ UE.plugin.register("simpleupload", function () { return; } + var successHandler = function (res) { + const loader = me.document.getElementById(loadingId); + domUtils.removeClasses(loader, "uep-loading"); + const link = me.options.imageUrlPrefix + res.url; + loader.setAttribute("src", link); + loader.setAttribute("_src", link); + loader.setAttribute("alt", res.original || ""); + loader.removeAttribute("id"); + me.fireEvent("contentchange"); + // 触发上传图片事件 + me.fireEvent("uploadsuccess", { + res: res, + type: 'image' + }); + }; + + var errorHandler = function (err) { + UE.dialog.removeLoadingPlaceholder(me, loadingId); + UE.dialog.tipError(me, err); + }; + var upload = function (file) { + if(me.getOpt('uploadServiceEnable')){ + me.getOpt('uploadServiceUpload')('image', file, { + success: function( res ) { + successHandler( res ); + }, + error: function( err ) { + errorHandler(me.getLang("simpleupload.loadError") + ' : ' + err); + }, + progress: function( percent ) { + + } + }, { + from: 'upload' + }); + return; + } const formData = new FormData(); formData.append(me.getOpt('imageFieldName'), file, file.name); UE.api.requestAction(me, me.getOpt("imageActionName"), { data: formData }).then(function (res) { - var resData = me.getOpt('serverResponsePrepare')( res.data ) - if ('SUCCESS' === resData.state && resData.url) { - const loader = me.document.getElementById(loadingId); - domUtils.removeClasses(loader, "uep-loading"); - const link = me.options.imageUrlPrefix + resData.url; - loader.setAttribute("src", link); - loader.setAttribute("_src", link); - loader.setAttribute("alt", resData.original || ""); - loader.removeAttribute("id"); - me.fireEvent("contentchange"); - // 触发上传图片事件 - me.fireEvent("uploadsuccess", { - res: resData, - type: 'image' - }); + res = me.getOpt('serverResponsePrepare')( res.data ) + if ('SUCCESS' === res.state && res.url) { + successHandler(res) } else { - UE.dialog.removeLoadingPlaceholder(me, loadingId); - UE.dialog.tipError(me, resData.state); + errorHandler(res.state); } input.value = ''; }).catch(function (err) { - UE.dialog.removeLoadingPlaceholder(me, loadingId); - UE.dialog.tipError(me, err); + errorHandler(err) input.value = ''; }); }; @@ -34739,23 +34803,23 @@ UE.ui = baidu.editor.ui = {}; var dialogIframeUrlMap = { anchor: "~/dialogs/anchor/anchor.html?2f10d082", - insertimage: "~/dialogs/image/image.html?6a849045", + insertimage: "~/dialogs/image/image.html?4bce17a0", link: "~/dialogs/link/link.html?ccbfcf18", spechars: "~/dialogs/spechars/spechars.html?3bbeb696", searchreplace: "~/dialogs/searchreplace/searchreplace.html?2cb782d2", - insertvideo: "~/dialogs/video/video.html?6622232f", - insertaudio: "~/dialogs/audio/audio.html?89740cff", + insertvideo: "~/dialogs/video/video.html?7fde01cd", + insertaudio: "~/dialogs/audio/audio.html?d264cea1", help: "~/dialogs/help/help.html?05c0c8bf", preview: "~/dialogs/preview/preview.html?5d9a0847", emotion: "~/dialogs/emotion/emotion.html?a7bc0989", wordimage: "~/dialogs/wordimage/wordimage.html?11da452e", formula: "~/dialogs/formula/formula.html?9a5a1511", - attachment: "~/dialogs/attachment/attachment.html?109af49f", + attachment: "~/dialogs/attachment/attachment.html?d632fa7c", insertframe: "~/dialogs/insertframe/insertframe.html?807119a5", edittip: "~/dialogs/table/edittip.html?fa0ea189", edittable: "~/dialogs/table/edittable.html?134e2f06", edittd: "~/dialogs/table/edittd.html?9fe1a06e", - scrawl: "~/dialogs/scrawl/scrawl.html?81bccab9", + scrawl: "~/dialogs/scrawl/scrawl.html?c8323e43", template: "~/dialogs/template/template.html?3c8090b7", background: "~/dialogs/background/background.html?c2bb8b05", contentimport: "~/dialogs/contentimport/contentimport.html?e298f77b", diff --git a/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/ueditor.config.js b/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/ueditor.config.js index 78ddaa6b..a7345cd5 100644 --- a/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/ueditor.config.js +++ b/vendor/modstart/modstart/resources/asset/src/vendor/ueditor/ueditor.config.js @@ -10,14 +10,8 @@ **************************提示********************************/ (function () { - /** - * 编辑器资源文件根路径。它所表示的含义是:以编辑器实例化页面为当前路径,指向编辑器资源文件(即dialog等文件夹)的路径。 - * 鉴于很多同学在使用编辑器的时候出现的种种路径问题,此处强烈建议大家使用"相对于网站根目录的相对路径"进行配置。 - * "相对于网站根目录的相对路径"也就是以斜杠开头的形如"/myProject/ueditor/"这样的路径。 - * 如果站点中有多个不在同一层级的页面需要实例化编辑器,且引用了同一UEditor的时候,此处的URL可能不适用于每个页面的编辑器。 - * 因此,UEditor提供了针对不同页面的编辑器可单独配置的根路径,具体来说,在需要实例化编辑器的页面最顶部写上如下代码即可。当然,需要令此处的URL等于对应的配置。 - * window.UEDITOR_HOME_URL = "/xxxx/xxxx/"; - */ + // 资源文件根路径,如果你的页面不是放在根目录下,请注意修改这个路径 + // 通常情况下这个可以配置成静态资源CDN的地址 var URL, CORS_URL; if (window.UEDITOR_HOME_URL) { URL = window.UEDITOR_HOME_URL; @@ -28,6 +22,8 @@ } else { URL = getUEBasePath(); } + // 需要能跨域的静态资源请求,主要用户弹窗页面等静态资源 + // 通常情况下这个可以配置成静态资源CDN的地址 if (window.UEDITOR_CORS_URL) { CORS_URL = window.UEDITOR_CORS_URL; } else if (window.__msRoot) { @@ -188,6 +184,33 @@ // } } + // 自定义上传功能 + , uploadServiceEnable: false + // 自定义上传函数,需要在这个函数中实现自定义上传逻辑 + // type 上传类型,image 图片,video 视频,audio 音频,attachment 附件 + // file 文件对象 + // callback 回调函数,需要在上传完成后调用 callback.success、callback.error、callback.progress + // option 上传配置,其他一些未来扩展配置 + , uploadServiceUpload: function(type, file, callback, option ) { + console.log('uploadServiceUpload', type, file, callback, option); + // var i = 0; + // var call = function(){ + // i++; + // if(i > 3){ + // callback.success({ + // "state": "SUCCESS", + // "url": "https://ms-assets.modstart.com/demo/modstart.jpg", + // }) + // return; + // } + // setTimeout(function(){ + // callback.progress(0.3 * i); + // call(); + // },500); + // } + // call(); + } + // 插入图片自定义配置 , imageConfig: { // 禁止本地上传 diff --git a/vendor/modstart/modstart/src/Admin/Config/AdminMenu.php b/vendor/modstart/modstart/src/Admin/Config/AdminMenu.php index deef09a1..366c0fd7 100644 --- a/vendor/modstart/modstart/src/Admin/Config/AdminMenu.php +++ b/vendor/modstart/modstart/src/Admin/Config/AdminMenu.php @@ -4,12 +4,18 @@ namespace ModStart\Admin\Config; +use Illuminate\Support\Facades\Log; +use ModStart\Core\Util\SerializeUtil; + class AdminMenu { private static $menu = []; public static function register($menu) { + if (is_array($menu)) { + Log::warning('AdminMenu.register is not callable - ' . SerializeUtil::jsonEncode($menu)); + } self::$menu[] = $menu; } diff --git a/vendor/modstart/modstart/src/Command/InitCommand.php b/vendor/modstart/modstart/src/Command/InitCommand.php new file mode 100644 index 00000000..bd79fca0 --- /dev/null +++ b/vendor/modstart/modstart/src/Command/InitCommand.php @@ -0,0 +1,47 @@ +option('username'); + $password = $this->option('password'); + while (empty($username)) { + $username = $this->ask('Please Input Username'); + } + while (empty($password)) { + $password = $this->ask('Please Input Password'); + } + + $this->info('ModStart.Init - migrate - start'); + $ret = Artisan::call('migrate', ['--force' => true]); + $this->info('ModStart.Init - migrate - end - code:' . $ret); + + $this->info('ModStart.Init - modstart:module-install-all - start'); + $ret = Artisan::call('modstart:module-install-all'); + $this->info('ModStart.Init - modstart:module-install-all - end - code:' . $ret); + + if (ModelUtil::count(AdminUser::class) == 0) { + $admin = Admin::add($username, $password); + $this->info('ModStart.Init - init user - id:' . $admin['id'] . ', username:' . $username . ', password: ' . $password); + } else { + $this->info('ModStart.Init - init user - ignore'); + } + + $lockFile = storage_path('install.lock'); + if (!file_exists($lockFile)) { + file_put_contents($lockFile, 'ok'); + } + } + +} diff --git a/vendor/modstart/modstart/src/Core/Util/ExceptionUtil.php b/vendor/modstart/modstart/src/Core/Util/ExceptionUtil.php new file mode 100644 index 00000000..08ec6227 --- /dev/null +++ b/vendor/modstart/modstart/src/Core/Util/ExceptionUtil.php @@ -0,0 +1,51 @@ + true, + ], $option); + $message = $e->getMessage(); + if (!empty($option['mysql'])) { + if (Str::contains($message, 'Duplicate entry')) { + BizException::throws(L('Records Duplicated')); + } + $formatErrorTemplates = [ + ['Data too long for column', '/Data too long for column \'(.*)\' at row/', 'FieldTooLong'], + ['Data truncated for column', '/Data truncated for column \'(.*)\' at row/', 'FieldTooLong'], + ['Incorrect integer value', '/ for column \'(.*)\' at row/', 'FieldFormatError'], + ['Incorrect decimal value', '/ for column \'(.*)\' at row/', 'FieldFormatError'], + ['Incorrect datetime value', '/ for column \'(.*)\' at row/', 'FieldFormatError'], + ['Incorrect time value', '/ for column \'(.*)\' at row/', 'FieldFormatError'], + ['Incorrect date value', '/ for column \'(.*)\' at row/', 'FieldFormatError'], + ]; + $langTrans = [ + 'FieldTooLong' => "Field %s Too Long", + 'FieldFormatError' => "Field %s Format Error", + ]; + foreach ($formatErrorTemplates as $f) { + if (Str::contains($message, $f[0])) { + $column = ReUtil::group1($f[1], $message); + if (!empty($column)) { + $msg = $f[2]; + if (isset($langTrans[$msg])) { + $msg = L($langTrans[$msg], $column); + } else { + $msg = "$msg:$column"; + } + BizException::throws($msg); + } + throw $e; + } + } + } + throw $e; + } +} diff --git a/vendor/modstart/modstart/src/Core/Util/HtmlUtil.php b/vendor/modstart/modstart/src/Core/Util/HtmlUtil.php index 52c5bb5b..ff1b6842 100644 --- a/vendor/modstart/modstart/src/Core/Util/HtmlUtil.php +++ b/vendor/modstart/modstart/src/Core/Util/HtmlUtil.php @@ -46,14 +46,24 @@ public static function recordsReplaceImageSrcToFull(&$records, $key, $useAssets } } - public static function extractTextAndImages($content) + public static function extractTextAndImages($content, $option = []) { + $option = array_merge([ + // 是否将换行转换为空格 + 'textBreakToSpace' => false, + ], $option); + $summary = [ 'text' => '', 'images' => [] ]; $text = preg_replace('/<[^>]+>/', '', $content); + // 替换多余的空行 + $text = preg_replace('/\n\s*\n/', "\n", $text); + if ($option['textBreakToSpace']) { + $text = str_replace("\n", ' ', $text); + } $summary['text'] = $text; preg_match_all('//i', $content, $mat); diff --git a/vendor/modstart/modstart/src/Core/Util/RandomUtil.php b/vendor/modstart/modstart/src/Core/Util/RandomUtil.php index 75dadb2f..a4747bc9 100644 --- a/vendor/modstart/modstart/src/Core/Util/RandomUtil.php +++ b/vendor/modstart/modstart/src/Core/Util/RandomUtil.php @@ -123,6 +123,15 @@ public static function upperString($length) return substr(str_shuffle(str_repeat($pool, $length)), 0, $length); } + public static function withIn($chars, $length) + { + $result = []; + for ($i = 0; $i < $length; $i++) { + $result[] = $chars[rand(0, strlen($chars) - 1)]; + } + return join('', $result); + } + /** * @Util 随机UUID * @return string UUID diff --git a/vendor/modstart/modstart/src/Core/Util/TreeUtil.php b/vendor/modstart/modstart/src/Core/Util/TreeUtil.php index 1e1f4014..d3b5a671 100644 --- a/vendor/modstart/modstart/src/Core/Util/TreeUtil.php +++ b/vendor/modstart/modstart/src/Core/Util/TreeUtil.php @@ -402,6 +402,32 @@ public static function treeChain(&$tree, $id, $pk_name = 'id', $pid_name = 'pid' return []; } + /** + * 获取树的所有子节点 + * @param $tree + * @param $id + * @param $pk_name + * @param $pid_name + * @param $children + * @return array|mixed + */ + public static function treeChildren(&$tree, $id, $pk_name = 'id', $pid_name = 'pid') + { + foreach ($tree as $item) { + if ($item[$pk_name] == $id) { + return isset($item[self::$CHILD_KEY]) ? $item[self::$CHILD_KEY] : []; + } else { + if (!empty($item[self::$CHILD_KEY])) { + $children = self::treeChildren($item[self::$CHILD_KEY], $id, $pk_name, $pid_name); + if (!is_null($children)) { + return $children; + } + } + } + } + return null; + } + /** * 根据id计算节点的所有上级 * @param $nodes diff --git a/vendor/modstart/modstart/src/Field/AbstractField.php b/vendor/modstart/modstart/src/Field/AbstractField.php index 72da050e..5ad7f909 100644 --- a/vendor/modstart/modstart/src/Field/AbstractField.php +++ b/vendor/modstart/modstart/src/Field/AbstractField.php @@ -445,8 +445,9 @@ public function item($item = null) /** * 数据反序列化 - * @param $value - * @param $model + * 数据从存储系统(如数据库)读取出来,会调用此方法转换为字段 $value 值 + * @param mixed $value 字段值 + * @param AbstractField $field 字段对象 * @return mixed */ public function unserializeValue($value, AbstractField $field) @@ -455,9 +456,10 @@ public function unserializeValue($value, AbstractField $field) } /** - * 值序列化 - * @param $value - * @param $model + * 字段值序列化 + * 数据提交到存储系统(如数据库)时,会调用此方法转换为存储值 + * @param mixed $value 字段值 + * @param mixed $model 当前记录 * @return mixed */ public function serializeValue($value, $model) @@ -466,9 +468,10 @@ public function serializeValue($value, $model) } /** - * 转换从view到提交值 - * @param mixed $value - * @param array $dataSubmitted + * 字段输入获取准备 + * 数据从用户输入获后需要进行的处理,如转换、验证等,如果异常可以直接抛出 BizException 异常 + * @param mixed $value 字段值 + * @param array $dataSubmitted 用户提交的所有数据 * @return mixed */ public function prepareInput($value, $dataSubmitted) diff --git a/vendor/modstart/modstart/src/Field/ComplexFieldsList.php b/vendor/modstart/modstart/src/Field/ComplexFieldsList.php index 7d38f4f1..45711e1f 100644 --- a/vendor/modstart/modstart/src/Field/ComplexFieldsList.php +++ b/vendor/modstart/modstart/src/Field/ComplexFieldsList.php @@ -25,6 +25,7 @@ protected function setup() // ['name' => 'xxx', 'title' => '文本(只读)', 'type' => 'display', 'defaultValue' => '', 'placeholder'=>'', 'tip'=>'', ], // ['name' => 'xxx', 'title' => '开关', 'type' => 'switch', 'defaultValue' => false, 'placeholder'=>'', 'tip'=>'', ], // ['name' => 'xxx', 'title' => '文本', 'type' => 'text', 'defaultValue' => '', 'placeholder'=>'', 'tip'=>'', ], + // ['name' => 'xxx', 'title' => '文本', 'type' => 'textarea', 'defaultValue' => '', 'placeholder'=>'', 'tip'=>'', ], // ['name' => 'xxx', 'title' => '图标', 'type' => 'icon', 'defaultValue' => 'iconfont icon-home', 'placeholder'=>'', 'tip'=>'', ], // ['name' => 'xxx', 'title' => '数字', 'type' => 'number', 'defaultValue' => 0, 'placeholder'=>'', 'tip'=>'', ], // ['name' => 'xxx', 'title' => '数字', 'type' => 'number-text', 'defaultValue' => 0, 'placeholder'=>'', 'tip'=>'', ], diff --git a/vendor/modstart/modstart/src/Field/SelectRemote.php b/vendor/modstart/modstart/src/Field/SelectRemote.php index b98a9e5f..1bcf2385 100644 --- a/vendor/modstart/modstart/src/Field/SelectRemote.php +++ b/vendor/modstart/modstart/src/Field/SelectRemote.php @@ -26,6 +26,13 @@ public function server($server) return $this; } + /** + * 动态显示模型数据 + * @param $table string 模型表名 + * @param $valueKey string 模型主键,默认为id + * @param $labelKey string 模型显示字段,默认为title + * @return $this + */ public function viewWithModel($table, $valueKey = 'id', $labelKey = 'title') { $this->hookRendering(function (AbstractField $field, $item, $index) use ($table, $valueKey, $labelKey) { @@ -43,6 +50,13 @@ public function viewWithModel($table, $valueKey = 'id', $labelKey = 'title') return $this; } + /** + * @param $table string 模型表名 + * @param $valueKey string 模型主键,默认为id + * @param $labelKey string 模型显示字段,默认为title + * @param $param array 查询参数 + * @return array + */ public static function handleModel($table, $valueKey = 'id', $labelKey = 'title', $param = []) { if (!isset($param['sort'])) { diff --git a/vendor/modstart/modstart/src/Form/Form.php b/vendor/modstart/modstart/src/Form/Form.php index 9dc4d409..73ea5da2 100644 --- a/vendor/modstart/modstart/src/Form/Form.php +++ b/vendor/modstart/modstart/src/Form/Form.php @@ -17,6 +17,7 @@ use ModStart\Core\Input\Response; use ModStart\Core\Type\SortDirection; use ModStart\Core\Util\CRUDUtil; +use ModStart\Core\Util\ExceptionUtil; use ModStart\Core\Util\IdUtil; use ModStart\Core\Util\SerializeUtil; use ModStart\Detail\Detail; @@ -545,6 +546,8 @@ public function formRequest($callback, array $data = null) return Response::jsonError($e->getMessage()); } catch (ResultException $e) { return Response::jsonError($e->getMessage()); + } catch (\Exception $e) { + ExceptionUtil::throwExcpectException($e); } } diff --git a/vendor/modstart/modstart/src/ModStartServiceProvider.php b/vendor/modstart/modstart/src/ModStartServiceProvider.php index ad545857..0215560b 100644 --- a/vendor/modstart/modstart/src/ModStartServiceProvider.php +++ b/vendor/modstart/modstart/src/ModStartServiceProvider.php @@ -30,6 +30,7 @@ class ModStartServiceProvider extends ServiceProvider { protected $commands = [ + \ModStart\Command\InitCommand::class, \ModStart\Command\ModuleListCommand::class, \ModStart\Command\ModuleInstallCommand::class, \ModStart\Command\ModuleUninstallCommand::class, diff --git a/vendor/modstart/modstart/src/Repository/EloquentRepository.php b/vendor/modstart/modstart/src/Repository/EloquentRepository.php index 41db6a34..3d2aefb8 100644 --- a/vendor/modstart/modstart/src/Repository/EloquentRepository.php +++ b/vendor/modstart/modstart/src/Repository/EloquentRepository.php @@ -17,6 +17,7 @@ use ModStart\Core\Exception\ResultException; use ModStart\Core\Type\SortAddPosition; use ModStart\Core\Type\SortDirection; +use ModStart\Core\Util\ExceptionUtil; use ModStart\Core\Util\ReUtil; use ModStart\Core\Util\TreeUtil; use ModStart\Detail\Detail; @@ -487,43 +488,11 @@ public function add(Form $form) ResultException::throwsIfFail($form->hookCall($form->hookChanged())); }); } catch (\Exception $e) { - $this->throwDatabaseException($e); + ExceptionUtil::throwExcpectException($e); } return $model->getKey(); } - /** - * 统一处理数据库异常 - * @param \Exception $e - * @throws BizException - */ - private function throwDatabaseException(\Exception $e) - { - $message = $e->getMessage(); - if (Str::contains($message, 'Duplicate entry')) { - BizException::throws(L('Records Duplicated')); - } - $formatErrorTemplates = [ - ['Data too long for column', '/Data too long for column \'(.*)\' at row/', 'FieldTooLong'], - ['Data truncated for column', '/Data truncated for column \'(.*)\' at row/', 'FieldTooLong'], - ['Incorrect integer value', '/ for column \'(.*)\' at row/', 'FieldFormatError'], - ['Incorrect decimal value', '/ for column \'(.*)\' at row/', 'FieldFormatError'], - ['Incorrect datetime value', '/ for column \'(.*)\' at row/', 'FieldFormatError'], - ['Incorrect time value', '/ for column \'(.*)\' at row/', 'FieldFormatError'], - ['Incorrect date value', '/ for column \'(.*)\' at row/', 'FieldFormatError'], - ]; - foreach ($formatErrorTemplates as $f) { - if (Str::contains($message, $f[0])) { - $column = ReUtil::group1($f[1], $message); - if (!empty($column)) { - BizException::throws("{$f[2]}:$column"); - } - throw $e; - } - } - throw $e; - } - /** * 更新数据 * @@ -567,7 +536,7 @@ public function edit(Form $form) ResultException::throwsIfFail($form->hookCall($form->hookChanged())); }); } catch (\Exception $e) { - $this->throwDatabaseException($e); + ExceptionUtil::throwExcpectException($e); } return $result; } diff --git a/vendor/modstart/modstart/src/helpers.php b/vendor/modstart/modstart/src/helpers.php index 5d193ccc..41bfa32c 100644 --- a/vendor/modstart/modstart/src/helpers.php +++ b/vendor/modstart/modstart/src/helpers.php @@ -361,37 +361,66 @@ function L_locale_title($locale = null) function L_locale($locale = null) { - static $useLocale = null; + static $useLocales = [ + 'Admin' => null, + 'Web' => null, + ]; + $app = \ModStart\App\Core\CurrentApp::WEB; $localeList = config('modstart.i18n.langs', []); if (\ModStart\App\Core\CurrentApp::is(\ModStart\App\Core\CurrentApp::ADMIN)) { $app = \ModStart\App\Core\CurrentApp::ADMIN; $localeList = config('modstart.admin.i18n.langs', []); } - $changingLocale = null; + + if (!array_key_exists($app, $useLocales)) { + return 'zh'; + } + + $forceLocale = null; if (null !== $locale) { if (!isset($localeList[$locale])) { - $changingLocale = $locale; + $forceLocale = $locale; } } - if (null !== $changingLocale || null === $useLocale) { - // routeLocale > sessionLocale > i18nLocale > locale > fallbackLocale + + if (null !== $forceLocale || null === $useLocales[$app]) { + + // forceLocale > routeLocale > sessionLocale > i18nLocale > locale > fallbackLocale + + $routeLocale = null; + if ($app == \ModStart\App\Core\CurrentApp::WEB) { + $routeLocale = \Illuminate\Support\Facades\Request::route('locale'); + } + $sessionLocaleKey = '_locale'; if ($app == \ModStart\App\Core\CurrentApp::ADMIN) { $sessionLocaleKey = '_adminLocale'; } - $routeLocale = \Illuminate\Support\Facades\Request::route('locale'); $sessionLocale = \Illuminate\Support\Facades\Session::get($sessionLocaleKey, null); + $i18nLocale = null; - $locale = config('app.locale'); - $fallbackLocale = config('app.fallback_locale'); if (!\ModStart\App\Core\CurrentApp::is(\ModStart\App\Core\CurrentApp::ADMIN) - && - ModuleManager::isModuleInstalled('I18n')) { + && ModuleManager::isModuleInstalled('I18n')) { $i18nLocale = \Module\I18n\Util\LangUtil::getDefault('shortName'); - $langTrans = \Module\I18n\Util\LangTransUtil::map(); } - $currentLocale = $changingLocale; + + $locale = config('app.locale'); + + $fallbackLocale = config('app.fallback_locale'); + + //if (!empty($_GET['_DEBUG']) && !$routeLocale) { + // \Illuminate\Support\Facades\Log::info('$forceLocale - ' . json_encode([ + // $app, + // $routeLocale, + // $sessionLocale, + // $locale, + // $fallbackLocale, + // debug_backtrace(), + // ])); + //} + + $currentLocale = $forceLocale; if (empty($currentLocale)) { $currentLocale = $routeLocale; } @@ -408,9 +437,17 @@ function L_locale($locale = null) $currentLocale = $fallbackLocale; } \Illuminate\Support\Facades\Session::put($sessionLocaleKey, $currentLocale); - $useLocale = $currentLocale; + $useLocales[$app] = $currentLocale; } - return $useLocale; + return $useLocales[$app]; +} + +function L_format($name, $params) +{ + if (empty($params)) { + return $name; + } + return sprintf($name, ...$params); } /** @@ -427,22 +464,32 @@ function L_locale($locale = null) */ function LM($module, $name, ...$params) { - static $trackMissing = null; $useLocale = L_locale(); - if (null === $trackMissing) { - $trackMissing = config('modstart.trackMissingLang', false); + if (empty($useLocale)) { + return $name; } static $langs = []; if (!isset($langs[$module])) { $langs[$module] = []; - if ($useLocale && file_exists($file = ModuleManager::path($module, "Lang/$useLocale.php"))) { - $langs[$module] = (require $file); + $langFile = ModuleManager::path($module, "Lang/$useLocale.php"); + if (file_exists($langFile)) { + $langs[$module] = (require $langFile); } } if (isset($langs[$module][$name])) { - return L($langs[$module][$name], ...$params); + return L_format($langs[$module][$name], $params); } - return L($name, ...$params); + static $trackMissing = null; + if (null === $trackMissing) { + $trackMissing = config('modstart.trackMissingLang', false); + } + if ($trackMissing) { + $langs[$module][$name] = $name; + ksort($langs[$module]); + $langFile = ModuleManager::path($module, "Lang/$useLocale.php"); + \ModStart\Core\Util\FileUtil::write($langFile, \ModStart\Core\Util\CodeUtil::phpVarExportReturnFile($langs[$module])); + } + return L_format($name, $params); } /** @@ -459,67 +506,62 @@ function LM($module, $name, ...$params) */ function L($name, ...$params) { - static $trackMissing = null; - static $trackMissingData = null; $useLocale = L_locale(); - if (null === $trackMissing) { - $trackMissing = config('modstart.trackMissingLang', false); - } if (empty($useLocale)) { return $name; } - if ($trackMissing && null === $trackMissingData) { - $trackMissingData = []; - if (file_exists($file = storage_path('cache/lang_missing.php'))) { - $trackMissingData = (require $file); - } - register_shutdown_function(function () use (&$trackMissingData, $file) { - ksort($trackMissingData); - file_put_contents($file, ' $v) { + if (is_array($v)) { + foreach ($v as $kk => $vv) { + $lang['validation.' . $k . '.' . $kk] = $vv; + } + } else { + $lang['validation.' . $k] = $v; + } } - if (!empty($params)) { - return call_user_func_array('sprintf', array_merge([$trans], $params)); + } + if (ModuleManager::isModuleInstalled('I18n')) { + $langTrans = \Module\I18n\Util\LangTransUtil::map(); + if (isset($langTrans[$useLocale])) { + $lang = array_merge($lang, $langTrans[$useLocale]); } - return $trans; } } - if ($trackMissing) { - $trackMissingData[$nameRaw] = $nameRaw; + if (isset($lang[$name])) { + return L_format($lang[$name], $params); } - if (!empty($params)) { - return call_user_func_array('sprintf', array_merge([$name], $params)); + static $trackMissing = null; + if (null === $trackMissing) { + $trackMissing = config('modstart.trackMissingLang', false); + } + if ($trackMissing) { + $lang[$name] = $name; + $langFile = base_path('resources/lang/' . $useLocale . '/base.php'); + if (file_exists($langFile)) { + $langFileData = (require $langFile); + } else { + $langFileData = []; + } + $langFileData[$name] = $name; + ksort($langFileData); + file_put_contents($langFile, \ModStart\Core\Util\CodeUtil::phpVarExportReturnFile($langFileData)); } - return $nameRaw; + return L_format($name, $params); } if (!function_exists('array_build')) { diff --git a/vendor/modstart/modstart/views/admin/frame.blade.php b/vendor/modstart/modstart/views/admin/frame.blade.php index 9b453fdb..aa6286e6 100644 --- a/vendor/modstart/modstart/views/admin/frame.blade.php +++ b/vendor/modstart/modstart/views/admin/frame.blade.php @@ -137,7 +137,7 @@ class="title" data-keywords-filter> @if(\ModStart\Admin\Auth\AdminPermission::permit('SystemManage')) @@ -149,7 +149,7 @@ class="title" data-keywords-filter>
    @@ -177,7 +177,7 @@ class="title" data-keywords-filter> @if(\ModStart\Admin\Auth\AdminPermission::permit('\ModStart\Admin\Controller\ProfileController@changePassword')) {{L('Change Password')}} + href="{{modstart_admin_url('profile/change_password')}}">{{L('Change Password')}} @endif {{L('Logout')}} diff --git a/vendor/modstart/modstart/views/admin/login.blade.php b/vendor/modstart/modstart/views/admin/login.blade.php index 52c313d6..a91c7ce0 100644 --- a/vendor/modstart/modstart/views/admin/login.blade.php +++ b/vendor/modstart/modstart/views/admin/login.blade.php @@ -70,7 +70,7 @@
    - +
    diff --git a/vendor/modstart/modstart/views/core/field/complexFieldsList.blade.php b/vendor/modstart/modstart/views/core/field/complexFieldsList.blade.php index 0a7c8182..0b04b4b2 100644 --- a/vendor/modstart/modstart/views/core/field/complexFieldsList.blade.php +++ b/vendor/modstart/modstart/views/core/field/complexFieldsList.blade.php @@ -38,6 +38,11 @@ class="iconfont icon-warning"> + @elseif($f['type']=='textarea') + @elseif($f['type']=='icon') diff --git a/vendor/modstart/modstart/views/core/grid/filter/eq-select.blade.php b/vendor/modstart/modstart/views/core/grid/filter/eq-select.blade.php index c9460a8e..ebbbc13d 100644 --- a/vendor/modstart/modstart/views/core/grid/filter/eq-select.blade.php +++ b/vendor/modstart/modstart/views/core/grid/filter/eq-select.blade.php @@ -1,24 +1,95 @@ +selectSearch() || $field->selectRemote()){ + $useVueRender = true; +} +?>
    {{$label}}
    -
    - -
    + @if($useVueRender) +
    + + selectSearch() || $field->selectRemote()) filterable @endif + @if($field->selectRemote()) remote :remote-method="onRemoteMethod" @endif + :loading="loading"> + + +
    + @else +
    + +
    + @endif
    +@if($useVueRender) +{{ \ModStart\ModStart::js('asset/vendor/vue.js') }} +{{ \ModStart\ModStart::js('asset/vendor/element-ui/index.js') }} +{{ \ModStart\ModStart::css('asset/vendor/element-ui/index.css') }} +@endif diff --git a/vendor/modstart/modstart/views/core/grid/index.blade.php b/vendor/modstart/modstart/views/core/grid/index.blade.php index a106b8cf..3a3b2d4f 100644 --- a/vendor/modstart/modstart/views/core/grid/index.blade.php +++ b/vendor/modstart/modstart/views/core/grid/index.blade.php @@ -51,7 +51,7 @@ @endif @if($canExport) - @endif