From 5480a6367ad9a409f630adbef376cee7bb1775e1 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 10 May 2017 17:48:55 +0200 Subject: [PATCH] Improved and unified build scripts --- extra/_build.js | 86 ------------- extra/_buildAll.js | 42 +++++++ extra/_buildCore.js | 119 ++++++++++++++++++ extra/_buildExternal.js | 82 ++++++++++++ extra/build.bat | 11 -- extra/build.sh | 8 -- extra/buildAll.bat | 5 + extra/buildAll.sh | 2 + extra/compiler.js | 33 +++++ .../files/acp/js/WCF.ACP.Language.min.js | 2 +- .../install/files/acp/js/WCF.ACP.Style.min.js | 2 +- wcfsetup/install/files/acp/js/WCF.ACP.min.js | 4 +- .../redactor2/redactor.combined.min.js | 64 +++++----- wcfsetup/install/files/js/WCF.Combined.min.js | 52 ++++---- .../install/files/js/WCF.Combined.tiny.min.js | 40 +++--- wcfsetup/install/files/js/require.build.js | 9 +- 16 files changed, 370 insertions(+), 191 deletions(-) delete mode 100644 extra/_build.js create mode 100644 extra/_buildAll.js create mode 100644 extra/_buildCore.js create mode 100644 extra/_buildExternal.js delete mode 100644 extra/build.bat delete mode 100644 extra/build.sh create mode 100644 extra/buildAll.bat create mode 100644 extra/buildAll.sh create mode 100644 extra/compiler.js diff --git a/extra/_build.js b/extra/_build.js deleted file mode 100644 index 4f412984c8..0000000000 --- a/extra/_build.js +++ /dev/null @@ -1,86 +0,0 @@ -const fs = require("fs"); -const uglify = require("uglify-js"); - -let uglifyJsConfig = { - compress: { - sequences: true, - properties: true, - dead_code: true, - conditionals: true, - comparisons: true, - booleans: true, - loops: true, - hoist_funs: true, - hoist_vars: true, - if_return: true, - join_vars: true, - cascade: true, - /* this is basically the `--define` argument */ - global_defs: { - COMPILER_TARGET_DEFAULT: false - } - } -}; - -function compile(destination, files) { - let minifiedData = []; - - files.forEach(filename => { - minifiedData.push({ - filename: filename, - content: uglify.minify(filename, uglifyJsConfig) - }); - }); - - let content = `// ${destination} -- DO NOT EDIT\n\n`; - - minifiedData.forEach(fileData => { - content += `// ${fileData.filename}\n`; - content += `(function (window, undefined) { ${fileData.content.code} })(this);`; - content += "\n\n"; - }); - - fs.writeFileSync(destination, content); -}; - -// -// step 1) build `WCF.Combined.min.js` and `WCF.Combined.tiny.min.js` -// -process.chdir("../wcfsetup/install/files/js/"); -[true, false].forEach(COMPILER_TARGET_DEFAULT => { - uglifyJsConfig.compress.global_defs.COMPILER_TARGET_DEFAULT = COMPILER_TARGET_DEFAULT; - - let output = "WCF.Combined" + (COMPILER_TARGET_DEFAULT ? "" : ".tiny") + ".min.js"; - console.time(output); - { - let data = fs.readFileSync(".buildOrder", "utf8"); - let files = data - .trim() - .split(/\r?\n/) - .map(filename => `${filename}.js`); - - compile(output, files); - } - console.timeEnd(output); -}); - -// -// step 2) Redactor II + plugins -// -const redactorCombined = "redactor.combined.min.js"; -process.chdir("3rdParty/redactor2/"); - -console.time(redactorCombined); -{ - let files = ['redactor.js']; - fs.readdirSync("./plugins/").forEach(file => { - file = `plugins/${file}`; - let stat = fs.statSync(file); - if (stat.isFile() && !stat.isSymbolicLink()) { - files.push(file); - } - }); - - compile(redactorCombined, files); -} -console.timeEnd(redactorCombined); diff --git a/extra/_buildAll.js b/extra/_buildAll.js new file mode 100644 index 0000000000..73b268e94d --- /dev/null +++ b/extra/_buildAll.js @@ -0,0 +1,42 @@ +const childProcess = require("child_process"); +const fs = require("fs"); + +if (process.argv.length !== 3) { + throw new Error("Requires the base path as argument."); +} + +const basePath = process.argv[2]; +if (!basePath.match(/[\\\/]$/)) { + throw new Error("Path must end with a slash - any slash will do."); +} +else if (!fs.existsSync(basePath)) { + throw new Error(`Invalid path, '${basePath}' does not exist or is not readable.`); +} + +fs.readdirSync(basePath) + .filter(directory => { + if (directory.indexOf('.') !== 0 && fs.statSync(basePath + directory).isDirectory()) { + // filter by known repository name patterns + if (directory === "WCF" || directory.indexOf("com.woltlab.") === 0) { + return true; + } + } + + return false; + }) + .forEach(directory => { + console.log(`##### Building ${directory} #####\n`); + + let path = basePath + directory; + if (directory === "WCF") { + childProcess.execSync(`node _buildCore.js`, { + stdio: [0, 1, 2] + }); + } + else { + childProcess.execSync(`node _buildExternal.js ${path}`, { + stdio: [0, 1, 2] + }); + } + console.log("\n"); + }); \ No newline at end of file diff --git a/extra/_buildCore.js b/extra/_buildCore.js new file mode 100644 index 0000000000..5b2137bbbf --- /dev/null +++ b/extra/_buildCore.js @@ -0,0 +1,119 @@ +const childProcess = require("child_process"); +const compiler = require("./compiler"); +const fs = require("fs"); + +function compile(destination, files, overrides) { + let minifiedData = []; + + files.forEach(filename => { + minifiedData.push({ + filename: filename, + content: compiler.compile(filename, overrides) + }); + }); + + let content = `// ${destination} -- DO NOT EDIT\n\n`; + + minifiedData.forEach(fileData => { + content += `// ${fileData.filename}\n`; + content += `(function (window, undefined) { ${fileData.content.code} })(this);`; + content += "\n\n"; + }); + + fs.writeFileSync(destination, content); +}; + +// +// step 1) build `WCF.Combined.min.js` and `WCF.Combined.tiny.min.js` +// +process.chdir("../wcfsetup/install/files/js/"); +[true, false].forEach(COMPILER_TARGET_DEFAULT => { + let output = "WCF.Combined" + (COMPILER_TARGET_DEFAULT ? "" : ".tiny") + ".min.js"; + console.time(output); + { + let data = fs.readFileSync(".buildOrder", "utf8"); + let files = data + .trim() + .split(/\r?\n/) + .map(filename => `${filename}.js`); + + compile(output, files, { + compress: { + global_defs: { + COMPILER_TARGET_DEFAULT: COMPILER_TARGET_DEFAULT + } + } + }); + } + console.timeEnd(output); +}); + +// +// step 2) Redactor II + plugins +// +const redactorCombined = "redactor.combined.min.js"; +process.chdir("3rdParty/redactor2/"); + +console.time(redactorCombined); +{ + let files = ['redactor.js']; + fs.readdirSync("./plugins/").forEach(file => { + file = `plugins/${file}`; + let stat = fs.statSync(file); + if (stat.isFile() && !stat.isSymbolicLink()) { + files.push(file); + } + }); + + compile(redactorCombined, files); +} +console.timeEnd(redactorCombined); + +// +// step3) build rjs +// +const rjsCmd = (process.platform === "win32") ? "r.js.cmd" : "r.js"; +process.chdir("../../"); + +{ + let configFile = "require.build.js"; + let outFilename = require(process.cwd() + `/${configFile}`).out; + + [true, false].forEach(COMPILER_TARGET_DEFAULT => { + let overrides = "uglify2.global_defs.COMPILER_TARGET_DEFAULT=" + (COMPILER_TARGET_DEFAULT ? "true" : "false"); + if (!COMPILER_TARGET_DEFAULT) { + outFilename = outFilename.replace(/\.min\.js$/, '.tiny.min.js'); + overrides += " out=" + outFilename; + } + + console.time(outFilename); + childProcess.execSync(`${rjsCmd} -o ${configFile} ${overrides}`, { + cwd: process.cwd(), + stdio: [0, 1, 2] + }); + console.timeEnd(outFilename); + }); +} + +// +// step 4) legacy ACP scripts +// +process.chdir("../acp/js/"); + +fs.readdirSync("./") + .filter(filename => { + let stat = fs.statSync(filename); + if (stat.isFile() && !stat.isSymbolicLink()) { + return filename.match(/\.js$/) && !filename.match(/\.min\.js$/); + } + + return false; + }) + .forEach(filename => { + console.time(filename); + { + let output = compiler.compile(process.cwd() + `/${filename}`); + fs.writeFileSync(filename.replace(/\.js$/, '.min.js'), output.code); + } + console.timeEnd(filename); + }); diff --git a/extra/_buildExternal.js b/extra/_buildExternal.js new file mode 100644 index 0000000000..b4195234d7 --- /dev/null +++ b/extra/_buildExternal.js @@ -0,0 +1,82 @@ +const childProcess = require("child_process"); +const compiler = require("./compiler"); +const fs = require("fs"); +const path = require("path"); + +if (process.argv.length !== 3) { + throw new Error("Requires the path to an existing repository."); +} + +const repository = process.argv[2]; +if (!fs.existsSync(repository)) { + throw new Error(`Unable to locate repsitory, the path ${repository} is invalid.`); +} +process.chdir(repository); + +let rjsPaths = []; + +// get all directories at the repository root +fs.readdirSync("./") + .filter(directory => fs.statSync(directory).isDirectory()) + .forEach(directory => { + // look for a generic `js` directory + let path = `./${directory}/js/`; + if (fs.existsSync(path)) { + fs.readdirSync(path) + .filter(filename => { + // ignore build configurations + if (filename === "require.build.js") { + if (rjsPaths.indexOf(path) === -1) rjsPaths.push(path); + + return false; + } + + let stat = fs.statSync(path + filename); + // allow only non-minified *.js files + if (stat.isFile() && !stat.isSymbolicLink() && filename.match(/\.js$/) && !filename.match(/\.min\.js$/)) { + return true; + } + + return false; + }) + .forEach(filename => { + [true, false].forEach(COMPILER_TARGET_DEFAULT => { + let outFilename = filename.replace(/\.js$/, (COMPILER_TARGET_DEFAULT ? "" : ".tiny") + ".min.js"); + console.time(outFilename); + { + let output = compiler.compile(path + filename, { + compress: { + global_defs: { + COMPILER_TARGET_DEFAULT: COMPILER_TARGET_DEFAULT + } + } + }); + + fs.writeFileSync(path + outFilename, output.code); + } + console.timeEnd(outFilename); + }); + }); + } + }); + +const rjsCmd = (process.platform === "win32") ? "r.js.cmd" : "r.js"; +rjsPaths.forEach(path => { + let buildConfig = `${path}require.build.js`; + let outFilename = require(process.cwd() + `/${buildConfig}`).out; + + [true, false].forEach(COMPILER_TARGET_DEFAULT => { + let overrides = "uglify2.global_defs.COMPILER_TARGET_DEFAULT=" + (COMPILER_TARGET_DEFAULT ? "true" : "false"); + if (!COMPILER_TARGET_DEFAULT) { + outFilename = outFilename.replace(/\.min\.js$/, '.tiny.min.js'); + overrides += " out=" + outFilename; + } + + console.time(outFilename); + childProcess.execSync(`${rjsCmd} -o require.build.js ${overrides}`, { + cwd: path, + stdio: [0, 1, 2] + }); + console.timeEnd(outFilename); + }); +}); diff --git a/extra/build.bat b/extra/build.bat deleted file mode 100644 index e3525462f1..0000000000 --- a/extra/build.bat +++ /dev/null @@ -1,11 +0,0 @@ -@echo off - -call node _build.js - -cd ..\wcfsetup\install\files\js\ -rem default build -call r.js.cmd -o require.build.js uglify2.global_defs.COMPILER_TARGET_DEFAULT=true -rem tiny build -call r.js.cmd -o require.build.js uglify2.global_defs.COMPILER_TARGET_DEFAULT=false out=WoltLabSuite.Core.tiny.min.js - -pause \ No newline at end of file diff --git a/extra/build.sh b/extra/build.sh deleted file mode 100644 index 0e99d00ef6..0000000000 --- a/extra/build.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -node _build.js - -cd ../wcfsetup/install/files/js/ -# default build -r.js -o require.build.js uglify2.global_defs.COMPILER_TARGET_DEFAULT=true -# tiny build -r.js -o require.build.js uglify2.global_defs.COMPILER_TARGET_DEFAULT=false out=WoltLabSuite.Core.tiny.min.js diff --git a/extra/buildAll.bat b/extra/buildAll.bat new file mode 100644 index 0000000000..b87a292b10 --- /dev/null +++ b/extra/buildAll.bat @@ -0,0 +1,5 @@ +@echo off + +call node _buildAll.js ../../ + +pause \ No newline at end of file diff --git a/extra/buildAll.sh b/extra/buildAll.sh new file mode 100644 index 0000000000..0e240cf02e --- /dev/null +++ b/extra/buildAll.sh @@ -0,0 +1,2 @@ +#!/bin/sh +node _buildAll.js ../../ diff --git a/extra/compiler.js b/extra/compiler.js new file mode 100644 index 0000000000..b700ebc9cf --- /dev/null +++ b/extra/compiler.js @@ -0,0 +1,33 @@ +const fs = require("fs"); +const uglify = require("uglify-js"); + +const uglifyJsConfig = { + compress: { + sequences: true, + properties: true, + dead_code: true, + conditionals: true, + comparisons: true, + booleans: true, + loops: true, + hoist_funs: true, + hoist_vars: true, + if_return: true, + join_vars: true, + cascade: true, + /* this is basically the `--define` argument */ + global_defs: { + COMPILER_TARGET_DEFAULT: false + } + } +}; + +module.exports = { + compile: (filename, overrides) => { + if (overrides === undefined) overrides = {}; + + return uglify.minify( + filename, + Object.assign(uglifyJsConfig, overrides)); + } +} \ No newline at end of file diff --git a/wcfsetup/install/files/acp/js/WCF.ACP.Language.min.js b/wcfsetup/install/files/acp/js/WCF.ACP.Language.min.js index 2ceaf6b631..03b7712caf 100644 --- a/wcfsetup/install/files/acp/js/WCF.ACP.Language.min.js +++ b/wcfsetup/install/files/acp/js/WCF.ACP.Language.min.js @@ -1 +1 @@ -WCF.ACP.Language={},WCF.ACP.Language.ItemList=Class.extend({_proxy:null,_dialog:null,_notification:null,init:function(){this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),$(".jsLanguageItem").each($.proxy(function(a,t){var e=$(t),i=e.data("languageItemID"),n=this;e.click(function(){n._click(i)})},this))},_click:function(a){this._proxy.setOption("data",{actionName:"prepareEdit",className:"wcf\\data\\language\\item\\LanguageItemAction",objectIDs:[a]}),this._proxy.sendRequest()},_success:function(a){a.returnValues?(this._showDialog(a.returnValues.template,a.returnValues.languageItem),this._dialog.find(".jsSubmitLanguageItem").click($.proxy(this._submit,this))):(null===this._notification&&(this._notification=new WCF.System.Notification(WCF.Language.get("wcf.global.success.edit"))),this._dialog.wcfDialog("close"),this._notification.show())},_showDialog:function(a,t){null===this._dialog&&(this._dialog=$("#languageItemEdit"),this._dialog.length||(this._dialog=$('
').hide().appendTo(document.body))),this._dialog.html(a).wcfDialog({title:t}).wcfDialog("render")},_submit:function(){var a=$("#overlayLanguageItemValue").val(),t=$("#overlayLanguageCustomItemValue").val(),e=$("#overlayLanguageUseCustomValue").is(":checked")?1:0,i=$("#overlayLanguageItemID").val();this._proxy.setOption("data",{actionName:"edit",className:"wcf\\data\\language\\item\\LanguageItemAction",objectIDs:[i],parameters:{languageItemValue:a,languageCustomItemValue:t,languageUseCustomValue:e}}),this._proxy.sendRequest()}}); \ No newline at end of file +WCF.ACP.Language={},WCF.ACP.Language.ItemList=Class.extend({_proxy:null,_dialog:null,_notification:null,init:function(){this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),$(".jsLanguageItem").each($.proxy(function(a,t){var e=$(t),i=e.data("languageItemID"),n=this;e.click(function(){n._click(i)})},this))},_click:function(a){this._proxy.setOption("data",{actionName:"prepareEdit",className:"wcf\\data\\language\\item\\LanguageItemAction",objectIDs:[a]}),this._proxy.sendRequest()},_success:function(a,t,e){a.returnValues?(this._showDialog(a.returnValues.template,a.returnValues.languageItem),this._dialog.find(".jsSubmitLanguageItem").click($.proxy(this._submit,this))):(null===this._notification&&(this._notification=new WCF.System.Notification(WCF.Language.get("wcf.global.success.edit"))),this._dialog.wcfDialog("close"),this._notification.show())},_showDialog:function(a,t){null===this._dialog&&(this._dialog=$("#languageItemEdit"),this._dialog.length||(this._dialog=$('
').hide().appendTo(document.body))),this._dialog.html(a).wcfDialog({title:t}).wcfDialog("render")},_submit:function(){var a=$("#overlayLanguageItemValue").val(),t=$("#overlayLanguageCustomItemValue").val(),e=$("#overlayLanguageUseCustomValue").is(":checked")?1:0,i=$("#overlayLanguageItemID").val();this._proxy.setOption("data",{actionName:"edit",className:"wcf\\data\\language\\item\\LanguageItemAction",objectIDs:[i],parameters:{languageItemValue:a,languageCustomItemValue:t,languageUseCustomValue:e}}),this._proxy.sendRequest()}}); \ No newline at end of file diff --git a/wcfsetup/install/files/acp/js/WCF.ACP.Style.min.js b/wcfsetup/install/files/acp/js/WCF.ACP.Style.min.js index 085bdc20ef..2b6f21cdbf 100644 --- a/wcfsetup/install/files/acp/js/WCF.ACP.Style.min.js +++ b/wcfsetup/install/files/acp/js/WCF.ACP.Style.min.js @@ -1 +1 @@ -WCF.ACP.Style={},WCF.ACP.Style.CopyStyle=Class.extend({_styleID:0,init:function(t){this._styleID=t;var e=this;$(".jsCopyStyle").click(function(){WCF.System.Confirmation.show(WCF.Language.get("wcf.acp.style.copyStyle.confirmMessage"),$.proxy(e._copy,e),void 0,void 0,!0)})},_copy:function(t){"confirm"===t&&new WCF.Action.Proxy({autoSend:!0,data:{actionName:"copy",className:"wcf\\data\\style\\StyleAction",objectIDs:[this._styleID]},success:$.proxy(this._success,this)})},_success:function(t){window.location=t.returnValues.redirectURL}}),WCF.ACP.Style.ImageUpload=WCF.Upload.extend({_button:null,_image:null,_styleID:0,_tmpHash:"",init:function(t,e){this._styleID=parseInt(t)||0,this._tmpHash=e,this._button=$("#uploadImage"),this._image=$("#styleImage"),this._super(this._button,void 0,"wcf\\data\\style\\StyleAction")},_initFile:function(){return this._image},_getParameters:function(){return{styleID:this._styleID,tmpHash:this._tmpHash}},_success:function(t,e){if(e.returnValues.url){this._image.attr("src",e.returnValues.url+"?timestamp="+Date.now()),this._button.next(".innerError").remove();var s=new WCF.System.Notification(WCF.Language.get("wcf.global.success"));s.show()}else e.returnValues.errorType&&this._getInnerErrorElement().text(WCF.Language.get("wcf.acp.style.image.error."+e.returnValues.errorType))},_getInnerErrorElement:function(){var t=this._button.next(".innerError");return t.length||(t=$('').insertAfter(this._button)),t}}),WCF.ACP.Style.LogoUpload=WCF.Upload.extend({_button:null,_imagePath:null,_logo:null,_pageLogo:null,_tmpHash:"",_wcfPath:"",init:function(t,e){this._tmpHash=t,this._wcfPath=e,this._button=$("#uploadLogo"),this._image=$("#styleLogo"),this._imagePath=$("#imagePath"),this._pageLogo=$("#pageLogo"),this._super(this._button,void 0,"wcf\\data\\style\\StyleAction",{action:"uploadLogo"}),this._image.attr("src").length||this._updateLogo(),this._pageLogo.blur($.proxy(this._updateLogo,this))},_updateLogo:function(){var t=this._pageLogo.val();if(t.length){if(!t.match(/^https?:\/\//)){var e=this._imagePath.val();e||(e="images/"),e=this._wcfPath+e.replace(/^\/?images\/?/,""),"/"!==e.substr(-1)&&(e+="/"),t=e+t}}else t=WCF_PATH+"images/default-logo.png",$("#pageLogoWidth").val(281),$("#pageLogoHeight").val(40);this._image.attr("src",t+"?timestamp="+Date.now())},_initFile:function(){return this._image},_getParameters:function(){return{tmpHash:this._tmpHash}},_success:function(t,e){if(e.returnValues.url){this._image.attr("src",e.returnValues.url+"?timestamp="+Date.now()),this._pageLogo.val(e.returnValues.url),this._button.next(".innerError").remove(),$("#pageLogoWidth").val(e.returnValues.width),$("#pageLogoHeight").val(e.returnValues.height);var s=new WCF.System.Notification(WCF.Language.get("wcf.global.success"));s.show()}else e.returnValues.errorType&&this._getInnerErrorElement().text(WCF.Language.get("wcf.acp.style.image.error."+e.returnValues.errorType))},_getInnerErrorElement:function(){var t=this._button.next(".innerError");return t.length||(t=$('').insertAfter(this._button)),t}}),WCF.ACP.Style.LogoUploadMobile=WCF.Upload.extend({_button:null,_imagePath:null,_logo:null,_pageLogo:null,_tmpHash:"",_wcfPath:"",init:function(t,e){this._tmpHash=t,this._wcfPath=e,this._button=$("#uploadLogoMobile"),this._image=$("#styleLogoMobile"),this._imagePath=$("#imagePathMobile"),this._pageLogo=$("#pageLogoMobile"),this._super(this._button,void 0,"wcf\\data\\style\\StyleAction",{action:"uploadLogoMobile"}),this._image.attr("src").length||this._updateLogo(),this._pageLogo.blur($.proxy(this._updateLogo,this))},_updateLogo:function(){var t=this._pageLogo.val();if(t.length){if(!t.match(/^https?:\/\//)){var e=this._imagePath.val();e||(e="images/"),e=this._wcfPath+e.replace(/^\/?images\/?/,""),"/"!==e.substr(-1)&&(e+="/"),t=e+t}}else t=WCF_PATH+"images/default-logo-small.png";this._image.attr("src",t+"?timestamp="+Date.now())},_initFile:function(){return this._image},_getParameters:function(){return{tmpHash:this._tmpHash}},_success:function(t,e){if(e.returnValues.url){this._image.attr("src",e.returnValues.url+"?timestamp="+Date.now()),this._pageLogo.val(e.returnValues.url),this._button.next(".innerError").remove();var s=new WCF.System.Notification(WCF.Language.get("wcf.global.success"));s.show()}else e.returnValues.errorType&&this._getInnerErrorElement().text(WCF.Language.get("wcf.acp.style.image.error."+e.returnValues.errorType))},_getInnerErrorElement:function(){var t=this._button.next(".innerError");return t.length||(t=$('').insertAfter(this._button)),t}}),WCF.ACP.Style.List=Class.extend({_proxy:null,init:function(){this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),$(".styleList .buttonList").each($.proxy(function(t,e){var s=$(e),i=s.data("styleID"),a=this;s.find(".jsSetAsDefault").click(function(){a._click("setAsDefault",i)}),s.find(".jsDelete").click(function(t){a._delete(t,i)})},this))},_click:function(t,e){this._proxy.setOption("data",{actionName:t,className:"wcf\\data\\style\\StyleAction",objectIDs:[e]}),this._proxy.sendRequest()},_delete:function(t,e){var s=$(t.currentTarget).data("confirmMessageHtml");if(s){var i=this;WCF.System.Confirmation.show(s,function(t){"confirm"===t&&i._click("delete",e)},void 0,void 0,!0)}else this._click("delete",e)},_success:function(){window.location.reload()}}); \ No newline at end of file +WCF.ACP.Style={},WCF.ACP.Style.CopyStyle=Class.extend({_styleID:0,init:function(t){this._styleID=t;var e=this;$(".jsCopyStyle").click(function(){WCF.System.Confirmation.show(WCF.Language.get("wcf.acp.style.copyStyle.confirmMessage"),$.proxy(e._copy,e),void 0,void 0,!0)})},_copy:function(t){"confirm"===t&&new WCF.Action.Proxy({autoSend:!0,data:{actionName:"copy",className:"wcf\\data\\style\\StyleAction",objectIDs:[this._styleID]},success:$.proxy(this._success,this)})},_success:function(t,e,s){window.location=t.returnValues.redirectURL}}),WCF.ACP.Style.ImageUpload=WCF.Upload.extend({_button:null,_image:null,_styleID:0,_tmpHash:"",init:function(t,e){this._styleID=parseInt(t)||0,this._tmpHash=e,this._button=$("#uploadImage"),this._image=$("#styleImage"),this._super(this._button,void 0,"wcf\\data\\style\\StyleAction")},_initFile:function(t){return this._image},_getParameters:function(){return{styleID:this._styleID,tmpHash:this._tmpHash}},_success:function(t,e){if(e.returnValues.url){this._image.attr("src",e.returnValues.url+"?timestamp="+Date.now()),this._button.next(".innerError").remove();new WCF.System.Notification(WCF.Language.get("wcf.global.success")).show()}else e.returnValues.errorType&&this._getInnerErrorElement().text(WCF.Language.get("wcf.acp.style.image.error."+e.returnValues.errorType))},_getInnerErrorElement:function(){var t=this._button.next(".innerError");return t.length||(t=$('').insertAfter(this._button)),t}}),WCF.ACP.Style.LogoUpload=WCF.Upload.extend({_button:null,_imagePath:null,_logo:null,_pageLogo:null,_tmpHash:"",_wcfPath:"",init:function(t,e){this._tmpHash=t,this._wcfPath=e,this._button=$("#uploadLogo"),this._image=$("#styleLogo"),this._imagePath=$("#imagePath"),this._pageLogo=$("#pageLogo"),this._super(this._button,void 0,"wcf\\data\\style\\StyleAction",{action:"uploadLogo"}),this._image.attr("src").length||this._updateLogo(),this._pageLogo.blur($.proxy(this._updateLogo,this))},_updateLogo:function(){var t=this._pageLogo.val();if(t.length){if(!t.match(/^https?:\/\//)){var e=this._imagePath.val();e||(e="images/"),e=this._wcfPath+e.replace(/^\/?images\/?/,""),"/"!==e.substr(-1)&&(e+="/"),t=e+t}}else t=WCF_PATH+"images/default-logo.png",$("#pageLogoWidth").val(281),$("#pageLogoHeight").val(40);this._image.attr("src",t+"?timestamp="+Date.now())},_initFile:function(t){return this._image},_getParameters:function(){return{tmpHash:this._tmpHash}},_success:function(t,e){if(e.returnValues.url){this._image.attr("src",e.returnValues.url+"?timestamp="+Date.now()),this._pageLogo.val(e.returnValues.url),this._button.next(".innerError").remove(),$("#pageLogoWidth").val(e.returnValues.width),$("#pageLogoHeight").val(e.returnValues.height);new WCF.System.Notification(WCF.Language.get("wcf.global.success")).show()}else e.returnValues.errorType&&this._getInnerErrorElement().text(WCF.Language.get("wcf.acp.style.image.error."+e.returnValues.errorType))},_getInnerErrorElement:function(){var t=this._button.next(".innerError");return t.length||(t=$('').insertAfter(this._button)),t}}),WCF.ACP.Style.LogoUploadMobile=WCF.Upload.extend({_button:null,_imagePath:null,_logo:null,_pageLogo:null,_tmpHash:"",_wcfPath:"",init:function(t,e){this._tmpHash=t,this._wcfPath=e,this._button=$("#uploadLogoMobile"),this._image=$("#styleLogoMobile"),this._imagePath=$("#imagePathMobile"),this._pageLogo=$("#pageLogoMobile"),this._super(this._button,void 0,"wcf\\data\\style\\StyleAction",{action:"uploadLogoMobile"}),this._image.attr("src").length||this._updateLogo(),this._pageLogo.blur($.proxy(this._updateLogo,this))},_updateLogo:function(){var t=this._pageLogo.val();if(t.length){if(!t.match(/^https?:\/\//)){var e=this._imagePath.val();e||(e="images/"),e=this._wcfPath+e.replace(/^\/?images\/?/,""),"/"!==e.substr(-1)&&(e+="/"),t=e+t}}else t=WCF_PATH+"images/default-logo-small.png";this._image.attr("src",t+"?timestamp="+Date.now())},_initFile:function(t){return this._image},_getParameters:function(){return{tmpHash:this._tmpHash}},_success:function(t,e){if(e.returnValues.url){this._image.attr("src",e.returnValues.url+"?timestamp="+Date.now()),this._pageLogo.val(e.returnValues.url),this._button.next(".innerError").remove();new WCF.System.Notification(WCF.Language.get("wcf.global.success")).show()}else e.returnValues.errorType&&this._getInnerErrorElement().text(WCF.Language.get("wcf.acp.style.image.error."+e.returnValues.errorType))},_getInnerErrorElement:function(){var t=this._button.next(".innerError");return t.length||(t=$('').insertAfter(this._button)),t}}),WCF.ACP.Style.List=Class.extend({_proxy:null,init:function(){this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),$(".styleList .buttonList").each($.proxy(function(t,e){var s=$(e),i=s.data("styleID"),a=this;s.find(".jsSetAsDefault").click(function(){a._click("setAsDefault",i)}),s.find(".jsDelete").click(function(t){a._delete(t,i)})},this))},_click:function(t,e){this._proxy.setOption("data",{actionName:t,className:"wcf\\data\\style\\StyleAction",objectIDs:[e]}),this._proxy.sendRequest()},_delete:function(t,e){var s=$(t.currentTarget).data("confirmMessageHtml");if(s){var i=this;WCF.System.Confirmation.show(s,function(t){"confirm"===t&&i._click("delete",e)},void 0,void 0,!0)}else this._click("delete",e)},_success:function(t,e,s){window.location.reload()}}); \ No newline at end of file diff --git a/wcfsetup/install/files/acp/js/WCF.ACP.min.js b/wcfsetup/install/files/acp/js/WCF.ACP.min.js index 52712e0c37..d3bedb6459 100644 --- a/wcfsetup/install/files/acp/js/WCF.ACP.min.js +++ b/wcfsetup/install/files/acp/js/WCF.ACP.min.js @@ -1,2 +1,2 @@ -WCF.ACP={},WCF.ACP.Application={},WCF.ACP.Cronjob={},WCF.ACP.Cronjob.ExecutionHandler=Class.extend({_notification:null,_proxy:null,init:function(){this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),$(".jsCronjobRow .jsExecuteButton").click($.proxy(this._click,this)),this._notification=new WCF.System.Notification(WCF.Language.get("wcf.global.success"),"success")},_click:function(e){this._proxy.setOption("data",{actionName:"execute",className:"wcf\\data\\cronjob\\CronjobAction",objectIDs:[$(e.target).data("objectID")]}),this._proxy.sendRequest()},_success:function(e){$(".jsCronjobRow").each($.proxy(function(t,a){var i=$(a).find(".jsExecuteButton"),s=i.data("objectID");return WCF.inArray(s,e.objectIDs)?(e.returnValues[s]&&($(a).find("td.columnNextExec").html(e.returnValues[s].formatted),$(a).wcfHighlight()),this._notification.show(),!1):void 0},this))}}),WCF.ACP.Cronjob.LogList=Class.extend({_dialog:null,init:function(){$(".jsCronjobLogDelete").click(function(){WCF.System.Confirmation.show(WCF.Language.get("wcf.acp.cronjob.log.clear.confirm"),function(e){"confirm"==e&&new WCF.Action.Proxy({autoSend:!0,data:{actionName:"clearAll",className:"wcf\\data\\cronjob\\log\\CronjobLogAction"},success:function(){window.location.reload()}})})}),$(".jsCronjobError").click($.proxy(this._showError,this))},_showError:function(e){var t=$(e.currentTarget);null===this._dialog?(this._dialog=$('
'+t.next().html()+"
").hide().appendTo(document.body),this._dialog.wcfDialog({title:WCF.Language.get("wcf.acp.cronjob.log.error.details")})):(this._dialog.html("
"+t.next().html()+"
"),this._dialog.wcfDialog("open"))}}),WCF.ACP.Package={},WCF.ACP.Package.Installation=Class.extend({_actionName:"InstallPackage",_allowRollback:!1,_dialog:null,_dialogTitle:"",_proxy:null,_queueID:0,_shouldRender:!1,init:function(e,t,a,i){switch(this._actionName=t?t:"InstallPackage",this._allowRollback=a===!0,this._queueID=e,this._actionName){case"InstallPackage":this._dialogTitle="wcf.acp.package."+(i?"update":"install")+".title";break;case"UninstallPackage":this._dialogTitle="wcf.acp.package.uninstallation.title"}this._initProxy(),this._init()},_initProxy:function(){for(var e="",t=this._actionName.split(/([A-Z][a-z0-9]+)/),a=0,i=t.length;i>a;a++){var s=t[a];s.length&&(e.length&&(e+="-"),e+=s.toLowerCase())}this._proxy=new WCF.Action.Proxy({failure:$.proxy(this._failure,this),showLoadingOverlay:!1,success:$.proxy(this._success,this),url:"index.php?"+e+"/&t="+SECURITY_TOKEN})},_init:function(){$("#submitButton").click($.proxy(this.prepareInstallation,this))},_failure:function(){null!==this._dialog&&($("#packageInstallationProgress").removeAttr("value"),this._setIcon("times")),this._allowRollback&&null!==this._dialog&&this._purgeTemplateContent($.proxy(function(){var e=$('
').appendTo($("#packageInstallationInnerContent"));$('").appendTo(e).click($.proxy(this._rollback,this)),$("#packageInstallationInnerContentContainer").show(),this._dialog.wcfDialog("render")},this))},_rollback:function(e){this._setIcon("spinner"),e&&$(e.currentTarget).disable(),this._executeStep("rollback")},prepareInstallation:function(){document.activeElement&&document.activeElement.blur(),this._proxy.setOption("data",this._getParameters()),this._proxy.sendRequest()},_getParameters:function(){return{queueID:this._queueID,step:"prepare"}},_success:function(e){if(this._shouldRender=!1,null===this._dialog&&(this._dialog=$('
').hide().appendTo(document.body),this._dialog.wcfDialog({closable:!1,title:WCF.Language.get(this._dialogTitle)})),this._setIcon("spinner"),"rollback"==e.step)return this._dialog.wcfDialog("close"),this._dialog.remove(),void new WCF.PeriodicalExecuter(function(t){t.stop();var a=new WCF.ACP.Package.Uninstallation;a.start(e.packageID)},200);if(e.queueID&&(this._queueID=e.queueID),e.template&&!e.ignoreTemplate&&(this._dialog.html(e.template),this._shouldRender=!0),e.progress&&($("#packageInstallationProgress").attr("value",e.progress).text(e.progress+"%"),$("#packageInstallationProgressLabel").text(e.progress+"%")),e.currentAction&&$("#packageInstallationAction").html(e.currentAction),"success"===e.step)return this._setIcon("check"),void this._purgeTemplateContent($.proxy(function(){var t=$('
').appendTo($("#packageInstallationInnerContent")),a=$('").appendTo(t).click(function(){$(this).disable(),window.location=e.redirectLocation});$("#packageInstallationInnerContentContainer").show(),$(document).keydown(function(e){e.which===$.ui.keyCode.ENTER&&a.trigger("click")}),this._dialog.wcfDialog("render")},this));if(e.innerTemplate){var t=this;if($("#packageInstallationInnerContent").html(e.innerTemplate).find("input").keyup(function(a){a.keyCode===$.ui.keyCode.ENTER&&t._submit(e)}),e.step&&e.node){$("#packageInstallationProgress").removeAttr("value"),this._setIcon("question");var a=$('
').appendTo($("#packageInstallationInnerContent"));$('").appendTo(a).click($.proxy(function(t){$(t.currentTarget).disable(),this._submit(e)},this))}return $("#packageInstallationInnerContentContainer").show(),void this._dialog.wcfDialog("render")}this._purgeTemplateContent($.proxy(function(){this._shouldRender&&this._dialog.wcfDialog("render"),e.step&&e.node&&this._executeStep(e.step,e.node)},this))},_submit:function(e){this._setIcon("spinner");var t={};$("#packageInstallationInnerContent input").each(function(e,a){var i=$(a),s=i.attr("type");if("checkbox"!=s&&"radio"!=s||i.prop("checked")){var n=i.attr("name");n.match(/(.*)\[([^[]*)\]$/)?(n=RegExp.$1,$key=RegExp.$2,void 0===t[n]&&(t[n]=$key?{}:[]),$key?t[n][$key]=i.val():t[n].push(i.val())):t[n]=i.val()}}),this._executeStep(e.step,e.node,t)},_purgeTemplateContent:function(e){$("#packageInstallationInnerContent").children().length&&($("#packageInstallationInnerContentContainer").hide(),$("#packageInstallationInnerContent").empty(),this._shouldRender=!0),e()},_executeStep:function(e,t,a){a||(a={});var i=$.extend({node:t,queueID:this._queueID,step:e},a);this._proxy.setOption("data",i),this._proxy.sendRequest()},_setIcon:function(e){this._dialog.find(".jsPackageInstallationStatus").removeClass("fa-check fa-question fa-times fa-spinner").addClass("fa-"+e)}}),WCF.ACP.Package.Installation.Cancel=Class.extend({init:function(e){$("#backButton").click(function(){new WCF.Action.Proxy({autoSend:!0,data:{actionName:"cancelInstallation",className:"wcf\\data\\package\\installation\\queue\\PackageInstallationQueueAction",objectIDs:[e]},success:function(e){window.location=e.returnValues.url}})})}}),WCF.ACP.Package.Uninstallation=WCF.ACP.Package.Installation.extend({_elements:null,_packageID:0,_wcfPackageListURL:"",init:function(e,t){this._elements=e,this._packageID=0,this._wcfPackageListURL=t,void 0!==this._elements&&this._elements.length&&this._super(0,"UninstallPackage")},start:function(e){this._actionName="UninstallPackage",this._packageID=e,this._queueID=0,this._dialogTitle="wcf.acp.package.uninstallation.title",this._initProxy(),this.prepareInstallation()},_init:function(){this._elements.click($.proxy(this._showConfirmationDialog,this))},_showConfirmationDialog:function(e){var t=$(e.currentTarget);if(t.data("isApplication")&&this._wcfPackageListURL)return void(window.location=WCF.String.unescapeHTML(this._wcfPackageListURL.replace(/{packageID}/,t.data("objectID"))));var a=this;WCF.System.Confirmation.show(t.data("confirmMessage"),function(e){"confirm"===e&&(a._packageID=t.data("objectID"),a.prepareInstallation())},void 0,void 0,!0)},_getParameters:function(){return{packageID:this._packageID,step:"prepare"}}}),WCF.ACP.Package.Search=Class.extend({_button:null,_cache:{},_container:null,_dialog:null,_package:null,_packageDescription:null,_packageName:null,_packageSearchResultContainer:null,_packageSearchResultList:null,_pageCount:0,_pageNo:1,_proxy:null,_searchID:0,_selectedPackage:"",_selectedPackageVersion:"",init:function(){this._button=null,this._cache={},this._container=$("#packageSearch"),this._dialog=null,this._package=null,this._packageName=null,this._packageSearchResultContainer=$("#packageSearchResultContainer"),this._packageSearchResultList=$("#packageSearchResultList"),this._pageCount=0,this._pageNo=1,this._searchDescription=null,this._searchID=0,this._selectedPackage="",this._selectedPackageVersion="",this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),this._initElements()},_initElements:function(){this._button=this._container.find(".formSubmit > button.jsButtonPackageSearch").disable().click($.proxy(this._search,this)),this._package=$("#package").keyup($.proxy(this._keyUp,this)),this._packageDescription=$("#packageDescription").keyup($.proxy(this._keyUp,this)),this._packageName=$("#packageName").keyup($.proxy(this._keyUp,this))},_keyUp:function(e){""===this._package.val()&&""===this._packageDescription.val()&&""===this._packageName.val()?this._button.disable():(this._button.enable(),13===e.which&&this._button.trigger("click"))},_search:function(){var e=this._getSearchValues();return this._validate(e)?(e.pageNo=this._pageNo,this._proxy.setOption("data",{actionName:"search",className:"wcf\\data\\package\\update\\PackageUpdateAction",parameters:e}),void this._proxy.sendRequest()):!1},_getSearchValues:function(){return{package:$.trim(this._package.val()),packageDescription:$.trim(this._packageDescription.val()),packageName:$.trim(this._packageName.val())}},_validate:function(e){return""===e.package&&""===e.packageDescription&&""===e.packageName?!1:!0},_success:function(e){switch(e.actionName){case"getResultList":this._insertTemplate(e.returnValues.template);break;case"prepareInstallation":if(e.returnValues.queueID){null!==this._dialog&&this._dialog.wcfDialog("close");var t=new WCF.ACP.Package.Installation(e.returnValues.queueID,void 0,!1);t.prepareInstallation()}else e.returnValues.template&&(null===this._dialog?(this._dialog=$("
"+e.returnValues.template+"
").hide().appendTo(document.body),this._dialog.wcfDialog({title:WCF.Language.get("wcf.acp.package.update.unauthorized")})):this._dialog.html(e.returnValues.template).wcfDialog("open"),this._dialog.find(".formSubmit > button").click($.proxy(this._submitAuthentication,this)));break;case"search":this._pageCount=e.returnValues.pageCount,this._searchID=e.returnValues.searchID,this._insertTemplate(e.returnValues.template,void 0===e.returnValues.count?void 0:e.returnValues.count),this._setupPagination()}},_submitAuthentication:function(e){var t=$("#packageUpdateServerUsername"),a=$("#packageUpdateServerPassword");t.next("small.innerError").remove(),a.next("small.innerError").remove();var i=!0;""===$.trim(t.val())&&($(''+WCF.Language.get("wcf.global.form.error.empty")+"").insertAfter(t),i=!1),""===$.trim(a.val())&&($(''+WCF.Language.get("wcf.global.form.error.empty")+"").insertAfter(a),i=!1),i&&this._prepareInstallation($(e.currentTarget).data("packageUpdateServerID"))},_insertTemplate:function(e,t){this._packageSearchResultContainer.show(),this._packageSearchResultList.html(e),void 0===t&&(this._content[this._pageNo]=e),void 0!==t&&(this._content={1:e},this._packageSearchResultContainer.find("h2.sectionTitle > .badge").html(t)),this._packageSearchResultList.find(".jsInstallPackage").click($.proxy(this._click,this))},_click:function(e){var t=$(e.currentTarget);WCF.System.Confirmation.show(t.data("confirmMessage"),$.proxy(function(e){"confirm"===e&&(this._selectedPackage=t.data("package"),this._selectedPackageVersion=t.data("packageVersion"),this._prepareInstallation())},this),void 0,void 0,!0)},_prepareInstallation:function(e){var t={packages:{}};t.packages[this._selectedPackage]=this._selectedPackageVersion,e&&(t.authData={packageUpdateServerID:e,password:$.trim($("#packageUpdateServerPassword").val()),saveCredentials:$("#packageUpdateServerSaveCredentials:checked").length?!0:!1,username:$.trim($("#packageUpdateServerUsername").val())}),this._proxy.setOption("data",{actionName:"prepareInstallation",className:"wcf\\data\\package\\update\\PackageUpdateAction",parameters:t}),this._proxy.sendRequest()},_setupPagination:function(){this._content={1:this._packageSearchResultList.html()},this._packageSearchResultContainer.find(".pagination").wcfPages("destroy").remove(),this._pageCount>1&&$('
').insertAfter(this._packageSearchResultList).wcfPages({activePage:this._pageNo,maxPage:this._pageCount}).on("wcfpagesswitched",$.proxy(this._showPage,this))},_showPage:function(e,t){return t&&t.activePage&&(this._pageNo=t.activePage),this._pageNo<1||this._pageNo>this._pageCount?void console.debug("[WCF.ACP.Package.Search] Cannot access page "+this._pageNo+" of "+this._pageCount):void(void 0===this._content[this._pageNo]?(this._proxy.setOption("data",{actionName:"getResultList",className:"wcf\\data\\package\\update\\PackageUpdateAction",parameters:{pageNo:this._pageNo,searchID:this._searchID}}),this._proxy.sendRequest()):(this._packageSearchResultList.html(this._content[this._pageNo]),WCF.DOMNodeInsertedHandler.execute()))}}),WCF.ACP.Package.Server={},WCF.ACP.Package.Server.Installation=Class.extend({_proxy:null,_selectedPackage:"",init:function(){this._dialog=null,this._selectedPackage=null,this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)})},bind:function(){$(".jsButtonPackageInstall").removeClass("jsButtonPackageInstall").click($.proxy(this._click,this))},_click:function(e){var t=$(e.currentTarget);WCF.System.Confirmation.show(t.data("confirmMessage"),$.proxy(function(e){"confirm"===e&&(this._selectedPackage=t.data("package"),this._selectedPackageVersion=t.data("packageVersion"),this._prepareInstallation())},this),void 0,void 0,!0)},_success:function(e){if(e.returnValues.queueID){null!==this._dialog&&this._dialog.wcfDialog("close");var t=new WCF.ACP.Package.Installation(e.returnValues.queueID,void 0,!1);t.prepareInstallation()}else e.returnValues.template&&(null===this._dialog?(this._dialog=$("
"+e.returnValues.template+"
").hide().appendTo(document.body),this._dialog.wcfDialog({title:WCF.Language.get("wcf.acp.package.update.unauthorized")})):this._dialog.html(e.returnValues.template).wcfDialog("open"),this._dialog.find(".formSubmit > button").click($.proxy(this._submitAuthentication,this)))},_submitAuthentication:function(e){var t=$("#packageUpdateServerUsername"),a=$("#packageUpdateServerPassword");t.next("small.innerError").remove(),a.next("small.innerError").remove();var i=!0;""===$.trim(t.val())&&($(''+WCF.Language.get("wcf.global.form.error.empty")+"").insertAfter(t),i=!1),""===$.trim(a.val())&&($(''+WCF.Language.get("wcf.global.form.error.empty")+"").insertAfter(a),i=!1),i&&this._prepareInstallation($(e.currentTarget).data("packageUpdateServerID"))},_prepareInstallation:function(e){var t={packages:{}};t.packages[this._selectedPackage]=this._selectedPackageVersion,e&&(t.authData={packageUpdateServerID:e,password:$.trim($("#packageUpdateServerPassword").val()),saveCredentials:$("#packageUpdateServerSaveCredentials:checked").length?!0:!1,username:$.trim($("#packageUpdateServerUsername").val())}),this._proxy.setOption("data",{actionName:"prepareInstallation",className:"wcf\\data\\package\\update\\PackageUpdateAction",parameters:t}),this._proxy.sendRequest()}}),WCF.ACP.Package.Update={},WCF.ACP.Package.Update.Manager=Class.extend({_dialog:null,_proxy:null,_submitButton:null,init:function(){this._dialog=null,this._submitButton=$(".formSubmit > button").click($.proxy(this._click,this)),this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),$(".jsPackageUpdate").each($.proxy(function(e,t){var a=$(t);a.find("input[type=checkbox]").data("packageUpdate",a).change($.proxy(this._change,this))},this))},_change:function(e){var t=$(e.currentTarget);t.is(":checked")?(t.data("packageUpdate").find("select").enable(),t.data("packageUpdate").find("dl").removeClass("disabled"),this._submitButton.enable()):(t.data("packageUpdate").find("select").disable(),t.data("packageUpdate").find("dl").addClass("disabled"),$("input[type=checkbox]:checked").length?this._submitButton.enable():this._submitButton.disable())},_click:function(e,t){var a={};if($(".jsPackageUpdate").each($.proxy(function(e,t){var i=$(t);i.find("input[type=checkbox]:checked").length&&(a[i.data("package")]=i.find("select").val())},this)),$.getLength(a)){this._submitButton.disable();var i={packages:a};t&&(i.authData={packageUpdateServerID:t,password:$.trim($("#packageUpdateServerPassword").val()),saveCredentials:$("#packageUpdateServerSaveCredentials:checked").length?!0:!1,username:$.trim($("#packageUpdateServerUsername").val())}),this._proxy.setOption("data",{actionName:"prepareUpdate",className:"wcf\\data\\package\\update\\PackageUpdateAction",parameters:i}),this._proxy.sendRequest()}},_success:function(e){if(e.returnValues.queueID){null!==this._dialog&&this._dialog.wcfDialog("close");var t=new WCF.ACP.Package.Installation(e.returnValues.queueID,void 0,!1,!0);t.prepareInstallation()}else e.returnValues.excludedPackages?(null===this._dialog?(this._dialog=$("
"+e.returnValues.template+"
").hide().appendTo(document.body),this._dialog.wcfDialog({title:WCF.Language.get("wcf.acp.package.update.excludedPackages")})):(this._dialog.wcfDialog("option","title",WCF.Language.get("wcf.acp.package.update.excludedPackages")),this._dialog.html(e.returnValues.template).wcfDialog("open")),this._submitButton.enable()):e.returnValues.template&&(null===this._dialog?(this._dialog=$("
"+e.returnValues.template+"
").hide().appendTo(document.body),this._dialog.wcfDialog({title:WCF.Language.get("wcf.acp.package.update.unauthorized")})):(this._dialog.wcfDialog("option","title",WCF.Language.get("wcf.acp.package.update.unauthorized")),this._dialog.html(e.returnValues.template).wcfDialog("open")),this._dialog.find(".formSubmit > button").click($.proxy(this._submitAuthentication,this)))},_submitAuthentication:function(e){var t=$("#packageUpdateServerUsername"),a=$("#packageUpdateServerPassword");t.next("small.innerError").remove(),a.next("small.innerError").remove();var i=!0;""===$.trim(t.val())&&($(''+WCF.Language.get("wcf.global.form.error.empty")+"").insertAfter(t),i=!1),""===$.trim(a.val())&&($(''+WCF.Language.get("wcf.global.form.error.empty")+"").insertAfter(a),i=!1),i&&this._click(void 0,$(e.currentTarget).data("packageUpdateServerID"))}}),WCF.ACP.Package.Update.Search=Class.extend({_dialog:null,init:function(e){if(this._dialog=null,e===!0)$(".jsButtonPackageUpdate").click($.proxy(this._click,this));else{var t=$('
  • '+WCF.Language.get("wcf.acp.package.searchForUpdates")+"
  • ");t.click(this._click.bind(this)).prependTo($(".contentHeaderNavigation > ul"))}},_click:function(){null===this._dialog?new WCF.Action.Proxy({autoSend:!0,data:{actionName:"searchForUpdates",className:"wcf\\data\\package\\update\\PackageUpdateAction",parameters:{ignoreCache:1}},success:$.proxy(this._success,this)}):this._dialog.wcfDialog("open")},_success:function(e){e.returnValues.url?window.location=e.returnValues.url:(this._dialog=$("
    "+WCF.Language.get("wcf.acp.package.searchForUpdates.noResults")+"
    ").hide().appendTo(document.body),this._dialog.wcfDialog({title:WCF.Language.get("wcf.acp.package.searchForUpdates")}))}}),WCF.ACP.PluginStore={},WCF.ACP.PluginStore.PurchasedItems={},WCF.ACP.PluginStore.PurchasedItems.Search=Class.extend({_dialog:null,_proxy:null,init:function(){this._dialog=null,this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});var e=$('
  • '+WCF.Language.get("wcf.acp.pluginStore.purchasedItems.button.search")+"
  • ");e.prependTo($(".contentHeaderNavigation > ul")).click($.proxy(this._click,this))},_click:function(){this._proxy.setOption("data",{actionName:"searchForPurchasedItems",className:"wcf\\data\\package\\PackageAction"}),this._proxy.sendRequest()},_success:function(e){if(e.returnValues.template){null===this._dialog?(this._dialog=$("
    ").hide().appendTo(document.body),this._dialog.html(e.returnValues.template).wcfDialog({title:WCF.Language.get("wcf.acp.pluginStore.authorization")})):(this._dialog.html(e.returnValues.template),this._dialog.wcfDialog("open"));var t=this._dialog.find("button").click($.proxy(this._submit,this));this._dialog.find("input").keyup(function(e){return e.which==$.ui.keyCode.ENTER?(t.trigger("click"),!1):void 0})}else e.returnValues.noResults?null===this._dialog?(this._dialog=$("
    ").hide().appendTo(document.body),this._dialog.html(e.returnValues.noResults).wcfDialog({title:WCF.Language.get("wcf.acp.pluginStore.purchasedItems")})):(this._dialog.wcfDialog("option","title",WCF.Language.get("wcf.acp.pluginStore.purchasedItems")),this._dialog.html(e.returnValues.noResults),this._dialog.wcfDialog("open")):e.returnValues.noSSL?null===this._dialog?(this._dialog=$("
    ").hide().appendTo(document.body),this._dialog.html(e.returnValues.noSSL).wcfDialog({title:WCF.Language.get("wcf.global.error.title")})):(this._dialog.wcfDialog("option","title",WCF.Language.get("wcf.global.error.title")),this._dialog.html(e.returnValues.noSSL),this._dialog.wcfDialog("open")):e.returnValues.redirectURL&&(window.location=e.returnValues.redirectURL)},_submit:function(){this._dialog.wcfDialog("close"),this._proxy.setOption("data",{actionName:"searchForPurchasedItems",className:"wcf\\data\\package\\PackageAction",parameters:{password:$("#pluginStorePassword").val(),username:$("#pluginStoreUsername").val()}}),this._proxy.sendRequest()}}),WCF.ACP.Worker=Class.extend({_aborted:!1,_callback:null,_dialogID:null,_dialog:null,_proxy:null,_title:"",init:function(e,t,a,i,s){this._aborted=!1,this._callback=s||null,this._dialogID=e+"Worker",this._dialog=null,this._proxy=new WCF.Action.Proxy({autoSend:!0,data:{className:t,parameters:i||{}},showLoadingOverlay:!1,success:$.proxy(this._success,this),url:"index.php?worker-proxy/&t="+SECURITY_TOKEN}),this._title=a},_success:function(e){if(null===this._dialog&&(this._dialog=$('
    ').hide().appendTo(document.body),this._dialog.wcfDialog({closeConfirmMessage:WCF.Language.get("wcf.acp.worker.abort.confirmMessage"),closeViaModal:!1,onClose:$.proxy(function(){this._aborted=!0,this._proxy.abortPrevious(),window.location.reload()},this),title:this._title})),!this._aborted)if(e.template&&this._dialog.html(e.template),this._dialog.find("progress").attr("value",e.progress).text(e.progress+"%").next("span").text(e.progress+"%"),e.progress<100)this._proxy.setOption("data",{className:e.className,loopCount:e.loopCount,parameters:e.parameters}),this._proxy.sendRequest();else if(null!==this._callback)this._callback(this,e);else{this._dialog.find(".fa-spinner").removeClass("fa-spinner").addClass("fa-check");var t=$('
    ').appendTo(this._dialog);$('").appendTo(t).focus().click(function(){window.location=e.proceedURL}),this._dialog.wcfDialog("render")}}}),WCF.ACP.Category={},WCF.ACP.Category.Collapsible=WCF.Collapsible.SimpleRemote.extend({init:function(e){var t=$('.formSubmit > button[data-type="submit"]');t&&t.click($.proxy(this._sort,this)),this._super(e)},_getButtonContainer:function(e){return $("#"+e+" > .buttons")},_getContainers:function(){return $(".jsCategory").has("ol").has("li")},_getTarget:function(e){return $("#"+e+" > ol")},_sort:function(){$(".collapsibleButton").remove(),this._containers={},this._containerData={};var e=this._getContainers();0==e.length&&console.debug("[WCF.ACP.Category.Collapsible] Empty container set given, aborting."),e.each($.proxy(function(e,t){var a=$(t),i=a.wcfIdentify();this._containers[i]=a,this._initContainer(i)},this))}}),WCF.ACP.Search=WCF.Search.Base.extend({_providerName:"",init:function(){this._className="wcf\\data\\acp\\search\\provider\\ACPSearchProviderAction",this._super("#pageHeaderSearch input[name=q]"),$("#pageHeaderSearch > form").on("submit",function(e){e.preventDefault()});var e=WCF.Dropdown.getDropdownMenu("pageHeaderSearchType");e.find("a[data-provider-name]").on("click",$.proxy(function(e){e.preventDefault();var t=$(e.target);$(".pageHeaderSearchType > .button").text(t.text());var a=this._providerName;if(this._providerName="everywhere"!=t.data("providerName")?t.data("providerName"):"",a!=this._providerName){var i=$.trim(this._searchInput.val());if(i){var s={data:{excludedSearchValues:this._excludedSearchValues,searchString:i}};this._queryServer(s)}}},this))},_createListItem:function(e){this._list.children("li").length>0&&$('").appendTo(this._list);for(var t in e.items){var a=e.items[t];$('
  • '+WCF.String.escapeHTML(a.title)+""+(a.subtitle?""+WCF.String.escapeHTML(a.subtitle)+"":"")+"
  • ").appendTo(this._list),this._itemCount++}},_openDropdown:function(){this._list.find("small").each(function(e,t){for(;t.scrollWidth>t.clientWidth;)t.innerText="… "+t.innerText.substr(3)})},_handleEmptyResult:function(){return $('").appendTo(this._list),!0},_highlightSelectedElement:function(){this._list.find("li").removeClass("dropdownNavigationItem"),this._list.find("li:not(.dropdownDivider):not(.dropdownText)").eq(this._itemIndex).addClass("dropdownNavigationItem")},_selectElement:function(){return-1===this._itemIndex?!1:void(window.location=this._list.find("li.dropdownNavigationItem > a").attr("href"))},_success:function(e){this._super(e),this._list.addClass("acpSearchDropdown")},_getParameters:function(e){return e.data.providerName=this._providerName,e}}),WCF.ACP.User={},WCF.ACP.User.BanHandler={_callback:null,_dialog:null,_proxy:null,init:function(){this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),$(".jsBanButton").click($.proxy(function(e){var t=$(e.currentTarget);t.data("banned")?this.unban([t.data("objectID")]):this.ban([t.data("objectID")])},this)),require(["EventHandler"],function(e){e.add("com.woltlab.wcf.clipboard","com.woltlab.wcf.user",this._clipboardAction.bind(this))}.bind(this))},_clipboardAction:function(e){"com.woltlab.wcf.user.ban"===e.data.actionName&&this.ban(e.data.parameters.objectIDs)},unban:function(e){this._proxy.setOption("data",{actionName:"unban",className:"wcf\\data\\user\\UserAction",objectIDs:e}),this._proxy.sendRequest()},ban:function(e){null===this._dialog?(this._dialog=$("
    ").hide().appendTo(document.body),this._dialog.append($('
    ",Bt.noCloneChecked=!!t.cloneNode(!0).lastChild.defaultValue}(),Le=qt.documentElement,He=/^key/,Fe=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Oe=/^([^.]*)(?:\.(.+)|)/,zt.event={global:{},add:function(e,t,n,r,i){var o,s,a,u,l,c,f,p,d,h,g,m=ye.get(e);if(m)for(n.handler&&(o=n,n=o.handler,i=o.selector),i&&zt.find.matchesSelector(Le,i),n.guid||(n.guid=zt.guid++),(u=m.events)||(u=m.events={}),(s=m.handle)||(s=m.handle=function(t){return void 0!==zt&&zt.event.triggered!==t.type?zt.event.dispatch.apply(e,arguments):void 0}),t=(t||"").match(pe)||[""],l=t.length;l--;)a=Oe.exec(t[l])||[],d=g=a[1],h=(a[2]||"").split(".").sort(),d&&(f=zt.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=zt.event.special[d]||{},c=zt.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&zt.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||(p=u[d]=[],p.delegateCount=0,f.setup&&!1!==f.setup.call(e,r,h,s)||e.addEventListener&&e.addEventListener(d,s)),f.add&&(f.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),zt.event.global[d]=!0)},remove:function(e,t,n,r,i){var o,s,a,u,l,c,f,p,d,h,g,m=ye.hasData(e)&&ye.get(e);if(m&&(u=m.events)){for(t=(t||"").match(pe)||[""],l=t.length;l--;)if(a=Oe.exec(t[l])||[],d=g=a[1],h=(a[2]||"").split(".").sort(),d){for(f=zt.event.special[d]||{},d=(r?f.delegateType:f.bindType)||d,p=u[d]||[],a=a[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),s=o=p.length;o--;)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||a&&!a.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));s&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,m.handle)||zt.removeEvent(e,d,m.handle),delete u[d])}else for(d in u)zt.event.remove(e,d+t[l],n,r,!0);zt.isEmptyObject(u)&&ye.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,s,a=zt.event.fix(e),u=new Array(arguments.length),l=(ye.get(this,"events")||{})[a.type]||[],c=zt.event.special[a.type]||{};for(u[0]=a,t=1;t=1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],s={},n=0;n-1:zt.find(i,this,null,[l]).length),s[i]&&o.push(r);o.length&&a.push({elem:l,handlers:o})}return l=this,u\x20\t\r\n\f]*)[^>]*)\/>/gi,Re=/\s*$/g,zt.extend({htmlPrefilter:function(e){return e.replace(Pe,"<$1>")},clone:function(e,t,n){var r,i,o,s,a=e.cloneNode(!0),u=zt.contains(e.ownerDocument,e);if(!(Bt.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||zt.isXMLDoc(e)))for(s=v(a),o=v(e),r=0,i=o.length;r0&&x(s,!u&&v(e,"script")),a},cleanData:function(e){for(var t,n,r,i=zt.event.special,o=0;void 0!==(n=e[o]);o++)if(me(n)){if(t=n[ye.expando]){if(t.events)for(r in t.events)i[r]?zt.event.remove(n,r):zt.removeEvent(n,r,t.handle);n[ye.expando]=void 0}n[ve.expando]&&(n[ve.expando]=void 0)}}}),zt.fn.extend({detach:function(e){return q(this,e,!0)},remove:function(e){return q(this,e)},text:function(e){return ge(this,function(e){return void 0===e?zt.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return A(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){k(this,e).appendChild(e)}})},prepend:function(){return A(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=k(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return A(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return A(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(zt.cleanData(v(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return zt.clone(this,e,t)})},html:function(e){return ge(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Re.test(e)&&!Ae[(De.exec(e)||["",""])[1].toLowerCase()]){e=zt.htmlPrefilter(e);try{for(;n1)}}),zt.Tween=I,I.prototype={constructor:I,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||zt.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(zt.cssNumber[n]?"":"px")},cur:function(){var e=I.propHooks[this.prop];return e&&e.get?e.get(this):I.propHooks._default.get(this)},run:function(e){var t,n=I.propHooks[this.prop];return this.options.duration?this.pos=t=zt.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):I.propHooks._default.set(this),this}},I.prototype.init.prototype=I.prototype,I.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=zt.css(e.elem,e.prop,""),t&&"auto"!==t?t:0)},set:function(e){zt.fx.step[e.prop]?zt.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[zt.cssProps[e.prop]]&&!zt.cssHooks[e.prop]?e.elem[e.prop]=e.now:zt.style(e.elem,e.prop,e.now+e.unit)}}},I.propHooks.scrollTop=I.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},zt.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},zt.fx=I.prototype.init,zt.fx.step={},Ke=/^(?:toggle|show|hide)$/,Ze=/queueHooks$/,zt.Animation=zt.extend(U,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return g(n.elem,e,Te.exec(t),n),n}]},tweener:function(e,t){zt.isFunction(e)?(t=e,e=["*"]):e=e.match(pe);for(var n,r=0,i=e.length;r1)},removeAttr:function(e){return this.each(function(){zt.removeAttr(this,e)})}}),zt.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return void 0===e.getAttribute?zt.prop(e,t,n):(1===o&&zt.isXMLDoc(e)||(i=zt.attrHooks[t.toLowerCase()]||(zt.expr.match.bool.test(t)?et:void 0)),void 0!==n?null===n?void zt.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:(r=zt.find.attr(e,t),null==r?void 0:r))},attrHooks:{type:{set:function(e,t){if(!Bt.radioValue&&"radio"===t&&i(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(pe);if(i&&1===e.nodeType)for(;n=i[r++];)e.removeAttribute(n)}}),et={set:function(e,t,n){return!1===t?zt.removeAttr(e,n):e.setAttribute(n,n),n}},zt.each(zt.expr.match.bool.source.match(/\w+/g),function(e,t){var n=tt[t]||zt.find.attr;tt[t]=function(e,t,r){var i,o,s=t.toLowerCase();return r||(o=tt[s],tt[s]=i,i=null!=n(e,t,r)?s:null,tt[s]=o),i}}),nt=/^(?:input|select|textarea|button)$/i,rt=/^(?:a|area)$/i,zt.fn.extend({prop:function(e,t){return ge(this,zt.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[zt.propFix[e]||e]})}}),zt.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&zt.isXMLDoc(e)||(t=zt.propFix[t]||t,i=zt.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=zt.find.attr(e,"tabindex");return t?parseInt(t,10):nt.test(e.nodeName)||rt.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),Bt.optSelected||(zt.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),zt.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){zt.propFix[this.toLowerCase()]=this}),zt.fn.extend({addClass:function(e){var t,n,r,i,o,s,a,u=0;if(zt.isFunction(e))return this.each(function(t){zt(this).addClass(e.call(this,t,G(this)))});if("string"==typeof e&&e)for(t=e.match(pe)||[];n=this[u++];)if(i=G(n),r=1===n.nodeType&&" "+V(i)+" "){for(s=0;o=t[s++];)r.indexOf(" "+o+" ")<0&&(r+=o+" ");a=V(r),i!==a&&n.setAttribute("class",a)}return this},removeClass:function(e){var t,n,r,i,o,s,a,u=0;if(zt.isFunction(e))return this.each(function(t){zt(this).removeClass(e.call(this,t,G(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof e&&e)for(t=e.match(pe)||[];n=this[u++];)if(i=G(n),r=1===n.nodeType&&" "+V(i)+" "){for(s=0;o=t[s++];)for(;r.indexOf(" "+o+" ")>-1;)r=r.replace(" "+o+" "," ");a=V(r),i!==a&&n.setAttribute("class",a)}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):zt.isFunction(e)?this.each(function(n){zt(this).toggleClass(e.call(this,n,G(this),t),t)}):this.each(function(){var t,r,i,o;if("string"===n)for(r=0,i=zt(this),o=e.match(pe)||[];t=o[r++];)i.hasClass(t)?i.removeClass(t):i.addClass(t);else void 0!==e&&"boolean"!==n||(t=G(this),t&&ye.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":ye.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;for(t=" "+e+" ";n=this[r++];)if(1===n.nodeType&&(" "+V(G(n))+" ").indexOf(t)>-1)return!0;return!1}}),it=/\r/g,zt.fn.extend({val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=zt.isFunction(e),this.each(function(n){var i;1===this.nodeType&&(i=r?e.call(this,n,zt(this).val()):e,null==i?i="":"number"==typeof i?i+="":Array.isArray(i)&&(i=zt.map(i,function(e){return null==e?"":e+""})),(t=zt.valHooks[this.type]||zt.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))});if(i)return(t=zt.valHooks[i.type]||zt.valHooks[i.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:(n=i.value,"string"==typeof n?n.replace(it,""):null==n?"":n)}}}),zt.extend({valHooks:{option:{get:function(e){var t=zt.find.attr(e,"value");return null!=t?t:V(zt.text(e))}},select:{get:function(e){var t,n,r,o=e.options,s=e.selectedIndex,a="select-one"===e.type,u=a?null:[],l=a?s+1:o.length;for(r=s<0?l:a?s:0;r-1)&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),zt.each(["radio","checkbox"],function(){zt.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=zt.inArray(zt(e).val(),t)>-1}},Bt.checkOn||(zt.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),ot=/^(?:focusinfocus|focusoutblur)$/,zt.extend(zt.event,{trigger:function(t,n,r,i){var o,s,a,u,l,c,f,p=[r||qt],d=It.call(t,"type")?t.type:t,h=It.call(t,"namespace")?t.namespace.split("."):[];if(s=a=r=r||qt,3!==r.nodeType&&8!==r.nodeType&&!ot.test(d+zt.event.triggered)&&(d.indexOf(".")>-1&&(h=d.split("."),d=h.shift(),h.sort()),l=d.indexOf(":")<0&&"on"+d,t=t[zt.expando]?t:new zt.Event(d,"object"==typeof t&&t),t.isTrigger=i?2:3,t.namespace=h.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=r),n=null==n?[t]:zt.makeArray(n,[t]),f=zt.event.special[d]||{},i||!f.trigger||!1!==f.trigger.apply(r,n))){if(!i&&!f.noBubble&&!zt.isWindow(r)){for(u=f.delegateType||d,ot.test(u+d)||(s=s.parentNode);s;s=s.parentNode)p.push(s),a=s;a===(r.ownerDocument||qt)&&p.push(a.defaultView||a.parentWindow||e)}for(o=0;(s=p[o++])&&!t.isPropagationStopped();)t.type=o>1?u:f.bindType||d,c=(ye.get(s,"events")||{})[t.type]&&ye.get(s,"handle"),c&&c.apply(s,n),(c=l&&s[l])&&c.apply&&me(s)&&(t.result=c.apply(s,n),!1===t.result&&t.preventDefault());return t.type=d,i||t.isDefaultPrevented()||f._default&&!1!==f._default.apply(p.pop(),n)||!me(r)||l&&zt.isFunction(r[d])&&!zt.isWindow(r)&&(a=r[l],a&&(r[l]=null),zt.event.triggered=d,r[d](),zt.event.triggered=void 0,a&&(r[l]=a)),t.result}},simulate:function(e,t,n){var r=zt.extend(new zt.Event,n,{type:e,isSimulated:!0});zt.event.trigger(r,null,t)}}),zt.fn.extend({trigger:function(e,t){return this.each(function(){zt.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return zt.event.trigger(e,t,n,!0)}}),zt.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,t){zt.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),zt.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),Bt.focusin="onfocusin"in e,Bt.focusin||zt.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){zt.event.simulate(t,e.target,zt.event.fix(e))};zt.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=ye.access(r,t);i||r.addEventListener(e,n,!0),ye.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=ye.access(r,t)-1;i?ye.access(r,t,i):(r.removeEventListener(e,n,!0),ye.remove(r,t))}}}),st=e.location,at=zt.now(),ut=/\?/,zt.parseXML=function(t){var n;if(!t||"string"!=typeof t)return null;try{n=(new e.DOMParser).parseFromString(t,"text/xml")}catch(e){n=void 0}return n&&!n.getElementsByTagName("parsererror").length||zt.error("Invalid XML: "+t),n},lt=/\[\]$/,ct=/\r?\n/g,ft=/^(?:submit|button|image|reset|file)$/i,pt=/^(?:input|select|textarea|keygen)/i,zt.param=function(e,t){var n,r=[],i=function(e,t){var n=zt.isFunction(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(Array.isArray(e)||e.jquery&&!zt.isPlainObject(e))zt.each(e,function(){i(this.name,this.value)});else for(n in e)Y(n,e[n],t,i);return r.join("&")},zt.fn.extend({serialize:function(){return zt.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=zt.prop(this,"elements");return e?zt.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!zt(this).is(":disabled")&&pt.test(this.nodeName)&&!ft.test(e)&&(this.checked||!Ne.test(e))}).map(function(e,t){var n=zt(this).val();return null==n?null:Array.isArray(n)?zt.map(n,function(e){return{name:t.name,value:e.replace(ct,"\r\n")}}):{name:t.name,value:n.replace(ct,"\r\n")}}).get()}}),dt=/%20/g,ht=/#.*$/,gt=/([?&])_=[^&]*/,mt=/^(.*?):[ \t]*([^\r\n]*)$/gm,yt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,vt=/^(?:GET|HEAD)$/,xt=/^\/\//,bt={},wt={},Tt="*/".concat("*"),Ct=qt.createElement("a"),Ct.href=st.href,zt.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:st.href,type:"GET",isLocal:yt.test(st.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Tt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":zt.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?K(K(e,zt.ajaxSettings),t):K(zt.ajaxSettings,e)},ajaxPrefilter:Q(bt),ajaxTransport:Q(wt),ajax:function(t,n){function r(t,n,r,a){var l,p,d,b,w,T=n;c||(c=!0,u&&e.clearTimeout(u),i=void 0,s=a||"",C.readyState=t>0?4:0,l=t>=200&&t<300||304===t,r&&(b=Z(h,C,r)),b=ee(h,b,C,l),l?(h.ifModified&&(w=C.getResponseHeader("Last-Modified"),w&&(zt.lastModified[o]=w),(w=C.getResponseHeader("etag"))&&(zt.etag[o]=w)),204===t||"HEAD"===h.type?T="nocontent":304===t?T="notmodified":(T=b.state,p=b.data,d=b.error,l=!d)):(d=T,!t&&T||(T="error",t<0&&(t=0))),C.status=t,C.statusText=(n||T)+"",l?y.resolveWith(g,[p,T,C]):y.rejectWith(g,[C,T,d]),C.statusCode(x),x=void 0,f&&m.trigger(l?"ajaxSuccess":"ajaxError",[C,h,l?p:d]),v.fireWith(g,[C,T]),f&&(m.trigger("ajaxComplete",[C,h]),--zt.active||zt.event.trigger("ajaxStop")))}"object"==typeof t&&(n=t,t=void 0),n=n||{};var i,o,s,a,u,l,c,f,p,d,h=zt.ajaxSetup({},n),g=h.context||h,m=h.context&&(g.nodeType||g.jquery)?zt(g):zt.event,y=zt.Deferred(),v=zt.Callbacks("once memory"),x=h.statusCode||{},b={},w={},T="canceled",C={readyState:0,getResponseHeader:function(e){var t;if(c){if(!a)for(a={};t=mt.exec(s);)a[t[1].toLowerCase()]=t[2];t=a[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return c?s:null},setRequestHeader:function(e,t){return null==c&&(e=w[e.toLowerCase()]=w[e.toLowerCase()]||e,b[e]=t),this},overrideMimeType:function(e){return null==c&&(h.mimeType=e),this},statusCode:function(e){var t;if(e)if(c)C.always(e[C.status]);else for(t in e)x[t]=[x[t],e[t]];return this},abort:function(e){var t=e||T;return i&&i.abort(t),r(0,t),this}};if(y.promise(C),h.url=((t||h.url||st.href)+"").replace(xt,st.protocol+"//"),h.type=n.method||n.type||h.method||h.type,h.dataTypes=(h.dataType||"*").toLowerCase().match(pe)||[""],null==h.crossDomain){l=qt.createElement("a");try{l.href=h.url,l.href=l.href,h.crossDomain=Ct.protocol+"//"+Ct.host!=l.protocol+"//"+l.host}catch(e){h.crossDomain=!0}}if(h.data&&h.processData&&"string"!=typeof h.data&&(h.data=zt.param(h.data,h.traditional)),J(bt,h,n,C),c)return C;f=zt.event&&h.global,f&&0==zt.active++&&zt.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!vt.test(h.type),o=h.url.replace(ht,""),h.hasContent?h.data&&h.processData&&0===(h.contentType||"").indexOf("application/x-www-form-urlencoded")&&(h.data=h.data.replace(dt,"+")):(d=h.url.slice(o.length),h.data&&(o+=(ut.test(o)?"&":"?")+h.data,delete h.data),!1===h.cache&&(o=o.replace(gt,"$1"),d=(ut.test(o)?"&":"?")+"_="+at+++d),h.url=o+d),h.ifModified&&(zt.lastModified[o]&&C.setRequestHeader("If-Modified-Since",zt.lastModified[o]),zt.etag[o]&&C.setRequestHeader("If-None-Match",zt.etag[o])),(h.data&&h.hasContent&&!1!==h.contentType||n.contentType)&&C.setRequestHeader("Content-Type",h.contentType),C.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+Tt+"; q=0.01":""):h.accepts["*"]);for(p in h.headers)C.setRequestHeader(p,h.headers[p]);if(h.beforeSend&&(!1===h.beforeSend.call(g,C,h)||c))return C.abort();if(T="abort",v.add(h.complete),C.done(h.success),C.fail(h.error),i=J(wt,h,n,C)){if(C.readyState=1,f&&m.trigger("ajaxSend",[C,h]),c)return C;h.async&&h.timeout>0&&(u=e.setTimeout(function(){C.abort("timeout")},h.timeout));try{c=!1,i.send(b,r)}catch(e){if(c)throw e;r(-1,e)}}else r(-1,"No Transport");return C},getJSON:function(e,t,n){return zt.get(e,t,n,"json")},getScript:function(e,t){return zt.get(e,void 0,t,"script")}}),zt.each(["get","post"],function(e,t){zt[t]=function(e,n,r,i){return zt.isFunction(n)&&(i=i||r,r=n,n=void 0),zt.ajax(zt.extend({url:e,type:t,dataType:i,data:n,success:r},zt.isPlainObject(e)&&e))}}),zt._evalUrl=function(e){return zt.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,throws:!0})},zt.fn.extend({wrapAll:function(e){var t;return this[0]&&(zt.isFunction(e)&&(e=e.call(this[0])),t=zt(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return zt.isFunction(e)?this.each(function(t){zt(this).wrapInner(e.call(this,t))}):this.each(function(){var t=zt(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=zt.isFunction(e);return this.each(function(n){zt(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){zt(this).replaceWith(this.childNodes)}),this}}),zt.expr.pseudos.hidden=function(e){return!zt.expr.pseudos.visible(e)},zt.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},zt.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch(e){}},Et={0:200,1223:204},kt=zt.ajaxSettings.xhr(),Bt.cors=!!kt&&"withCredentials"in kt,Bt.ajax=kt=!!kt,zt.ajaxTransport(function(t){var n,r;if(Bt.cors||kt&&!t.crossDomain)return{send:function(i,o){var s,a=t.xhr();if(a.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(s in t.xhrFields)a[s]=t.xhrFields[s];t.mimeType&&a.overrideMimeType&&a.overrideMimeType(t.mimeType),t.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");for(s in i)a.setRequestHeader(s,i[s]);n=function(e){return function(){n&&(n=r=a.onload=a.onerror=a.onabort=a.onreadystatechange=null,"abort"===e?a.abort():"error"===e?"number"!=typeof a.status?o(0,"error"):o(a.status,a.statusText):o(Et[a.status]||a.status,a.statusText,"text"!==(a.responseType||"text")||"string"!=typeof a.responseText?{binary:a.response}:{text:a.responseText},a.getAllResponseHeaders()))}},a.onload=n(),r=a.onerror=n("error"),void 0!==a.onabort?a.onabort=r:a.onreadystatechange=function(){4===a.readyState&&e.setTimeout(function(){n&&r()})},n=n("abort");try{a.send(t.hasContent&&t.data||null)}catch(e){if(n)throw e}},abort:function(){n&&n()}}}),zt.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),zt.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return zt.globalEval(e),e}}}),zt.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),zt.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(r,i){t=zt("