diff --git a/CHANGELOG.md b/CHANGELOG.md index 033a64a..3e5c34d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +### v2.8.2: +1. 修复页面脚本和全局脚本通信重复的bug + ### v2.8: 1. 屏蔽百度云大文件检测 diff --git a/safari2aria.safariextension/Info.plist b/safari2aria.safariextension/Info.plist index ba80810..a246749 100644 --- a/safari2aria.safariextension/Info.plist +++ b/safari2aria.safariextension/Info.plist @@ -13,9 +13,9 @@ CFBundleInfoDictionaryVersion 1.0 CFBundleShortVersionString - 2.8.1 + 2.8.2 CFBundleVersion - 2.8.1 + 2.8.2 Chrome Database Quota @@ -87,7 +87,7 @@ Update From Gallery Update Manifest URL - https://miniers.github.io/safari2aria/update.plist?t=2.8.1 + https://miniers.github.io/safari2aria/update.plist?t=2.8.2 Website https://github.com/miniers/safari2aria diff --git a/safari2aria.safariextension/global.html b/safari2aria.safariextension/global.html index db2eb99..4e3c2a8 100644 --- a/safari2aria.safariextension/global.html +++ b/safari2aria.safariextension/global.html @@ -8,5 +8,5 @@
- + diff --git a/safari2aria.safariextension/popover.html b/safari2aria.safariextension/popover.html index a81adb9..77dc0d9 100644 --- a/safari2aria.safariextension/popover.html +++ b/safari2aria.safariextension/popover.html @@ -8,5 +8,5 @@
- + diff --git a/safari2aria.safariextension/static/js/endscript.js b/safari2aria.safariextension/static/js/endscript.js index be1d17f..b14db1e 100644 --- a/safari2aria.safariextension/static/js/endscript.js +++ b/safari2aria.safariextension/static/js/endscript.js @@ -1 +1 @@ -webpackJsonp([3],{146:function(e,t,n){"use strict";function i(e,t){var n=0;return new window.Promise(function(i,o){var a=function(e){var a=document.querySelector(e);return a&&t&&"none"==a.style.display?++n>20&&(o(!1),!0):(i(a),!0)},c=setInterval(function(){a(e)&&clearInterval(c)},500)})}function o(e,t){e.value=t;var n=/^magnet|torrent$/.test(e.value);$("#newoffline-dialog").find("span:contains('确定')[class='text']").click(),n&&i("#offlinebtlist-dialog",!0).then(function(e){"文件名"==$(".content-title-name").html()&&$("a.checked-all")[0].click(),e.querySelectorAll(".dialog-footer>.g-button")[1].click()});!function e(){i("#offlinelist-dialog",!0).then(function(){o()}),i("#dialog1",!0).then(function(t){var n=t.find(".input-code"),i=void 0;n.focus(),i=setInterval(function(){4==n.val().length&&(clearInterval(i),$("#dialog1").find("span:contains('确定')[class='text']").click(),e())},200)})}()}t.a=function(e){document.querySelector(".g-button[data-button-id=b13]").click(),i("#_disk_id_2").then(function(e){return e.click(),i("#share-offline-link")}).then(function(t){o(t,e)})}},150:function(e,t,n){"use strict";t.a=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Promise(function(t,n){setTimeout(function(){n("timeout to get config")},1e4),window.extensionMessageListener||safari.self.addEventListener("message",function(e){var i=0;window.extensionMessageListener.forEach(function(n){e.name===n.name&&(document.hidden&&!n.background||(n.cb&&n.cb(e.message||{}),t(e.message||{}),i++))}),i||n(document.hidden?"in background":"no listener"),e.message&&e.message.hasCb&&safari.self.tab.dispatchMessage([e.name,"cb"].join("_"),{cookie:document.cookie})},!1),window.extensionMessageListener=[].concat(window.extensionMessageListener||[]).concat(e.listeners||[]),e.send&&e.send.forEach(function(e){safari.self.tab.dispatchMessage(e.name,e.params)})})}},153:function(e,t,n){var i,o,a;!function(n,c){o=[],i=c,void 0!==(a="function"==typeof i?i.apply(t,o):i)&&(e.exports=a)}(0,function(){"use strict";function e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};return function(){function n(e,t){var i=this;e.style.opacity&&e.style.opacity>.05?e.style.opacity=e.style.opacity-.05:e.style.opacity&&e.style.opacity<=.1?e.parentNode&&(e.parentNode.removeChild(e),t&&t()):e.style.opacity=.9,setTimeout(function(){return n.apply(i,[e,t])},1e3/30)}function i(e,n,o){n=n||{},o=o||"";for(var a in e)if(e.hasOwnProperty(a)){var c=e[a];c&&"object"===(void 0===c?"undefined":t(c))&&!(c instanceof Date||c instanceof RegExp)?i(c,n,o+a+" "):n[o]&&"object"===t(n[o])?n[o][a]=c:(n[o]={},n[o][a]=c)}return n}function o(e){var t=i(e),n=JSON.stringify(t,null,2);return n=n.replace(/"([^"]*)": \{/g,"$1 {").replace(/"([^"]*)"/g,"$1").replace(/(\w*-?\w*): ([\w\d .#]*),?/g,"$1: $2;").replace(/},/g,"}\n").replace(/ &([.:])/g,"$1"),n=n.substr(1,n.lastIndexOf("}")-1)}function a(e){var t=document.head||document.getElementsByTagName("head")[0],n=c("style");n.id="mini-toastr-styles",n.type="text/css",n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e)),t.appendChild(n)}function c(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div";return document.createElement(e)}function s(e,t,n){var i=c(n.icons[t].nodeType),o=n.icons[t].attrs;for(var a in o)o.hasOwnProperty(a)&&i.setAttribute(a,o[a]);e.appendChild(i)}function r(e,t,n){var i=c();i.className=n,i.appendChild(document.createTextNode(t)),e.appendChild(i)}var u,d;if("undefined"==typeof window)return{init:function(){}};var l={error:"error",warn:"warn",success:"success",info:"info"},f={container:"mini-toastr",notification:"mini-toastr__notification",title:"mini-toastr-notification__title",icon:"mini-toastr-notification__icon",message:"mini-toastr-notification__message",error:"-"+l.error,warn:"-"+l.warn,success:"-"+l.success,info:"-"+l.info},m={types:l,animation:n,timeout:3e3,icons:{},appendTarget:document.body,node:c(),style:(d={},e(d,"."+f.container,{position:"fixed","z-index":99999,right:"12px",top:"12px"}),e(d,"."+f.notification,(u={cursor:"pointer",padding:"12px 18px",margin:"0 0 6px 0","background-color":"#000",opacity:.8,color:"#fff","border-radius":"3px","box-shadow":"#3c3b3b 0 0 12px",width:"300px"},e(u,"&."+f.error,{"background-color":"#D5122B"}),e(u,"&."+f.warn,{"background-color":"#F5AA1E"}),e(u,"&."+f.success,{"background-color":"#7AC13E"}),e(u,"&."+f.info,{"background-color":"#4196E1"}),e(u,"&:hover",{opacity:1,"box-shadow":"#000 0 0 12px"}),u)),e(d,"."+f.title,{"font-weight":"500"}),e(d,"."+f.message,{display:"inline-block","vertical-align":"middle",width:"240px",padding:"0 12px"}),d)},p={config:m,showMessage:function(e,t,n,i,o,a){var u={};Object.assign(u,this.config),Object.assign(u,a);var d=c();return d.className=f.notification+" "+f[n],d.onclick=function(){u.animation(d,null)},t&&r(d,t,f.title),u.icons[n]&&s(d,n,u),e&&r(d,e,f.message),u.node.insertBefore(d,u.node.firstChild),setTimeout(function(){return u.animation(d,o)},i||u.timeout),o&&o(),this},init:function(e){var t=this,n={};return Object.assign(n,m),Object.assign(n,e),this.config=n,a(o(n.style)),n.node.id=""+f.container,n.node.className=""+f.container,n.appendTarget.appendChild(n.node),Object.keys(n.types).forEach(function(e){p[n.types[e]]=function(t,i,o,a,c){return this.showMessage(t,i,n.types[e],o,a,c),this}.bind(t)}),this},setIcon:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"i",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];n.class=n.class?n.class+" "+f.icon:f.icon,this.config.icons[e]={nodeType:t,attrs:n}}};return p}()})},157:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(153),o=n.n(i),a=n(146),c=n(36),s=n(150),r=n(37);window.top===window&&function(){function e(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=g.language||navigator.language;return b[n]&&b[n][e]?[b[n][e]," "].join(""):t.notfailback?"":[e," "].join("")}function t(){var e=window.getSelection().toString();return e.match(/^https?/)||e.match(/magnet:/)?e:null}function i(e){var t=null;return"BODY"===e.tagName?t=null:"IMG"===e.tagName&&e.src?t=e.src:e.href?t=e.href:e.parentNode&&(t=i(e.parentNode)),t}function u(e){console.log("disableBaiduLimit:",e.disableBaiduLimit),window.mDisableBaiduLimit=e.disableBaiduLimit}function d(t){n.i(s.a)({send:[{name:"getConfig"}],listeners:[{name:"changeRpc",cb:function(t){o.a.success(e("Success switch the default download service to")+t)}},{name:"currentRpc",cb:function(t){o.a.success(e("The current download service is")+t)}},{name:"showMassage",cb:function(e){o.a[e.action||"success"](e.text,e.title)}},{name:"baiduLixian",cb:function(e){location.href.match(/^https?:\/\/pan\.baidu\.com/)&&n.i(a.a)(e.url)}},{name:"updateConfig",background:!0,cb:function(e){g=e,f(),safari.self.tab.dispatchMessage("documentReady",{cookie:document.cookie}),location.href.match(/baidu/)&&n.i(r.a)(u,{disableBaiduLimit:g.disableBaiduLimit})}}]})}function l(e){var n=[i(e.target)||t(),document.location.href,document.cookie];safari.self.tab.setContextMenuEventUserInfo(e,n)}function f(){if(p)return void(g.catchIframe||p.disconnect());g.catchIframe&&(p=new MutationObserver(function(e){e.some(function(e){return!("IFRAME"!==e.target.tagName||"attributes"!==e.type||"src"!==e.attributeName||!n.i(c.a)(e.target.src,g,h))&&(!e.target.src.match(/^https:\/\/127\.0\.0\.1\//)&&(safari.self.tab.dispatchMessage("downloadFromIframe",{url:e.target.src,cookie:document.cookie}),e.target.src="https://127.0.0.1/",!1))})}),p.observe(document.body,{attributes:!0,attributeFilter:["src"],attributeOldValue:!0,characterData:!1,characterDataOldValue:!1,childList:!1,subtree:!0}))}function m(){h.isCommandPressed=!!h[91],h.isShiftPressd=!!h[16],h.isOptionPressd=!!h[18],safari.self.tab.dispatchMessage("keyPress",{keyPressed:h})}var p,g,h={},b={"zh-CN":{"Success switch the default download service to":"成功切换默认下载服务至","The current download service is":"当前下载服务为"}};document.onkeydown=function(e){var t=e.charCode?e.charCode:e.keyCode;h[t]=!0,m()},document.onkeyup=function(e){var t=e.charCode?e.charCode:e.keyCode;delete h[t],m()},window.onblur=function(e){h={},m()},function(){o.a.init({appendTarget:document.body,timeout:5e3}),document.addEventListener("contextmenu",l,!1),d(),m()}()}()},36:function(e,t,n){"use strict";function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e&&!n[82]&&t.enableTypefiles?!n.isCommandPressed:n.isCommandPressed){if(e.match(/magnet:[^\\"]+/))return!0;var i=e.substr(e.lastIndexOf(".")+1);i=i.toLowerCase();for(var o=t.filetypes?t.filetypes.split(" "):[],a=0;a20&&(o(!1),!0):(i(a),!0)},r=setInterval(function(){a(e)&&clearInterval(r)},500)})}function o(e,t){e.value=t;var n=/^magnet|torrent$/.test(e.value);$("#newoffline-dialog").find("span:contains('确定')[class='text']").click(),n&&i("#offlinebtlist-dialog",!0).then(function(e){"文件名"==$(".content-title-name").html()&&$("a.checked-all")[0].click(),e.querySelectorAll(".dialog-footer>.g-button")[1].click()});!function e(){i("#offlinelist-dialog",!0).then(function(){o()}),i("#dialog1",!0).then(function(t){var n=t.find(".input-code"),i=void 0;n.focus(),i=setInterval(function(){4==n.val().length&&(clearInterval(i),$("#dialog1").find("span:contains('确定')[class='text']").click(),e())},200)})}()}t.a=function(e){document.querySelector(".g-button[data-button-id=b13]").click(),i("#_disk_id_2").then(function(e){return e.click(),i("#share-offline-link")}).then(function(t){o(t,e)})}},150:function(e,t,n){"use strict";t.a=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Promise(function(t,n){setTimeout(function(){n("timeout to get config")},1e4),window.extensionMessageListener||safari.self.addEventListener("message",function(e){var i=0;window.extensionMessageListener.forEach(function(n){e.name===n.name&&(n.cb&&n.cb(e.message||{}),t(e.message||{}),i++)}),i||n("no listener"),e.message&&e.message.hasCb&&safari.self.tab.dispatchMessage([e.name,"cb"].join("_"),{cookie:document.cookie})},!1),window.extensionMessageListener=[].concat(window.extensionMessageListener||[]).concat(e.listeners||[]),e.send&&e.send.forEach(function(e){safari.self.tab.dispatchMessage(e.name,e.params)})})}},153:function(e,t,n){var i,o,a;!function(n,r){o=[],i=r,void 0!==(a="function"==typeof i?i.apply(t,o):i)&&(e.exports=a)}(0,function(){"use strict";function e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};return function(){function n(e,t){var i=this;e.style.opacity&&e.style.opacity>.05?e.style.opacity=e.style.opacity-.05:e.style.opacity&&e.style.opacity<=.1?e.parentNode&&(e.parentNode.removeChild(e),t&&t()):e.style.opacity=.9,setTimeout(function(){return n.apply(i,[e,t])},1e3/30)}function i(e,n,o){n=n||{},o=o||"";for(var a in e)if(e.hasOwnProperty(a)){var r=e[a];r&&"object"===(void 0===r?"undefined":t(r))&&!(r instanceof Date||r instanceof RegExp)?i(r,n,o+a+" "):n[o]&&"object"===t(n[o])?n[o][a]=r:(n[o]={},n[o][a]=r)}return n}function o(e){var t=i(e),n=JSON.stringify(t,null,2);return n=n.replace(/"([^"]*)": \{/g,"$1 {").replace(/"([^"]*)"/g,"$1").replace(/(\w*-?\w*): ([\w\d .#]*),?/g,"$1: $2;").replace(/},/g,"}\n").replace(/ &([.:])/g,"$1"),n=n.substr(1,n.lastIndexOf("}")-1)}function a(e){var t=document.head||document.getElementsByTagName("head")[0],n=r("style");n.id="mini-toastr-styles",n.type="text/css",n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e)),t.appendChild(n)}function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div";return document.createElement(e)}function c(e,t,n){var i=r(n.icons[t].nodeType),o=n.icons[t].attrs;for(var a in o)o.hasOwnProperty(a)&&i.setAttribute(a,o[a]);e.appendChild(i)}function s(e,t,n){var i=r();i.className=n,i.appendChild(document.createTextNode(t)),e.appendChild(i)}var u,d;if("undefined"==typeof window)return{init:function(){}};var l={error:"error",warn:"warn",success:"success",info:"info"},f={container:"mini-toastr",notification:"mini-toastr__notification",title:"mini-toastr-notification__title",icon:"mini-toastr-notification__icon",message:"mini-toastr-notification__message",error:"-"+l.error,warn:"-"+l.warn,success:"-"+l.success,info:"-"+l.info},m={types:l,animation:n,timeout:3e3,icons:{},appendTarget:document.body,node:r(),style:(d={},e(d,"."+f.container,{position:"fixed","z-index":99999,right:"12px",top:"12px"}),e(d,"."+f.notification,(u={cursor:"pointer",padding:"12px 18px",margin:"0 0 6px 0","background-color":"#000",opacity:.8,color:"#fff","border-radius":"3px","box-shadow":"#3c3b3b 0 0 12px",width:"300px"},e(u,"&."+f.error,{"background-color":"#D5122B"}),e(u,"&."+f.warn,{"background-color":"#F5AA1E"}),e(u,"&."+f.success,{"background-color":"#7AC13E"}),e(u,"&."+f.info,{"background-color":"#4196E1"}),e(u,"&:hover",{opacity:1,"box-shadow":"#000 0 0 12px"}),u)),e(d,"."+f.title,{"font-weight":"500"}),e(d,"."+f.message,{display:"inline-block","vertical-align":"middle",width:"240px",padding:"0 12px"}),d)},p={config:m,showMessage:function(e,t,n,i,o,a){var u={};Object.assign(u,this.config),Object.assign(u,a);var d=r();return d.className=f.notification+" "+f[n],d.onclick=function(){u.animation(d,null)},t&&s(d,t,f.title),u.icons[n]&&c(d,n,u),e&&s(d,e,f.message),u.node.insertBefore(d,u.node.firstChild),setTimeout(function(){return u.animation(d,o)},i||u.timeout),o&&o(),this},init:function(e){var t=this,n={};return Object.assign(n,m),Object.assign(n,e),this.config=n,a(o(n.style)),n.node.id=""+f.container,n.node.className=""+f.container,n.appendTarget.appendChild(n.node),Object.keys(n.types).forEach(function(e){p[n.types[e]]=function(t,i,o,a,r){return this.showMessage(t,i,n.types[e],o,a,r),this}.bind(t)}),this},setIcon:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"i",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];n.class=n.class?n.class+" "+f.icon:f.icon,this.config.icons[e]={nodeType:t,attrs:n}}};return p}()})},157:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(153),o=n.n(i),a=n(146),r=n(36),c=n(150),s=n(37);window.top===window&&function(){function e(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=g.language||navigator.language;return b[n]&&b[n][e]?[b[n][e]," "].join(""):t.notfailback?"":[e," "].join("")}function t(){var e=window.getSelection().toString();return e.match(/^https?/)||e.match(/magnet:/)?e:null}function i(e){var t=null;return"BODY"===e.tagName?t=null:"IMG"===e.tagName&&e.src?t=e.src:e.href?t=e.href:e.parentNode&&(t=i(e.parentNode)),t}function u(e,t){console.log("disableBaiduLimit:",e.disableBaiduLimit),window.mDisableBaiduLimit=e.disableBaiduLimit,document.getElementById(t).remove()}function d(t){n.i(c.a)({send:[{name:"getConfig"}],listeners:[{name:"changeRpc",cb:function(t){o.a.success(e("Success switch the default download service to")+t)}},{name:"currentRpc",cb:function(t){o.a.success(e("The current download service is")+t)}},{name:"showMassage",cb:function(e){o.a[e.action||"success"](e.text,e.title)}},{name:"baiduLixian",cb:function(e){location.href.match(/^https?:\/\/pan\.baidu\.com/)&&n.i(a.a)(e.url)}},{name:"updateConfig",cb:function(e){var t=g||{};g=e,f(),safari.self.tab.dispatchMessage("documentReady",{cookie:document.cookie}),location.href.match(/baidu/)&&g.disableBaiduLimit!==t.disableBaiduLimit&&n.i(s.a)(u,{disableBaiduLimit:g.disableBaiduLimit})}}]})}function l(e){var n=[i(e.target)||t(),document.location.href,document.cookie];safari.self.tab.setContextMenuEventUserInfo(e,n)}function f(){if(p)return void(g.catchIframe||p.disconnect());g.catchIframe&&(p=new MutationObserver(function(e){e.some(function(e){return!("IFRAME"!==e.target.tagName||"attributes"!==e.type||"src"!==e.attributeName||!n.i(r.a)(e.target.src,g,h))&&(!e.target.src.match(/^https:\/\/127\.0\.0\.1\//)&&(safari.self.tab.dispatchMessage("downloadFromIframe",{url:e.target.src,cookie:document.cookie}),e.target.src="https://127.0.0.1/",!1))})}),p.observe(document.body,{attributes:!0,attributeFilter:["src"],attributeOldValue:!0,characterData:!1,characterDataOldValue:!1,childList:!1,subtree:!0}))}function m(){h.isCommandPressed=!!h[91],h.isShiftPressd=!!h[16],h.isOptionPressd=!!h[18],safari.self.tab.dispatchMessage("keyPress",{keyPressed:h})}var p,g,h={},b={"zh-CN":{"Success switch the default download service to":"成功切换默认下载服务至","The current download service is":"当前下载服务为"}};document.onkeydown=function(e){var t=e.charCode?e.charCode:e.keyCode;h[t]=!0,m()},document.onkeyup=function(e){var t=e.charCode?e.charCode:e.keyCode;delete h[t],m()},window.onblur=function(e){h={},m()},function(){o.a.init({appendTarget:document.body,timeout:5e3}),document.addEventListener("contextmenu",l,!1),d(),m()}()}()},36:function(e,t,n){"use strict";function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e&&!n[82]&&t.enableTypefiles?!n.isCommandPressed:n.isCommandPressed){if(e.match(/magnet:[^\\"]+/))return!0;var i=e.substr(e.lastIndexOf(".")+1);i=i.toLowerCase();var o=t.filetypes?t.filetypes.split(" "):[];if(n.isShiftPressd)return!0;for(var a=0;a1&&void 0!==arguments[1]?arguments[1]:{},n=D.language||navigator.language;return x()(A,[n,t],e.notfailback?"":[t," "].join(""))}function i(){var t={};D.rpcList.forEach(function(e,n){var o=e.url.match(/^(http|ws)(s)?(?:\:\/\/)(token\:[^@]*)?@?([^\:\/]*)\:?(\d*)(\/[^\/]*)/),i={host:o[4],port:o[5]||6800,secure:!(!o||!o[2]),secret:o[3]?o[3].split(":")[1]:"",path:o[6]||"/jsonrpc"};if(j[e.url])t[e.url]=j[e.url],delete j[e.url];else{var r=new I.Aria2(i);t[e.url]={aria2:r,rpc:e,push:e.push}}e.push&&a(t[e.url],e.name)});for(var e in j){var n=j[e].aria2;n&&n.socket&&1===n.socket.readyState&&j[e].aria2.close()}j=t}function a(t,e){var n=t.aria2;return!(!t.aria2||!t.aria2.socket||1!==n.socket.readyState)||(n.open().then(function(){s(t,e),t.reconnect&&(delete t.reconnect,R.success([o("Successful links to"),e]))}).catch(function(n){x()(safari,"application.activeBrowserWindow.activeTab.url")&&(!t.reconnect&&R.error([o("Make sure the aria2 is running, every 10 seconds will automatically retry")],[e,o("Connection fail")]),t.reconnect=!0),P=P||setInterval(function(){var t=0;S()(j,function(e){t+=a(e)?0:1}),t||clearInterval(P)},1e4)}),!1)}function r(){x()(safari,"extension.popovers[0].contentWindow.tlwin.refreshTaskList")&&safari.extension.popovers[0].contentWindow.tlwin.refreshTaskList()}function s(t,e){var n=t.aria2,i=function(t){r()},a=function(t){r()},s=function(t,e){r(),c(n,t.gid).then(function(t){R.show(e?"error":"success",[t,o("Download"),o(e?"error":"success")])})};n.onDownloadStart=i,n.onDownloadPause=a,n.onDownloadStop=a,n.onDownloadComplete=s,n.onBtDownloadComplete=s,n.onDownloadError=function(t){s(t,!0)}}function c(t,e){return t.tellStatus(e,["bittorrent"]).then(function(n){return t.getFiles(e).then(function(t){return{files:t,bt:n}})}).then(function(t){var e=t.files[0].path,n=e.split("/").pop();return t.bt&&t.bt.info?bt.bittorrent.info.name:n}).catch(function(t){R.error([o("Failed to get task information")])})}function l(t){var e=j[t[0].url],n=!!e&&e.aria2,i=D.enableCookie?"Cookie: "+t[3]:"";n&&t[1]?n.addUri([t[1]],{header:i,timeout:10,"content-disposition-default-utf8":!0,"user-agent":D.userAgent}).then(function(){R.success([o("Successfully added to the"),e.rpc.name,D.enableCookie?"":"(with cookie)"])}).catch(function(t){R.error([o("Fail to Added to the"),e.rpc.name,o("failure",{notfailback:!0}),D.enableCookie?"":"(without cookie)"]),console.log(t)}):R.error(["添加任务失败:没有url或者没有连接aria2"])}function u(t){"showOptions"===t.key&&f()}function f(){safari.application.activeBrowserWindow.openTab().url=safari.extension.baseURI+"options.html"}function d(){D=localStorage.getItem("safari2aria");try{D=JSON.parse(D||"{}")}catch(t){D={defaultRpcIndex:0}}L=D.filetypes?D.filetypes.split(" "):[];for(var t=0;t=0){var n=t.userInfo;n&&n.length&&n[0]||(t.target.disabled=!0)}}function g(t){n.i(C.a)(t.url,D,O)&&(t.preventDefault(),p("getCookie",function(e){l([E[D.defaultRpcIndex],t.url,t.target.url,e.cookie])}))}function w(t){E.forEach(function(e,n){t.contextMenu.appendContextMenuItem(["DownloadWithAria2",n].join("."),[o("Downloaded to"),e.name].join(""))}),D.enableXunleiLixian&&t.contextMenu.appendContextMenuItem("DownloadWithXunleilixian",[o("Import to thunder lixian")].join("")),D.enableBaiduLixian&&t.contextMenu.appendContextMenuItem("DownloadWithBaidulixian",[o("Import to baidu lixian")].join(""))}function y(t){M[t.name]&&M[t.name](t.message,t)}Object.defineProperty(e,"__esModule",{value:!0});var b=n(18),x=n.n(b),k=n(55),S=n.n(k),I=n(54),C=n(36),D={defaultRpcIndex:0},A={"zh-CN":{"Successful links to":"成功链接","Connection fail":"连接失败",Download:"下载",error:"失败","Import to thunder lixian":"导入至迅雷离线","Import to baidu lixian":"导入至百度离线","Downloaded to":"下载至",success:"成功","Successfully added to the":"成功添加至","Added to the":"添加至",failure:"失败","Failed to get task information":"获取任务信息失败","Make sure the aria2 is running, every 10 seconds will automatically retry":"请确认aria2已经运行,每隔10秒将会自动重试"}},O=void 0,L=[],E=[],j={},W={},P=void 0,M={updateSafari2Aria:function(t){localStorage.setItem("safari2aria",JSON.stringify(t)),d()},keyPress:function(t){h(t)},getConfig:function(){p("updateConfig",D)},documentReady:function(){S()(W,function(t){t.action()})},downloadFromIframe:function(t,e){l([E[D.defaultRpcIndex],t.url,e.target.url,t.cookie])}},R={success:function(t,e){R.show("success",t,e)},error:function(t,e){R.show("error",t,e)},show:function(t,e,n){e instanceof Array&&(e=e.join("")),n instanceof Array&&(n=n.join("")),p("showMassage",{action:t||"success",text:e,title:n})}};window.s2a={changeServer:function(t){var e=void 0;S()(E,function(n,o){n.url===t&&(e=o)}),D.defaultRpcIndex=e,y({name:"updateSafari2Aria",message:D})},dispatchMessage:y,openOptions:f,getConfig:function(){return{config:D,aria2Connects:j}}},document.addEventListener("DOMContentLoaded",d),safari.application.addEventListener("message",y,!1),safari.extension.settings.addEventListener("change",u,!1),safari.application.addEventListener("command",m,!1),safari.application.addEventListener("validate",v,!1),safari.application.addEventListener("beforeNavigate",g,!1),safari.application.addEventListener("contextmenu",w,!1)},36:function(t,e,n){"use strict";function o(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(t&&!n[82]&&e.enableTypefiles?!n.isCommandPressed:n.isCommandPressed){if(t.match(/magnet:[^\\"]+/))return!0;var o=t.substr(t.lastIndexOf(".")+1);o=o.toLowerCase();for(var i=e.filetypes?e.filetypes.split(" "):[],a=0;a0&&(o.params=t.params);var i="http"+(this.secure?"s":"")+"://"+this.host+":"+this.port+this.path;fetch(i,{method:"POST",body:JSON.stringify(o),headers:{Accept:"application/json","Content-Type":"application/json"}}).then(function(t){return t.json()}).then(function(t){n._onmessage(t)}).catch(e)},a.prototype.send=function(t){var e=Array.prototype.slice.call(arguments,1),n="function"==typeof e[e.length-1]?e.pop():null;return this.exec(t,e,n)},a.prototype.exec=function(t,e,n){if("string"!=typeof t)throw new TypeError(t+" is not a string");0!==t.indexOf("system.")&&0!==t.indexOf("aria2.")&&(t="aria2."+t);var i={method:t,"json-rpc":"2.0",id:this.lastId++},a=this.secret?["token:"+this.secret]:[];Array.isArray(e)&&("system.multicall"===t?(Array.isArray(e[0])&&e[0].forEach(function(t){t.params||(t.params=[]),t.params=a.concat(t.params)}),a=e):a=a.concat(e)),a.length>0&&(i.params=a),this.onsend(i);var r=this;return this.socket&&1===this.socket.readyState?this.socket.send(JSON.stringify(i)):this.http(i,function(t){r.callbacks[i.id](t),delete r.callbacks[i.id]}),o()(function(t){r.callbacks[i.id]=t},n)},a.prototype._onmessage=function(t){if(this.onmessage(t),void 0!==t.id){var e=this.callbacks[t.id];e&&(t.error?e(t.error):e(null,t.result),delete this.callbacks[t.id])}else if(t.method){var n=t.method.split("aria2.")[1];0===n.indexOf("on")&&"function"==typeof this[n]&&a.notifications.indexOf(n)>-1&&this[n].apply(this,t.params)}},a.prototype.open=function(t){var e="ws"+(this.secure?"s":"")+"://"+this.host+":"+this.port+this.path,n=this.socket=new WebSocket(e),i=this,a=!1;return n.onmessage=function(t){i._onmessage(JSON.parse(t.data))},o()(function(t){n.onopen=function(){a||(t(),a=!0),i.onopen()},n.onclose=function(e){i.onclose(),1006==e.code&&(a||(t(e),a=!0))},n.onerror=function(e){a||(t(e),a=!0)}},t)},a.prototype.close=function(t){var e=this.socket;return o()(function(t){e?(e.addEventListener("close",function(){t()}),e.close()):t()},t)},a.methods=["addUri","addTorrent","addMetalink","remove","forceRemove","pause","pauseAll","forcePause","forcePauseAll","unpause","unpauseAll","tellStatus","getUris","getFiles","getPeers","getServers","tellActive","tellWaiting","tellStopped","changePosition","changeUri","getOption","changeOption","getGlobalOption","changeGlobalOption","getGlobalStat","purgeDownloadResult","removeDownloadResult","getVersion","getSessionInfo","shutdown","forceShutdown","saveSession","system.multicall","system.listMethods","system.listNotifications"],a.notifications=["onDownloadStart","onDownloadPause","onDownloadStop","onDownloadComplete","onDownloadError","onBtDownloadComplete"],a.events=["onopen","onclose","onsend","onmessage"],a.options={secure:!1,host:"localhost",port:6800,secret:"",path:"/jsonrpc"},a.methods.forEach(function(t){var e=t.indexOf(".")>-1?t.split(".")[1]:t;a.prototype[e]=function(){return this.send.apply(this,[t].concat(Array.prototype.slice.call(arguments)))}}),a.notifications.forEach(function(t){a.prototype[t]=function(){}}),a.events.forEach(function(t){a.prototype[t]=function(){}}),n?t.exports=a:e.Aria2=a}(this)}).call(e,n(132)(t))}},[159]); \ No newline at end of file diff --git a/safari2aria.safariextension/static/js/global.15247ca5699b404075b7.js b/safari2aria.safariextension/static/js/global.15247ca5699b404075b7.js new file mode 100644 index 0000000..bbbb36c --- /dev/null +++ b/safari2aria.safariextension/static/js/global.15247ca5699b404075b7.js @@ -0,0 +1 @@ +webpackJsonp([4],{159:function(t,e,n){"use strict";function o(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=D.language||navigator.language;return x()(O,[n,t],e.notfailback?"":[t," "].join(""))}function a(){var t={};D.rpcList.forEach(function(e,n){var o=e.url.match(/^(http|ws)(s)?(?:\:\/\/)(token\:[^@]*)?@?([^\:\/]*)\:?(\d*)(\/[^\/]*)/),a={host:o[4],port:o[5]||6800,secure:!(!o||!o[2]),secret:o[3]?o[3].split(":")[1]:"",path:o[6]||"/jsonrpc"};if(W[e.url])t[e.url]=W[e.url],delete W[e.url];else{var r=new I.Aria2(a);t[e.url]={aria2:r,rpc:e,push:e.push}}e.push&&i(t[e.url],e.name)});for(var e in W){var n=W[e].aria2;n&&n.socket&&1===n.socket.readyState&&W[e].aria2.close()}W=t}function i(t,e){var n=t.aria2;return!(!t.aria2||!t.aria2.socket||1!==n.socket.readyState)||(n.open().then(function(){s(t,e),t.reconnect&&(delete t.reconnect,T.success([o("Successful links to"),e]))}).catch(function(n){x()(safari,"application.activeBrowserWindow.activeTab.url")&&(!t.reconnect&&T.error([o("Make sure the aria2 is running, every 10 seconds will automatically retry")],[e,o("Connection fail")]),t.reconnect=!0),M=M||setInterval(function(){var t=0;S()(W,function(e){t+=i(e)?0:1}),t||clearInterval(M)},1e4)}),!1)}function r(){x()(safari,"extension.popovers[0].contentWindow.tlwin.refreshTaskList")&&safari.extension.popovers[0].contentWindow.tlwin.refreshTaskList()}function s(t,e){var n=t.aria2,a=function(t){r()},i=function(t){r()},s=function(t,e){r(),c(n,t.gid).then(function(t){T.show(e?"error":"success",[t,o("Download"),o(e?"error":"success")])})};n.onDownloadStart=a,n.onDownloadPause=i,n.onDownloadStop=i,n.onDownloadComplete=s,n.onBtDownloadComplete=s,n.onDownloadError=function(t){s(t,!0)}}function c(t,e){return t.tellStatus(e,["bittorrent"]).then(function(n){return t.getFiles(e).then(function(t){return{files:t,bt:n}})}).then(function(t){var e=t.files[0].path,n=e.split("/").pop();return t.bt&&t.bt.info?bt.bittorrent.info.name:n}).catch(function(t){T.error([o("Failed to get task information")])})}function l(t){var e=W[t[0].url],n=!!e&&e.aria2,a=D.enableCookie?"Cookie: "+t[3]:"";n&&t[1]?n.addUri([t[1]],{header:a,timeout:10,"content-disposition-default-utf8":!0,"user-agent":D.userAgent}).then(function(){T.success([o("Successfully added to the"),e.rpc.name,D.enableCookie?"":"(with cookie)"])}).catch(function(t){T.error([o("Fail to Added to the"),e.rpc.name,o("failure",{notfailback:!0}),D.enableCookie?"":"(without cookie)"]),console.log(t)}):T.error(["添加任务失败:没有url或者没有连接aria2"])}function u(t){"showOptions"===t.key&&f()}function f(){safari.application.activeBrowserWindow.openTab().url=safari.extension.baseURI+"options.html"}function d(){D=localStorage.getItem("safari2aria");try{D=JSON.parse(D||"{}")}catch(t){D={defaultRpcIndex:0}}j=D.filetypes?D.filetypes.split(" "):[];for(var t=0;t=0){var n=t.userInfo;n&&n.length&&n[0]||(t.target.disabled=!0)}}function g(t){n.i(A.a)(t.url,D,L)&&(t.preventDefault(),p("getCookie",function(e){l([E[D.defaultRpcIndex],t.url,t.target.url,e.cookie])}))}function w(t){E.forEach(function(e,n){t.contextMenu.appendContextMenuItem(["DownloadWithAria2",n].join("."),[o("Downloaded to"),e.name].join(""))}),D.enableXunleiLixian&&t.contextMenu.appendContextMenuItem("DownloadWithXunleilixian",[o("Import to thunder lixian")].join("")),D.enableBaiduLixian&&t.contextMenu.appendContextMenuItem("DownloadWithBaidulixian",[o("Import to baidu lixian")].join(""))}function y(t){R[t.name]&&R[t.name](t.message,t)}Object.defineProperty(e,"__esModule",{value:!0});var b=n(18),x=n.n(b),k=n(55),S=n.n(k),I=n(54),A=n(36),C=Object.assign||function(t){for(var e=1;e1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(t&&!n[82]&&e.enableTypefiles?!n.isCommandPressed:n.isCommandPressed){if(t.match(/magnet:[^\\"]+/))return!0;var o=t.substr(t.lastIndexOf(".")+1);o=o.toLowerCase();var a=e.filetypes?e.filetypes.split(" "):[];if(n.isShiftPressd)return!0;for(var i=0;i0&&(o.params=t.params);var a="http"+(this.secure?"s":"")+"://"+this.host+":"+this.port+this.path;fetch(a,{method:"POST",body:JSON.stringify(o),headers:{Accept:"application/json","Content-Type":"application/json"}}).then(function(t){return t.json()}).then(function(t){n._onmessage(t)}).catch(e)},i.prototype.send=function(t){var e=Array.prototype.slice.call(arguments,1),n="function"==typeof e[e.length-1]?e.pop():null;return this.exec(t,e,n)},i.prototype.exec=function(t,e,n){if("string"!=typeof t)throw new TypeError(t+" is not a string");0!==t.indexOf("system.")&&0!==t.indexOf("aria2.")&&(t="aria2."+t);var a={method:t,"json-rpc":"2.0",id:this.lastId++},i=this.secret?["token:"+this.secret]:[];Array.isArray(e)&&("system.multicall"===t?(Array.isArray(e[0])&&e[0].forEach(function(t){t.params||(t.params=[]),t.params=i.concat(t.params)}),i=e):i=i.concat(e)),i.length>0&&(a.params=i),this.onsend(a);var r=this;return this.socket&&1===this.socket.readyState?this.socket.send(JSON.stringify(a)):this.http(a,function(t){r.callbacks[a.id](t),delete r.callbacks[a.id]}),o()(function(t){r.callbacks[a.id]=t},n)},i.prototype._onmessage=function(t){if(this.onmessage(t),void 0!==t.id){var e=this.callbacks[t.id];e&&(t.error?e(t.error):e(null,t.result),delete this.callbacks[t.id])}else if(t.method){var n=t.method.split("aria2.")[1];0===n.indexOf("on")&&"function"==typeof this[n]&&i.notifications.indexOf(n)>-1&&this[n].apply(this,t.params)}},i.prototype.open=function(t){var e="ws"+(this.secure?"s":"")+"://"+this.host+":"+this.port+this.path,n=this.socket=new WebSocket(e),a=this,i=!1;return n.onmessage=function(t){a._onmessage(JSON.parse(t.data))},o()(function(t){n.onopen=function(){i||(t(),i=!0),a.onopen()},n.onclose=function(e){a.onclose(),1006==e.code&&(i||(t(e),i=!0))},n.onerror=function(e){i||(t(e),i=!0)}},t)},i.prototype.close=function(t){var e=this.socket;return o()(function(t){e?(e.addEventListener("close",function(){t()}),e.close()):t()},t)},i.methods=["addUri","addTorrent","addMetalink","remove","forceRemove","pause","pauseAll","forcePause","forcePauseAll","unpause","unpauseAll","tellStatus","getUris","getFiles","getPeers","getServers","tellActive","tellWaiting","tellStopped","changePosition","changeUri","getOption","changeOption","getGlobalOption","changeGlobalOption","getGlobalStat","purgeDownloadResult","removeDownloadResult","getVersion","getSessionInfo","shutdown","forceShutdown","saveSession","system.multicall","system.listMethods","system.listNotifications"],i.notifications=["onDownloadStart","onDownloadPause","onDownloadStop","onDownloadComplete","onDownloadError","onBtDownloadComplete"],i.events=["onopen","onclose","onsend","onmessage"],i.options={secure:!1,host:"localhost",port:6800,secret:"",path:"/jsonrpc"},i.methods.forEach(function(t){var e=t.indexOf(".")>-1?t.split(".")[1]:t;i.prototype[e]=function(){return this.send.apply(this,[t].concat(Array.prototype.slice.call(arguments)))}}),i.notifications.forEach(function(t){i.prototype[t]=function(){}}),i.events.forEach(function(t){i.prototype[t]=function(){}}),n?t.exports=i:e.Aria2=i}(this)}).call(e,n(132)(t))}},[159]); \ No newline at end of file diff --git a/safari2aria.safariextension/static/js/manifest.js b/safari2aria.safariextension/static/js/manifest.js index 6c7e683..4fe9bd3 100644 --- a/safari2aria.safariextension/static/js/manifest.js +++ b/safari2aria.safariextension/static/js/manifest.js @@ -1 +1 @@ -!function(e){function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var r=window.webpackJsonp;window.webpackJsonp=function(t,c,a){for(var f,i,u,s=0,d=[];s0&&(n.params=t.params);var a="http"+(this.secure?"s":"")+"://"+this.host+":"+this.port+this.path;fetch(a,{method:"POST",body:JSON.stringify(n),headers:{Accept:"application/json","Content-Type":"application/json"}}).then(function(t){return t.json()}).then(function(t){i._onmessage(t)}).catch(e)},s.prototype.send=function(t){var e=Array.prototype.slice.call(arguments,1),i="function"==typeof e[e.length-1]?e.pop():null;return this.exec(t,e,i)},s.prototype.exec=function(t,e,i){if("string"!=typeof t)throw new TypeError(t+" is not a string");0!==t.indexOf("system.")&&0!==t.indexOf("aria2.")&&(t="aria2."+t);var a={method:t,"json-rpc":"2.0",id:this.lastId++},s=this.secret?["token:"+this.secret]:[];Array.isArray(e)&&("system.multicall"===t?(Array.isArray(e[0])&&e[0].forEach(function(t){t.params||(t.params=[]),t.params=s.concat(t.params)}),s=e):s=s.concat(e)),s.length>0&&(a.params=s),this.onsend(a);var o=this;return this.socket&&1===this.socket.readyState?this.socket.send(JSON.stringify(a)):this.http(a,function(t){o.callbacks[a.id](t),delete o.callbacks[a.id]}),n()(function(t){o.callbacks[a.id]=t},i)},s.prototype._onmessage=function(t){if(this.onmessage(t),void 0!==t.id){var e=this.callbacks[t.id];e&&(t.error?e(t.error):e(null,t.result),delete this.callbacks[t.id])}else if(t.method){var i=t.method.split("aria2.")[1];0===i.indexOf("on")&&"function"==typeof this[i]&&s.notifications.indexOf(i)>-1&&this[i].apply(this,t.params)}},s.prototype.open=function(t){var e="ws"+(this.secure?"s":"")+"://"+this.host+":"+this.port+this.path,i=this.socket=new WebSocket(e),a=this,s=!1;return i.onmessage=function(t){a._onmessage(JSON.parse(t.data))},n()(function(t){i.onopen=function(){s||(t(),s=!0),a.onopen()},i.onclose=function(e){a.onclose(),1006==e.code&&(s||(t(e),s=!0))},i.onerror=function(e){s||(t(e),s=!0)}},t)},s.prototype.close=function(t){var e=this.socket;return n()(function(t){e?(e.addEventListener("close",function(){t()}),e.close()):t()},t)},s.methods=["addUri","addTorrent","addMetalink","remove","forceRemove","pause","pauseAll","forcePause","forcePauseAll","unpause","unpauseAll","tellStatus","getUris","getFiles","getPeers","getServers","tellActive","tellWaiting","tellStopped","changePosition","changeUri","getOption","changeOption","getGlobalOption","changeGlobalOption","getGlobalStat","purgeDownloadResult","removeDownloadResult","getVersion","getSessionInfo","shutdown","forceShutdown","saveSession","system.multicall","system.listMethods","system.listNotifications"],s.notifications=["onDownloadStart","onDownloadPause","onDownloadStop","onDownloadComplete","onDownloadError","onBtDownloadComplete"],s.events=["onopen","onclose","onsend","onmessage"],s.options={secure:!1,host:"localhost",port:6800,secret:"",path:"/jsonrpc"},s.methods.forEach(function(t){var e=t.indexOf(".")>-1?t.split(".")[1]:t;s.prototype[e]=function(){return this.send.apply(this,[t].concat(Array.prototype.slice.call(arguments)))}}),s.notifications.forEach(function(t){s.prototype[t]=function(){}}),s.events.forEach(function(t){s.prototype[t]=function(){}}),i?t.exports=s:e.Aria2=s}(this)}).call(e,i(132)(t))},,,function(t,e,i){"use strict";function n(t){var e="";return e=t.bittorrent?r()(t,"bittorrent.info.name",["BT:",t.infoHash].join("")):r()(t,"files[0].path","").replace(/^.*[\\\/]/,""),e||(e=r()(t,"files[0].uris[0].uri")),e||"..."}function a(t,e){t=Number(t);var i=["Bytes","KB","MB","GB","TB"];if(0===t)return"0 KB";var n=parseInt(Math.floor(Math.log(t)/Math.log(1e3)),10);if(0===n)return t+" "+i[n];var a=[1,1,10,100,100][n];return Number.isInteger(e)&&(a=Math.pow(10,e)),""+Math.floor(100*t/Math.pow(1024,n)*a)/(100*a)+i[n]}function s(t,e){function i(t,e){return(new Array(e+1).join("0")+t).slice(-e)}var n=/((?:[^ydhms']+)|(?:'(?:[^']|'')*')|(?:y+|d+|h+|m+|s+))(.*)/,a={y:{value:31536e6},yy:{value:"y",pad:2},d:{value:864e5},dd:{value:"d",pad:2},h:{value:36e5},hh:{value:"h",pad:2},m:{value:6e4},mm:{value:"m",pad:2},s:{value:1e3},ss:{value:"s",pad:2},sss:{value:1},ssss:{value:"sss",pad:4}},s=parseFloat(t,10),o=function(t){for(var e=[],i=t?t.toString():"";i;){var a=n.exec(i);a?(e=e.concat(a.slice(1)),i=e.pop()):(e.push(i),i=null)}return e}(e);return isNaN(s)||0===o.length?t:function(t,e){var n="",s={};e.filter(function(t){return a.hasOwnProperty(t)}).map(function(t){var e=a[t];return e.hasOwnProperty("pad")?e.value:t}).filter(function(t,e,i){return i.indexOf(t)===e}).map(function(t){return Object.assign({name:t},a[t])}).sort(function(t,e){return e.value-t.value}).forEach(function(e){var i=s[e.name]=Math.floor(t/e.value);t-=i*e.value});for(var o=0;o=2&&t.length<=6},msg:"中文姓名"}};e.default={created:function(){var t=this;this.currentValue=this.value||"",this.title||this.placeholder||this.currentValue||console.warn("no title and no placeholder?"),this.required&&!this.currentValue&&(this.valid=!1),this.handleChangeEvent=!0,this.debounce&&(this._debounce=i.i(h.a)(function(){t.$emit("on-change",t.currentValue)},this.debounce))},mounted:function(){this.$slots&&this.$slots["restricted-label"]&&(this.hasRestrictedLabel=!0)},beforeDestroy:function(){this._debounce&&this._debounce.cancel()},mixins:[n.a],components:{Icon:s.a,InlineDesc:r.a},props:{title:{type:String,default:""},type:{type:String,default:"text"},placeholder:String,value:[String,Number],name:String,readonly:Boolean,disabled:Boolean,keyboard:String,inlineDesc:String,isType:[String,Function],min:Number,max:Number,showClear:{type:Boolean,default:!0},equalWith:String,textAlign:String,autocomplete:{type:String,default:"off"},autocapitalize:{type:String,default:"off"},autocorrect:{type:String,default:"off"},spellcheck:{type:String,default:"false"},novalidate:{type:Boolean,default:!1},iconType:String,debounce:Number,placeholderAlign:String,labelWidth:String},computed:{labelStyles:function(){return{width:this.labelWidthComputed||this.$parent.labelWidth||this.labelWidthComputed,textAlign:this.$parent.labelAlign,marginRight:this.$parent.labelMarginRight}},pattern:function(){if("number"===this.keyboard||"china-mobile"===this.isType)return"[0-9]*"},labelWidthComputed:function(){var t=this.title.replace(/[^x00-xff]/g,"00").length/2+1;if(t<10)return t+"em"},hasErrors:function(){return Object.keys(this.errors).length>0},inputStyle:function(){if(this.textAlign)return{textAlign:this.textAlign}},showWarn:function(){return!this.novalidate&&!this.equalWith&&!this.valid&&this.firstError&&(this.touched||this.forceShowError)}},methods:{reset:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.dirty=!1,this.currentValue=t,this.firstError="",this.valid=!0},clear:function(){this.currentValue="",this.focus()},focus:function(){this.$refs.input.focus()},blur:function(){this.$refs.input.blur()},focusHandler:function(){this.$emit("on-focus",this.currentValue)},onBlur:function(){this.setTouched(),this.validate(),this.$emit("on-blur",this.currentValue)},onKeyUp:function(t){"Enter"===t.key&&(t.target.blur(),this.$emit("on-enter",this.currentValue))},getError:function(){var t=Object.keys(this.errors)[0];this.firstError=this.errors[t]},validate:function(){if(void 0!==this.equalWith)return void this.validateEqual();if(this.errors={},!this.currentValue&&!this.required)return void(this.valid=!0);if(!this.currentValue&&this.required)return this.valid=!1,this.errors.required="必填哦",void this.getError();if("string"==typeof this.isType){var t=p[this.isType];if(t){if(this.valid=t.fn(this.currentValue),!this.valid)return void(this.errors.format=t.msg+"格式不对哦~");delete this.errors.format}}if("function"==typeof this.isType){var e=this.isType(this.currentValue);if(this.valid=e.valid,!this.valid)return this.errors.format=e.msg,this.forceShowError=!0,void(this.firstError||this.getError());delete this.errors.format}if(this.min){if(this.currentValue.lengththis.max)return this.errors.max="最多可以输入"+this.max+"个字符哦",this.valid=!1,void(this.forceShowError=!0);this.forceShowError=!1,delete this.errors.max}this.valid=!0},validateEqual:function(){return!this.equalWith&&this.currentValue?(this.valid=!1,void(this.errors.equal="输入不一致")):(this.dirty||this.currentValue.length>=this.equalWith.length)&&this.currentValue!==this.equalWith?(this.valid=!1,void(this.errors.equal="输入不一致")):void(!this.currentValue&&this.required?this.valid=!1:(this.valid=!0,delete this.errors.equal))}},data:function(){return{hasRestrictedLabel:!1,firstError:"",forceShowError:!1,hasLengthEqual:!1,valid:!0,currentValue:""}},watch:{valid:function(){this.getError()},value:function(t){this.currentValue=t},equalWith:function(t){t&&this.equalWith?(t.length===this.equalWith.length&&(this.hasLengthEqual=!0),this.validateEqual()):this.validate()},currentValue:function(t){!this.equalWith&&t&&this.validateEqual(),t&&this.equalWith?(t.length===this.equalWith.length&&(this.hasLengthEqual=!0),this.validateEqual()):this.validate(),this.$emit("input",t),this._debounce?this._debounce():this.$emit("on-change",t)}}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(7),a=i.n(n);e.default={components:{InlineDesc:a.a},computed:{labelStyle:function(){var t=/<\/?[^>]*>/.test(this.title);return{display:"block",width:Math.min(t?5:this.title.length+1,14)+"em"}}},props:{title:{type:String,required:!0},disabled:Boolean,value:{type:Boolean,default:!1},inlineDesc:[String,Boolean,Number]},data:function(){return{currentValue:this.value}},watch:{currentValue:function(t){this.$emit("input",t),this.$emit("on-change",t)},value:function(t){this.currentValue=t}}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(19),a=i(7),s=i.n(a),o=i(106),r=i.n(o);e.default={minxins:[n.a],mounted:function(){var t=this;this.$slots&&this.$slots["restricted-label"]&&(this.hasRestrictedLabel=!0),this.$nextTick(function(){t.autosize&&t.bindAutosize()})},components:{InlineDesc:s.a},props:{title:String,inlineDesc:String,showCounter:{type:Boolean,default:!0},max:Number,value:String,name:String,placeholder:String,readonly:Boolean,rows:{type:Number,default:3},cols:{type:Number,default:30},height:Number,autocomplete:{type:String,default:"off"},autocapitalize:{type:String,default:"off"},autocorrect:{type:String,default:"off"},spellcheck:{type:String,default:"false"},autosize:Boolean},created:function(){this.currentValue=this.value},watch:{autosize:function(t){this.unbindAutosize(),t&&this.bindAutosize()},value:function(t){this.currentValue=t},currentValue:function(t){this.max&&t&&t.length>this.max&&(this.currentValue=t.slice(0,this.max)),this.$emit("input",this.currentValue),this.$emit("on-change",this.currentValue)}},data:function(){return{hasRestrictedLabel:!1,currentValue:""}},computed:{count:function(){var t=0;return this.currentValue&&(t=this.currentValue.replace(/\n/g,"aa").length),t>this.max?this.max:t},textareaStyle:function(){if(this.height)return{height:this.height+"px"}},labelStyles:function(){return{width:this.$parent.labelWidth||this.labelWidth+"em",textAlign:this.$parent.labelAlign,marginRight:this.$parent.labelMarginRight}},labelWidth:function(){return this.title.replace(/[^x00-xff]/g,"00").length/2+1}},methods:{bindAutosize:function(){r()(this.$refs.textarea)},unbindAutosize:function(){r.a.destroy(this.$refs.textarea)},focus:function(){this.$refs.textarea.focus()}},beforeDestroy:function(){this.unbindAutosize()}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(15),a=i.n(n);e.default={components:{Icon:a.a},methods:{updateValue:function(){this.$emit("update:value",this.val)}},props:{value:[String,Number],val:[String,Number],type:{type:String,default:"default"}}}},,,,function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){},,,,function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("button",{staticClass:"weui-btn",class:t.classes,attrs:{disabled:t.disabled,type:t.actionType},on:{click:t.onClick}},[t.showLoading?i("i",{staticClass:"weui-loading"}):t._e(),t._v(" "),t._t("default",[t._v(t._s(t.text))])],2)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement;return(t._self._c||e)("div",{staticClass:"vux-flexbox",class:{"vux-flex-col":"vertical"===t.orient,"vux-flex-row":"horizontal"===t.orient},style:t.styles},[t._t("default")],2)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"vux-header"},[i("div",{staticClass:"vux-header-left"},[t._t("overwrite-left",[i("transition",{attrs:{name:t.transition}},[i("a",{directives:[{name:"show",rawName:"v-show",value:t._leftOptions.showBack,expression:"_leftOptions.showBack"}],staticClass:"vux-header-back",on:{click:[function(e){if(!("button"in e)&&t._k(e.keyCode,"preventDefault"))return null},t.onClickBack]}},[t._v(t._s(void 0===t._leftOptions.backText?"返回":t._leftOptions.backText))])]),t._v(" "),i("transition",{attrs:{name:t.transition}},[i("div",{directives:[{name:"show",rawName:"v-show",value:t._leftOptions.showBack,expression:"_leftOptions.showBack"}],staticClass:"left-arrow",on:{click:t.onClickBack}})])]),t._v(" "),t._t("left")],2),t._v(" "),i("h1",{staticClass:"vux-header-title",on:{click:function(e){t.$emit("on-click-title")}}},[t._t("default",[i("transition",{attrs:{name:t.transition}},[i("span",{directives:[{name:"show",rawName:"v-show",value:t.title,expression:"title"}]},[t._v(t._s(t.title))])])])],2),t._v(" "),i("div",{staticClass:"vux-header-right"},[t.rightOptions.showMore?i("a",{staticClass:"vux-header-more",on:{click:[function(e){if(!("button"in e)&&t._k(e.keyCode,"preventDefault"))return null},function(e){t.$emit("on-click-more")}]}}):t._e(),t._v(" "),t._t("right")],2)])},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"weui-cell",class:{"vux-tap-active":t.isLink||!!t.link,"weui-cell_access":t.isLink||!!t.link,"vux-cell-no-border-intent":!t.borderIntent,"vux-cell-disabled":t.disabled},on:{click:t.onClick}},[i("div",{staticClass:"weui-cell__hd"},[t._t("icon")],2),t._v(" "),i("div",{staticClass:"vux-cell-bd",class:{"vux-cell-primary":"title"===t.primary&&"left"!==t.valueAlign}},[i("p",[t.title||t.hasTitleSlot?i("label",{staticClass:"vux-label",style:t.getLabelStyles()},[t._t("title",[t._v(t._s(t.title))])],2):t._e(),t._v(" "),t._t("after-title")],2),t._v(" "),i("inline-desc",[t._t("inline-desc",[t._v(t._s(t.inlineDesc))])],2)],1),t._v(" "),i("div",{staticClass:"weui-cell__ft",class:t.valueClass},[t._t("value"),t._v(" "),t._t("default",[t._v(t._s(t.value))]),t._v(" "),t.isLoading?i("i",{staticClass:"weui-loading"}):t._e()],2),t._v(" "),t._t("child")],2)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"vux-check-icon",on:{click:t.updateValue}},[i("icon",{directives:[{name:"show",rawName:"v-show",value:"default"===t.type&&t.value===t.val,expression:"type === 'default' && value === val"}],attrs:{type:"success"}}),t._v(" "),i("icon",{directives:[{name:"show",rawName:"v-show",value:"plain"===t.type&&t.value===t.val,expression:"type === 'plain' && value === val"}],attrs:{type:"success_circle"}}),t._v(" "),i("icon",{directives:[{name:"show",rawName:"v-show",value:t.value!==t.val,expression:"value !== val"}],attrs:{type:"circle"}}),t._v(" "),i("input",{directives:[{name:"model",rawName:"v-model",value:t.value,expression:"value"}],staticClass:"radio",attrs:{type:"radio"},domProps:{value:t.val,checked:t._q(t.value,t.val)},on:{__c:function(e){t.value=t.val}}}),t._v(" "),i("span",[t._t("default")],2)],1)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"vux-x-switch weui-cell weui-cell_switch"},[i("div",{staticClass:"weui-cell__bd"},[i("label",{staticClass:"weui-label",style:t.labelStyle,domProps:{innerHTML:t._s(t.title)}}),t._v(" "),t.inlineDesc?i("inline-desc",[t._v(t._s(t.inlineDesc))]):t._e()],1),t._v(" "),i("div",{staticClass:"weui-cell__ft"},[i("input",{directives:[{name:"model",rawName:"v-model",value:t.currentValue,expression:"currentValue"}],staticClass:"weui-switch",attrs:{type:"checkbox",disabled:t.disabled},domProps:{checked:Array.isArray(t.currentValue)?t._i(t.currentValue,null)>-1:t.currentValue},on:{__c:function(e){var i=t.currentValue,n=e.target,a=!!n.checked;if(Array.isArray(i)){var s=t._i(i,null);a?s<0&&(t.currentValue=i.concat(null)):s>-1&&(t.currentValue=i.slice(0,s).concat(i.slice(s+1)))}else t.currentValue=a}}})])])},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement;return(t._self._c||e)("div",{staticClass:"vux-flexbox-item",style:t.style},[t._t("default")],2)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"vux-check-icon",on:{click:t.updateValue}},[i("icon",{directives:[{name:"show",rawName:"v-show",value:"default"===t.type&&t.value,expression:"type === 'default' && value"}],attrs:{type:"success"}}),t._v(" "),i("icon",{directives:[{name:"show",rawName:"v-show",value:"plain"===t.type&&t.value,expression:"type === 'plain' && value"}],attrs:{type:"success_circle"}}),t._v(" "),i("icon",{directives:[{name:"show",rawName:"v-show",value:!t.value,expression:"!value"}],attrs:{type:"circle"}}),t._v(" "),i("span",[t._t("default")],2)],1)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"vux-x-input weui-cell",class:{"weui-cell_warn":t.showWarn}},[i("div",{staticClass:"weui-cell__hd"},[t.hasRestrictedLabel?i("div",{style:t.labelStyles},[t._t("restricted-label")],2):t._e(),t._v(" "),t._t("label",[t.title?i("label",{staticClass:"weui-label",style:{width:t.labelWidth||t.$parent.labelWidth||t.labelWidthComputed,textAlign:t.$parent.labelAlign,marginRight:t.$parent.labelMarginRight},domProps:{innerHTML:t._s(t.title)}}):t._e(),t._v(" "),t.inlineDesc?i("inline-desc",[t._v(t._s(t.inlineDesc))]):t._e()])],2),t._v(" "),i("div",{staticClass:"weui-cell__bd weui-cell__primary",class:t.placeholderAlign?"vux-x-input-placeholder-"+t.placeholderAlign:""},[t.type&&"text"!==t.type?t._e():i("input",{directives:[{name:"model",rawName:"v-model",value:t.currentValue,expression:"currentValue"}],ref:"input",staticClass:"weui-input",style:t.inputStyle,attrs:{maxlength:t.max,autocomplete:t.autocomplete,autocapitalize:t.autocapitalize,autocorrect:t.autocorrect,spellcheck:t.spellcheck,type:"text",name:t.name,pattern:t.pattern,placeholder:t.placeholder,readonly:t.readonly,disabled:t.disabled},domProps:{value:t.currentValue},on:{focus:t.focusHandler,blur:t.onBlur,keyup:t.onKeyUp,input:function(e){e.target.composing||(t.currentValue=e.target.value)}}}),t._v(" "),"number"===t.type?i("input",{directives:[{name:"model",rawName:"v-model",value:t.currentValue,expression:"currentValue"}],ref:"input",staticClass:"weui-input",style:t.inputStyle,attrs:{maxlength:t.max,autocomplete:t.autocomplete,autocapitalize:t.autocapitalize,autocorrect:t.autocorrect,spellcheck:t.spellcheck,type:"number",name:t.name,pattern:t.pattern,placeholder:t.placeholder,readonly:t.readonly,disabled:t.disabled},domProps:{value:t.currentValue},on:{focus:t.focusHandler,blur:[t.onBlur,function(e){t.$forceUpdate()}],keyup:t.onKeyUp,input:function(e){e.target.composing||(t.currentValue=e.target.value)}}}):t._e(),t._v(" "),"email"===t.type?i("input",{directives:[{name:"model",rawName:"v-model",value:t.currentValue,expression:"currentValue"}],ref:"input",staticClass:"weui-input",style:t.inputStyle,attrs:{maxlength:t.max,autocomplete:t.autocomplete,autocapitalize:t.autocapitalize,autocorrect:t.autocorrect,spellcheck:t.spellcheck,type:"email",name:t.name,pattern:t.pattern,placeholder:t.placeholder,readonly:t.readonly,disabled:t.disabled},domProps:{value:t.currentValue},on:{focus:t.focusHandler,blur:t.onBlur,keyup:t.onKeyUp,input:function(e){e.target.composing||(t.currentValue=e.target.value)}}}):t._e(),t._v(" "),"password"===t.type?i("input",{directives:[{name:"model",rawName:"v-model",value:t.currentValue,expression:"currentValue"}],ref:"input",staticClass:"weui-input",style:t.inputStyle,attrs:{maxlength:t.max,autocomplete:t.autocomplete,autocapitalize:t.autocapitalize,autocorrect:t.autocorrect,spellcheck:t.spellcheck,type:"password",name:t.name,pattern:t.pattern,placeholder:t.placeholder,readonly:t.readonly,disabled:t.disabled},domProps:{value:t.currentValue},on:{focus:t.focusHandler,blur:t.onBlur,keyup:t.onKeyUp,input:function(e){e.target.composing||(t.currentValue=e.target.value)}}}):t._e(),t._v(" "),"tel"===t.type?i("input",{directives:[{name:"model",rawName:"v-model",value:t.currentValue,expression:"currentValue"}],ref:"input",staticClass:"weui-input",style:t.inputStyle,attrs:{maxlength:t.max,autocomplete:t.autocomplete,autocapitalize:t.autocapitalize,autocorrect:t.autocorrect,spellcheck:t.spellcheck,type:"tel",name:t.name,pattern:t.pattern,placeholder:t.placeholder,readonly:t.readonly,disabled:t.disabled},domProps:{value:t.currentValue},on:{focus:t.focusHandler,blur:t.onBlur,keyup:t.onKeyUp,input:function(e){e.target.composing||(t.currentValue=e.target.value)}}}):t._e()]),t._v(" "),i("div",{staticClass:"weui-cell__ft"},[i("icon",{directives:[{name:"show",rawName:"v-show",value:!t.equalWith&&t.showClear&&t.currentValue&&!t.readonly&&!t.disabled,expression:"!equalWith && showClear && currentValue && !readonly && !disabled"}],attrs:{type:"clear"},nativeOn:{click:function(e){t.clear(e)}}}),t._v(" "),i("icon",{directives:[{name:"show",rawName:"v-show",value:t.showWarn,expression:"showWarn"}],staticClass:"vux-input-icon",attrs:{type:"warn",title:t.valid?"":t.firstError}}),t._v(" "),!t.novalidate&&t.hasLengthEqual&&t.dirty&&t.equalWith&&!t.valid?i("icon",{staticClass:"vux-input-icon",attrs:{type:"warn"}}):t._e(),t._v(" "),i("icon",{directives:[{name:"show",rawName:"v-show",value:!t.novalidate&&t.equalWith&&t.equalWith===t.currentValue&&t.valid,expression:"!novalidate && equalWith && equalWith === currentValue && valid"}],attrs:{type:"success"}}),t._v(" "),i("icon",{directives:[{name:"show",rawName:"v-show",value:t.novalidate&&"success"===t.iconType,expression:"novalidate && iconType === 'success'"}],staticClass:"vux-input-icon",attrs:{type:"success"}}),t._v(" "),i("icon",{directives:[{name:"show",rawName:"v-show",value:t.novalidate&&"error"===t.iconType,expression:"novalidate && iconType === 'error'"}],staticClass:"vux-input-icon",attrs:{type:"warn"}}),t._v(" "),t._t("right")],2)])},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement;return(t._self._c||e)("span",{staticClass:"vux-label-desc"},[t._t("default")],2)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement;return(t._self._c||e)("i",{class:[t.className,t.isMsg?"weui-icon_msg":""]})},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",[t.title?i("div",{staticClass:"weui-cells__title",style:{color:t.titleColor},domProps:{innerHTML:t._s(t.title)}}):t._e(),t._v(" "),i("div",{staticClass:"weui-cells",class:{"vux-no-group-title":!t.title},style:{marginTop:"number"==typeof t.gutter?t.gutter+"px":t.gutter}},[t._t("after-title"),t._v(" "),t._t("default")],2)])},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"weui-cell vux-x-textarea"},[i("div",{staticClass:"weui-cell__hd"},[t.hasRestrictedLabel?i("div",{style:t.labelStyles},[t._t("restricted-label")],2):t._e(),t._v(" "),t._t("label",[t.title?i("label",{staticClass:"weui-label",style:{width:t.$parent.labelWidth||t.labelWidth+"em",textAlign:t.$parent.labelAlign,marginRight:t.$parent.labelMarginRight},domProps:{innerHTML:t._s(t.title)}}):t._e(),t._v(" "),t.inlineDesc?i("inline-desc",[t._v(t._s(t.inlineDesc))]):t._e()])],2),t._v(" "),i("div",{staticClass:"weui-cell__bd"},[i("textarea",{directives:[{name:"model",rawName:"v-model",value:t.currentValue,expression:"currentValue"}],ref:"textarea",staticClass:"weui-textarea",style:t.textareaStyle,attrs:{autocomplete:t.autocomplete,autocapitalize:t.autocapitalize,autocorrect:t.autocorrect,spellcheck:t.spellcheck,placeholder:t.placeholder,readonly:t.readonly,name:t.name,rows:t.rows,cols:t.cols,maxlength:t.max},domProps:{value:t.currentValue},on:{focus:function(e){t.$emit("on-focus")},blur:function(e){t.$emit("on-blur")},input:function(e){e.target.composing||(t.currentValue=e.target.value)}}}),t._v(" "),i("div",{directives:[{name:"show",rawName:"v-show",value:t.showCounter&&t.max,expression:"showCounter && max"}],staticClass:"weui-textarea-counter",on:{click:t.focus}},[i("span",[t._v(t._s(t.count))]),t._v("/"+t._s(t.max)+"\n ")])])])},staticRenderFns:[]}},function(t,e,i){i(77);var n=i(1)(i(69),i(92),null,null);t.exports=n.exports},,,,,,function(t,e,i){"use strict";var n=i(55),a=(i.n(n),i(18)),s=i.n(a);i(54);e.a={getConfig:function(){var t=(arguments.length>0&&void 0!==arguments[0]&&arguments[0],s()(safari,"extension.globalPage.contentWindow.s2a",{}));if(t.getConfig){var e=t.getConfig();e.aria2Connects}return t}}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(t,e,i){"use strict";var n=i(12),a=i(131),s=i(328),o=i.n(s);n.a.use(a.a),e.a=new a.a({routes:[{path:"/",name:"Index",component:o.a}]})},function(t,e,i){"use strict";function n(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function a(t){if(Array.isArray(t)){for(var e=0,i=Array(t.length);e1?n-1:0),o=1;o1?e-1:0),n=1;n1&&void 0!==arguments[1]?arguments[1]:{config:{}},n=JSON.parse(JSON.stringify(p({},e.config,i.config)));f.dispatchMessage({name:"updateSafari2Aria",message:n})},toggleSelectedStatus:function(t){var e=t.dispatch,i=t.state,n=t.getters,a=(t.commit,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}),s=o()(a,"gids",i.selectedGids),r=n.taskLists.filter(function(t){return~s.indexOf(t.gid)}),l={active:[],paused:[]};r.map(function(t){var e=t.status;e="waiting"===e?"active":e,l[e]=l[e]||[],l[e].push(t.gid)});var c=l.active.length>=l.paused.length?"active":"paused",u=l.active.length>=l.paused.length?"pause":"unpause";return l.active.length||l.paused.length?v.mutilCall(i.currentServerUrl,l[c].map(function(t){return{methodName:"aria2."+u,params:[t]}})).then(function(){return e("getTaskList")}):Promise.resolve("no change")},saveOptions:function(t){var e=t.dispatch,i=t.state,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return v.sendCall(i.currentServerUrl,"aria2.changeGlobalOption",p({},n.options)).then(function(){return e("getTaskList",{loadOptions:!0})}).catch(function(t){console.log(t)})},startSelectedDownloads:function(t){var e=t.dispatch,i=t.state,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=o()(n,"gids",i.selectedGids);return v.mutilCall(i.currentServerUrl,a.map(function(t){return{methodName:"aria2.unpause",params:[t]}})).then(function(){return e("getTaskList")})},pauseSelectedDownloads:function(t){var e=t.dispatch,i=t.state,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=o()(n,"gids",i.selectedGids);return v.mutilCall(i.currentServerUrl,a.map(function(t){return{methodName:"aria2.pause",params:[t]}})).then(function(){return e("getTaskList")})},removeSelectedDownloads:function(t){var e=t.dispatch,i=t.state,n=t.getters,a=t.commit,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=o()(s,"gids",i.selectedGids),l=n.taskLists.filter(function(t){return~r.indexOf(t.gid)});return v.mutilCall(i.currentServerUrl,l.map(function(t){return{methodName:"aria2."+(~["active","paused","waiting"].indexOf(t.status)?"remove":"removeDownloadResult"),params:[t.gid]}})).then(function(){return a("setSelected",{selected:[]}),e("getTaskList")})},removeStoppedDownloads:function(t){var e=t.dispatch,i=t.state,n=(t.getters,t.commit);arguments.length>1&&void 0!==arguments[1]&&arguments[1];return v.sendCall(i.currentServerUrl,"aria2.purgeDownloadResult").then(function(){return n("setSelected",{selected:[]}),e("getTaskList")})},getTaskList:function(t){var e=t.commit,i=t.state,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!v.get_s2a())return Promise.reject("获取global变量错误");i.currentServerUrl||e("refreshServerList");var a=[{methodName:"aria2.tellActive",params:[]}];return n.activeList||a.push({methodName:"aria2.tellWaiting",params:[0,1e3]},{methodName:"aria2.tellStopped",params:[0,1e3]}),a.push({methodName:"aria2.getGlobalStat",params:null}),n.loadOptions&&a.push({methodName:"aria2.getGlobalOption",params:null}),i.currentServerUrl?v.sendCall(i.currentServerUrl,"system.multicall",a).then(function(t){var a=void 0;a=n.activeList?p({},i.taskList[i.currentServerUrl],{active:t[0][0]||[]}):{active:t[0][0]||[],waiting:t[1][0]||[],stopped:t[2][0]||[]},e("setTaskList",{list:a,url:i.currentServerUrl});var s=n.activeList?1:3;if(e("setGlobalStat",{globalStat:t[s][0]}),o()(window.safari||{},"extension.toolbarItems")&&(a.active.length>0||a.waiting.length>0?safari.extension.toolbarItems[0].badge=a.active.length+a.waiting.length:safari.extension.toolbarItems[0].badge=0),n.loadOptions&&e("setGlobalOption",{globalOption:t[s+1][0]}),t[s]&&t[s].code)return Promise.reject(t[s])}).catch(function(t){e("setGlobalStat",{globalStat:!1}),console.log("获取列表失败",t)}):Promise.reject("no server url")}},_={isDebug:function(t){return!!v.get_s2a()&&f.isDebug},serverList:function(t){return t.serverList},getAllTaskGid:function(t,e){return e.taskLists.map(function(t){return t.gid})},getStoppedTaskGid:function(){var t=m.currentServerUrl;return o()(m,["taskList",t,"stopped"],[]).map(function(t){return t?t.gid:null})},getGlobalStat:function(t){var e=Object.assign({},t.globalStat);return e.downloadSpeedText=d.a(e.downloadSpeed||0)+"/s",e.uploadSpeedText=d.a(e.uploadSpeed||0)+"/s",e},taskLists:function(t){var e=["complete","error","paused","waiting","active"],i=t.currentServerUrl,n=[];return t.taskList[i]&&(n=[].concat(t.taskList[i].active||[],t.taskList[i].waiting||[],t.taskList[i].stopped||[]),n=n.slice(0).sort(function(t,i){return t.status===i.status?d.b(i)>d.b(t)?1:-1:e.indexOf(i.status)>e.indexOf(t.status)?1:-1})),n},selectedTasks:function(t,e){return e.taskLists.filter(function(e){return~t.selectedGids.indexOf(e.gid)})}};e.a=new u.a.Store({state:m,getters:_,actions:w,mutations:g})},,function(t,e,i){"use strict";var n=i(162),a=function(t){return Object.keys(t).map(function(e){var a={};return e.split("+").forEach(function(t){switch(t.toLowerCase()){case"ctrl":case"alt":case"shift":case"meta":a[t]=!0;break;default:a.keyCode=i.i(n.a)(t)}}),a.callback=t[e],a})};e.a={install:function(t){t.directive("hotkey",{bind:function(t,e,i,n){t._keymap=a(e.value),t._keyHandler=function(e){var i=!0,n=!1,a=void 0;try{for(var s,o=t._keymap[Symbol.iterator]();!(i=(s=o.next()).done);i=!0){var r=s.value;r.keyCode===e.keyCode&&!!r.ctrl===e.ctrlKey&&!!r.alt===e.altKey&&!!r.shift===e.shiftKey&&!!r.meta===e.metaKey&&r.callback(e)}}catch(t){n=!0,a=t}finally{try{!i&&o.return&&o.return()}finally{if(n)throw a}}},document.addEventListener("keydown",t._keyHandler)},unbind:function(t,e,i,n){document.removeEventListener("keydown",t._keyHandler)}})}}},,,,function(t,e,i){i(226);var n=i(1)(i(173),i(304),null,null);t.exports=n.exports},,,,,,function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(12),a=i(155),s=i.n(a),o=i(148),r=i(149),l=i(151),c=i(152),u=i(56);n.a.use(u.a);var d=new u.a({locale:navigator.language});n.a.use(c.a),n.a.use(l.a),new n.a({router:o.a,store:r.a,i18n:d,render:function(t){return t(s.a)}}).$mount("#app-box"),window.tlwin={refreshServerList:function(){r.a.commit("refreshServerList")},refreshTaskList:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r.a.dispatch("getTaskList",{loadOptions:!0,all:t.all})}}},function(t,e,i){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};e.a=function(t){if(t&&"object"===(void 0===t?"undefined":n(t))){var e=t.which||t.keyCode||t.charCode;e&&(t=e)}if("number"==typeof t)return names[t];var i=String(t),o=a[i.toLowerCase()];if(o)return o;var o=s[i.toLowerCase()];return o||(1===i.length?i.charCodeAt(0):void 0)};var a={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},s={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91};for(o=97;o<123;o++)a[String.fromCharCode(o)]=o-32;for(var o=48;o<58;o++)a[o-48]=o;for(o=1;o<13;o++)a["f"+o]=o+111;for(o=0;o<10;o++)a["numpad "+o]=o+96},function(t,e,i){"use strict";function n(t){if(Array.isArray(t)){for(var e=0,i=Array(t.length);e1?i-1:0),s=1;s50){for(var n=[],a=0,s=parseInt(i.length/50)+1;a=i.length&&(s=i.length-a-1);for(var l=a;l<=a+s;l++)o+=i[l];o=parseInt(o*(r/s)),n.push(o),a+=s}e=16*(parseInt(i.length/50)+1),i=n,t.length=i.length}return{grid:{left:"0%",right:"0%",containLabel:!1},xAxis:{show:!1,data:t},yAxis:{show:!1,max:e},series:[{type:"bar",barGap:"0%",silent:!0,barCategoryGap:"0",itemStyle:{normal:{color:"#eeeeee"}},data:i}]}},getStatus:function(){return this.$t(this.download.status)||""},name:function(){return k.b(this.download)},path:function(){return["file://",this.download.dir].join("")},progress:function(){var t="0"===this.download.totalLength?0:this.download.completedLength/this.download.totalLength;return[parseInt(100*t),"%"].join("")},completedSize:function(){return k.a(this.download.completedLength,-1)},size:function(){return k.a(this.download.totalLength,-1)},isDownloading:function(){return"active"===this.download.status&&"0"!==this.download.downloadSpeed},isUploading:function(){return"active"===this.download.status&&"0"!==this.download.uploadSpeed},downloadSpeed:function(){return[k.a(this.download.downloadSpeed||0,-1),"/s"].join("")},downloadConnections:function(){return this.download.connections},uploadSpeed:function(){return k.a(this.download.uploadSpeed||0)+"/s"}},i.i(C.c)({globalConfig:"config"})),methods:A({showAction:function(){this.showAction=!0},hideAction:function(){this.showAction=!0}},i.i(C.e)(["startSelectedDownloads","pauseSelectedDownloads","removeSelectedDownloads"]))}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(29),a=i.n(n),s=i(27),o=i.n(s),r=i(30),l=i.n(r),c=i(32),u=i.n(c),d=i(24),h=i.n(d),p=i(26),f=i.n(p),v=i(25),m=i.n(v),g=i(28),w=i.n(g),_=i(31),y=i.n(_),b=i(23),x=i.n(b),S=i(329),k=i.n(S),C=i(49),O=Object.assign||function(t){for(var e=1;es[1]&&s.reverse(),i=this.gids.slice(s[0],s[1]+1)}this.setSelected({selected:i})},startOrPause:function(t){"paused"===t.status?this.$store.dispatch("startSelectedDownloads"):"active"===t.status&&this.$store.dispatch("pauseSelectedDownloads")}},i.i(C.d)(["setSelected"]))}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(t,e){},function(t,e){},function(t,e){},,function(t,e){},function(t,e){},function(t,e){},function(t,e){},,,function(t,e){},function(t,e){},function(t,e){},function(t,e){},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{attrs:{id:"app"}},[i("router-view")],1)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"vux-drawer"},[i("div",{staticClass:"vux-drawer-body",style:{transform:"translate3d("+t.translateX+"px, 0, 0)"}},[t._t("default"),t._v(" "),i("div",{staticClass:"drawer-mask",class:t.show?"vux-drawer-active":"",on:{click:t.hideMask}})],2),t._v(" "),i("div",{ref:"drawer",staticClass:"vux-drawer-content",class:["left"!==t.placement?"drawer-right":"drawer-left",t.show?"vux-drawer-active":""],style:t.drawerStyle},[t._t("drawer")],2)])},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{directives:[{name:"hotkey",rawName:"v-hotkey",value:t.keymap,expression:"keymap"}],staticClass:"pop_wrapper"},[i("drawer",{attrs:{width:"240px;",show:t.menuShow,"show-mode":"overlay",placement:"right","drawer-style":{"background-color":"#35495e",width:"240px"}},on:{"update:show":function(e){t.menuShow=e}}},[i("div",{slot:"drawer"},[i("group",{attrs:{title:t.$t("Options")}},[i("cell",{attrs:{title:t.$t("Open options panel"),"is-link":!0},nativeOn:{click:function(e){t.menuShow=!1,t.openOptionsPanel()}}})],1),t._v(" "),t.uaList&&t.uaList.length>1?i("group",{attrs:{title:"User-Agent"}},[i("radio",{attrs:{value:t.config.userAgent,options:t.uaList},on:{"on-change":t.changeUa}})],1):t._e()],1),t._v(" "),i("x-header",{staticClass:"pop_header",attrs:{"left-options":{showBack:!1},"right-options":{showMore:!0}},on:{"on-click-more":function(e){t.menuShow=!0}}},[i("popmenu",{ref:"popmenu",attrs:{placement:"bottom"},on:{"on-show":t.popmenuShow,"on-hide":t.popmenuHide}},[i("div",{staticClass:"selectRpcServer",slot:"content"},[i("group",t._l(t.serverList,function(e){return i("cell",{key:e.url,class:{acitve:e.url===t.currentServerUrl},attrs:{title:e.name},nativeOn:{click:function(i){t.changeList({url:e.url})}}})}))],1),t._v(" "),i("div",{staticClass:"rpcServer"},[i("button",[t._v(t._s(t.currenServerName)+t._s(t.globalStat?"":"("+t.$t("ununited")+")"))]),t._v(" "),i("i",{staticClass:"material-icons"},[t._v(t._s(t.popmenuIsShow?"keyboard_arrow_up":"keyboard_arrow_down"))])])])],1),t._v(" "),i("div",{staticClass:"globalStatus"},[i("div",{staticClass:"control"},[i("x-button",{directives:[{name:"show",rawName:"v-show",value:t.taskLists.length>0,expression:"taskLists.length>0"}],attrs:{mini:"",plain:""},nativeOn:{click:function(e){e.stopPropagation(),t.selecteAll()}}},[i("i",{directives:[{name:"show",rawName:"v-show",value:0===t.selectedGids.length,expression:"selectedGids.length===0"}],staticClass:"material-icons"},[t._v("done_all")]),t._v(" "),i("i",{directives:[{name:"show",rawName:"v-show",value:t.selectedGids.length>0,expression:"selectedGids.length>0"}],staticClass:"material-icons"},[t._v("cancel")])]),t._v(" "),i("div",{directives:[{name:"show",rawName:"v-show",value:t.selectedGids.length>0,expression:"selectedGids.length>0"}],staticClass:"inner"},[i("x-button",{attrs:{mini:"",plain:""},nativeOn:{click:function(e){e.stopPropagation(),t.startSelectedDownloads()}}},[i("i",{staticClass:"material-icons"},[t._v("play_arrow")])]),t._v(" "),i("x-button",{attrs:{mini:"",plain:""},nativeOn:{click:function(e){e.stopPropagation(),t.pauseSelectedDownloads()}}},[i("i",{staticClass:"material-icons"},[t._v("pause")])]),t._v(" "),i("x-button",{attrs:{mini:"",plain:""},nativeOn:{click:function(e){e.stopPropagation(),t.removeSelectedDownloads()}}},[i("i",{staticClass:"material-icons"},[t._v("delete_forever")])])],1),t._v(" "),i("x-button",{directives:[{name:"show",rawName:"v-show",value:t.getStoppedTaskGid.length>0&&0===t.selectedGids.length,expression:"getStoppedTaskGid.length>0 && selectedGids.length===0"}],attrs:{mini:"",plain:""},nativeOn:{click:function(e){e.stopPropagation(),t.removeStoppedDownloads()}}},[t._v(t._s(t.$t("Remove stopped"))+"\n ")])],1),t._v(" "),i("div",{staticClass:"speed",attrs:{title:t.$t("Click to set global speed limit")},on:{click:function(e){if(!("button"in e)&&t._k(e.keyCode,"nativ"))return null;e.stopPropagation(),t.openAria2Options()}}},[t.getGlobalStat.uploadSpeed>0?i("div",{staticClass:"up"},[i("i",{staticClass:"material-icons"},[t._v("arrow_upward")]),t._v("\n "+t._s(t.getGlobalStat.uploadSpeedText)+"\n ")]):t._e(),t._v(" "),i("div",{staticClass:"down"},[i("i",{staticClass:"material-icons"},[t._v("arrow_downward")]),t._v("\n "+t._s(t.getGlobalStat.downloadSpeedText)+"\n ")])])]),t._v(" "),i("task-list",{staticClass:"pop_list",attrs:{list:t.taskLists},nativeOn:{click:function(e){e.stopPropagation(),t.setSelected({selected:[]})}}}),t._v(" "),i("x-dialog",{staticClass:"dialog-options",attrs:{"hide-on-blur":"",scroll:!1},model:{value:t.showOptions,callback:function(e){t.showOptions=e},expression:"showOptions"}},[i("group",[i("x-input",{attrs:{title:t.$t("max-overall-download-limit"),type:"number","show-clear":!1,min:0},model:{value:t.change2GlobalOptions["max-overall-download-limit"],callback:function(e){var i=t.change2GlobalOptions;Array.isArray(i)?i.splice("max-overall-download-limit",1,e):t.change2GlobalOptions["max-overall-download-limit"]=e},expression:"change2GlobalOptions['max-overall-download-limit']"}},[i("span",{slot:"right"},[t._v("KB")])]),t._v(" "),i("x-input",{attrs:{title:t.$t("max-overall-upload-limit"),type:"number","show-clear":!1,min:0},model:{value:t.change2GlobalOptions["max-overall-upload-limit"],callback:function(e){var i=t.change2GlobalOptions;Array.isArray(i)?i.splice("max-overall-upload-limit",1,e):t.change2GlobalOptions["max-overall-upload-limit"]=e},expression:"change2GlobalOptions['max-overall-upload-limit']"}},[i("span",{slot:"right"},[t._v("KB")])]),t._v(" "),i("x-input",{attrs:{title:t.$t("max-concurrent-downloads"),type:"number","show-clear":!1,min:1},model:{value:t.change2GlobalOptions["max-concurrent-downloads"],callback:function(e){var i=t.change2GlobalOptions;Array.isArray(i)?i.splice("max-concurrent-downloads",1,e):t.change2GlobalOptions["max-concurrent-downloads"]=e},expression:"change2GlobalOptions['max-concurrent-downloads']"}},[i("span",{slot:"right"},[t._v("个")])])],1),t._v(" "),i("group",{staticClass:"buttonGroup"},[i("x-button",{nativeOn:{click:function(e){t.saveAria2Options()}}},[t._v(t._s(t.$t("Save")))]),t._v(" "),i("x-button",{nativeOn:{click:function(e){t.showOptions=!1}}},[t._v(t._s(t.$t("Cancel")))])],1)],1)],1)],1)},staticRenderFns:[]}},,function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"weui-cells_radio",class:t.disabled?"vux-radio-disabled":""},[t._l(t.options,function(e,n){return i("label",{staticClass:"weui-cell weui-cell_radio weui-check__label",attrs:{for:"radio_"+t.uuid+"_"+n}},[i("div",{staticClass:"weui-cell__bd"},[t._t("each-item",[i("p",[i("img",{directives:[{name:"show",rawName:"v-show",value:e&&e.icon,expression:"one && one.icon"}],staticClass:"vux-radio-icon",attrs:{src:e.icon}}),t._v(" "),i("span",{staticClass:"vux-radio-label",style:t.currentValue===t.getKey(e)?t.selectedLabelStyle||"":""},[t._v(t._s(t._f("getValue")(e)))])])],{icon:e.icon,label:t.getValue(e),index:n,selected:t.currentValue===t.getKey(e)})],2),t._v(" "),i("div",{staticClass:"weui-cell__ft"},[i("input",{directives:[{name:"model",rawName:"v-model",value:t.currentValue,expression:"currentValue"}],staticClass:"weui-check",attrs:{type:"radio",id:t.disabled?"":"radio_"+t.uuid+"_"+n},domProps:{value:t.getKey(e),checked:t._q(t.currentValue,t.getKey(e))},on:{__c:function(i){t.currentValue=t.getKey(e)}}}),t._v(" "),i("span",{staticClass:"weui-icon-checked"})])])}),t._v(" "),i("div",{directives:[{name:"show",rawName:"v-show",value:t.fillMode,expression:"fillMode"}],staticClass:"weui-cell"},[i("div",{staticClass:"weui-cell__hd"},[i("label",{staticClass:"weui-label",attrs:{for:""}},[t._v(t._s(t.fillLabel))])]),t._v(" "),i("div",{staticClass:"weui-cell__bd"},[i("input",{directives:[{name:"model",rawName:"v-model",value:t.fillValue,expression:"fillValue"}],staticClass:"weui-input needsclick",attrs:{type:"text",placeholder:t.fillPlaceholder},domProps:{value:t.fillValue},on:{blur:function(e){t.isFocus=!1},focus:function(e){t.onFocus()},input:function(e){e.target.composing||(t.fillValue=e.target.value)}}})]),t._v(" "),i("div",{directives:[{name:"show",rawName:"v-show",value:""===t.value&&!t.isFocus,expression:"value==='' && !isFocus"}],staticClass:"weui-cell__ft"},[i("i",{staticClass:"weui-icon-warn"})])])],2)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement;return(t._self._c||e)("div",{staticClass:"echarts"})},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"vux-x-dialog",on:{touchmove:t.onTouchMove}},[i("transition",{attrs:{name:t.maskTransition}},[i("div",{directives:[{name:"show",rawName:"v-show",value:t.currentValue,expression:"currentValue"}],staticClass:"weui-mask",on:{click:function(e){t.hideOnBlur&&(t.currentValue=!1)}}})]),t._v(" "),i("transition",{attrs:{name:t.dialogTransition}},[i("div",{directives:[{name:"show",rawName:"v-show",value:t.currentValue,expression:"currentValue"}],class:t.dialogClass,style:t.dialogStyle},[t._t("default")],2)])],1)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{directives:[{name:"click-outside",rawName:"v-click-outside",value:t.onClickedOutside,expression:"onClickedOutside"}]},[i("span",{ref:"trigger",on:{click:t.toggle}},[t._t("default")],2),t._v(" "),i("div",{directives:[{name:"show",rawName:"v-show",value:t.show,expression:"show"}],ref:"popover",staticClass:"vux-popover",style:t.popoverStyle},[i("div",{class:t.arrowClass}),t._v(" "),i("div",{on:{click:function(e){t.$emit("on-click-content")}}},[t._t("content",[i("div",{domProps:{innerHTML:t._s(t.content)}})])],2)])])},staticRenderFns:[]}},,,function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("group",[i("div",{staticClass:"download-list"},[t._l(t.list,function(e){return i("task-line",{key:e.gid,attrs:{download:e,selected:~t.selectedGids.indexOf(e.gid)},nativeOn:{click:function(i){i.stopPropagation(),t.select(e.gid,i)},dblclick:function(i){i.stopPropagation(),t.startOrPause(e)}}})}),t._v(" "),t.list.length<1?i("cell",{staticClass:"empty",attrs:{title:t.$t("No downloads")}}):t._e()],2)])},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("cell-box",{staticClass:"download",class:{selected:t.selected},nativeOn:{mouseenter:function(e){t.showAction=!0},mouseleave:function(e){t.showAction=!1}}},[t.globalConfig.enableChart?i("chart",{staticClass:"chart",attrs:{autoResize:!0,options:t.char}}):t._e(),t._v(" "),i("div",{staticClass:"progress",style:{width:t.progress}},[i("span",{directives:[{name:"show",rawName:"v-show",value:t.showPercent,expression:"showPercent"}]},[t._v(t._s(parseInt(t.progress)))])]),t._v(" "),i("div",{staticClass:"info"},[i("div",{staticClass:"left"},[i("div",{staticClass:"name",attrs:{title:t.name}},[t._v("\n "+t._s(t.name)+"\n ")]),t._v(" "),i("div",{staticClass:"status"},[t.download.errorMessage?i("div",[t._v(t._s(t.download.errorMessage))]):t._e(),t._v(" "),t.download.errorMessage?t._e():i("div",["active"!=t.download.status?i("span",[t._v(t._s(t.getStatus))]):t._e(),t._v(" "),"0"!==t.download.totalLength?i("span",{staticClass:"size",on:{mouseenter:function(e){t.showPercent=!0},mouseleave:function(e){t.showPercent=!1}}},[t._v(t._s(t.isDownloading?t.completedSize+"/":"")+t._s(t.size))]):t._e(),t._v(" "),t.isDownloading?i("span",{staticClass:"speed"},[t._v(t._s(t.downloadSpeed))]):t._e(),t._v(" "),t.isDownloading?i("span",{staticClass:"connections",attrs:{title:t.$t("connections")}},[t._v(t._s(t.downloadConnections))]):t._e(),t._v(" "),t.isUploading?i("span",{staticClass:"speed upload"},[t._v(t._s(t.uploadSpeed))]):t._e(),t._v(" "),t.isDownloading?i("span",{staticClass:"eta"},[t._v(t._s(t.$t("eta"))+":"+t._s(t.eta))]):t._e()])])]),t._v(" "),i("div",{staticClass:"right"},[i("div",{directives:[{name:"show",rawName:"v-show",value:t.showAction&&!t.showPercent,expression:"showAction&&!showPercent"}],staticClass:"action"},[i("i",{directives:[{name:"show",rawName:"v-show",value:"active"===t.download.status,expression:"download.status === 'active'"}],staticClass:"material-icons",attrs:{title:t.$t("pause")},on:{click:function(e){e.stopPropagation(),t.pauseSelectedDownloads({gids:[t.download.gid]})}}},[t._v("pause_circle_outline")]),t._v(" "),i("i",{directives:[{name:"show",rawName:"v-show",value:"paused"===t.download.status,expression:"download.status === 'paused'"}],staticClass:"material-icons",attrs:{title:t.$t("start")},on:{click:function(e){e.stopPropagation(),t.startSelectedDownloads({gids:[t.download.gid]})}}},[t._v("play_circle_outline")]),t._v(" "),i("i",{staticClass:"material-icons",attrs:{title:t.$t("delete")},on:{click:function(e){e.stopPropagation(),t.removeSelectedDownloads({gids:[t.download.gid]})}}},[t._v("delete_forever")])])])])],1)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"vux-toast"},[i("div",{directives:[{name:"show",rawName:"v-show",value:t.isShowMask&&t.show,expression:"isShowMask && show"}],staticClass:"weui-mask_transparent"}),t._v(" "),i("transition",{attrs:{name:t.currentTransition}},[i("div",{directives:[{name:"show",rawName:"v-show",value:t.show,expression:"show"}],staticClass:"weui-toast",class:t.toastClass,style:{width:t.width}},[i("i",{directives:[{name:"show",rawName:"v-show",value:"text"!==t.type,expression:"type !== 'text'"}],staticClass:"weui-icon-success-no-circle weui-icon_toast"}),t._v(" "),t.text?i("p",{staticClass:"weui-toast__content",style:t.style,domProps:{innerHTML:t._s(t.text)}}):i("p",{staticClass:"weui-toast__content"},[t._t("default")],2)])])],1)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"vux-cell-box weui-cell",class:{"vux-tap-active":t.isLink||!!t.link,"weui-cell_access":t.isLink||!!t.link,"vux-cell-no-border-intent":!t.borderIntent},on:{click:t.onClick}},[i("div",[t._t("default")],2)])},staticRenderFns:[]}},,function(t,e,i){i(231);var n=i(1)(i(163),i(309),null,null);t.exports=n.exports},function(t,e,i){i(239);var n=i(1)(i(164),i(317),null,null);t.exports=n.exports},function(t,e,i){i(227);var n=i(1)(i(165),i(305),null,null);t.exports=n.exports},function(t,e,i){i(230);var n=i(1)(i(166),i(308),null,null);t.exports=n.exports},,function(t,e,i){i(238);var n=i(1)(i(168),i(316),null,null);t.exports=n.exports},function(t,e,i){i(232);var n=i(1)(i(169),i(310),null,null);t.exports=n.exports},function(t,e,i){i(233);var n=i(1)(i(170),i(311),null,null);t.exports=n.exports},,function(t,e,i){i(228);var n=i(1)(i(174),i(306),null,null);t.exports=n.exports},function(t,e,i){i(237);var n=i(1)(i(175),i(315),null,null);t.exports=n.exports},function(t,e,i){i(236);var n=i(1)(i(176),i(314),null,null);t.exports=n.exports}],[161]); \ No newline at end of file +webpackJsonp([1],[,,,,,,,function(t,e,i){i(81);var n=i(1)(null,i(97),null,null);t.exports=n.exports},,,,,,,,function(t,e,i){i(82);var n=i(1)(i(63),i(98),null,null);t.exports=n.exports},,,,,,,,function(t,e,i){i(76);var n=i(1)(i(58),i(91),null,null);t.exports=n.exports},function(t,e,i){i(79);var n=i(1)(i(59),i(95),null,null);t.exports=n.exports},function(t,e,i){var n=i(1)(i(60),i(94),null,null);t.exports=n.exports},function(t,e,i){i(74);var n=i(1)(i(61),i(89),null,null);t.exports=n.exports},function(t,e,i){i(83);var n=i(1)(i(62),i(99),null,null);t.exports=n.exports},function(t,e,i){i(73);var n=i(1)(i(64),i(88),null,null);t.exports=n.exports},function(t,e,i){i(75);var n=i(1)(i(65),i(90),null,null);t.exports=n.exports},function(t,e,i){i(80);var n=i(1)(i(66),i(96),null,null);t.exports=n.exports},function(t,e,i){i(78);var n=i(1)(i(67),i(93),null,null);t.exports=n.exports},function(t,e,i){i(84);var n=i(1)(i(68),i(100),null,null);t.exports=n.exports},,,,,,,,,,,,,,,,,,,,,,function(t,e,i){"use strict";(function(t){var e=i(127),n=i.n(e),a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(e){var i=void 0!==t&&t.exports,s=function t(e){this.callbacks=Object.create(null),this.lastId=0;for(var i in t.options)this[i]="object"===(void 0===e?"undefined":a(e))&&i in e?e[i]:t.options[i]};s.prototype.http=function(t,e){var i=this,n={method:t.method,id:t.id};Array.isArray(t.params)&&t.params.length>0&&(n.params=t.params);var a="http"+(this.secure?"s":"")+"://"+this.host+":"+this.port+this.path;fetch(a,{method:"POST",body:JSON.stringify(n),headers:{Accept:"application/json","Content-Type":"application/json"}}).then(function(t){return t.json()}).then(function(t){i._onmessage(t)}).catch(e)},s.prototype.send=function(t){var e=Array.prototype.slice.call(arguments,1),i="function"==typeof e[e.length-1]?e.pop():null;return this.exec(t,e,i)},s.prototype.exec=function(t,e,i){if("string"!=typeof t)throw new TypeError(t+" is not a string");0!==t.indexOf("system.")&&0!==t.indexOf("aria2.")&&(t="aria2."+t);var a={method:t,"json-rpc":"2.0",id:this.lastId++},s=this.secret?["token:"+this.secret]:[];Array.isArray(e)&&("system.multicall"===t?(Array.isArray(e[0])&&e[0].forEach(function(t){t.params||(t.params=[]),t.params=s.concat(t.params)}),s=e):s=s.concat(e)),s.length>0&&(a.params=s),this.onsend(a);var o=this;return this.socket&&1===this.socket.readyState?this.socket.send(JSON.stringify(a)):this.http(a,function(t){o.callbacks[a.id](t),delete o.callbacks[a.id]}),n()(function(t){o.callbacks[a.id]=t},i)},s.prototype._onmessage=function(t){if(this.onmessage(t),void 0!==t.id){var e=this.callbacks[t.id];e&&(t.error?e(t.error):e(null,t.result),delete this.callbacks[t.id])}else if(t.method){var i=t.method.split("aria2.")[1];0===i.indexOf("on")&&"function"==typeof this[i]&&s.notifications.indexOf(i)>-1&&this[i].apply(this,t.params)}},s.prototype.open=function(t){var e="ws"+(this.secure?"s":"")+"://"+this.host+":"+this.port+this.path,i=this.socket=new WebSocket(e),a=this,s=!1;return i.onmessage=function(t){a._onmessage(JSON.parse(t.data))},n()(function(t){i.onopen=function(){s||(t(),s=!0),a.onopen()},i.onclose=function(e){a.onclose(),1006==e.code&&(s||(t(e),s=!0))},i.onerror=function(e){s||(t(e),s=!0)}},t)},s.prototype.close=function(t){var e=this.socket;return n()(function(t){e?(e.addEventListener("close",function(){t()}),e.close()):t()},t)},s.methods=["addUri","addTorrent","addMetalink","remove","forceRemove","pause","pauseAll","forcePause","forcePauseAll","unpause","unpauseAll","tellStatus","getUris","getFiles","getPeers","getServers","tellActive","tellWaiting","tellStopped","changePosition","changeUri","getOption","changeOption","getGlobalOption","changeGlobalOption","getGlobalStat","purgeDownloadResult","removeDownloadResult","getVersion","getSessionInfo","shutdown","forceShutdown","saveSession","system.multicall","system.listMethods","system.listNotifications"],s.notifications=["onDownloadStart","onDownloadPause","onDownloadStop","onDownloadComplete","onDownloadError","onBtDownloadComplete"],s.events=["onopen","onclose","onsend","onmessage"],s.options={secure:!1,host:"localhost",port:6800,secret:"",path:"/jsonrpc"},s.methods.forEach(function(t){var e=t.indexOf(".")>-1?t.split(".")[1]:t;s.prototype[e]=function(){return this.send.apply(this,[t].concat(Array.prototype.slice.call(arguments)))}}),s.notifications.forEach(function(t){s.prototype[t]=function(){}}),s.events.forEach(function(t){s.prototype[t]=function(){}}),i?t.exports=s:e.Aria2=s}(this)}).call(e,i(132)(t))},,,function(t,e,i){"use strict";function n(t){var e="";return e=t.bittorrent?r()(t,"bittorrent.info.name",["BT:",t.infoHash].join("")):r()(t,"files[0].path","").replace(/^.*[\\\/]/,""),e||(e=r()(t,"files[0].uris[0].uri")),e||"..."}function a(t,e){t=Number(t);var i=["Bytes","KB","MB","GB","TB"];if(0===t)return"0 KB";var n=parseInt(Math.floor(Math.log(t)/Math.log(1e3)),10);if(0===n)return t+" "+i[n];var a=[1,1,10,100,100][n];return Number.isInteger(e)&&(a=Math.pow(10,e)),""+Math.floor(100*t/Math.pow(1024,n)*a)/(100*a)+i[n]}function s(t,e){function i(t,e){return(new Array(e+1).join("0")+t).slice(-e)}var n=/((?:[^ydhms']+)|(?:'(?:[^']|'')*')|(?:y+|d+|h+|m+|s+))(.*)/,a={y:{value:31536e6},yy:{value:"y",pad:2},d:{value:864e5},dd:{value:"d",pad:2},h:{value:36e5},hh:{value:"h",pad:2},m:{value:6e4},mm:{value:"m",pad:2},s:{value:1e3},ss:{value:"s",pad:2},sss:{value:1},ssss:{value:"sss",pad:4}},s=parseFloat(t,10),o=function(t){for(var e=[],i=t?t.toString():"";i;){var a=n.exec(i);a?(e=e.concat(a.slice(1)),i=e.pop()):(e.push(i),i=null)}return e}(e);return isNaN(s)||0===o.length?t:function(t,e){var n="",s={};e.filter(function(t){return a.hasOwnProperty(t)}).map(function(t){var e=a[t];return e.hasOwnProperty("pad")?e.value:t}).filter(function(t,e,i){return i.indexOf(t)===e}).map(function(t){return Object.assign({name:t},a[t])}).sort(function(t,e){return e.value-t.value}).forEach(function(e){var i=s[e.name]=Math.floor(t/e.value);t-=i*e.value});for(var o=0;o=2&&t.length<=6},msg:"中文姓名"}};e.default={created:function(){var t=this;this.currentValue=this.value||"",this.title||this.placeholder||this.currentValue||console.warn("no title and no placeholder?"),this.required&&!this.currentValue&&(this.valid=!1),this.handleChangeEvent=!0,this.debounce&&(this._debounce=i.i(h.a)(function(){t.$emit("on-change",t.currentValue)},this.debounce))},mounted:function(){this.$slots&&this.$slots["restricted-label"]&&(this.hasRestrictedLabel=!0)},beforeDestroy:function(){this._debounce&&this._debounce.cancel()},mixins:[n.a],components:{Icon:s.a,InlineDesc:r.a},props:{title:{type:String,default:""},type:{type:String,default:"text"},placeholder:String,value:[String,Number],name:String,readonly:Boolean,disabled:Boolean,keyboard:String,inlineDesc:String,isType:[String,Function],min:Number,max:Number,showClear:{type:Boolean,default:!0},equalWith:String,textAlign:String,autocomplete:{type:String,default:"off"},autocapitalize:{type:String,default:"off"},autocorrect:{type:String,default:"off"},spellcheck:{type:String,default:"false"},novalidate:{type:Boolean,default:!1},iconType:String,debounce:Number,placeholderAlign:String,labelWidth:String},computed:{labelStyles:function(){return{width:this.labelWidthComputed||this.$parent.labelWidth||this.labelWidthComputed,textAlign:this.$parent.labelAlign,marginRight:this.$parent.labelMarginRight}},pattern:function(){if("number"===this.keyboard||"china-mobile"===this.isType)return"[0-9]*"},labelWidthComputed:function(){var t=this.title.replace(/[^x00-xff]/g,"00").length/2+1;if(t<10)return t+"em"},hasErrors:function(){return Object.keys(this.errors).length>0},inputStyle:function(){if(this.textAlign)return{textAlign:this.textAlign}},showWarn:function(){return!this.novalidate&&!this.equalWith&&!this.valid&&this.firstError&&(this.touched||this.forceShowError)}},methods:{reset:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.dirty=!1,this.currentValue=t,this.firstError="",this.valid=!0},clear:function(){this.currentValue="",this.focus()},focus:function(){this.$refs.input.focus()},blur:function(){this.$refs.input.blur()},focusHandler:function(){this.$emit("on-focus",this.currentValue)},onBlur:function(){this.setTouched(),this.validate(),this.$emit("on-blur",this.currentValue)},onKeyUp:function(t){"Enter"===t.key&&(t.target.blur(),this.$emit("on-enter",this.currentValue))},getError:function(){var t=Object.keys(this.errors)[0];this.firstError=this.errors[t]},validate:function(){if(void 0!==this.equalWith)return void this.validateEqual();if(this.errors={},!this.currentValue&&!this.required)return void(this.valid=!0);if(!this.currentValue&&this.required)return this.valid=!1,this.errors.required="必填哦",void this.getError();if("string"==typeof this.isType){var t=p[this.isType];if(t){if(this.valid=t.fn(this.currentValue),!this.valid)return void(this.errors.format=t.msg+"格式不对哦~");delete this.errors.format}}if("function"==typeof this.isType){var e=this.isType(this.currentValue);if(this.valid=e.valid,!this.valid)return this.errors.format=e.msg,this.forceShowError=!0,void(this.firstError||this.getError());delete this.errors.format}if(this.min){if(this.currentValue.lengththis.max)return this.errors.max="最多可以输入"+this.max+"个字符哦",this.valid=!1,void(this.forceShowError=!0);this.forceShowError=!1,delete this.errors.max}this.valid=!0},validateEqual:function(){return!this.equalWith&&this.currentValue?(this.valid=!1,void(this.errors.equal="输入不一致")):(this.dirty||this.currentValue.length>=this.equalWith.length)&&this.currentValue!==this.equalWith?(this.valid=!1,void(this.errors.equal="输入不一致")):void(!this.currentValue&&this.required?this.valid=!1:(this.valid=!0,delete this.errors.equal))}},data:function(){return{hasRestrictedLabel:!1,firstError:"",forceShowError:!1,hasLengthEqual:!1,valid:!0,currentValue:""}},watch:{valid:function(){this.getError()},value:function(t){this.currentValue=t},equalWith:function(t){t&&this.equalWith?(t.length===this.equalWith.length&&(this.hasLengthEqual=!0),this.validateEqual()):this.validate()},currentValue:function(t){!this.equalWith&&t&&this.validateEqual(),t&&this.equalWith?(t.length===this.equalWith.length&&(this.hasLengthEqual=!0),this.validateEqual()):this.validate(),this.$emit("input",t),this._debounce?this._debounce():this.$emit("on-change",t)}}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(7),a=i.n(n);e.default={components:{InlineDesc:a.a},computed:{labelStyle:function(){var t=/<\/?[^>]*>/.test(this.title);return{display:"block",width:Math.min(t?5:this.title.length+1,14)+"em"}}},props:{title:{type:String,required:!0},disabled:Boolean,value:{type:Boolean,default:!1},inlineDesc:[String,Boolean,Number]},data:function(){return{currentValue:this.value}},watch:{currentValue:function(t){this.$emit("input",t),this.$emit("on-change",t)},value:function(t){this.currentValue=t}}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(19),a=i(7),s=i.n(a),o=i(106),r=i.n(o);e.default={minxins:[n.a],mounted:function(){var t=this;this.$slots&&this.$slots["restricted-label"]&&(this.hasRestrictedLabel=!0),this.$nextTick(function(){t.autosize&&t.bindAutosize()})},components:{InlineDesc:s.a},props:{title:String,inlineDesc:String,showCounter:{type:Boolean,default:!0},max:Number,value:String,name:String,placeholder:String,readonly:Boolean,rows:{type:Number,default:3},cols:{type:Number,default:30},height:Number,autocomplete:{type:String,default:"off"},autocapitalize:{type:String,default:"off"},autocorrect:{type:String,default:"off"},spellcheck:{type:String,default:"false"},autosize:Boolean},created:function(){this.currentValue=this.value},watch:{autosize:function(t){this.unbindAutosize(),t&&this.bindAutosize()},value:function(t){this.currentValue=t},currentValue:function(t){this.max&&t&&t.length>this.max&&(this.currentValue=t.slice(0,this.max)),this.$emit("input",this.currentValue),this.$emit("on-change",this.currentValue)}},data:function(){return{hasRestrictedLabel:!1,currentValue:""}},computed:{count:function(){var t=0;return this.currentValue&&(t=this.currentValue.replace(/\n/g,"aa").length),t>this.max?this.max:t},textareaStyle:function(){if(this.height)return{height:this.height+"px"}},labelStyles:function(){return{width:this.$parent.labelWidth||this.labelWidth+"em",textAlign:this.$parent.labelAlign,marginRight:this.$parent.labelMarginRight}},labelWidth:function(){return this.title.replace(/[^x00-xff]/g,"00").length/2+1}},methods:{bindAutosize:function(){r()(this.$refs.textarea)},unbindAutosize:function(){r.a.destroy(this.$refs.textarea)},focus:function(){this.$refs.textarea.focus()}},beforeDestroy:function(){this.unbindAutosize()}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(15),a=i.n(n);e.default={components:{Icon:a.a},methods:{updateValue:function(){this.$emit("update:value",this.val)}},props:{value:[String,Number],val:[String,Number],type:{type:String,default:"default"}}}},,,,function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){},,,,function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("button",{staticClass:"weui-btn",class:t.classes,attrs:{disabled:t.disabled,type:t.actionType},on:{click:t.onClick}},[t.showLoading?i("i",{staticClass:"weui-loading"}):t._e(),t._v(" "),t._t("default",[t._v(t._s(t.text))])],2)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement;return(t._self._c||e)("div",{staticClass:"vux-flexbox",class:{"vux-flex-col":"vertical"===t.orient,"vux-flex-row":"horizontal"===t.orient},style:t.styles},[t._t("default")],2)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"vux-header"},[i("div",{staticClass:"vux-header-left"},[t._t("overwrite-left",[i("transition",{attrs:{name:t.transition}},[i("a",{directives:[{name:"show",rawName:"v-show",value:t._leftOptions.showBack,expression:"_leftOptions.showBack"}],staticClass:"vux-header-back",on:{click:[function(e){if(!("button"in e)&&t._k(e.keyCode,"preventDefault"))return null},t.onClickBack]}},[t._v(t._s(void 0===t._leftOptions.backText?"返回":t._leftOptions.backText))])]),t._v(" "),i("transition",{attrs:{name:t.transition}},[i("div",{directives:[{name:"show",rawName:"v-show",value:t._leftOptions.showBack,expression:"_leftOptions.showBack"}],staticClass:"left-arrow",on:{click:t.onClickBack}})])]),t._v(" "),t._t("left")],2),t._v(" "),i("h1",{staticClass:"vux-header-title",on:{click:function(e){t.$emit("on-click-title")}}},[t._t("default",[i("transition",{attrs:{name:t.transition}},[i("span",{directives:[{name:"show",rawName:"v-show",value:t.title,expression:"title"}]},[t._v(t._s(t.title))])])])],2),t._v(" "),i("div",{staticClass:"vux-header-right"},[t.rightOptions.showMore?i("a",{staticClass:"vux-header-more",on:{click:[function(e){if(!("button"in e)&&t._k(e.keyCode,"preventDefault"))return null},function(e){t.$emit("on-click-more")}]}}):t._e(),t._v(" "),t._t("right")],2)])},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"weui-cell",class:{"vux-tap-active":t.isLink||!!t.link,"weui-cell_access":t.isLink||!!t.link,"vux-cell-no-border-intent":!t.borderIntent,"vux-cell-disabled":t.disabled},on:{click:t.onClick}},[i("div",{staticClass:"weui-cell__hd"},[t._t("icon")],2),t._v(" "),i("div",{staticClass:"vux-cell-bd",class:{"vux-cell-primary":"title"===t.primary&&"left"!==t.valueAlign}},[i("p",[t.title||t.hasTitleSlot?i("label",{staticClass:"vux-label",style:t.getLabelStyles()},[t._t("title",[t._v(t._s(t.title))])],2):t._e(),t._v(" "),t._t("after-title")],2),t._v(" "),i("inline-desc",[t._t("inline-desc",[t._v(t._s(t.inlineDesc))])],2)],1),t._v(" "),i("div",{staticClass:"weui-cell__ft",class:t.valueClass},[t._t("value"),t._v(" "),t._t("default",[t._v(t._s(t.value))]),t._v(" "),t.isLoading?i("i",{staticClass:"weui-loading"}):t._e()],2),t._v(" "),t._t("child")],2)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"vux-check-icon",on:{click:t.updateValue}},[i("icon",{directives:[{name:"show",rawName:"v-show",value:"default"===t.type&&t.value===t.val,expression:"type === 'default' && value === val"}],attrs:{type:"success"}}),t._v(" "),i("icon",{directives:[{name:"show",rawName:"v-show",value:"plain"===t.type&&t.value===t.val,expression:"type === 'plain' && value === val"}],attrs:{type:"success_circle"}}),t._v(" "),i("icon",{directives:[{name:"show",rawName:"v-show",value:t.value!==t.val,expression:"value !== val"}],attrs:{type:"circle"}}),t._v(" "),i("input",{directives:[{name:"model",rawName:"v-model",value:t.value,expression:"value"}],staticClass:"radio",attrs:{type:"radio"},domProps:{value:t.val,checked:t._q(t.value,t.val)},on:{__c:function(e){t.value=t.val}}}),t._v(" "),i("span",[t._t("default")],2)],1)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"vux-x-switch weui-cell weui-cell_switch"},[i("div",{staticClass:"weui-cell__bd"},[i("label",{staticClass:"weui-label",style:t.labelStyle,domProps:{innerHTML:t._s(t.title)}}),t._v(" "),t.inlineDesc?i("inline-desc",[t._v(t._s(t.inlineDesc))]):t._e()],1),t._v(" "),i("div",{staticClass:"weui-cell__ft"},[i("input",{directives:[{name:"model",rawName:"v-model",value:t.currentValue,expression:"currentValue"}],staticClass:"weui-switch",attrs:{type:"checkbox",disabled:t.disabled},domProps:{checked:Array.isArray(t.currentValue)?t._i(t.currentValue,null)>-1:t.currentValue},on:{__c:function(e){var i=t.currentValue,n=e.target,a=!!n.checked;if(Array.isArray(i)){var s=t._i(i,null);a?s<0&&(t.currentValue=i.concat(null)):s>-1&&(t.currentValue=i.slice(0,s).concat(i.slice(s+1)))}else t.currentValue=a}}})])])},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement;return(t._self._c||e)("div",{staticClass:"vux-flexbox-item",style:t.style},[t._t("default")],2)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"vux-check-icon",on:{click:t.updateValue}},[i("icon",{directives:[{name:"show",rawName:"v-show",value:"default"===t.type&&t.value,expression:"type === 'default' && value"}],attrs:{type:"success"}}),t._v(" "),i("icon",{directives:[{name:"show",rawName:"v-show",value:"plain"===t.type&&t.value,expression:"type === 'plain' && value"}],attrs:{type:"success_circle"}}),t._v(" "),i("icon",{directives:[{name:"show",rawName:"v-show",value:!t.value,expression:"!value"}],attrs:{type:"circle"}}),t._v(" "),i("span",[t._t("default")],2)],1)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"vux-x-input weui-cell",class:{"weui-cell_warn":t.showWarn}},[i("div",{staticClass:"weui-cell__hd"},[t.hasRestrictedLabel?i("div",{style:t.labelStyles},[t._t("restricted-label")],2):t._e(),t._v(" "),t._t("label",[t.title?i("label",{staticClass:"weui-label",style:{width:t.labelWidth||t.$parent.labelWidth||t.labelWidthComputed,textAlign:t.$parent.labelAlign,marginRight:t.$parent.labelMarginRight},domProps:{innerHTML:t._s(t.title)}}):t._e(),t._v(" "),t.inlineDesc?i("inline-desc",[t._v(t._s(t.inlineDesc))]):t._e()])],2),t._v(" "),i("div",{staticClass:"weui-cell__bd weui-cell__primary",class:t.placeholderAlign?"vux-x-input-placeholder-"+t.placeholderAlign:""},[t.type&&"text"!==t.type?t._e():i("input",{directives:[{name:"model",rawName:"v-model",value:t.currentValue,expression:"currentValue"}],ref:"input",staticClass:"weui-input",style:t.inputStyle,attrs:{maxlength:t.max,autocomplete:t.autocomplete,autocapitalize:t.autocapitalize,autocorrect:t.autocorrect,spellcheck:t.spellcheck,type:"text",name:t.name,pattern:t.pattern,placeholder:t.placeholder,readonly:t.readonly,disabled:t.disabled},domProps:{value:t.currentValue},on:{focus:t.focusHandler,blur:t.onBlur,keyup:t.onKeyUp,input:function(e){e.target.composing||(t.currentValue=e.target.value)}}}),t._v(" "),"number"===t.type?i("input",{directives:[{name:"model",rawName:"v-model",value:t.currentValue,expression:"currentValue"}],ref:"input",staticClass:"weui-input",style:t.inputStyle,attrs:{maxlength:t.max,autocomplete:t.autocomplete,autocapitalize:t.autocapitalize,autocorrect:t.autocorrect,spellcheck:t.spellcheck,type:"number",name:t.name,pattern:t.pattern,placeholder:t.placeholder,readonly:t.readonly,disabled:t.disabled},domProps:{value:t.currentValue},on:{focus:t.focusHandler,blur:[t.onBlur,function(e){t.$forceUpdate()}],keyup:t.onKeyUp,input:function(e){e.target.composing||(t.currentValue=e.target.value)}}}):t._e(),t._v(" "),"email"===t.type?i("input",{directives:[{name:"model",rawName:"v-model",value:t.currentValue,expression:"currentValue"}],ref:"input",staticClass:"weui-input",style:t.inputStyle,attrs:{maxlength:t.max,autocomplete:t.autocomplete,autocapitalize:t.autocapitalize,autocorrect:t.autocorrect,spellcheck:t.spellcheck,type:"email",name:t.name,pattern:t.pattern,placeholder:t.placeholder,readonly:t.readonly,disabled:t.disabled},domProps:{value:t.currentValue},on:{focus:t.focusHandler,blur:t.onBlur,keyup:t.onKeyUp,input:function(e){e.target.composing||(t.currentValue=e.target.value)}}}):t._e(),t._v(" "),"password"===t.type?i("input",{directives:[{name:"model",rawName:"v-model",value:t.currentValue,expression:"currentValue"}],ref:"input",staticClass:"weui-input",style:t.inputStyle,attrs:{maxlength:t.max,autocomplete:t.autocomplete,autocapitalize:t.autocapitalize,autocorrect:t.autocorrect,spellcheck:t.spellcheck,type:"password",name:t.name,pattern:t.pattern,placeholder:t.placeholder,readonly:t.readonly,disabled:t.disabled},domProps:{value:t.currentValue},on:{focus:t.focusHandler,blur:t.onBlur,keyup:t.onKeyUp,input:function(e){e.target.composing||(t.currentValue=e.target.value)}}}):t._e(),t._v(" "),"tel"===t.type?i("input",{directives:[{name:"model",rawName:"v-model",value:t.currentValue,expression:"currentValue"}],ref:"input",staticClass:"weui-input",style:t.inputStyle,attrs:{maxlength:t.max,autocomplete:t.autocomplete,autocapitalize:t.autocapitalize,autocorrect:t.autocorrect,spellcheck:t.spellcheck,type:"tel",name:t.name,pattern:t.pattern,placeholder:t.placeholder,readonly:t.readonly,disabled:t.disabled},domProps:{value:t.currentValue},on:{focus:t.focusHandler,blur:t.onBlur,keyup:t.onKeyUp,input:function(e){e.target.composing||(t.currentValue=e.target.value)}}}):t._e()]),t._v(" "),i("div",{staticClass:"weui-cell__ft"},[i("icon",{directives:[{name:"show",rawName:"v-show",value:!t.equalWith&&t.showClear&&t.currentValue&&!t.readonly&&!t.disabled,expression:"!equalWith && showClear && currentValue && !readonly && !disabled"}],attrs:{type:"clear"},nativeOn:{click:function(e){t.clear(e)}}}),t._v(" "),i("icon",{directives:[{name:"show",rawName:"v-show",value:t.showWarn,expression:"showWarn"}],staticClass:"vux-input-icon",attrs:{type:"warn",title:t.valid?"":t.firstError}}),t._v(" "),!t.novalidate&&t.hasLengthEqual&&t.dirty&&t.equalWith&&!t.valid?i("icon",{staticClass:"vux-input-icon",attrs:{type:"warn"}}):t._e(),t._v(" "),i("icon",{directives:[{name:"show",rawName:"v-show",value:!t.novalidate&&t.equalWith&&t.equalWith===t.currentValue&&t.valid,expression:"!novalidate && equalWith && equalWith === currentValue && valid"}],attrs:{type:"success"}}),t._v(" "),i("icon",{directives:[{name:"show",rawName:"v-show",value:t.novalidate&&"success"===t.iconType,expression:"novalidate && iconType === 'success'"}],staticClass:"vux-input-icon",attrs:{type:"success"}}),t._v(" "),i("icon",{directives:[{name:"show",rawName:"v-show",value:t.novalidate&&"error"===t.iconType,expression:"novalidate && iconType === 'error'"}],staticClass:"vux-input-icon",attrs:{type:"warn"}}),t._v(" "),t._t("right")],2)])},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement;return(t._self._c||e)("span",{staticClass:"vux-label-desc"},[t._t("default")],2)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement;return(t._self._c||e)("i",{class:[t.className,t.isMsg?"weui-icon_msg":""]})},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",[t.title?i("div",{staticClass:"weui-cells__title",style:{color:t.titleColor},domProps:{innerHTML:t._s(t.title)}}):t._e(),t._v(" "),i("div",{staticClass:"weui-cells",class:{"vux-no-group-title":!t.title},style:{marginTop:"number"==typeof t.gutter?t.gutter+"px":t.gutter}},[t._t("after-title"),t._v(" "),t._t("default")],2)])},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"weui-cell vux-x-textarea"},[i("div",{staticClass:"weui-cell__hd"},[t.hasRestrictedLabel?i("div",{style:t.labelStyles},[t._t("restricted-label")],2):t._e(),t._v(" "),t._t("label",[t.title?i("label",{staticClass:"weui-label",style:{width:t.$parent.labelWidth||t.labelWidth+"em",textAlign:t.$parent.labelAlign,marginRight:t.$parent.labelMarginRight},domProps:{innerHTML:t._s(t.title)}}):t._e(),t._v(" "),t.inlineDesc?i("inline-desc",[t._v(t._s(t.inlineDesc))]):t._e()])],2),t._v(" "),i("div",{staticClass:"weui-cell__bd"},[i("textarea",{directives:[{name:"model",rawName:"v-model",value:t.currentValue,expression:"currentValue"}],ref:"textarea",staticClass:"weui-textarea",style:t.textareaStyle,attrs:{autocomplete:t.autocomplete,autocapitalize:t.autocapitalize,autocorrect:t.autocorrect,spellcheck:t.spellcheck,placeholder:t.placeholder,readonly:t.readonly,name:t.name,rows:t.rows,cols:t.cols,maxlength:t.max},domProps:{value:t.currentValue},on:{focus:function(e){t.$emit("on-focus")},blur:function(e){t.$emit("on-blur")},input:function(e){e.target.composing||(t.currentValue=e.target.value)}}}),t._v(" "),i("div",{directives:[{name:"show",rawName:"v-show",value:t.showCounter&&t.max,expression:"showCounter && max"}],staticClass:"weui-textarea-counter",on:{click:t.focus}},[i("span",[t._v(t._s(t.count))]),t._v("/"+t._s(t.max)+"\n ")])])])},staticRenderFns:[]}},function(t,e,i){i(77);var n=i(1)(i(69),i(92),null,null);t.exports=n.exports},,,,,,function(t,e,i){"use strict";var n=i(55),a=(i.n(n),i(18)),s=i.n(a);i(54);e.a={getConfig:function(){var t=(arguments.length>0&&void 0!==arguments[0]&&arguments[0],s()(safari,"extension.globalPage.contentWindow.s2a",{}));if(t.getConfig){var e=t.getConfig();e.aria2Connects}return t}}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(t,e,i){"use strict";var n=i(12),a=i(131),s=i(328),o=i.n(s);n.a.use(a.a),e.a=new a.a({routes:[{path:"/",name:"Index",component:o.a}]})},function(t,e,i){"use strict";function n(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function a(t){if(Array.isArray(t)){for(var e=0,i=Array(t.length);e1?n-1:0),o=1;o1?e-1:0),n=1;n1&&void 0!==arguments[1]?arguments[1]:{config:{}},n=JSON.parse(JSON.stringify(p({},e.config,i.config)));f.dispatchMessage({name:"updateSafari2Aria",message:n})},toggleSelectedStatus:function(t){var e=t.dispatch,i=t.state,n=t.getters,a=(t.commit,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}),s=o()(a,"gids",i.selectedGids),r=n.taskLists.filter(function(t){return~s.indexOf(t.gid)}),l={active:[],paused:[]};r.map(function(t){var e=t.status;e="waiting"===e?"active":e,l[e]=l[e]||[],l[e].push(t.gid)});var c=l.active.length>=l.paused.length?"active":"paused",u=l.active.length>=l.paused.length?"pause":"unpause";return l.active.length||l.paused.length?v.mutilCall(i.currentServerUrl,l[c].map(function(t){return{methodName:"aria2."+u,params:[t]}})).then(function(){return e("getTaskList")}):Promise.resolve("no change")},saveOptions:function(t){var e=t.dispatch,i=t.state,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return v.sendCall(i.currentServerUrl,"aria2.changeGlobalOption",p({},n.options)).then(function(){return e("getTaskList",{loadOptions:!0})}).catch(function(t){console.log(t)})},startSelectedDownloads:function(t){var e=t.dispatch,i=t.state,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=o()(n,"gids",i.selectedGids);return v.mutilCall(i.currentServerUrl,a.map(function(t){return{methodName:"aria2.unpause",params:[t]}})).then(function(){return e("getTaskList")})},pauseSelectedDownloads:function(t){var e=t.dispatch,i=t.state,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=o()(n,"gids",i.selectedGids);return v.mutilCall(i.currentServerUrl,a.map(function(t){return{methodName:"aria2.pause",params:[t]}})).then(function(){return e("getTaskList")})},removeSelectedDownloads:function(t){var e=t.dispatch,i=t.state,n=t.getters,a=t.commit,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=o()(s,"gids",i.selectedGids),l=n.taskLists.filter(function(t){return~r.indexOf(t.gid)});return v.mutilCall(i.currentServerUrl,l.map(function(t){return{methodName:"aria2."+(~["active","paused","waiting"].indexOf(t.status)?"remove":"removeDownloadResult"),params:[t.gid]}})).then(function(){return a("setSelected",{selected:[]}),e("getTaskList")})},removeStoppedDownloads:function(t){var e=t.dispatch,i=t.state,n=(t.getters,t.commit);arguments.length>1&&void 0!==arguments[1]&&arguments[1];return v.sendCall(i.currentServerUrl,"aria2.purgeDownloadResult").then(function(){return n("setSelected",{selected:[]}),e("getTaskList")})},getTaskList:function(t){var e=t.commit,i=t.state,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!v.get_s2a())return Promise.reject("获取global变量错误");i.currentServerUrl||e("refreshServerList");var a=[{methodName:"aria2.tellActive",params:[]}];return n.activeList||a.push({methodName:"aria2.tellWaiting",params:[0,1e3]},{methodName:"aria2.tellStopped",params:[0,1e3]}),a.push({methodName:"aria2.getGlobalStat",params:null}),n.loadOptions&&a.push({methodName:"aria2.getGlobalOption",params:null}),i.currentServerUrl?v.sendCall(i.currentServerUrl,"system.multicall",a).then(function(t){var a=void 0;a=n.activeList?p({},i.taskList[i.currentServerUrl],{active:t[0][0]||[]}):{active:t[0][0]||[],waiting:t[1][0]||[],stopped:t[2][0]||[]},e("setTaskList",{list:a,url:i.currentServerUrl});var s=n.activeList?1:3;if(e("setGlobalStat",{globalStat:t[s][0]}),o()(window.safari||{},"extension.toolbarItems")&&(a.active.length>0||o()(a,"waiting",[]).length>0?safari.extension.toolbarItems[0].badge=a.active.length+o()(a,"waiting",[]).length:safari.extension.toolbarItems[0].badge=0),n.loadOptions&&e("setGlobalOption",{globalOption:t[s+1][0]}),t[s]&&t[s].code)return Promise.reject(t[s])}).catch(function(t){e("setGlobalStat",{globalStat:!1}),console.log("获取列表失败",t)}):Promise.reject("no server url")}},_={isDebug:function(t){return!!v.get_s2a()&&f.isDebug},serverList:function(t){return t.serverList},getAllTaskGid:function(t,e){return e.taskLists.map(function(t){return t.gid})},getStoppedTaskGid:function(){var t=m.currentServerUrl;return o()(m,["taskList",t,"stopped"],[]).map(function(t){return t?t.gid:null})},getGlobalStat:function(t){var e=Object.assign({},t.globalStat);return e.downloadSpeedText=d.a(e.downloadSpeed||0)+"/s",e.uploadSpeedText=d.a(e.uploadSpeed||0)+"/s",e},taskLists:function(t){var e=["complete","error","paused","waiting","active"],i=t.currentServerUrl,n=[];return t.taskList[i]&&(n=[].concat(t.taskList[i].active||[],t.taskList[i].waiting||[],t.taskList[i].stopped||[]),n=n.slice(0).sort(function(t,i){return t.status===i.status?d.b(i)>d.b(t)?1:-1:e.indexOf(i.status)>e.indexOf(t.status)?1:-1})),n},selectedTasks:function(t,e){return e.taskLists.filter(function(e){return~t.selectedGids.indexOf(e.gid)})}};e.a=new u.a.Store({state:m,getters:_,actions:w,mutations:g})},,function(t,e,i){"use strict";var n=i(162),a=function(t){return Object.keys(t).map(function(e){var a={};return e.split("+").forEach(function(t){switch(t.toLowerCase()){case"ctrl":case"alt":case"shift":case"meta":a[t]=!0;break;default:a.keyCode=i.i(n.a)(t)}}),a.callback=t[e],a})};e.a={install:function(t){t.directive("hotkey",{bind:function(t,e,i,n){t._keymap=a(e.value),t._keyHandler=function(e){var i=!0,n=!1,a=void 0;try{for(var s,o=t._keymap[Symbol.iterator]();!(i=(s=o.next()).done);i=!0){var r=s.value;r.keyCode===e.keyCode&&!!r.ctrl===e.ctrlKey&&!!r.alt===e.altKey&&!!r.shift===e.shiftKey&&!!r.meta===e.metaKey&&r.callback(e)}}catch(t){n=!0,a=t}finally{try{!i&&o.return&&o.return()}finally{if(n)throw a}}},document.addEventListener("keydown",t._keyHandler)},unbind:function(t,e,i,n){document.removeEventListener("keydown",t._keyHandler)}})}}},,,,function(t,e,i){i(226);var n=i(1)(i(173),i(304),null,null);t.exports=n.exports},,,,,,function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(12),a=i(155),s=i.n(a),o=i(148),r=i(149),l=i(151),c=i(152),u=i(56);n.a.use(u.a);var d=new u.a({locale:navigator.language});n.a.use(c.a),n.a.use(l.a),new n.a({router:o.a,store:r.a,i18n:d,render:function(t){return t(s.a)}}).$mount("#app-box"),window.tlwin={refreshServerList:function(){r.a.commit("refreshServerList")},refreshTaskList:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r.a.dispatch("getTaskList",{loadOptions:!0,all:t.all})}}},function(t,e,i){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};e.a=function(t){if(t&&"object"===(void 0===t?"undefined":n(t))){var e=t.which||t.keyCode||t.charCode;e&&(t=e)}if("number"==typeof t)return names[t];var i=String(t),o=a[i.toLowerCase()];if(o)return o;var o=s[i.toLowerCase()];return o||(1===i.length?i.charCodeAt(0):void 0)};var a={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},s={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91};for(o=97;o<123;o++)a[String.fromCharCode(o)]=o-32;for(var o=48;o<58;o++)a[o-48]=o;for(o=1;o<13;o++)a["f"+o]=o+111;for(o=0;o<10;o++)a["numpad "+o]=o+96},function(t,e,i){"use strict";function n(t){if(Array.isArray(t)){for(var e=0,i=Array(t.length);e1?i-1:0),s=1;s50){for(var n=[],a=0,s=parseInt(i.length/50)+1;a=i.length&&(s=i.length-a-1);for(var l=a;l<=a+s;l++)o+=i[l];o=parseInt(o*(r/s)),n.push(o),a+=s}e=16*(parseInt(i.length/50)+1),i=n,t.length=i.length}return{grid:{left:"0%",right:"0%",containLabel:!1},xAxis:{show:!1,data:t},yAxis:{show:!1,max:e},series:[{type:"bar",barGap:"0%",silent:!0,barCategoryGap:"0",itemStyle:{normal:{color:"#eeeeee"}},data:i}]}},getStatus:function(){return this.$t(this.download.status)||""},name:function(){return k.b(this.download)},path:function(){return["file://",this.download.dir].join("")},progress:function(){var t="0"===this.download.totalLength?0:this.download.completedLength/this.download.totalLength;return[parseInt(100*t),"%"].join("")},completedSize:function(){return k.a(this.download.completedLength,-1)},size:function(){return k.a(this.download.totalLength,-1)},isDownloading:function(){return"active"===this.download.status&&"0"!==this.download.downloadSpeed},isUploading:function(){return"active"===this.download.status&&"0"!==this.download.uploadSpeed},downloadSpeed:function(){return[k.a(this.download.downloadSpeed||0,-1),"/s"].join("")},downloadConnections:function(){return this.download.connections},uploadSpeed:function(){return k.a(this.download.uploadSpeed||0)+"/s"}},i.i(C.c)({globalConfig:"config"})),methods:A({showAction:function(){this.showAction=!0},hideAction:function(){this.showAction=!0}},i.i(C.e)(["startSelectedDownloads","pauseSelectedDownloads","removeSelectedDownloads"]))}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(29),a=i.n(n),s=i(27),o=i.n(s),r=i(30),l=i.n(r),c=i(32),u=i.n(c),d=i(24),h=i.n(d),p=i(26),f=i.n(p),v=i(25),m=i.n(v),g=i(28),w=i.n(g),_=i(31),y=i.n(_),b=i(23),x=i.n(b),S=i(329),k=i.n(S),C=i(49),O=Object.assign||function(t){for(var e=1;es[1]&&s.reverse(),i=this.gids.slice(s[0],s[1]+1)}this.setSelected({selected:i})},startOrPause:function(t){"paused"===t.status?this.$store.dispatch("startSelectedDownloads"):"active"===t.status&&this.$store.dispatch("pauseSelectedDownloads")}},i.i(C.d)(["setSelected"]))}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(t,e){},function(t,e){},function(t,e){},,function(t,e){},function(t,e){},function(t,e){},function(t,e){},,,function(t,e){},function(t,e){},function(t,e){},function(t,e){},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{attrs:{id:"app"}},[i("router-view")],1)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"vux-drawer"},[i("div",{staticClass:"vux-drawer-body",style:{transform:"translate3d("+t.translateX+"px, 0, 0)"}},[t._t("default"),t._v(" "),i("div",{staticClass:"drawer-mask",class:t.show?"vux-drawer-active":"",on:{click:t.hideMask}})],2),t._v(" "),i("div",{ref:"drawer",staticClass:"vux-drawer-content",class:["left"!==t.placement?"drawer-right":"drawer-left",t.show?"vux-drawer-active":""],style:t.drawerStyle},[t._t("drawer")],2)])},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{directives:[{name:"hotkey",rawName:"v-hotkey",value:t.keymap,expression:"keymap"}],staticClass:"pop_wrapper"},[i("drawer",{attrs:{width:"240px;",show:t.menuShow,"show-mode":"overlay",placement:"right","drawer-style":{"background-color":"#35495e",width:"240px"}},on:{"update:show":function(e){t.menuShow=e}}},[i("div",{slot:"drawer"},[i("group",{attrs:{title:t.$t("Options")}},[i("cell",{attrs:{title:t.$t("Open options panel"),"is-link":!0},nativeOn:{click:function(e){t.menuShow=!1,t.openOptionsPanel()}}})],1),t._v(" "),t.uaList&&t.uaList.length>1?i("group",{attrs:{title:"User-Agent"}},[i("radio",{attrs:{value:t.config.userAgent,options:t.uaList},on:{"on-change":t.changeUa}})],1):t._e()],1),t._v(" "),i("x-header",{staticClass:"pop_header",attrs:{"left-options":{showBack:!1},"right-options":{showMore:!0}},on:{"on-click-more":function(e){t.menuShow=!0}}},[i("popmenu",{ref:"popmenu",attrs:{placement:"bottom"},on:{"on-show":t.popmenuShow,"on-hide":t.popmenuHide}},[i("div",{staticClass:"selectRpcServer",slot:"content"},[i("group",t._l(t.serverList,function(e){return i("cell",{key:e.url,class:{acitve:e.url===t.currentServerUrl},attrs:{title:e.name},nativeOn:{click:function(i){t.changeList({url:e.url})}}})}))],1),t._v(" "),i("div",{staticClass:"rpcServer"},[i("button",[t._v(t._s(t.currenServerName)+t._s(t.globalStat?"":"("+t.$t("ununited")+")"))]),t._v(" "),i("i",{staticClass:"material-icons"},[t._v(t._s(t.popmenuIsShow?"keyboard_arrow_up":"keyboard_arrow_down"))])])])],1),t._v(" "),i("div",{staticClass:"globalStatus"},[i("div",{staticClass:"control"},[i("x-button",{directives:[{name:"show",rawName:"v-show",value:t.taskLists.length>0,expression:"taskLists.length>0"}],attrs:{mini:"",plain:""},nativeOn:{click:function(e){e.stopPropagation(),t.selecteAll()}}},[i("i",{directives:[{name:"show",rawName:"v-show",value:0===t.selectedGids.length,expression:"selectedGids.length===0"}],staticClass:"material-icons"},[t._v("done_all")]),t._v(" "),i("i",{directives:[{name:"show",rawName:"v-show",value:t.selectedGids.length>0,expression:"selectedGids.length>0"}],staticClass:"material-icons"},[t._v("cancel")])]),t._v(" "),i("div",{directives:[{name:"show",rawName:"v-show",value:t.selectedGids.length>0,expression:"selectedGids.length>0"}],staticClass:"inner"},[i("x-button",{attrs:{mini:"",plain:""},nativeOn:{click:function(e){e.stopPropagation(),t.startSelectedDownloads()}}},[i("i",{staticClass:"material-icons"},[t._v("play_arrow")])]),t._v(" "),i("x-button",{attrs:{mini:"",plain:""},nativeOn:{click:function(e){e.stopPropagation(),t.pauseSelectedDownloads()}}},[i("i",{staticClass:"material-icons"},[t._v("pause")])]),t._v(" "),i("x-button",{attrs:{mini:"",plain:""},nativeOn:{click:function(e){e.stopPropagation(),t.removeSelectedDownloads()}}},[i("i",{staticClass:"material-icons"},[t._v("delete_forever")])])],1),t._v(" "),i("x-button",{directives:[{name:"show",rawName:"v-show",value:t.getStoppedTaskGid.length>0&&0===t.selectedGids.length,expression:"getStoppedTaskGid.length>0 && selectedGids.length===0"}],attrs:{mini:"",plain:""},nativeOn:{click:function(e){e.stopPropagation(),t.removeStoppedDownloads()}}},[t._v(t._s(t.$t("Remove stopped"))+"\n ")])],1),t._v(" "),i("div",{staticClass:"speed",attrs:{title:t.$t("Click to set global speed limit")},on:{click:function(e){if(!("button"in e)&&t._k(e.keyCode,"nativ"))return null;e.stopPropagation(),t.openAria2Options()}}},[t.getGlobalStat.uploadSpeed>0?i("div",{staticClass:"up"},[i("i",{staticClass:"material-icons"},[t._v("arrow_upward")]),t._v("\n "+t._s(t.getGlobalStat.uploadSpeedText)+"\n ")]):t._e(),t._v(" "),i("div",{staticClass:"down"},[i("i",{staticClass:"material-icons"},[t._v("arrow_downward")]),t._v("\n "+t._s(t.getGlobalStat.downloadSpeedText)+"\n ")])])]),t._v(" "),i("task-list",{staticClass:"pop_list",attrs:{list:t.taskLists},nativeOn:{click:function(e){e.stopPropagation(),t.setSelected({selected:[]})}}}),t._v(" "),i("x-dialog",{staticClass:"dialog-options",attrs:{"hide-on-blur":"",scroll:!1},model:{value:t.showOptions,callback:function(e){t.showOptions=e},expression:"showOptions"}},[i("group",[i("x-input",{attrs:{title:t.$t("max-overall-download-limit"),type:"number","show-clear":!1,min:0},model:{value:t.change2GlobalOptions["max-overall-download-limit"],callback:function(e){var i=t.change2GlobalOptions;Array.isArray(i)?i.splice("max-overall-download-limit",1,e):t.change2GlobalOptions["max-overall-download-limit"]=e},expression:"change2GlobalOptions['max-overall-download-limit']"}},[i("span",{slot:"right"},[t._v("KB")])]),t._v(" "),i("x-input",{attrs:{title:t.$t("max-overall-upload-limit"),type:"number","show-clear":!1,min:0},model:{value:t.change2GlobalOptions["max-overall-upload-limit"],callback:function(e){var i=t.change2GlobalOptions;Array.isArray(i)?i.splice("max-overall-upload-limit",1,e):t.change2GlobalOptions["max-overall-upload-limit"]=e},expression:"change2GlobalOptions['max-overall-upload-limit']"}},[i("span",{slot:"right"},[t._v("KB")])]),t._v(" "),i("x-input",{attrs:{title:t.$t("max-concurrent-downloads"),type:"number","show-clear":!1,min:1},model:{value:t.change2GlobalOptions["max-concurrent-downloads"],callback:function(e){var i=t.change2GlobalOptions;Array.isArray(i)?i.splice("max-concurrent-downloads",1,e):t.change2GlobalOptions["max-concurrent-downloads"]=e},expression:"change2GlobalOptions['max-concurrent-downloads']"}},[i("span",{slot:"right"},[t._v("个")])])],1),t._v(" "),i("group",{staticClass:"buttonGroup"},[i("x-button",{nativeOn:{click:function(e){t.saveAria2Options()}}},[t._v(t._s(t.$t("Save")))]),t._v(" "),i("x-button",{nativeOn:{click:function(e){t.showOptions=!1}}},[t._v(t._s(t.$t("Cancel")))])],1)],1)],1)],1)},staticRenderFns:[]}},,function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"weui-cells_radio",class:t.disabled?"vux-radio-disabled":""},[t._l(t.options,function(e,n){return i("label",{staticClass:"weui-cell weui-cell_radio weui-check__label",attrs:{for:"radio_"+t.uuid+"_"+n}},[i("div",{staticClass:"weui-cell__bd"},[t._t("each-item",[i("p",[i("img",{directives:[{name:"show",rawName:"v-show",value:e&&e.icon,expression:"one && one.icon"}],staticClass:"vux-radio-icon",attrs:{src:e.icon}}),t._v(" "),i("span",{staticClass:"vux-radio-label",style:t.currentValue===t.getKey(e)?t.selectedLabelStyle||"":""},[t._v(t._s(t._f("getValue")(e)))])])],{icon:e.icon,label:t.getValue(e),index:n,selected:t.currentValue===t.getKey(e)})],2),t._v(" "),i("div",{staticClass:"weui-cell__ft"},[i("input",{directives:[{name:"model",rawName:"v-model",value:t.currentValue,expression:"currentValue"}],staticClass:"weui-check",attrs:{type:"radio",id:t.disabled?"":"radio_"+t.uuid+"_"+n},domProps:{value:t.getKey(e),checked:t._q(t.currentValue,t.getKey(e))},on:{__c:function(i){t.currentValue=t.getKey(e)}}}),t._v(" "),i("span",{staticClass:"weui-icon-checked"})])])}),t._v(" "),i("div",{directives:[{name:"show",rawName:"v-show",value:t.fillMode,expression:"fillMode"}],staticClass:"weui-cell"},[i("div",{staticClass:"weui-cell__hd"},[i("label",{staticClass:"weui-label",attrs:{for:""}},[t._v(t._s(t.fillLabel))])]),t._v(" "),i("div",{staticClass:"weui-cell__bd"},[i("input",{directives:[{name:"model",rawName:"v-model",value:t.fillValue,expression:"fillValue"}],staticClass:"weui-input needsclick",attrs:{type:"text",placeholder:t.fillPlaceholder},domProps:{value:t.fillValue},on:{blur:function(e){t.isFocus=!1},focus:function(e){t.onFocus()},input:function(e){e.target.composing||(t.fillValue=e.target.value)}}})]),t._v(" "),i("div",{directives:[{name:"show",rawName:"v-show",value:""===t.value&&!t.isFocus,expression:"value==='' && !isFocus"}],staticClass:"weui-cell__ft"},[i("i",{staticClass:"weui-icon-warn"})])])],2)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement;return(t._self._c||e)("div",{staticClass:"echarts"})},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"vux-x-dialog",on:{touchmove:t.onTouchMove}},[i("transition",{attrs:{name:t.maskTransition}},[i("div",{directives:[{name:"show",rawName:"v-show",value:t.currentValue,expression:"currentValue"}],staticClass:"weui-mask",on:{click:function(e){t.hideOnBlur&&(t.currentValue=!1)}}})]),t._v(" "),i("transition",{attrs:{name:t.dialogTransition}},[i("div",{directives:[{name:"show",rawName:"v-show",value:t.currentValue,expression:"currentValue"}],class:t.dialogClass,style:t.dialogStyle},[t._t("default")],2)])],1)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{directives:[{name:"click-outside",rawName:"v-click-outside",value:t.onClickedOutside,expression:"onClickedOutside"}]},[i("span",{ref:"trigger",on:{click:t.toggle}},[t._t("default")],2),t._v(" "),i("div",{directives:[{name:"show",rawName:"v-show",value:t.show,expression:"show"}],ref:"popover",staticClass:"vux-popover",style:t.popoverStyle},[i("div",{class:t.arrowClass}),t._v(" "),i("div",{on:{click:function(e){t.$emit("on-click-content")}}},[t._t("content",[i("div",{domProps:{innerHTML:t._s(t.content)}})])],2)])])},staticRenderFns:[]}},,,function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("group",[i("div",{staticClass:"download-list"},[t._l(t.list,function(e){return i("task-line",{key:e.gid,attrs:{download:e,selected:~t.selectedGids.indexOf(e.gid)},nativeOn:{click:function(i){i.stopPropagation(),t.select(e.gid,i)},dblclick:function(i){i.stopPropagation(),t.startOrPause(e)}}})}),t._v(" "),t.list.length<1?i("cell",{staticClass:"empty",attrs:{title:t.$t("No downloads")}}):t._e()],2)])},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("cell-box",{staticClass:"download",class:{selected:t.selected},nativeOn:{mouseenter:function(e){t.showAction=!0},mouseleave:function(e){t.showAction=!1}}},[t.globalConfig.enableChart?i("chart",{staticClass:"chart",attrs:{autoResize:!0,options:t.char}}):t._e(),t._v(" "),i("div",{staticClass:"progress",style:{width:t.progress}},[i("span",{directives:[{name:"show",rawName:"v-show",value:t.showPercent,expression:"showPercent"}]},[t._v(t._s(parseInt(t.progress)))])]),t._v(" "),i("div",{staticClass:"info"},[i("div",{staticClass:"left"},[i("div",{staticClass:"name",attrs:{title:t.name}},[t._v("\n "+t._s(t.name)+"\n ")]),t._v(" "),i("div",{staticClass:"status"},[t.download.errorMessage?i("div",[t._v(t._s(t.download.errorMessage))]):t._e(),t._v(" "),t.download.errorMessage?t._e():i("div",["active"!=t.download.status?i("span",[t._v(t._s(t.getStatus))]):t._e(),t._v(" "),"0"!==t.download.totalLength?i("span",{staticClass:"size",on:{mouseenter:function(e){t.showPercent=!0},mouseleave:function(e){t.showPercent=!1}}},[t._v(t._s(t.isDownloading?t.completedSize+"/":"")+t._s(t.size))]):t._e(),t._v(" "),t.isDownloading?i("span",{staticClass:"speed"},[t._v(t._s(t.downloadSpeed))]):t._e(),t._v(" "),t.isDownloading?i("span",{staticClass:"connections",attrs:{title:t.$t("connections")}},[t._v(t._s(t.downloadConnections))]):t._e(),t._v(" "),t.isUploading?i("span",{staticClass:"speed upload"},[t._v(t._s(t.uploadSpeed))]):t._e(),t._v(" "),t.isDownloading?i("span",{staticClass:"eta"},[t._v(t._s(t.$t("eta"))+":"+t._s(t.eta))]):t._e()])])]),t._v(" "),i("div",{staticClass:"right"},[i("div",{directives:[{name:"show",rawName:"v-show",value:t.showAction&&!t.showPercent,expression:"showAction&&!showPercent"}],staticClass:"action"},[i("i",{directives:[{name:"show",rawName:"v-show",value:"active"===t.download.status,expression:"download.status === 'active'"}],staticClass:"material-icons",attrs:{title:t.$t("pause")},on:{click:function(e){e.stopPropagation(),t.pauseSelectedDownloads({gids:[t.download.gid]})}}},[t._v("pause_circle_outline")]),t._v(" "),i("i",{directives:[{name:"show",rawName:"v-show",value:"paused"===t.download.status,expression:"download.status === 'paused'"}],staticClass:"material-icons",attrs:{title:t.$t("start")},on:{click:function(e){e.stopPropagation(),t.startSelectedDownloads({gids:[t.download.gid]})}}},[t._v("play_circle_outline")]),t._v(" "),i("i",{staticClass:"material-icons",attrs:{title:t.$t("delete")},on:{click:function(e){e.stopPropagation(),t.removeSelectedDownloads({gids:[t.download.gid]})}}},[t._v("delete_forever")])])])])],1)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"vux-toast"},[i("div",{directives:[{name:"show",rawName:"v-show",value:t.isShowMask&&t.show,expression:"isShowMask && show"}],staticClass:"weui-mask_transparent"}),t._v(" "),i("transition",{attrs:{name:t.currentTransition}},[i("div",{directives:[{name:"show",rawName:"v-show",value:t.show,expression:"show"}],staticClass:"weui-toast",class:t.toastClass,style:{width:t.width}},[i("i",{directives:[{name:"show",rawName:"v-show",value:"text"!==t.type,expression:"type !== 'text'"}],staticClass:"weui-icon-success-no-circle weui-icon_toast"}),t._v(" "),t.text?i("p",{staticClass:"weui-toast__content",style:t.style,domProps:{innerHTML:t._s(t.text)}}):i("p",{staticClass:"weui-toast__content"},[t._t("default")],2)])])],1)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"vux-cell-box weui-cell",class:{"vux-tap-active":t.isLink||!!t.link,"weui-cell_access":t.isLink||!!t.link,"vux-cell-no-border-intent":!t.borderIntent},on:{click:t.onClick}},[i("div",[t._t("default")],2)])},staticRenderFns:[]}},,function(t,e,i){i(231);var n=i(1)(i(163),i(309),null,null);t.exports=n.exports},function(t,e,i){i(239);var n=i(1)(i(164),i(317),null,null);t.exports=n.exports},function(t,e,i){i(227);var n=i(1)(i(165),i(305),null,null);t.exports=n.exports},function(t,e,i){i(230);var n=i(1)(i(166),i(308),null,null);t.exports=n.exports},,function(t,e,i){i(238);var n=i(1)(i(168),i(316),null,null);t.exports=n.exports},function(t,e,i){i(232);var n=i(1)(i(169),i(310),null,null);t.exports=n.exports},function(t,e,i){i(233);var n=i(1)(i(170),i(311),null,null);t.exports=n.exports},,function(t,e,i){i(228);var n=i(1)(i(174),i(306),null,null);t.exports=n.exports},function(t,e,i){i(237);var n=i(1)(i(175),i(315),null,null);t.exports=n.exports},function(t,e,i){i(236);var n=i(1)(i(176),i(314),null,null);t.exports=n.exports}],[161]); \ No newline at end of file diff --git a/safari2aria.safariextension/static/js/startscript.js b/safari2aria.safariextension/static/js/startscript.js index b28fef3..31a6482 100644 --- a/safari2aria.safariextension/static/js/startscript.js +++ b/safari2aria.safariextension/static/js/startscript.js @@ -1 +1 @@ -webpackJsonp([5],{158:function(i,n,t){"use strict";function o(){var i=window.mDisableBaiduLimit;window.mDisableBaiduLimit=!0;var n="浏览器window.navigator属性修改失败,自动尝试方案2。",t="无法修改浏览器window.navigator,这将影响屏蔽功能。",o=window.navigator.platform,e=window.navigator.userAgent;try{Object.defineProperty(window.navigator,"platform",{get:function(){return window.mDisableBaiduLimit?"Android":o}}),Object.defineProperty(window.navigator,"userAgent",{get:function(){return window.mDisableBaiduLimit?"Android":e}})}catch(i){}!function(){if("Android"!==window.navigator.platform){console.log(n);try{window.navigator.__defineGetter__("platform",function(){return window.mDisableBaiduLimit?"Android":o}),window.navigator.__defineGetter__("userAgent",function(){return window.mDisableBaiduLimit?"Android":e})}catch(i){}"Android"!==window.navigator.platform&&console.log(t)}window.mDisableBaiduLimit=i}()}Object.defineProperty(n,"__esModule",{value:!0});var e=t(37);window.top===window&&location.href.match(/baidu/)&&t.i(e.a)(o)},37:function(i,n,t){"use strict";n.a=function(i,n){var t=document.createElement("script");t.type="text/javascript",t.innerHTML=["(",i.toString(),")(",JSON.stringify(n),")"].join(""),document.documentElement.appendChild(t)}}},[158]); \ No newline at end of file +webpackJsonp([5],{158:function(i,n,t){"use strict";function o(){var i=window.mDisableBaiduLimit;window.mDisableBaiduLimit=!0;var n="浏览器window.navigator属性修改失败,自动尝试方案2。",t="无法修改浏览器window.navigator,这将影响屏蔽功能。",o=window.navigator.platform,e=window.navigator.userAgent;try{Object.defineProperty(window.navigator,"platform",{get:function(){return window.mDisableBaiduLimit?"Android":o}}),Object.defineProperty(window.navigator,"userAgent",{get:function(){return window.mDisableBaiduLimit?"Android":e}})}catch(i){}!function(){if("Android"!==window.navigator.platform){console.log(n);try{window.navigator.__defineGetter__("platform",function(){return window.mDisableBaiduLimit?"Android":o}),window.navigator.__defineGetter__("userAgent",function(){return window.mDisableBaiduLimit?"Android":e})}catch(i){}"Android"!==window.navigator.platform&&console.log(t)}window.mDisableBaiduLimit=i}()}Object.defineProperty(n,"__esModule",{value:!0});var e=t(37);window.top===window&&location.href.match(/baidu/)&&t.i(e.a)(o)},37:function(i,n,t){"use strict";function o(){var i=(new Date).getTime()*Math.random(),n=0;i=i.toString();for(var t=0;t{ - if(rpc.url === url){ + _.forEach(rpcList, (rpc, index) => { + if (rpc.url === url) { serverIndex = index; } }); @@ -101,7 +104,7 @@ window.s2a={ //sendMsg("changeRpc", rpcList[config.defaultRpcIndex].name); }, //打开配置面板 - dispatchMessage:messageHandler, + dispatchMessage: messageHandler, openOptions, //重新获取配置 getConfig(){ @@ -112,16 +115,16 @@ window.s2a={ } }; -function getText (text,options={}) { +function getText (text, options = {}) { let lang = config.language || navigator.language; - return _.get(i18n,[lang,text],options.notfailback?'':[text,' '].join('')) + return _.get(i18n, [lang, text], options.notfailback ? '' : [text, ' '].join('')) } //初始化aria2服务 function initAria2 () { - let newConnect={} + let newConnect = {} //从配置中处理服务器地址 - config.rpcList.forEach(function(rpc, index) { + config.rpcList.forEach(function (rpc, index) { let optionMatch = rpc.url.match(/^(http|ws)(s)?(?:\:\/\/)(token\:[^@]*)?@?([^\:\/]*)\:?(\d*)(\/[^\/]*)/); let options = { host: optionMatch[4],//主机地址 @@ -130,23 +133,23 @@ function initAria2 () { secret: optionMatch[3] ? optionMatch[3].split(':')[1] : '',//token path: optionMatch[6] || '/jsonrpc'//rpc路径 }; - if(aria2Connects[rpc.url]){ + if (aria2Connects[rpc.url]) { newConnect[rpc.url] = aria2Connects[rpc.url]; delete aria2Connects[rpc.url]; - }else{ + } else { let aria = new Aria2(options); newConnect[rpc.url] = { aria2: aria, - rpc:rpc, + rpc: rpc, push: rpc.push//是否用websocket连接 }; } -/* - //清除旧的定时器 - if(socketReconnectTimer){ - clearTimeout(socketReconnectTimer) - }*/ + /* + //清除旧的定时器 + if(socketReconnectTimer){ + clearTimeout(socketReconnectTimer) + }*/ //如果开启推送,则开启websocket连接 if (rpc.push) { initPush(newConnect[rpc.url], rpc.name) @@ -165,34 +168,34 @@ function initAria2 () { //初始化推送服务 function initPush (connect, name) { let aria = connect.aria2; - if(connect.aria2&&connect.aria2.socket&&aria.socket.readyState === 1){ - return true - }else{ + if (connect.aria2 && connect.aria2.socket && aria.socket.readyState === 1) { + return true + } else { aria.open() .then(() => { //初始化推送接受事件 initEvent(connect, name); //如果当前为重连,则弹出连接成功提示 - if(connect.reconnect){ + if (connect.reconnect) { delete connect.reconnect; toast.success([getText('Successful links to'), name]) } }).catch((err) => { //只在第一次未连接成功时提示用户 - if(_.get(safari,'application.activeBrowserWindow.activeTab.url')){ - !connect.reconnect&&toast.error([getText('Make sure the aria2 is running, every 10 seconds will automatically retry')], [ name, getText('Connection fail')]); - connect.reconnect=true; + if (_.get(safari, 'application.activeBrowserWindow.activeTab.url')) { + !connect.reconnect && toast.error([getText('Make sure the aria2 is running, every 10 seconds will automatically retry')], [name, getText('Connection fail')]); + connect.reconnect = true; } //开启定时器定时重连 socketReconnectTimer = socketReconnectTimer || setInterval(() => { - let count=0; - _.forEach(aria2Connects,(conn)=>{ - count+=initPush(conn)?0:1; - }); - if(!count){ - clearInterval(socketReconnectTimer); - } - }, 10000) + let count = 0; + _.forEach(aria2Connects, (conn) => { + count += initPush(conn) ? 0 : 1; + }); + if (!count) { + clearInterval(socketReconnectTimer); + } + }, 10000) }); return false } @@ -201,7 +204,7 @@ function initPush (connect, name) { //拉取最新任务状态并刷新扩展按钮小红点 function refreshToolbarItem () { //判断是否在 - if(_.get(safari,'extension.popovers[0].contentWindow.tlwin.refreshTaskList')){ + if (_.get(safari, 'extension.popovers[0].contentWindow.tlwin.refreshTaskList')) { safari.extension.popovers[0].contentWindow.tlwin.refreshTaskList(); } } @@ -213,7 +216,8 @@ function initEvent (connect, rpcName) { connect.started=true; }*/ refreshToolbarItem() - }; let downloadStop = function (e) { + }; + let downloadStop = function (e) { refreshToolbarItem() }; let downloadComplete = function (e, err) { @@ -259,16 +263,16 @@ function sendToAria2 (e) { //console.log('config.userAgent:',config.userAgent); aria.addUri([e[1]], { header: header, - timeout:10, - 'content-disposition-default-utf8':true, + timeout: 10, + 'content-disposition-default-utf8': true, "user-agent": config.userAgent - }).then(()=>{ + }).then(() => { toast.success([getText('Successfully added to the'), connect.rpc.name, config.enableCookie ? "" : '(with cookie)']) - }).catch(err=>{ - toast.error([getText('Fail to Added to the'), connect.rpc.name, getText('failure',{notfailback:true}), config.enableCookie ? "" : '(without cookie)']) + }).catch(err => { + toast.error([getText('Fail to Added to the'), connect.rpc.name, getText('failure', {notfailback: true}), config.enableCookie ? "" : '(without cookie)']) console.log(err); }) - }else{ + } else { toast.error(['添加任务失败:没有url或者没有连接aria2']) } @@ -295,13 +299,20 @@ function restoreOptions () { for (let a = 0; a < fileTypes.length; a++)fileTypes[a] = fileTypes[a].toLowerCase() rpcList = config.rpcList; //更新配置后需要同步至页面脚本 - sendMsg('updateConfig', config); + sendMsg('updateConfig', { + ...config, + sendAll:true + }); initAria2(); - if(_.get(safari,'extension.popovers[0].contentWindow.tlwin.refreshServerList')){ + if (_.get(safari, 'extension.popovers[0].contentWindow.tlwin.refreshServerList')) { safari.extension.popovers[0].contentWindow.tlwin.refreshServerList(); } } //向页面注入脚本发送通知消息 +//msg={ +// sendAll:false, 发送至所有页面 +// hasCb:true, 有回调 +// } function sendMsg (type, msg, cb) { if (msg instanceof Function) { cb = msg; @@ -314,14 +325,18 @@ function sendMsg (type, msg, cb) { }); messageAction[type + '_cb'] = cb; } - if(window.safari){ - _.get(safari,'application.browserWindows',[]).forEach(function (win) { - _.get(win,'tabs',[]).forEach(function (tab) { - if(tab.page){ - tab.page.dispatchMessage(type, msg); - } + if (window.safari) { + if (msg.sendAll) { + _.get(safari, 'application.browserWindows', []).forEach(function (win) { + _.get(win, 'tabs', []).forEach(function (tab) { + if (tab.page) { + tab.page.dispatchMessage(type, msg); + } + }) }) - }) + } else { + safari.application.activeBrowserWindow.activeTab.page.dispatchMessage(type, msg); + } } } //快捷键处理 @@ -358,27 +373,27 @@ function keyPressAction (keys) { } function handleCommand (e) { let command = e.command.split('.'); - let commandAction={ - "showOptions":function () { + let commandAction = { + "showOptions": function () { openOptions(); }, - "DownloadWithXunleilixian":()=>{ - safari.application.activeBrowserWindow.openTab().url = ['http://lixian.vip.xunlei.com/?furl=',e.userInfo[0]].join('') + "DownloadWithXunleilixian": () => { + safari.application.activeBrowserWindow.openTab().url = ['http://lixian.vip.xunlei.com/?furl=', e.userInfo[0]].join('') }, - "DownloadWithBaidulixian":()=>{ + "DownloadWithBaidulixian": () => { safari.application.activeBrowserWindow.openTab().url = "https://pan.baidu.com/disk/home"; - endPageReadyAction['baiduLixian']={ - action:function () { + endPageReadyAction['baiduLixian'] = { + action: function () { sendMsg("baiduLixian", this.param); delete endPageReadyAction['baiduLixian']; }, - param:{ - url:e.userInfo[0] + param: { + url: e.userInfo[0] } } }, - "DownloadWithAria2":()=>{ + "DownloadWithAria2": () => { let index = command[1]; let rpc = index && rpcList[index] ? rpcList[index] : rpcList[0]; let n = [rpc].concat(e.userInfo); @@ -398,7 +413,7 @@ function validateCommand (e) { } //拦截导航跳转事件 function handleNavigation (e) { - if (downloadAble(e.url,config,keyPressed)) { + if (downloadAble(e.url, config, keyPressed)) { e.preventDefault(); sendMsg('getCookie', function (msg) { let t = [ @@ -416,10 +431,10 @@ function handleContextMenu (event) { rpcList.forEach(function (rpc, index) { event.contextMenu.appendContextMenuItem(["DownloadWithAria2", index].join("."), [getText('Downloaded to'), rpc.name].join('')); }); - if(config.enableXunleiLixian){ + if (config.enableXunleiLixian) { event.contextMenu.appendContextMenuItem('DownloadWithXunleilixian', [getText('Import to thunder lixian')].join('')); } - if(config.enableBaiduLixian){ + if (config.enableBaiduLixian) { event.contextMenu.appendContextMenuItem('DownloadWithBaidulixian', [getText('Import to baidu lixian')].join('')); } } diff --git a/src/pages/popover/store/index.js b/src/pages/popover/store/index.js index dfa7ced..b169709 100644 --- a/src/pages/popover/store/index.js +++ b/src/pages/popover/store/index.js @@ -262,8 +262,8 @@ const actions = { globalStat: tasks[gloalStatIndex][0] }); if (_.get(window.safari || {}, 'extension.toolbarItems')) { - if (newTaskList.active.length>0 || newTaskList.waiting.length>0) { - safari.extension.toolbarItems[0].badge = newTaskList.active.length + newTaskList.waiting.length + if (newTaskList.active.length>0 || _.get(newTaskList,'waiting',[]).length>0) { + safari.extension.toolbarItems[0].badge = newTaskList.active.length + _.get(newTaskList,'waiting',[]).length } else { safari.extension.toolbarItems[0].badge = 0 } diff --git a/src/public/downloadAble.js b/src/public/downloadAble.js index 3cc51e8..f12adb4 100644 --- a/src/public/downloadAble.js +++ b/src/public/downloadAble.js @@ -10,10 +10,13 @@ export default function downloadAble (url, config = {}, keypress = {}) { let a = url.substr(url.lastIndexOf(".") + 1); a = a.toLowerCase(); let fileTypes = config.filetypes ? config.filetypes.split(" ") : []; + //如果按着shift则会强行拦截下载 + if(keypress.isShiftPressd){ + return true + } //判断url中文件后缀是否在配置内 for (let n = 0; n < fileTypes.length; n++) { - //如果按着shift则会强行拦截下载 - if (a === fileTypes[n].toLowerCase() || keypress.isShiftPressd) { + if (a === fileTypes[n].toLowerCase()) { return true } } diff --git a/src/public/pageScriptMessage.js b/src/public/pageScriptMessage.js index 7e1de18..b2fa75e 100644 --- a/src/public/pageScriptMessage.js +++ b/src/public/pageScriptMessage.js @@ -13,15 +13,13 @@ export default function (config={}) { let count=0; window.extensionMessageListener.forEach(function (listener) { if(e.name === listener.name){ - if(!document.hidden || listener.background){ - listener.cb&&listener.cb(e.message || {}); - resolve(e.message || {}); - count++; - } + listener.cb&&listener.cb(e.message || {}); + resolve(e.message || {}); + count++; } }); if(!count){ - reject(document.hidden?'in background':'no listener') + reject('no listener') } if (e.message && e.message.hasCb) { safari.self.tab.dispatchMessage([e.name, 'cb'].join('_'), { diff --git a/src/public/runInPage.js b/src/public/runInPage.js index c96d429..7dcc740 100644 --- a/src/public/runInPage.js +++ b/src/public/runInPage.js @@ -1,9 +1,20 @@ /** * Created by liukai on 2017/6/26. */ +function getId () { + let random = (new Date()).getTime() * Math.random(), + hash = 0; + random = random.toString(); + for (var i = 0; i < random.length; i++) { + hash = ~~(((hash << 5) - hash) + random.charCodeAt(i)); + } + return Math.abs(hash); +} + export default function (fn, args) { - var script = document.createElement( 'script' ); + var script = document.createElement('script'); script.type = 'text/javascript'; - script.innerHTML = ['(',fn.toString(),')(',JSON.stringify(args),')'].join(''); + script.id = ['run_js',getId()].join('_'); + script.innerHTML = ['(', fn.toString(), ')(', JSON.stringify(args), ',"', script.id, '")'].join(''); document.documentElement.appendChild(script) }