├── README.md ├── _locales └── en │ └── messages.json ├── css ├── main.css └── setting.css ├── custom.css ├── i18n.js ├── icons ├── icon128.png ├── icon16.png ├── icon19.png ├── icon48.png ├── icon64.png └── notificationicon.png ├── inject.js ├── js ├── classes │ ├── fancy-settings.js │ ├── search.js │ ├── setting.js │ └── tab.js └── i18n.js ├── lib ├── default.css ├── mootools-core.js ├── popup │ ├── popup.css │ ├── popup.js │ ├── popup.min.js │ └── popuplib.min.js └── store.js ├── main.js ├── manifest.js ├── manifest.json ├── popup.html ├── settings.html └── settings.js /README.md: -------------------------------------------------------------------------------- 1 | chrome-aria2-integration 2 | ======================== 3 | 4 | aria2 integration extension for Chrome 5 | 6 | Web Store: http://chrome.google.com/webstore/detail/aria2c-integration/edcakfpjaobkpdfpicldlccdffkhpbfk 7 | 8 | This extension captures new download tasks and sends them to aria2 automatically, as per capturing rules you set (file size, file type, site whitelist, site blacklist) 9 | 10 | It also adds a context menu item. Right click any link and select "Download with aria2" to add the link to aria2 download queue. 11 | 12 | Click the extension icon to reveal a quick view of tasks. Click a progress bar area to pause/unpause a task or remove a completed/error task. 13 | 14 | Requirements: 15 | 16 | 1. Chrome >= 31. Auto download capture doesn't work before this version. 17 | 2. aria2c (>=1.15.2) with RPC enabled. RPC user and password/RPC secret can be set in options. Also rpc-listen-all and rpc-allow-origin-all needs to be switched on. 18 | 19 | Example: aria2c --enable-rpc --rpc-listen-all=true --rpc-allow-origin-all=true 20 | 21 | Recommend: Tick off "Ask where to save each file before downloading" in Chrome settings. 22 | -------------------------------------------------------------------------------- /_locales/en/messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "l10nTabName": { 3 | "message":"Localization" 4 | ,"description":"name of the localization tab" 5 | } 6 | ,"l10nHeader": { 7 | "message":"It does localization too! (this whole tab is, actually)" 8 | ,"description":"Header text for the localization section" 9 | } 10 | ,"l10nIntro": { 11 | "message":"'L10n' refers to 'Localization' - 'L' an 'n' are obvious, and 10 comes from the number of letters between those two. It is the process/whatever of displaying something in the language of choice. It uses 'I18n', 'Internationalization', which refers to the tools / framework supporting L10n. I.e., something is internationalized if it has I18n support, and can be localized. Something is localized for you if it is in your language / dialect." 12 | ,"description":"introduce the basic idea." 13 | } 14 | ,"l10nProd": { 15 | "message":"You are planning to allow localization, right? You have no idea who will be using your extension! You have no idea who will be translating it! At least support the basics, it's not hard, and having the framework in place will let you transition much more easily later on." 16 | ,"description":"drive the point home. It's good for you." 17 | } 18 | ,"l10nFirstParagraph": { 19 | "message":"When the options page loads, elements decorated with data-l10n will automatically be localized!" 20 | ,"description":"inform that elements will be localized on load" 21 | } 22 | ,"l10nSecondParagraph": { 23 | "message":"If you need more complex localization, you can also define data-l10n-args. This should contain $containerType$ filled with $dataType$, which will be passed into Chrome's i18n API as $functionArgs$. In fact, this paragraph does just that, and wraps the args in mono-space font. Easy!" 24 | ,"description":"introduce the data-l10n-args attribute. End on a lame note." 25 | ,"placeholders": { 26 | "containerType": { 27 | "content":"$1" 28 | ,"example":"'array', 'list', or something similar" 29 | ,"description":"type of the args container" 30 | } 31 | ,"dataType": { 32 | "content":"$2" 33 | ,"example":"string" 34 | ,"description":"type of data in each array index" 35 | } 36 | ,"functionArgs": { 37 | "content":"$3" 38 | ,"example":"arguments" 39 | ,"description":"whatever you call what you pass into a function/method. args, params, etc." 40 | } 41 | } 42 | } 43 | ,"l10nThirdParagraph": { 44 | "message":"Message contents are passed right into innerHTML without processing - include any tags (or even scripts) that you feel like. If you have an input field, the placeholder will be set instead, and buttons will have the value attribute set." 45 | ,"description":"inform that we handle placeholders, buttons, and direct HTML input" 46 | } 47 | ,"l10nButtonsBefore": { 48 | "message":"Different types of buttons are handled as well. <button> elements have their html set:" 49 | } 50 | ,"l10nButton": { 51 | "message":"in a button" 52 | } 53 | ,"l10nButtonsBetween": { 54 | "message":"while <input type='submit'> and <input type='button'> get their 'value' set (note: no HTML):" 55 | } 56 | ,"l10nSubmit": { 57 | "message":"a submit value" 58 | } 59 | ,"l10nButtonsAfter": { 60 | "message":"Awesome, no?" 61 | } 62 | ,"l10nExtras": { 63 | "message":"You can even set data-l10n on things like the <title> tag, which lets you have translatable page titles, or fieldset <legend> tags, or anywhere else - the default Boil.localize() behavior will check every tag in the document, not just the body." 64 | ,"description":"inform about places which may not be obvious, like , etc" 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /css/main.css: -------------------------------------------------------------------------------- 1 | /* 2 | // Copyright (c) 2011 Frank Kohlhepp 3 | // https://github.com/frankkohlhepp/fancy-settings 4 | // License: LGPL v2.1 5 | */ 6 | .fancy { 7 | text-shadow: #F5F5F5 0 1px 0; 8 | } 9 | 10 | #sidebar { 11 | position: absolute; 12 | background-color: #EDEDED; 13 | background-image: linear-gradient(top, #EDEDED, #F5F5F5); 14 | background-image: -webkit-gradient( 15 | linear, 16 | left top, 17 | left 500, 18 | color-stop(0, #EDEDED), 19 | color-stop(1, #F5F5F5) 20 | ); 21 | background-image: -moz-linear-gradient( 22 | center top, 23 | #EDEDED 0%, 24 | #F5F5F5 100% 25 | ); 26 | background-image: -o-linear-gradient(top, #EDEDED, #F5F5F5); 27 | width: 219px; 28 | top: 0; 29 | left: 0; 30 | bottom: 0; 31 | border-right: 1px solid #C2C2C2; 32 | box-shadow: inset -8px 0 30px -30px black; 33 | } 34 | 35 | #icon { 36 | position: absolute; 37 | width: 30px; 38 | height: 30px; 39 | top: 12px; 40 | left: 12px; 41 | } 42 | 43 | #sidebar h1 { 44 | position: absolute; 45 | top: 13px; 46 | right: 25px; 47 | font-size: 26px; 48 | color: #707070; 49 | } 50 | 51 | #tab-container { 52 | position: absolute; 53 | top: 50px; 54 | left: 0; 55 | right: 0; 56 | bottom: 0; 57 | overflow-y: auto; 58 | overflow-x: hidden; 59 | text-align: right; 60 | } 61 | 62 | #tab-container .tab { 63 | height: 28px; 64 | padding-right: 25px; 65 | border-top: 1px solid transparent; 66 | border-bottom: 1px solid transparent; 67 | font-size: 12px; 68 | line-height: 28px; 69 | color: #808080; 70 | cursor: pointer; 71 | } 72 | 73 | #search-container { 74 | margin-top: 5px; 75 | margin-bottom: 5px; 76 | padding-right: 23px !important; 77 | cursor: default !important; 78 | } 79 | 80 | #search-container input { 81 | width: 130px; 82 | } 83 | 84 | #tab-container .tab.active, body.searching #search-container { 85 | background-color: #D4D4D4; 86 | border-color: #BFBFBF; 87 | color: black; 88 | text-shadow: #DBDBDB 0 1px 0; 89 | box-shadow: inset -12px 0 30px -30px black; 90 | } 91 | 92 | body.searching #tab-container .tab.active { 93 | background-color: transparent; 94 | border-color: transparent; 95 | color: #808080; 96 | text-shadow: inherit; 97 | box-shadow: none; 98 | } 99 | 100 | #content { 101 | position: absolute; 102 | top: 0; 103 | left: 220px; 104 | right: 0; 105 | bottom: 0; 106 | overflow: auto; 107 | } 108 | 109 | .tab-content { 110 | display: none; 111 | position: absolute; 112 | width: 840px; 113 | top: 0; 114 | left: 0; 115 | bottom: 0; 116 | padding: 20px; 117 | padding-top: 15px; 118 | } 119 | 120 | body.searching .tab-content { 121 | display: none !important; 122 | } 123 | 124 | body.searching #search-result-container { 125 | display: block !important; 126 | } 127 | 128 | body.measuring .tab-content, body.measuring #search-result-container { 129 | display: block !important; 130 | opacity: 0; 131 | overflow: hidden; 132 | } 133 | -------------------------------------------------------------------------------- /css/setting.css: -------------------------------------------------------------------------------- 1 | /* 2 | // Copyright (c) 2011 Frank Kohlhepp 3 | // https://github.com/frankkohlhepp/fancy-settings 4 | // License: LGPL v2.1 5 | */ 6 | .tab-content h2 { 7 | margin: 0; 8 | padding-bottom: 5px; 9 | font-size: 26px; 10 | color: #707070; 11 | line-height: 1; 12 | } 13 | 14 | .setting.group { 15 | border-top: 1px solid #EEEEEE; 16 | margin-top: 10px; 17 | padding-top: 5px; 18 | padding-left: 2px; 19 | } 20 | 21 | .setting.group-name { 22 | width: 140px; 23 | padding: 0; 24 | font-size: 14px; 25 | font-weight: bold; 26 | vertical-align: top; 27 | } 28 | 29 | .setting.bundle { 30 | max-width: 600px; 31 | margin-bottom: 5px; 32 | } 33 | 34 | .setting.bundle.list-box { 35 | margin-bottom: 10px; 36 | } 37 | 38 | .setting.label.radio-buttons + .setting.container.radio-buttons { 39 | margin-top: 3px; 40 | } 41 | 42 | .setting.label, .setting.element-label { 43 | margin-right: 15px; 44 | font-size: 13px; 45 | font-weight: normal; 46 | } 47 | 48 | .setting.label.checkbox, .setting.element-label { 49 | margin-left: 5px; 50 | margin-right: 0; 51 | } 52 | 53 | .setting.label.checkbox { 54 | position: relative; 55 | top: 1px; 56 | } 57 | 58 | .setting.element.slider { 59 | position: relative; 60 | width: 150px; 61 | top: 4px; 62 | } 63 | 64 | .setting.element.list-box { 65 | display: block; 66 | height: 100px; 67 | width: 100%; 68 | } 69 | 70 | .setting.display.slider { 71 | margin-left: 5px; 72 | color: #666666; 73 | } 74 | 75 | #nothing-found { 76 | display: none; 77 | margin-top: 10px; 78 | font-size: 18px; 79 | font-weight: lighter; 80 | color: #999999; 81 | } 82 | -------------------------------------------------------------------------------- /custom.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robbielj/chrome-aria2-integration/e5e3d96634b31d36048f82c30806af38b9ab67d5/custom.css -------------------------------------------------------------------------------- /i18n.js: -------------------------------------------------------------------------------- 1 | this.i18n = { 2 | "settings": { 3 | "en": "Settings" 4 | }, 5 | "RPC": { 6 | "en": "RPC" 7 | }, 8 | "JSONRPCPath": { 9 | "en": "JSON-RPC Path" 10 | }, 11 | "JSONRPCPathExample": { 12 | "en": "http://localhost:6800/jsonrpc" 13 | }, 14 | "RPCUser": { 15 | "en": "RPC User" 16 | }, 17 | "rpcuserDescription": { 18 | "en": "Leave it blank unless you have specified <b><i>rpc-user</i></b>." 19 | }, 20 | "RPCToken": { 21 | "en": "RPC Secret" 22 | }, 23 | "rpctokenDescription": { 24 | "en": "<b><i>rpc-passwd</i></b>/<b><i>rpc-secret</i></b> or leave it blank if neither is specified." 25 | }, 26 | "rpcsettingsDescription": { 27 | "en": "<br \>Note: aria2 1.15.2+ is required. Run aria2 with <b><i>enable-rpc=true</i></b>, <b><i>rpc-allow-origin-all=true</i></b> and <b><i>rpc-listen-all=true</i></b>." 28 | }, 29 | "capture": { 30 | "en": "Capture" 31 | }, 32 | "enablecap": { 33 | "en": "Enable Capture" 34 | }, 35 | "sizerule": { 36 | "en": "File Size" 37 | }, 38 | "filesize": { 39 | "en": "File Size >=" 40 | }, 41 | "filesizeDescription": { 42 | "en": "If enabled, downloading a file with size larger than this value is automatically captured by aria2. <br \>Default value: 500M, Available Metrics: K, M, G, T" 43 | }, 44 | "whitelisttype": { 45 | "en": "File Types" 46 | }, 47 | "whitelisttypeDescription": { 48 | "en": "These file types are <u>always handled</u> by aria2, <u>regardless of size</u>. <br \> Example: rar,zip" 49 | }, 50 | "whitelistsite": { 51 | "en": "Site Whitelist" 52 | }, 53 | "whitelistsiteDescription": { 54 | "en": "Downloads from these sites are <u>always handled</u> by aria2, <u>regardless of type or size</u>.<br \>Example: microsoft.com, download.windowsupdate.com, google.*" 55 | }, 56 | "blacklistsite": { 57 | "en": "Site Blacklist" 58 | }, 59 | "blacklistsiteDescription": { 60 | "en": "Downloads from these sites are <u>always ignored</u> by aria2, <u>regardless of type or size</u>. <br \>Example: microsoft.com, download.windowsupdate.com, google.*" 61 | }, 62 | }; 63 | -------------------------------------------------------------------------------- /icons/icon128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robbielj/chrome-aria2-integration/e5e3d96634b31d36048f82c30806af38b9ab67d5/icons/icon128.png -------------------------------------------------------------------------------- /icons/icon16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robbielj/chrome-aria2-integration/e5e3d96634b31d36048f82c30806af38b9ab67d5/icons/icon16.png -------------------------------------------------------------------------------- /icons/icon19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robbielj/chrome-aria2-integration/e5e3d96634b31d36048f82c30806af38b9ab67d5/icons/icon19.png -------------------------------------------------------------------------------- /icons/icon48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robbielj/chrome-aria2-integration/e5e3d96634b31d36048f82c30806af38b9ab67d5/icons/icon48.png -------------------------------------------------------------------------------- /icons/icon64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robbielj/chrome-aria2-integration/e5e3d96634b31d36048f82c30806af38b9ab67d5/icons/icon64.png -------------------------------------------------------------------------------- /icons/notificationicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robbielj/chrome-aria2-integration/e5e3d96634b31d36048f82c30806af38b9ab67d5/icons/notificationicon.png -------------------------------------------------------------------------------- /inject.js: -------------------------------------------------------------------------------- 1 | chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) { 2 | 'use strict'; 3 | if (request.range === "cookie") { 4 | sendResponse({pagecookie: document.cookie}); 5 | } 6 | if (request.range === "both") { 7 | sendResponse({pagecookie: document.cookie, taburl: document.URL}); 8 | } 9 | }); -------------------------------------------------------------------------------- /js/classes/fancy-settings.js: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2011 Frank Kohlhepp 3 | // https://github.com/frankkohlhepp/fancy-settings 4 | // License: LGPL v2.1 5 | // 6 | (function () { 7 | var FancySettings = this.FancySettings = new Class({ 8 | "tabs": {}, 9 | 10 | "initialize": function (name, icon) { 11 | // Set title and icon 12 | $("title").set("text", name); 13 | $("favicon").set("href", icon); 14 | $("icon").set("src", icon); 15 | $("settings-label").set("text", (i18n.get("settings") || "Settings")); 16 | $("search-label").set("text", (i18n.get("search") || "Search")); 17 | $("search").set("placeholder", (i18n.get("search") || "Search") + "..."); 18 | 19 | this.tab = new Tab($("tab-container"), $("content")); 20 | this.search = new Search($("search"), $("search-result-container")); 21 | }, 22 | 23 | "create": function (params) { 24 | var tab, 25 | group, 26 | row, 27 | content, 28 | bundle; 29 | 30 | // Create tab if it doesn't exist already 31 | if (this.tabs[params.tab] === undefined) { 32 | this.tabs[params.tab] = {"groups":{}}; 33 | tab = this.tabs[params.tab]; 34 | 35 | tab.content = this.tab.create(); 36 | tab.content.tab.set("text", params.tab); 37 | this.search.bind(tab.content.tab); 38 | 39 | tab.content = tab.content.content; 40 | (new Element("h2", { 41 | "text": params.tab 42 | })).inject(tab.content); 43 | } else { 44 | tab = this.tabs[params.tab]; 45 | } 46 | 47 | // Create group if it doesn't exist already 48 | if (tab.groups[params.group] === undefined) { 49 | tab.groups[params.group] = {}; 50 | group = tab.groups[params.group]; 51 | 52 | group.content = (new Element("table", { 53 | "class": "setting group" 54 | })).inject(tab.content); 55 | 56 | row = (new Element("tr")).inject(group.content); 57 | 58 | (new Element("td", { 59 | "class": "setting group-name", 60 | "text": params.group 61 | })).inject(row); 62 | 63 | content = (new Element("td", { 64 | "class": "setting group-content" 65 | })).inject(row); 66 | 67 | group.setting = new Setting(content); 68 | } else { 69 | group = tab.groups[params.group]; 70 | } 71 | 72 | // Create and index the setting 73 | bundle = group.setting.create(params); 74 | this.search.add(bundle); 75 | 76 | return bundle; 77 | }, 78 | 79 | "align": function (settings) { 80 | var types, 81 | type, 82 | maxWidth; 83 | 84 | types = [ 85 | "text", 86 | "button", 87 | "slider", 88 | "popupButton" 89 | ]; 90 | type = settings[0].params.type; 91 | maxWidth = 0; 92 | 93 | if (!types.contains(type)) { 94 | throw "invalidType"; 95 | } 96 | 97 | settings.each(function (setting) { 98 | if (setting.params.type !== type) { 99 | throw "multipleTypes"; 100 | } 101 | 102 | var width = setting.label.offsetWidth; 103 | if (width > maxWidth) { 104 | maxWidth = width; 105 | } 106 | }); 107 | 108 | settings.each(function (setting) { 109 | var width = setting.label.offsetWidth; 110 | if (width < maxWidth) { 111 | if (type === "button" || type === "slider") { 112 | setting.element.setStyle("margin-left", (maxWidth - width + 2) + "px"); 113 | setting.search.element.setStyle("margin-left", (maxWidth - width + 2) + "px"); 114 | } else { 115 | setting.element.setStyle("margin-left", (maxWidth - width) + "px"); 116 | setting.search.element.setStyle("margin-left", (maxWidth - width) + "px"); 117 | } 118 | } 119 | }); 120 | } 121 | }); 122 | 123 | FancySettings.__proto__.initWithManifest = function (callback) { 124 | var settings, 125 | output; 126 | 127 | settings = new FancySettings(manifest.name, manifest.icon); 128 | settings.manifest = {}; 129 | 130 | manifest.settings.each(function (params) { 131 | output = settings.create(params); 132 | if (params.name !== undefined) { 133 | settings.manifest[params.name] = output; 134 | } 135 | }); 136 | 137 | if (manifest.alignment !== undefined) { 138 | document.body.addClass("measuring"); 139 | manifest.alignment.each(function (group) { 140 | group = group.map(function (name) { 141 | return settings.manifest[name]; 142 | }); 143 | settings.align(group); 144 | }); 145 | document.body.removeClass("measuring"); 146 | } 147 | 148 | if (callback !== undefined) { 149 | callback(settings); 150 | } 151 | }; 152 | }()); 153 | -------------------------------------------------------------------------------- /js/classes/search.js: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2011 Frank Kohlhepp 3 | // https://github.com/frankkohlhepp/fancy-settings 4 | // License: LGPL v2.1 5 | // 6 | (function () { 7 | this.Search = new Class({ 8 | "index": [], 9 | "groups": {}, 10 | 11 | "initialize": function (search, searchResultContainer) { 12 | var setting, 13 | find; 14 | 15 | this.search = search; 16 | this.searchResultContainer = searchResultContainer; 17 | this.setting = new Setting(new Element("div")); 18 | 19 | // Create setting for message "nothing found" 20 | setting = new Setting(this.searchResultContainer); 21 | this.nothingFound = setting.create({ 22 | "type": "description", 23 | "text": (i18n.get("nothing-found") || "No matches were found.") 24 | }); 25 | this.nothingFound.bundle.set("id", "nothing-found"); 26 | 27 | // Create event handlers 28 | find = (function (event) { 29 | this.find(event.target.get("value")); 30 | }).bind(this); 31 | 32 | this.search.addEvent("keyup", (function (event) { 33 | if (event.key === "esc") { 34 | this.reset(); 35 | } else { 36 | find(event); 37 | } 38 | }).bind(this)); 39 | this.search.addEventListener("search", find, false); 40 | }, 41 | 42 | "bind": function (tab) { 43 | tab.addEvent("click", this.reset.bind(this)); 44 | }, 45 | 46 | "add": function (setting) { 47 | var searchSetting = this.setting.create(setting.params); 48 | setting.search = searchSetting; 49 | searchSetting.original = setting; 50 | this.index.push(searchSetting); 51 | 52 | setting.addEvent("action", function (value, stopPropagation) { 53 | if (searchSetting.set !== undefined && stopPropagation !== true) { 54 | searchSetting.set(value, true); 55 | } 56 | }); 57 | searchSetting.addEvent("action", function (value) { 58 | if (setting.set !== undefined) { 59 | setting.set(value, true); 60 | } 61 | setting.fireEvent("action", [value, true]); 62 | }); 63 | }, 64 | 65 | "find": function (searchString) { 66 | // Exit search mode 67 | if (searchString.trim() === "") { 68 | document.body.removeClass("searching"); 69 | return; 70 | } 71 | 72 | // Or enter search mode 73 | this.index.each(function (setting) { setting.bundle.dispose(); }); 74 | Object.each(this.groups, function (group) { group.dispose(); }); 75 | document.body.addClass("searching"); 76 | 77 | // Filter settings 78 | var result = this.index.filter(function (setting) { 79 | if (setting.params.searchString.contains(searchString.trim().toLowerCase())) { 80 | return true; 81 | } 82 | }); 83 | 84 | // Display settings 85 | result.each((function (setting) { 86 | var group, 87 | row; 88 | 89 | // Create group if it doesn't exist already 90 | if (this.groups[setting.params.group] === undefined) { 91 | this.groups[setting.params.group] = (new Element("table", { 92 | "class": "setting group" 93 | })).inject(this.searchResultContainer); 94 | 95 | group = this.groups[setting.params.group]; 96 | row = (new Element("tr")).inject(group); 97 | 98 | (new Element("td", { 99 | "class": "setting group-name", 100 | "text": setting.params.group 101 | })).inject(row); 102 | 103 | group.content = (new Element("td", { 104 | "class": "setting group-content" 105 | })).inject(row); 106 | } else { 107 | group = this.groups[setting.params.group].inject(this.searchResultContainer); 108 | } 109 | 110 | setting.bundle.inject(group.content); 111 | }).bind(this)); 112 | 113 | if (result.length === 0) { 114 | this.nothingFound.bundle.addClass("show"); 115 | } else { 116 | this.nothingFound.bundle.removeClass("show"); 117 | } 118 | }, 119 | 120 | "reset": function () { 121 | this.search.set("value", ""); 122 | this.search.blur(); 123 | this.find(""); 124 | } 125 | }); 126 | }()); 127 | -------------------------------------------------------------------------------- /js/classes/setting.js: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2011 Frank Kohlhepp 3 | // https://github.com/frankkohlhepp/fancy-settings 4 | // License: LGPL v2.1 5 | // 6 | (function () { 7 | var settings, 8 | Bundle; 9 | 10 | settings = new Store("settings"); 11 | Bundle = new Class({ 12 | // Attributes: 13 | // - tab 14 | // - group 15 | // - name 16 | // - type 17 | // 18 | // Methods: 19 | // - initialize 20 | // - createDOM 21 | // - setupDOM 22 | // - addEvents 23 | // - get 24 | // - set 25 | "Implements": Events, 26 | 27 | "initialize": function (params) { 28 | this.params = params; 29 | this.params.searchString = "•" + this.params.tab + "•" + this.params.group + "•"; 30 | 31 | this.createDOM(); 32 | this.setupDOM(); 33 | this.addEvents(); 34 | 35 | if (this.params.id !== undefined) { 36 | this.element.set("id", this.params.id); 37 | } 38 | 39 | if (this.params.name !== undefined) { 40 | this.set(settings.get(this.params.name), true); 41 | } 42 | 43 | this.params.searchString = this.params.searchString.toLowerCase(); 44 | }, 45 | 46 | "addEvents": function () { 47 | this.element.addEvent("change", (function (event) { 48 | if (this.params.name !== undefined) { 49 | settings.set(this.params.name, this.get()); 50 | } 51 | 52 | this.fireEvent("action", this.get()); 53 | }).bind(this)); 54 | }, 55 | 56 | "get": function () { 57 | return this.element.get("value"); 58 | }, 59 | 60 | "set": function (value, noChangeEvent) { 61 | this.element.set("value", value); 62 | 63 | if (noChangeEvent !== true) { 64 | this.element.fireEvent("change"); 65 | } 66 | 67 | return this; 68 | } 69 | }); 70 | 71 | Bundle.Description = new Class({ 72 | // text 73 | "Extends": Bundle, 74 | "addEvents": undefined, 75 | "get": undefined, 76 | "set": undefined, 77 | 78 | "initialize": function (params) { 79 | this.params = params; 80 | this.params.searchString = ""; 81 | 82 | this.createDOM(); 83 | this.setupDOM(); 84 | }, 85 | 86 | "createDOM": function () { 87 | this.bundle = new Element("div", { 88 | "class": "setting bundle description" 89 | }); 90 | 91 | this.container = new Element("div", { 92 | "class": "setting container description" 93 | }); 94 | 95 | this.element = new Element("p", { 96 | "class": "setting element description" 97 | }); 98 | }, 99 | 100 | "setupDOM": function () { 101 | if (this.params.text !== undefined) { 102 | this.element.set("html", this.params.text); 103 | } 104 | 105 | this.element.inject(this.container); 106 | this.container.inject(this.bundle); 107 | } 108 | }); 109 | 110 | Bundle.Button = new Class({ 111 | // label, text 112 | // action -> click 113 | "Extends": Bundle, 114 | "get": undefined, 115 | "set": undefined, 116 | 117 | "initialize": function (params) { 118 | this.params = params; 119 | this.params.searchString = "•" + this.params.tab + "•" + this.params.group + "•"; 120 | 121 | this.createDOM(); 122 | this.setupDOM(); 123 | this.addEvents(); 124 | 125 | if (this.params.id !== undefined) { 126 | this.element.set("id", this.params.id); 127 | } 128 | 129 | this.params.searchString = this.params.searchString.toLowerCase(); 130 | }, 131 | 132 | "createDOM": function () { 133 | this.bundle = new Element("div", { 134 | "class": "setting bundle button" 135 | }); 136 | 137 | this.container = new Element("div", { 138 | "class": "setting container button" 139 | }); 140 | 141 | this.element = new Element("input", { 142 | "class": "setting element button", 143 | "type": "button" 144 | }); 145 | 146 | this.label = new Element("label", { 147 | "class": "setting label button" 148 | }); 149 | }, 150 | 151 | "setupDOM": function () { 152 | if (this.params.label !== undefined) { 153 | this.label.set("html", this.params.label); 154 | this.label.inject(this.container); 155 | this.params.searchString += this.params.label + "•"; 156 | } 157 | 158 | if (this.params.text !== undefined) { 159 | this.element.set("value", this.params.text); 160 | this.params.searchString += this.params.text + "•"; 161 | } 162 | 163 | this.element.inject(this.container); 164 | this.container.inject(this.bundle); 165 | }, 166 | 167 | "addEvents": function () { 168 | this.element.addEvent("click", (function () { 169 | this.fireEvent("action"); 170 | }).bind(this)); 171 | } 172 | }); 173 | 174 | Bundle.Text = new Class({ 175 | // label, text, masked 176 | // action -> change & keyup 177 | "Extends": Bundle, 178 | 179 | "createDOM": function () { 180 | this.bundle = new Element("div", { 181 | "class": "setting bundle text" 182 | }); 183 | 184 | this.container = new Element("div", { 185 | "class": "setting container text" 186 | }); 187 | 188 | this.element = new Element("input", { 189 | "class": "setting element text", 190 | "type": "text" 191 | }); 192 | 193 | this.label = new Element("label", { 194 | "class": "setting label text" 195 | }); 196 | }, 197 | 198 | "setupDOM": function () { 199 | if (this.params.label !== undefined) { 200 | this.label.set("html", this.params.label); 201 | this.label.inject(this.container); 202 | this.params.searchString += this.params.label + "•"; 203 | } 204 | 205 | if (this.params.text !== undefined) { 206 | this.element.set("placeholder", this.params.text); 207 | this.params.searchString += this.params.text + "•"; 208 | } 209 | 210 | if (this.params.masked === true) { 211 | this.element.set("type", "password"); 212 | this.params.searchString += "password" + "•"; 213 | } 214 | 215 | this.element.inject(this.container); 216 | this.container.inject(this.bundle); 217 | }, 218 | 219 | "addEvents": function () { 220 | var change = (function (event) { 221 | if (this.params.name !== undefined) { 222 | settings.set(this.params.name, this.get()); 223 | } 224 | 225 | this.fireEvent("action", this.get()); 226 | }).bind(this); 227 | 228 | this.element.addEvent("change", change); 229 | this.element.addEvent("keyup", change); 230 | } 231 | }); 232 | 233 | Bundle.Checkbox = new Class({ 234 | // label 235 | // action -> change 236 | "Extends": Bundle, 237 | 238 | "createDOM": function () { 239 | this.bundle = new Element("div", { 240 | "class": "setting bundle checkbox" 241 | }); 242 | 243 | this.container = new Element("div", { 244 | "class": "setting container checkbox" 245 | }); 246 | 247 | this.element = new Element("input", { 248 | "id": String.uniqueID(), 249 | "class": "setting element checkbox", 250 | "type": "checkbox", 251 | "value": "true" 252 | }); 253 | 254 | this.label = new Element("label", { 255 | "class": "setting label checkbox", 256 | "for": this.element.get("id") 257 | }); 258 | }, 259 | 260 | "setupDOM": function () { 261 | this.element.inject(this.container); 262 | this.container.inject(this.bundle); 263 | 264 | if (this.params.label !== undefined) { 265 | this.label.set("html", this.params.label); 266 | this.label.inject(this.container); 267 | this.params.searchString += this.params.label + "•"; 268 | } 269 | }, 270 | 271 | "get": function () { 272 | return this.element.get("checked"); 273 | }, 274 | 275 | "set": function (value, noChangeEvent) { 276 | this.element.set("checked", value); 277 | 278 | if (noChangeEvent !== true) { 279 | this.element.fireEvent("change"); 280 | } 281 | 282 | return this; 283 | } 284 | }); 285 | 286 | Bundle.Slider = new Class({ 287 | // label, max, min, step, display, displayModifier 288 | // action -> change 289 | "Extends": Bundle, 290 | 291 | "initialize": function (params) { 292 | this.params = params; 293 | this.params.searchString = "•" + this.params.tab + "•" + this.params.group + "•"; 294 | 295 | this.createDOM(); 296 | this.setupDOM(); 297 | this.addEvents(); 298 | 299 | if (this.params.name !== undefined) { 300 | this.set((settings.get(this.params.name) || 0), true); 301 | } else { 302 | this.set(0, true); 303 | } 304 | 305 | this.params.searchString = this.params.searchString.toLowerCase(); 306 | }, 307 | 308 | "createDOM": function () { 309 | this.bundle = new Element("div", { 310 | "class": "setting bundle slider" 311 | }); 312 | 313 | this.container = new Element("div", { 314 | "class": "setting container slider" 315 | }); 316 | 317 | this.element = new Element("input", { 318 | "class": "setting element slider", 319 | "type": "range" 320 | }); 321 | 322 | this.label = new Element("label", { 323 | "class": "setting label slider" 324 | }); 325 | 326 | this.display = new Element("span", { 327 | "class": "setting display slider" 328 | }); 329 | }, 330 | 331 | "setupDOM": function () { 332 | if (this.params.label !== undefined) { 333 | this.label.set("html", this.params.label); 334 | this.label.inject(this.container); 335 | this.params.searchString += this.params.label + "•"; 336 | } 337 | 338 | if (this.params.max !== undefined) { 339 | this.element.set("max", this.params.max); 340 | } 341 | 342 | if (this.params.min !== undefined) { 343 | this.element.set("min", this.params.min); 344 | } 345 | 346 | if (this.params.step !== undefined) { 347 | this.element.set("step", this.params.step); 348 | } 349 | 350 | this.element.inject(this.container); 351 | if (this.params.display !== false) { 352 | if (this.params.displayModifier !== undefined) { 353 | this.display.set("text", this.params.displayModifier(0)); 354 | } else { 355 | this.display.set("text", 0); 356 | } 357 | this.display.inject(this.container); 358 | } 359 | this.container.inject(this.bundle); 360 | }, 361 | 362 | "addEvents": function () { 363 | this.element.addEvent("change", (function (event) { 364 | if (this.params.name !== undefined) { 365 | settings.set(this.params.name, this.get()); 366 | } 367 | 368 | if (this.params.displayModifier !== undefined) { 369 | this.display.set("text", this.params.displayModifier(this.get())); 370 | } else { 371 | this.display.set("text", this.get()); 372 | } 373 | this.fireEvent("action", this.get()); 374 | }).bind(this)); 375 | }, 376 | 377 | "get": function () { 378 | return Number.from(this.element.get("value")); 379 | }, 380 | 381 | "set": function (value, noChangeEvent) { 382 | this.element.set("value", value); 383 | 384 | if (noChangeEvent !== true) { 385 | this.element.fireEvent("change"); 386 | } else { 387 | if (this.params.displayModifier !== undefined) { 388 | this.display.set("text", this.params.displayModifier(Number.from(value))); 389 | } else { 390 | this.display.set("text", Number.from(value)); 391 | } 392 | } 393 | 394 | return this; 395 | } 396 | }); 397 | 398 | Bundle.PopupButton = new Class({ 399 | // label, options[{value, text}] 400 | // action -> change 401 | "Extends": Bundle, 402 | 403 | "createDOM": function () { 404 | this.bundle = new Element("div", { 405 | "class": "setting bundle popup-button" 406 | }); 407 | 408 | this.container = new Element("div", { 409 | "class": "setting container popup-button" 410 | }); 411 | 412 | this.element = new Element("select", { 413 | "class": "setting element popup-button" 414 | }); 415 | 416 | this.label = new Element("label", { 417 | "class": "setting label popup-button" 418 | }); 419 | 420 | if (this.params.options === undefined) { return; } 421 | 422 | // convert array syntax into object syntax for options 423 | function arrayToObject(option) { 424 | if (typeOf(option) == "array") { 425 | option = { 426 | "value": option[0], 427 | "text": option[1] || option[0], 428 | }; 429 | } 430 | return option; 431 | } 432 | 433 | // convert arrays 434 | if (typeOf(this.params.options) == "array") { 435 | var values = []; 436 | this.params.options.each((function(values, option) { 437 | values.push(arrayToObject(option)); 438 | }).bind(this, values)); 439 | this.params.options = { "values": values }; 440 | } 441 | 442 | var groups; 443 | if (this.params.options.groups !== undefined) { 444 | groups = {}; 445 | this.params.options.groups.each((function (groups, group) { 446 | this.params.searchString += (group) + "•"; 447 | groups[group] = (new Element("optgroup", { 448 | "label": group, 449 | }).inject(this.element)); 450 | }).bind(this, groups)); 451 | } 452 | 453 | if (this.params.options.values !== undefined) { 454 | this.params.options.values.each((function(groups, option) { 455 | option = arrayToObject(option); 456 | this.params.searchString += (option.text || option.value) + "•"; 457 | 458 | // find the parent of this option - either a group or the main element 459 | var parent; 460 | if (option.group && this.params.options.groups) { 461 | if ((option.group - 1) in this.params.options.groups) { 462 | option.group = this.params.options.groups[option.group-1]; 463 | } 464 | if (option.group in groups) { 465 | parent = groups[option.group]; 466 | } 467 | else { 468 | parent = this.element; 469 | } 470 | } 471 | else { 472 | parent = this.element; 473 | } 474 | 475 | (new Element("option", { 476 | "value": option.value, 477 | "text": option.text || option.value, 478 | })).inject(parent); 479 | }).bind(this, groups)); 480 | } 481 | }, 482 | 483 | "setupDOM": function () { 484 | if (this.params.label !== undefined) { 485 | this.label.set("html", this.params.label); 486 | this.label.inject(this.container); 487 | this.params.searchString += this.params.label + "•"; 488 | } 489 | 490 | this.element.inject(this.container); 491 | this.container.inject(this.bundle); 492 | } 493 | }); 494 | 495 | Bundle.ListBox = new Class({ 496 | // label, options[{value, text}] 497 | // action -> change 498 | "Extends": Bundle.PopupButton, 499 | 500 | "createDOM": function () { 501 | this.bundle = new Element("div", { 502 | "class": "setting bundle list-box" 503 | }); 504 | 505 | this.container = new Element("div", { 506 | "class": "setting container list-box" 507 | }); 508 | 509 | this.element = new Element("select", { 510 | "class": "setting element list-box", 511 | "size": "2" 512 | }); 513 | 514 | this.label = new Element("label", { 515 | "class": "setting label list-box" 516 | }); 517 | 518 | if (this.params.options === undefined) { return; } 519 | this.params.options.each((function (option) { 520 | this.params.searchString += (option.text || option.value) + "•"; 521 | 522 | (new Element("option", { 523 | "value": option.value, 524 | "text": option.text || option.value 525 | })).inject(this.element); 526 | }).bind(this)); 527 | }, 528 | 529 | "get": function () { 530 | return (this.element.get("value") || undefined); 531 | } 532 | }); 533 | 534 | Bundle.Textarea = new Class({ 535 | // label, text, value 536 | // action -> change & keyup 537 | "Extends": Bundle, 538 | 539 | "createDOM": function () { 540 | this.bundle = new Element("div", { 541 | "class": "setting bundle textarea" 542 | }); 543 | 544 | this.container = new Element("div", { 545 | "class": "setting container textarea" 546 | }); 547 | 548 | this.element = new Element("textarea", { 549 | "class": "setting element textarea" 550 | }); 551 | 552 | this.label = new Element("label", { 553 | "class": "setting label textarea" 554 | }); 555 | }, 556 | 557 | "setupDOM": function () { 558 | if (this.params.label !== undefined) { 559 | this.label.set("html", this.params.label); 560 | this.label.inject(this.container); 561 | this.params.searchString += this.params.label + "•"; 562 | } 563 | 564 | if (this.params.text !== undefined) { 565 | this.element.set("placeholder", this.params.text); 566 | this.params.searchString += this.params.text + "•"; 567 | } 568 | 569 | if (this.params.value !== undefined) { 570 | this.element.appendText(this.params.text); 571 | } 572 | 573 | this.element.inject(this.container); 574 | this.container.inject(this.bundle); 575 | }, 576 | 577 | "addEvents": function () { 578 | var change = (function (event) { 579 | if (this.params.name !== undefined) { 580 | settings.set(this.params.name, this.get()); 581 | } 582 | 583 | this.fireEvent("action", this.get()); 584 | }).bind(this); 585 | 586 | this.element.addEvent("change", change); 587 | this.element.addEvent("keyup", change); 588 | } 589 | }); 590 | 591 | Bundle.RadioButtons = new Class({ 592 | // label, options[{value, text}] 593 | // action -> change 594 | "Extends": Bundle, 595 | 596 | "createDOM": function () { 597 | var settingID = String.uniqueID(); 598 | 599 | this.bundle = new Element("div", { 600 | "class": "setting bundle radio-buttons" 601 | }); 602 | 603 | this.label = new Element("label", { 604 | "class": "setting label radio-buttons" 605 | }); 606 | 607 | this.containers = []; 608 | this.elements = []; 609 | this.labels = []; 610 | 611 | if (this.params.options === undefined) { return; } 612 | this.params.options.each((function (option) { 613 | var optionID, 614 | container; 615 | 616 | this.params.searchString += (option.text || option.value) + "•"; 617 | 618 | optionID = String.uniqueID(); 619 | container = (new Element("div", { 620 | "class": "setting container radio-buttons" 621 | })).inject(this.bundle); 622 | this.containers.push(container); 623 | 624 | this.elements.push((new Element("input", { 625 | "id": optionID, 626 | "name": settingID, 627 | "class": "setting element radio-buttons", 628 | "type": "radio", 629 | "value": option.value 630 | })).inject(container)); 631 | 632 | this.labels.push((new Element("label", { 633 | "class": "setting element-label radio-buttons", 634 | "for": optionID, 635 | "text": option.text || option.value 636 | })).inject(container)); 637 | }).bind(this)); 638 | }, 639 | 640 | "setupDOM": function () { 641 | if (this.params.label !== undefined) { 642 | this.label.set("html", this.params.label); 643 | this.label.inject(this.bundle, "top"); 644 | this.params.searchString += this.params.label + "•"; 645 | } 646 | }, 647 | 648 | "addEvents": function () { 649 | this.bundle.addEvent("change", (function (event) { 650 | if (this.params.name !== undefined) { 651 | settings.set(this.params.name, this.get()); 652 | } 653 | 654 | this.fireEvent("action", this.get()); 655 | }).bind(this)); 656 | }, 657 | 658 | "get": function () { 659 | var checkedEl = this.elements.filter((function (el) { 660 | return el.get("checked"); 661 | }).bind(this)); 662 | return (checkedEl[0] && checkedEl[0].get("value")); 663 | }, 664 | 665 | "set": function (value, noChangeEvent) { 666 | var desiredEl = this.elements.filter((function (el) { 667 | return (el.get("value") === value); 668 | }).bind(this)); 669 | desiredEl[0] && desiredEl[0].set("checked", true); 670 | 671 | if (noChangeEvent !== true) { 672 | this.bundle.fireEvent("change"); 673 | } 674 | 675 | return this; 676 | } 677 | }); 678 | 679 | this.Setting = new Class({ 680 | "initialize": function (container) { 681 | this.container = container; 682 | }, 683 | 684 | "create": function (params) { 685 | var types, 686 | bundle; 687 | 688 | // Available types 689 | types = { 690 | "description": "Description", 691 | "button": "Button", 692 | "text": "Text", 693 | "textarea": "Textarea", 694 | "checkbox": "Checkbox", 695 | "slider": "Slider", 696 | "popupButton": "PopupButton", 697 | "listBox": "ListBox", 698 | "radioButtons": "RadioButtons" 699 | }; 700 | 701 | if (types.hasOwnProperty(params.type)) { 702 | bundle = new Bundle[types[params.type]](params); 703 | bundle.bundleContainer = this.container; 704 | bundle.bundle.inject(this.container); 705 | return bundle; 706 | } else { 707 | throw "invalidType"; 708 | } 709 | } 710 | }); 711 | }()); 712 | -------------------------------------------------------------------------------- /js/classes/tab.js: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2011 Frank Kohlhepp 3 | // https://github.com/frankkohlhepp/fancy-settings 4 | // License: LGPL v2.1 5 | // 6 | (function () { 7 | var Bundle = new Class({ 8 | "initialize": function (creator) { 9 | this.creator = creator; 10 | 11 | // Create DOM elements 12 | this.tab = new Element("div", {"class": "tab"}); 13 | this.content = new Element("div", {"class": "tab-content"}); 14 | 15 | // Create event handlers 16 | this.tab.addEvent("click", this.activate.bind(this)); 17 | }, 18 | 19 | "activate": function () { 20 | if (this.creator.activeBundle && this.creator.activeBundle !== this) { 21 | this.creator.activeBundle.deactivate(); 22 | } 23 | this.tab.addClass("active"); 24 | this.content.addClass("show"); 25 | this.creator.activeBundle = this; 26 | }, 27 | 28 | "deactivate": function () { 29 | this.tab.removeClass("active"); 30 | this.content.removeClass("show"); 31 | this.creator.activeBundle = null; 32 | } 33 | }); 34 | 35 | this.Tab = new Class({ 36 | "activeBundle": null, 37 | 38 | "initialize": function (tabContainer, tabContentContainer) { 39 | this.tabContainer = tabContainer; 40 | this.tabContentContainer = tabContentContainer; 41 | }, 42 | 43 | "create": function () { 44 | var bundle = new Bundle(this); 45 | bundle.tab.inject(this.tabContainer); 46 | bundle.content.inject(this.tabContentContainer); 47 | if (!this.activeBundle) { bundle.activate(); } 48 | return bundle; 49 | } 50 | }); 51 | }()); 52 | -------------------------------------------------------------------------------- /js/i18n.js: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2011 Frank Kohlhepp 3 | // https://github.com/frankkohlhepp/fancy-settings 4 | // License: LGPL v2.1 5 | // 6 | (function () { 7 | var lang = navigator.language; 8 | if (this.i18n === undefined) { this.i18n = {}; } 9 | this.i18n.get = function (value) { 10 | if (value === "lang") { 11 | return lang; 12 | } 13 | 14 | if (this.hasOwnProperty(value)) { 15 | value = this[value]; 16 | if (value.hasOwnProperty(lang)) { 17 | return value[lang]; 18 | } else if (value.hasOwnProperty("en")) { 19 | return value["en"]; 20 | } else { 21 | return Object.values(value)[0]; 22 | } 23 | } else { 24 | return value; 25 | } 26 | }; 27 | }()); 28 | -------------------------------------------------------------------------------- /lib/default.css: -------------------------------------------------------------------------------- 1 | /* 2 | // Copyright (c) 2007 - 2010 blueprintcss.org 3 | // Modified and extended by Frank Kohlhepp in 2011 4 | // https://github.com/frankkohlhepp/default-css 5 | // License: MIT-license 6 | */ 7 | 8 | /* 9 | // Reset the default browser CSS 10 | */ 11 | html { 12 | margin: 0; 13 | padding: 0; 14 | border: 0; 15 | } 16 | 17 | body, div, span, object, iframe, 18 | h1, h2, h3, h4, h5, h6, p, blockquote, pre, 19 | a, abbr, acronym, address, code, 20 | del, dfn, em, img, q, dl, dt, dd, ol, ul, li, 21 | fieldset, form, label, legend, 22 | table, caption, tbody, tfoot, thead, tr, th, td, 23 | article, aside, dialog, figure, footer, header, 24 | hgroup, nav, section { 25 | margin: 0; 26 | padding: 0; 27 | border: 0; 28 | font-family: inherit; 29 | font-size: 100%; 30 | font-weight: inherit; 31 | font-style: inherit; 32 | vertical-align: baseline; 33 | } 34 | 35 | article, aside, dialog, figure, footer, header, 36 | hgroup, nav, section { 37 | display: block; 38 | } 39 | 40 | body { 41 | background-color: white; 42 | line-height: 1.5; 43 | } 44 | 45 | table { 46 | border-collapse: separate; 47 | border-spacing: 0; 48 | } 49 | 50 | caption, th, td { 51 | text-align: left; 52 | font-weight: normal; 53 | } 54 | 55 | table, th, td { 56 | vertical-align: middle; 57 | } 58 | 59 | blockquote:before, blockquote:after, q:before, q:after { 60 | content: ""; 61 | } 62 | 63 | blockquote, q { 64 | quotes: "" ""; 65 | } 66 | 67 | a img { 68 | border: none; 69 | } 70 | 71 | /* 72 | // Default typography 73 | */ 74 | html { 75 | font-size: 100.01%; 76 | } 77 | 78 | body { 79 | background-color: white; 80 | font-family: "Helvetica Neue", Arial, Helvetica, sans-serif; 81 | font-size: 75%; 82 | color: #222222; 83 | } 84 | 85 | /* Headings */ 86 | h1, h2, h3, h4, h5, h6 { 87 | font-weight: normal; 88 | color: #111111; 89 | } 90 | 91 | h1 { 92 | margin-bottom: 0.5em; 93 | font-size: 3em; 94 | line-height: 1; 95 | } 96 | 97 | h2 { 98 | margin-bottom: 0.75em; 99 | font-size: 2em; 100 | } 101 | 102 | h3 { 103 | margin-bottom: 1em; 104 | font-size: 1.5em; 105 | line-height: 1; 106 | } 107 | 108 | h4 { 109 | margin-bottom: 1.25em; 110 | font-size: 1.2em; 111 | line-height: 1.25; 112 | } 113 | 114 | h5 { 115 | margin-bottom: 1.5em; 116 | font-size: 1em; 117 | font-weight: bold; 118 | } 119 | 120 | h6 { 121 | font-size: 1em; 122 | font-weight: bold; 123 | } 124 | 125 | h1 img, h2 img, h3 img, 126 | h4 img, h5 img, h6 img { 127 | margin: 0; 128 | } 129 | 130 | /* Text elements */ 131 | p { 132 | margin: 0 0 1.5em; 133 | } 134 | 135 | .left { 136 | float: left !important; 137 | } 138 | 139 | p .left { 140 | margin: 1.5em 1.5em 1.5em 0; 141 | padding: 0; 142 | } 143 | 144 | .right { 145 | float: right !important; 146 | } 147 | 148 | p .right { 149 | margin: 1.5em 0 1.5em 1.5em; 150 | padding: 0; 151 | } 152 | 153 | a:focus, a:hover { 154 | color: #0099FF; 155 | } 156 | 157 | a { 158 | color: #0066CC; 159 | text-decoration: underline; 160 | } 161 | 162 | blockquote { 163 | margin: 1.5em; 164 | font-style: italic; 165 | color: #666666; 166 | } 167 | 168 | strong, dfn { 169 | font-weight: bold; 170 | } 171 | 172 | em, dfn { 173 | font-style: italic; 174 | } 175 | 176 | sup, sub { 177 | line-height: 0; 178 | } 179 | 180 | abbr, acronym { 181 | border-bottom: 1px dotted #666666; 182 | } 183 | 184 | address { 185 | margin: 0 0 1.5em; 186 | font-style: italic; 187 | } 188 | 189 | del { 190 | color: #666666; 191 | } 192 | 193 | pre { 194 | margin: 1.5em 0; 195 | white-space: pre; 196 | } 197 | 198 | pre, code, tt { 199 | font: 1em "andale mono", "lucida console", monospace; 200 | line-height: 1.5; 201 | } 202 | 203 | /* Lists */ 204 | li ul, li ol { 205 | margin: 0; 206 | } 207 | 208 | ul, ol { 209 | margin: 0 1.5em 1.5em 0; 210 | padding-left: 1.5em; 211 | } 212 | 213 | ul { 214 | list-style-type: disc; 215 | } 216 | 217 | ol { 218 | list-style-type: decimal; 219 | } 220 | 221 | dl { 222 | margin: 0 0 1.5em 0; 223 | } 224 | 225 | dl dt { 226 | font-weight: bold; 227 | } 228 | 229 | dd { 230 | margin-left: 1.5em; 231 | } 232 | 233 | /* Tables */ 234 | table { 235 | width: 100%; 236 | margin-bottom: 1.4em; 237 | } 238 | 239 | th { 240 | font-weight: bold; 241 | } 242 | 243 | table.zebra thead th, table.zebra tfoot th { 244 | background-color: #BFBFBF; 245 | } 246 | 247 | th, td, caption { 248 | padding: 4px 10px 4px 5px; 249 | } 250 | 251 | table.zebra tbody tr:nth-child(even) td, table.zebra tbody tr.even td { 252 | background-color: #E6E6E6; 253 | } 254 | 255 | caption { 256 | background-color: #EEEEEE; 257 | } 258 | 259 | /* Misc classes */ 260 | .fancy { 261 | text-shadow: white 0 1px 0; 262 | } 263 | 264 | .bfancy { 265 | text-shadow: black 0 1px 0; 266 | } 267 | 268 | .fancyt { 269 | text-shadow: white 0 -1px 0; 270 | } 271 | 272 | .bfancyt { 273 | text-shadow: black 0 -1px 0; 274 | } 275 | 276 | .no-fancy { 277 | text-shadow: none; 278 | } 279 | 280 | .select { 281 | cursor: auto; 282 | user-select: auto; 283 | -webkit-user-select: auto; 284 | -moz-user-select: auto; 285 | -o-user-select: auto; 286 | } 287 | 288 | img.select, .select img { 289 | user-drag: auto; 290 | -webkit-user-drag: auto; 291 | -moz-user-drag: auto; 292 | -o-user-drag: auto; 293 | } 294 | 295 | .no-select { 296 | cursor: default; 297 | user-select: none; 298 | -webkit-user-select: none; 299 | -moz-user-select: none; 300 | -o-user-select: none; 301 | } 302 | 303 | img.no-select, .no-select img { 304 | user-drag: none; 305 | -webkit-user-drag: none; 306 | -moz-user-drag: none; 307 | -o-user-drag: none; 308 | } 309 | 310 | .focus:focus, .focus :focus { 311 | outline: auto; 312 | } 313 | 314 | .no-focus:focus, .no-focus :focus { 315 | outline: 0; 316 | } 317 | 318 | .small { 319 | margin-bottom: 1.875em; 320 | font-size: .8em; 321 | line-height: 1.875em; 322 | } 323 | 324 | .large { 325 | margin-bottom: 1.25em; 326 | font-size: 1.2em; 327 | line-height: 2.5em; 328 | } 329 | 330 | .show { 331 | display: block !important; 332 | } 333 | 334 | .show-inline { 335 | display: inline-block !important; 336 | } 337 | 338 | .hide { 339 | display: none; 340 | } 341 | 342 | .quiet { 343 | color: #666666; 344 | } 345 | 346 | .loud { 347 | color: black; 348 | } 349 | 350 | .highlight { 351 | background-color: yellow; 352 | } 353 | 354 | .added { 355 | background-color: #006600; 356 | color: white; 357 | } 358 | 359 | .removed { 360 | background-color: #990000; 361 | color: white; 362 | } 363 | 364 | .first { 365 | margin-left: 0; 366 | padding-left: 0; 367 | } 368 | 369 | .last { 370 | margin-right: 0; 371 | padding-right: 0; 372 | } 373 | 374 | .top { 375 | margin-top: 0; 376 | padding-top: 0; 377 | } 378 | 379 | .bottom { 380 | margin-bottom: 0; 381 | padding-bottom: 0; 382 | } 383 | 384 | /* 385 | // Default styling for forms 386 | */ 387 | fieldset { 388 | margin: 0 0 1.5em 0; 389 | padding: 0 1.4em 1.4em 1.4em; 390 | border: 1px solid #CCCCCC; 391 | } 392 | 393 | legend { 394 | margin-top: -0.2em; 395 | margin-bottom: 1em; 396 | font-weight: bold; 397 | font-size: 1.2em; 398 | } 399 | 400 | /* Form fields */ 401 | input[type=text], input[type=password], textarea { 402 | background-color: white; 403 | border: 1px solid #BBBBBB; 404 | } 405 | 406 | input[type=text], input[type=password], 407 | textarea, select { 408 | margin: 0.5em 0; 409 | } 410 | 411 | input[type=text], input[type=password] { 412 | width: 300px; 413 | padding: 4px; 414 | } 415 | 416 | textarea { 417 | width: 450px; 418 | height: 170px; 419 | padding: 5px; 420 | } 421 | 422 | /* success, info, notice and error boxes */ 423 | .success, .info, .notice, .error { 424 | margin-bottom: 1em; 425 | padding: 0.8em; 426 | border: 2px solid #DDDDDD; 427 | } 428 | 429 | .success { 430 | background-color: #E6EFC2; 431 | border-color: #C6D880; 432 | color: #264409; 433 | } 434 | 435 | .info { 436 | background-color: #D5EDF8; 437 | border-color: #92CAE4; 438 | color: #205791; 439 | } 440 | 441 | .notice { 442 | background-color: #FFF6BF; 443 | border-color: #FFD324; 444 | color: #514721; 445 | } 446 | 447 | .error { 448 | background-color: #FBE3E4; 449 | border-color: #FBC2C4; 450 | color: #8A1F11; 451 | } 452 | 453 | .success a { 454 | color: #264409; 455 | } 456 | 457 | .info a { 458 | color: #205791; 459 | } 460 | 461 | .notice a { 462 | color: #514721; 463 | } 464 | 465 | .error a { 466 | color: #8A1F11; 467 | } 468 | -------------------------------------------------------------------------------- /lib/popup/popup.css: -------------------------------------------------------------------------------- 1 | /*popup*/ 2 | #purgebtn, #addbtn { 3 | margin: auto auto auto 5px; 4 | border: 1px solid #CCC; 5 | border-radius: 3px; 6 | background-color: white; 7 | padding: 2px; 8 | float: right; 9 | font-weight: bold; 10 | } 11 | 12 | #globalstat { 13 | display:inline-block; 14 | } 15 | 16 | #taskaddbox { 17 | width: 70%; 18 | margin-bottom: 15px; 19 | display: inline-block; 20 | } 21 | 22 | #taskaddbatch { 23 | display: none; 24 | width: 70%; 25 | margin-bottom: 15px; 26 | float: left; 27 | } 28 | 29 | #addmore{ 30 | margin: auto auto auto 5px; 31 | font-size: 0.8em; 32 | border: 1px solid #CCC; 33 | border-radius: 3px; 34 | background-color: white; 35 | padding: 3px; 36 | } 37 | 38 | #addsubmit { 39 | margin: auto auto auto 5px; 40 | font-size: 0.8em; 41 | border: 1px solid #CCC; 42 | border-radius: 3px; 43 | background-color: #6C788E; 44 | color: white; 45 | padding: 3px; 46 | } 47 | 48 | div[id^="taskInfo_"] { 49 | font-size: 13px; 50 | max-width: 330px; 51 | } 52 | 53 | .progbar { 54 | height: 20px; 55 | margin-top: 2px; 56 | margin-bottom: 10px; 57 | transition: width 1s; 58 | max-width: 350px; 59 | } 60 | 61 | .active, .waiting { 62 | background-color: #ACF; 63 | } 64 | 65 | .paused { 66 | background-color: #FFE573; 67 | } 68 | 69 | .error { 70 | background-color: #EA6A6A; 71 | } 72 | 73 | .complete { 74 | background-color: #8AE62E; 75 | } 76 | 77 | .removed { 78 | background-color: #ECECEC; 79 | } 80 | 81 | .tasktitle{ 82 | font-size: 15px !important; 83 | font-weight: bold; 84 | word-break: break-all !important; 85 | } 86 | 87 | .removebtn { 88 | margin: auto auto auto 5px; 89 | font-size: 0.6em; 90 | border: 1px solid #CCC; 91 | border-radius: 3px; 92 | background-color: white; 93 | padding: 1px; 94 | } 95 | 96 | 97 | .complete_info2{ 98 | display: none; 99 | } 100 | 101 | body { 102 | min-width:357px; 103 | overflow-x:hidden; 104 | } -------------------------------------------------------------------------------- /lib/popup/popup.js: -------------------------------------------------------------------------------- 1 | function bytesToSize(bytes, precision) 2 | { 3 | var kilobyte = 1024; 4 | var megabyte = kilobyte * 1024; 5 | var gigabyte = megabyte * 1024; 6 | var terabyte = gigabyte * 1024; 7 | 8 | if ((bytes >= 0) && (bytes < kilobyte)) { 9 | return bytes + ' B'; 10 | 11 | } else if ((bytes >= kilobyte) && (bytes < megabyte)) { 12 | return (bytes / kilobyte).toFixed(precision) + ' KB'; 13 | 14 | } else if ((bytes >= megabyte) && (bytes < gigabyte)) { 15 | return (bytes / megabyte).toFixed(precision) + ' MB'; 16 | 17 | } else if ((bytes >= gigabyte) && (bytes < terabyte)) { 18 | return (bytes / gigabyte).toFixed(precision) + ' GB'; 19 | 20 | } else if (bytes >= terabyte) { 21 | return (bytes / terabyte).toFixed(precision) + ' TB'; 22 | 23 | } else { 24 | return bytes + ' B'; 25 | } 26 | } 27 | 28 | Number.prototype.toHHMMSS = function () { 29 | var sec_num = parseInt(this, 10); // don't forget the second param 30 | if (isNaN(sec_num) || sec_num === null) { 31 | time = '-'; 32 | return time; 33 | } else { 34 | var hours = Math.floor(sec_num / 3600); 35 | var minutes = Math.floor((sec_num - (hours * 3600)) / 60); 36 | var seconds = sec_num - (hours * 3600) - (minutes * 60); 37 | 38 | if (hours < 10) {hours = "0"+hours;} 39 | if (minutes < 10) {minutes = "0"+minutes;} 40 | if (seconds < 10) {seconds = "0"+seconds;} 41 | time = hours+'h'+minutes+'m'+seconds+'s'; 42 | time = time.replace(/00[\w]{1}/g, ''); 43 | if (isNaN(hours) && isNaN(minutes) && isNaN(seconds)){ 44 | time = '∞'; 45 | } 46 | return time; 47 | } 48 | } 49 | 50 | function capitaliseFirstLetter(string) 51 | { 52 | return string.charAt(0).toUpperCase() + string.slice(1); 53 | } 54 | 55 | Object.defineProperty(Array.prototype, "prepend", { 56 | enumerable: false, 57 | configurable: false, 58 | writable: false, 59 | value: function(e) { 60 | if (e != '') { 61 | this.unshift(e); 62 | } 63 | return this; 64 | } 65 | }); 66 | 67 | 68 | chrome.storage.local.get(null, function(obj){ 69 | var endAddr; 70 | if (obj.rpcuser) { 71 | endAddr = obj.rpcpath.replace(/(\:\/\/)/g, '$1' + obj.rpcuser + ':' + obj.rpctoken + '@'); 72 | window.rpct = ''; 73 | } else { 74 | endAddr = obj.rpcpath; 75 | if (obj.rpctoken) { 76 | window.rpct = 'token:' + obj.rpctoken; 77 | } else { 78 | window.rpct = ''; 79 | } 80 | } 81 | $.jsonRPC.setup({ 82 | endPoint: endAddr, 83 | namespace: 'aria2' 84 | }); 85 | }) 86 | 87 | function aria2CMD(c,i) { 88 | chrome.storage.local.get(null, function(obj){ 89 | $.jsonRPC.request(c, { 90 | params: [i].prepend(rpct) 91 | }) 92 | }); 93 | } 94 | 95 | // add new task manually 96 | function addurisubmit() { 97 | var toadduri = (e_taskaddbox.value == '' ? e_taskaddbatch.value.split('\n') : e_taskaddbox.value.split('\n')); 98 | for (var i=0, urilen = toadduri.length; i<urilen; i++) { 99 | var uri_i = toadduri[i]; 100 | aria2CMD('addUri', [uri_i]); 101 | } 102 | e_addtaskctn.style.display= 'none'; 103 | e_addbtn.value = 'Add'; 104 | } 105 | 106 | function addmoretoggle() { 107 | if (e_addmore.value == '>>') { 108 | e_taskaddbox.style.display = 'none'; 109 | e_taskaddbatch.style.display = 'inline-block'; 110 | e_addmore.value = '<<'; 111 | } else { 112 | e_taskaddbox.style.display = 'inline-block'; 113 | e_taskaddbatch.style.display = 'none'; 114 | e_addmore.value = '>>'; 115 | } 116 | } 117 | 118 | function addtasktoggle() { 119 | e_addtaskctn.style.display = (e_addtaskctn.style.display != 'none' ? 'none' : '' ); 120 | e_addbtn.value = (e_addbtn.value == 'Add' ? 'Cancel' : 'Add' ); 121 | e_taskaddbox.style.display = 'inline-block'; 122 | e_taskaddbatch.style.display = 'none'; 123 | e_addmore.value = '>>'; 124 | } 125 | 126 | //event binding 127 | var e_purgebtn = document.getElementById('purgebtn'), e_addbtn = document.getElementById('addbtn'), e_addtask = document.getElementById("addtask"), 128 | e_addmore = document.getElementById('addmore'), 129 | e_addtaskctn = document.getElementById("addtaskcontainer"), e_taskaddbox = document.getElementById("taskaddbox"), e_taskaddbatch = document.getElementById("taskaddbatch"), 130 | e_tasklist = document.getElementById('tasklist'), 131 | headInfotpl = document.getElementById('headInfo').innerHTML, taskInfotpl = document.getElementById('taskInfo').innerHTML, 132 | e_globalstat = document.getElementById('globalstat'); 133 | 134 | e_purgebtn.addEventListener("click", function(){aria2CMD('purgeDownloadResult','')}, false); 135 | e_addbtn.addEventListener("click", function(){addtasktoggle();}, false); 136 | e_addmore.addEventListener("click", function(){addmoretoggle();}, false); 137 | e_addtask.addEventListener("submit", function(e){ 138 | addurisubmit(); 139 | e.preventDefault(); 140 | }, false); 141 | 142 | $(e_tasklist).on("click", "button.removebtn", function(){ 143 | var taskStatus = $(this).attr('class').split(' ')[0], taskId = $(this).attr('id').split('_').pop(), meth; 144 | switch(taskStatus) 145 | { 146 | case 'active': 147 | case 'waiting': 148 | case 'paused': 149 | meth = 'forceRemove'; 150 | break; 151 | case 'error': 152 | case 'complete': 153 | case 'removed': 154 | meth = 'removeDownloadResult'; 155 | break; 156 | } 157 | aria2CMD(meth, taskId); 158 | }); 159 | 160 | $(e_tasklist).on("click", "div.progbar", function(){ 161 | var taskStatus = $(this).attr('class').split(' ')[0], taskId = $(this).attr('id').split('_').pop(), meth; 162 | switch(taskStatus) 163 | { 164 | case 'active': 165 | case 'waiting': 166 | meth = 'pause'; 167 | break; 168 | case 'error': 169 | case 'complete': 170 | case 'removed': 171 | meth = 'removeDownloadResult'; 172 | break; 173 | case 'paused': 174 | meth = 'unpause'; 175 | break; 176 | } 177 | aria2CMD(meth, taskId); 178 | }); 179 | 180 | 181 | Mustache.parse(headInfotpl); 182 | Mustache.parse(taskInfotpl); 183 | 184 | function writeUI() { 185 | chrome.storage.local.get(null, function(obj){ 186 | $.jsonRPC.request('getGlobalStat', { 187 | params: [rpct], 188 | success: function(result) { 189 | // headline part 190 | var res = result.result, tplpart = new Object(); 191 | if (res.downloadSpeed == 0) { 192 | tplpart.globspeed = ''; 193 | } else { 194 | tplpart.globspeed = bytesToSize(res.downloadSpeed, 2) + '/s'; 195 | } 196 | var headInfohtml = Mustache.render(headInfotpl, res, tplpart); 197 | e_globalstat.innerHTML = headInfohtml; 198 | 199 | var rquestParams = ["status","gid","completedLength","totalLength","files","connections","dir","downloadSpeed","bittorrent","uploadSpeed","numSeeders"]; 200 | $.jsonRPC.batchRequest([ 201 | { 202 | method: 'tellActive', 203 | params: [rquestParams].prepend(rpct) 204 | }, 205 | { 206 | method: 'tellWaiting', 207 | params: [0,parseInt(res.numWaiting),rquestParams].prepend(rpct) 208 | }, 209 | { 210 | method: 'tellStopped', 211 | params: [0,parseInt(res.numStopped),rquestParams].prepend(rpct) 212 | } 213 | ], { 214 | success: function(result) { 215 | var activeRes = result[0].result, waitRes = result[1].result, stopRes = result[2].result; 216 | if (activeRes.length + waitRes.length + stopRes.length === 0 && !$(document).find('.tasktitle').length) { 217 | e_tasklist.innerHTML = 'Empty task list'; 218 | //clearInterval(uirefrsh); 219 | } else { 220 | printTask(result); 221 | } 222 | } 223 | }); 224 | }}) 225 | }) 226 | } 227 | 228 | function printTask(res) { 229 | var taskInfohtml = '', reslen = res.length; 230 | for (var i = 0; i < reslen; i++) { 231 | var r = res[i].result, rlen = r.length, files, taskid, tplpart = new Object(), etasec; 232 | for (var j = 0; j < rlen; j++) { 233 | files = r[j].files; 234 | taskid = r[j].gid; 235 | if (r[j].bittorrent && r[j].bittorrent.info && r[j].bittorrent.info.name) { 236 | tplpart.displayName = r[j].bittorrent.info.name; /*display name */ 237 | } else { 238 | tplpart.displayName = files[0].path.split("/").pop() 239 | } 240 | if (r[j].bittorrent) { 241 | tplpart.upspeedPrec = ' (up:' + bytesToSize(r[j].uploadSpeed, 2) + '/s)'; 242 | tplpart.numSeedersf = '/' + r[j].numSeeders.toString() + ' seeds'; 243 | } else { 244 | tplpart.upspeedPrec = ''; 245 | tplpart.numSeedersf = ''; 246 | } 247 | tplpart.dlspeedPrec = bytesToSize(r[j].downloadSpeed, 2); 248 | tplpart.tlengthPrec = bytesToSize(r[j].totalLength, 2); 249 | tplpart.clengthPrec = bytesToSize(r[j].completedLength, 2); 250 | tplpart.completeRatio = parseFloat(r[j].completedLength/r[j].totalLength*100,2).toFixed(2).toString(); 251 | etasec = (r[j].totalLength - r[j].completedLength)/r[j].downloadSpeed; 252 | tplpart.eta = etasec.toHHMMSS(); 253 | tplpart.statusUpper = capitaliseFirstLetter(r[j].status); 254 | if (isNaN(r[j].completedLength) || r[j].completedLength == 0) { 255 | tplpart.p = '0%'; 256 | } else { 257 | tplpart.p = parseFloat(r[j].completedLength/r[j].totalLength*100,2).toFixed(2).toString() + '%'; 258 | } 259 | taskInfohtml += Mustache.render(taskInfotpl, r[j], tplpart); 260 | } 261 | } 262 | e_tasklist.innerHTML = taskInfohtml;// write to html 263 | } 264 | 265 | writeUI(); 266 | var uirefrsh = setInterval(writeUI, 1000); -------------------------------------------------------------------------------- /lib/popup/popup.min.js: -------------------------------------------------------------------------------- 1 | function bytesToSize(a,b){return 0<=a&&1024>a?a+" B":1024<=a&&1048576>a?(a/1024).toFixed(b)+" KB":1048576<=a&&1073741824>a?(a/1048576).toFixed(b)+" MB":1073741824<=a&&1099511627776>a?(a/1073741824).toFixed(b)+" GB":1099511627776<=a?(a/1099511627776).toFixed(b)+" TB":a+" B"} 2 | Number.prototype.toHHMMSS=function(){var a=parseInt(this,10);if(isNaN(a)||null===a)time="-";else{var b=Math.floor(a/3600),c=Math.floor((a-3600*b)/60),a=a-3600*b-60*c;10>b&&(b="0"+b);10>c&&(c="0"+c);10>a&&(a="0"+a);time=b+"h"+c+"m"+a+"s";time=time.replace(/00[\w]{1}/g,"");isNaN(b)&&isNaN(c)&&isNaN(a)&&(time="\u221e")}return time};function capitaliseFirstLetter(a){return a.charAt(0).toUpperCase()+a.slice(1)} 3 | Object.defineProperty(Array.prototype,"prepend",{enumerable:!1,configurable:!1,writable:!1,value:function(a){""!=a&&this.unshift(a);return this}});chrome.storage.local.get(null,function(a){var b;a.rpcuser?(b=a.rpcpath.replace(/(\:\/\/)/g,"$1"+a.rpcuser+":"+a.rpctoken+"@"),window.rpct=""):(b=a.rpcpath,window.rpct=a.rpctoken?"token:"+a.rpctoken:"");$.jsonRPC.setup({endPoint:b,namespace:"aria2"})}); 4 | function aria2CMD(a,b){chrome.storage.local.get(null,function(c){$.jsonRPC.request(a,{params:[b].prepend(rpct)})})}function addurisubmit(){for(var a=""==e_taskaddbox.value?e_taskaddbatch.value.split("\n"):e_taskaddbox.value.split("\n"),b=0,c=a.length;b<c;b++)aria2CMD("addUri",[a[b]]);e_addtaskctn.style.display="none";e_addbtn.value="Add"} 5 | function addmoretoggle(){">>"==e_addmore.value?(e_taskaddbox.style.display="none",e_taskaddbatch.style.display="inline-block",e_addmore.value="<<"):(e_taskaddbox.style.display="inline-block",e_taskaddbatch.style.display="none",e_addmore.value=">>")}function addtasktoggle(){e_addtaskctn.style.display="none"!=e_addtaskctn.style.display?"none":"";e_addbtn.value="Add"==e_addbtn.value?"Cancel":"Add";e_taskaddbox.style.display="inline-block";e_taskaddbatch.style.display="none";e_addmore.value=">>"} 6 | var e_purgebtn=document.getElementById("purgebtn"),e_addbtn=document.getElementById("addbtn"),e_addtask=document.getElementById("addtask"),e_addmore=document.getElementById("addmore"),e_addtaskctn=document.getElementById("addtaskcontainer"),e_taskaddbox=document.getElementById("taskaddbox"),e_taskaddbatch=document.getElementById("taskaddbatch"),e_tasklist=document.getElementById("tasklist"),headInfotpl=document.getElementById("headInfo").innerHTML,taskInfotpl=document.getElementById("taskInfo").innerHTML, 7 | e_globalstat=document.getElementById("globalstat");e_purgebtn.addEventListener("click",function(){aria2CMD("purgeDownloadResult","")},!1);e_addbtn.addEventListener("click",function(){addtasktoggle()},!1);e_addmore.addEventListener("click",function(){addmoretoggle()},!1);e_addtask.addEventListener("submit",function(a){addurisubmit();a.preventDefault()},!1); 8 | $(e_tasklist).on("click","button.removebtn",function(){var a=$(this).attr("class").split(" ")[0],b=$(this).attr("id").split("_").pop(),c;switch(a){case "active":case "waiting":case "paused":c="forceRemove";break;case "error":case "complete":case "removed":c="removeDownloadResult"}aria2CMD(c,b)}); 9 | $(e_tasklist).on("click","div.progbar",function(){var a=$(this).attr("class").split(" ")[0],b=$(this).attr("id").split("_").pop(),c;switch(a){case "active":case "waiting":c="pause";break;case "error":case "complete":case "removed":c="removeDownloadResult";break;case "paused":c="unpause"}aria2CMD(c,b)});Mustache.parse(headInfotpl);Mustache.parse(taskInfotpl); 10 | function writeUI(){chrome.storage.local.get(null,function(a){$.jsonRPC.request("getGlobalStat",{params:[rpct],success:function(a){a=a.result;var c={};c.globspeed=0==a.downloadSpeed?"":bytesToSize(a.downloadSpeed,2)+"/s";c=Mustache.render(headInfotpl,a,c);e_globalstat.innerHTML=c;c="status gid completedLength totalLength files connections dir downloadSpeed bittorrent uploadSpeed numSeeders".split(" ");$.jsonRPC.batchRequest([{method:"tellActive",params:[c].prepend(rpct)},{method:"tellWaiting",params:[0, 11 | parseInt(a.numWaiting),c].prepend(rpct)},{method:"tellStopped",params:[0,parseInt(a.numStopped),c].prepend(rpct)}],{success:function(a){0!==a[0].result.length+a[1].result.length+a[2].result.length||$(document).find(".tasktitle").length?printTask(a):e_tasklist.innerHTML="Empty task list"}})}})})} 12 | function printTask(a){for(var b="",c=a.length,h=0;h<c;h++)for(var e=a[h].result,k=e.length,g,f={},d=0;d<k;d++)g=e[d].files,f.displayName=e[d].bittorrent&&e[d].bittorrent.info&&e[d].bittorrent.info.name?e[d].bittorrent.info.name:g[0].path.split("/").pop(),e[d].bittorrent?(f.upspeedPrec=" (up:"+bytesToSize(e[d].uploadSpeed,2)+"/s)",f.numSeedersf="/"+e[d].numSeeders.toString()+" seeds"):(f.upspeedPrec="",f.numSeedersf=""),f.dlspeedPrec=bytesToSize(e[d].downloadSpeed,2),f.tlengthPrec=bytesToSize(e[d].totalLength, 13 | 2),f.clengthPrec=bytesToSize(e[d].completedLength,2),f.completeRatio=parseFloat(e[d].completedLength/e[d].totalLength*100,2).toFixed(2).toString(),g=(e[d].totalLength-e[d].completedLength)/e[d].downloadSpeed,f.eta=g.toHHMMSS(),f.statusUpper=capitaliseFirstLetter(e[d].status),isNaN(e[d].completedLength)||0==e[d].completedLength?f.p="0%":f.p=parseFloat(e[d].completedLength/e[d].totalLength*100,2).toFixed(2).toString()+"%",b+=Mustache.render(taskInfotpl,e[d],f);e_tasklist.innerHTML=b}writeUI(); 14 | var uirefrsh=setInterval(writeUI,1E3); -------------------------------------------------------------------------------- /lib/popup/popuplib.min.js: -------------------------------------------------------------------------------- 1 | (function(n,l){function p(a){var b=a.length,d=c.type(a);return c.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===d||"function"!==d&&(0===b||"number"==typeof b&&0<b&&b-1 in a)}function t(a){var b=bb[a]={};return c.each(a.match(Q)||[],function(a,c){b[c]=!0}),b}function F(a,b,d,e){if(c.acceptData(a)){var f,g,h=c.expando,k="string"==typeof b,m=a.nodeType,v=m?c.cache:a,s=m?a[h]:a[h]&&h;if(s&&v[s]&&(e||v[s].data)||!k||d!==l)return s||(m?a[h]=s=ca.pop()||c.guid++:s=h),v[s]||(v[s]={},m||(v[s].toJSON=c.noop)), 2 | ("object"==typeof b||"function"==typeof b)&&(e?v[s]=c.extend(v[s],b):v[s].data=c.extend(v[s].data,b)),f=v[s],e||(f.data||(f.data={}),f=f.data),d!==l&&(f[c.camelCase(b)]=d),k?(g=f[b],null==g&&(g=f[c.camelCase(b)])):g=f,g}}function z(a,b,d){if(c.acceptData(a)){var e,f,g,h=a.nodeType,k=h?c.cache:a,m=h?a[c.expando]:c.expando;if(k[m]){if(b&&(e=d?k[m]:k[m].data)){c.isArray(b)?b=b.concat(c.map(b,c.camelCase)):b in e?b=[b]:(b=c.camelCase(b),b=b in e?[b]:b.split(" "));f=0;for(g=b.length;g>f;f++)delete e[b[f]]; 3 | if(!(d?U:c.isEmptyObject)(e))return}(d||(delete k[m].data,U(k[m])))&&(h?c.cleanData([a],!0):c.support.deleteExpando||k!=k.window?delete k[m]:k[m]=null)}}}function I(a,b,d){if(d===l&&1===a.nodeType){var e="data-"+b.replace(Eb,"-$1").toLowerCase();if(d=a.getAttribute(e),"string"==typeof d){try{d="true"===d?!0:"false"===d?!1:"null"===d?null:+d+""===d?+d:Fb.test(d)?c.parseJSON(d):d}catch(f){}c.data(a,b,d)}else d=l}return d}function U(a){for(var b in a)if(("data"!==b||!c.isEmptyObject(a[b]))&&"toJSON"!== 4 | b)return!1;return!0}function da(){return!0}function aa(){return!1}function xa(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}function ya(a,b,d){if(b=b||0,c.isFunction(b))return c.grep(a,function(a,c){return!!b.call(a,c,a)===d});if(b.nodeType)return c.grep(a,function(a){return a===b===d});if("string"==typeof b){var e=c.grep(a,function(a){return 1===a.nodeType});if(Gb.test(b))return c.filter(b,e,!d);b=c.filter(b,e)}return c.grep(a,function(a){return 0<=c.inArray(a,b)===d})}function za(a){var b=cb.split("|"); 5 | a=a.createDocumentFragment();if(a.createElement)for(;b.length;)a.createElement(b.pop());return a}function Aa(a,b){return a.getElementsByTagName(b)[0]||a.appendChild(a.ownerDocument.createElement(b))}function pa(a){var b=a.getAttributeNode("type");return a.type=(b&&b.specified)+"/"+a.type,a}function Ba(a){var b=Hb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function qa(a,b){for(var d,e=0;null!=(d=a[e]);e++)c._data(d,"globalEval",!b||c._data(b[e],"globalEval"))}function ja(a,b){if(1=== 6 | b.nodeType&&c.hasData(a)){var d,e,f;e=c._data(a);var g=c._data(b,e),h=e.events;if(h)for(d in delete g.handle,g.events={},h)for(e=0,f=h[d].length;f>e;e++)c.event.add(b,d,h[d][e]);g.data&&(g.data=c.extend({},g.data))}}function r(a,b){var d,e,f=0,g=a.getElementsByTagName!==l?a.getElementsByTagName(b||"*"):a.querySelectorAll!==l?a.querySelectorAll(b||"*"):l;if(!g)for(g=[],d=a.childNodes||a;null!=(e=d[f]);f++)!b||c.nodeName(e,b)?g.push(e):c.merge(g,r(e,b));return b===l||b&&c.nodeName(a,b)?c.merge([a], 7 | g):g}function M(a){La.test(a.type)&&(a.defaultChecked=a.checked)}function O(a,b){if(b in a)return b;for(var c=b.charAt(0).toUpperCase()+b.slice(1),e=b,f=db.length;f--;)if(b=db[f]+c,b in a)return b;return e}function B(a,b){return a=b||a,"none"===c.css(a,"display")||!c.contains(a.ownerDocument,a)}function X(a,b){for(var d,e=[],f=0,g=a.length;g>f;f++)d=a[f],d.style&&(e[f]=c._data(d,"olddisplay"),b?(e[f]||"none"!==d.style.display||(d.style.display=""),""===d.style.display&&B(d)&&(e[f]=c._data(d,"olddisplay", 8 | x(d.nodeName)))):e[f]||B(d)||c._data(d,"olddisplay",c.css(d,"display")));for(f=0;g>f;f++)d=a[f],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?e[f]||"":"none"));return a}function y(a,b,c){return(a=Ib.exec(b))?Math.max(0,a[1]-(c||0))+(a[2]||"px"):b}function C(a,b,d,e,f){b=d===(e?"border":"content")?4:"width"===b?1:0;for(var g=0;4>b;b+=2)"margin"===d&&(g+=c.css(a,d+Y[b],!0,f)),e?("content"===d&&(g-=c.css(a,"padding"+Y[b],!0,f)),"margin"!==d&&(g-=c.css(a,"border"+Y[b]+ 9 | "Width",!0,f))):(g+=c.css(a,"padding"+Y[b],!0,f),"padding"!==d&&(g+=c.css(a,"border"+Y[b]+"Width",!0,f)));return g}function w(a,b,d){var e=!0,f="width"===b?a.offsetWidth:a.offsetHeight,g=fa(a),h=c.support.boxSizing&&"border-box"===c.css(a,"boxSizing",!1,g);if(0>=f||null==f){if(f=ga(a,b,g),(0>f||null==f)&&(f=a.style[b]),Ca.test(f))return f;e=h&&(c.support.boxSizingReliable||f===a.style[b]);f=parseFloat(f)||0}return f+C(a,b,d||(h?"border":"content"),e,g)+"px"}function x(a){var b=u,d=eb[a];return d|| 10 | (d=J(a,b),"none"!==d&&d||(sa=(sa||c("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(b.documentElement),b=(sa[0].contentWindow||sa[0].contentDocument).document,b.write("<!doctype html><html><body>"),b.close(),d=J(a,b),sa.detach()),eb[a]=d),d}function J(a,b){var d=c(b.createElement(a)).appendTo(b.body),e=c.css(d[0],"display");return d.remove(),e}function ta(a,b,d,e){var f;if(c.isArray(b))c.each(b,function(b,c){d||Jb.test(a)?e(a,c):ta(a+"["+("object"== 11 | typeof c?b:"")+"]",c,d,e)});else if(d||"object"!==c.type(b))e(a,b);else for(f in b)ta(a+"["+f+"]",b[f],d,e)}function K(a){return function(b,d){"string"!=typeof b&&(d=b,b="*");var e,f=0,g=b.toLowerCase().match(Q)||[];if(c.isFunction(d))for(;e=g[f++];)"+"===e[0]?(e=e.slice(1)||"*",(a[e]=a[e]||[]).unshift(d)):(a[e]=a[e]||[]).push(d)}}function R(a,b,d,e){function f(k){var m;return g[k]=!0,c.each(a[k]||[],function(a,c){var k=c(b,d,e);return"string"!=typeof k||h||g[k]?h?!(m=k):l:(b.dataTypes.unshift(k), 12 | f(k),!1)}),m}var g={},h=a===Ma;return f(b.dataTypes[0])||!g["*"]&&f("*")}function D(a,b){var d,e,f=c.ajaxSettings.flatOptions||{};for(d in b)b[d]!==l&&((f[d]?a:e||(e={}))[d]=b[d]);return e&&c.extend(!0,a,e),a}function S(){try{return new n.XMLHttpRequest}catch(a){}}function P(){return setTimeout(function(){ka=l}),ka=c.now()}function Kb(a,b){c.each(b,function(b,c){for(var f=(va[b]||[]).concat(va["*"]),g=0,h=f.length;h>g&&!f[g].call(a,b,c);g++);})}function fb(a,b,d){var e,f=0,g=Da.length,h=c.Deferred().always(function(){delete k.elem}), 13 | k=function(){if(e)return!1;for(var b=ka||P(),b=Math.max(0,m.startTime+m.duration-b),c=1-(b/m.duration||0),d=0,f=m.tweens.length;f>d;d++)m.tweens[d].run(c);return h.notifyWith(a,[m,c,b]),1>c&&f?b:(h.resolveWith(a,[m]),!1)},m=h.promise({elem:a,props:c.extend({},b),opts:c.extend(!0,{specialEasing:{}},d),originalProperties:b,originalOptions:d,startTime:ka||P(),duration:d.duration,tweens:[],createTween:function(b,d){var e=c.Tween(a,m.opts,b,d,m.opts.specialEasing[b]||m.opts.easing);return m.tweens.push(e), 14 | e},stop:function(b){var c=0,d=b?m.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)m.tweens[c].run(1);return b?h.resolveWith(a,[m,b]):h.rejectWith(a,[m,b]),this}});d=m.props;for(Lb(d,m.opts.specialEasing);g>f;f++)if(b=Da[f].call(m,a,d,m.opts))return b;return Kb(m,d),c.isFunction(m.opts.start)&&m.opts.start.call(a,m),c.fx.timer(c.extend(k,{elem:a,anim:m,queue:m.opts.queue})),m.progress(m.opts.progress).done(m.opts.done,m.opts.complete).fail(m.opts.fail).always(m.opts.always)}function Lb(a,b){var d, 15 | e,f,g,h;for(d in a)if(e=c.camelCase(d),f=b[e],g=a[d],c.isArray(g)&&(f=g[1],g=a[d]=g[0]),d!==e&&(a[e]=g,delete a[d]),h=c.cssHooks[e],h&&"expand"in h)for(d in g=h.expand(g),delete a[e],g)d in a||(a[d]=g[d],b[d]=f);else b[e]=f}function T(a,b,c,e,f){return new T.prototype.init(a,b,c,e,f)}function Ea(a,b){var c,e={height:a},f=0;for(b=b?1:0;4>f;f+=2-b)c=Y[f],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function gb(a){return c.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow: 16 | !1}var hb,Fa,u=n.document,Mb=n.location,Nb=n.jQuery,Ob=n.$,Ga={},ca=[],ib=ca.concat,Na=ca.push,ha=ca.slice,jb=ca.indexOf,Pb=Ga.toString,Oa=Ga.hasOwnProperty,Pa="1.9.0".trim,c=function(a,b){return new c.fn.init(a,b,hb)},Ha=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,Q=/\S+/g,Qb=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,Rb=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,kb=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,Sb=/^[\],:{}\s]*$/,Tb=/(?:^|:|,)(?:\s*\[)+/g,Ub=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,Vb=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g, 17 | Wb=/^-ms-/,Xb=/-([\da-z])/gi,Yb=function(a,b){return b.toUpperCase()},Ia=function(){u.addEventListener?(u.removeEventListener("DOMContentLoaded",Ia,!1),c.ready()):"complete"===u.readyState&&(u.detachEvent("onreadystatechange",Ia),c.ready())};c.fn=c.prototype={jquery:"1.9.0",constructor:c,init:function(a,b,d){var e,f;if(!a)return this;if("string"==typeof a){if(e="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&3<=a.length?[null,a,null]:Rb.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||d).find(a):this.constructor(b).find(a); 18 | if(e[1]){if(b=b instanceof c?b[0]:b,c.merge(this,c.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:u,!0)),kb.test(e[1])&&c.isPlainObject(b))for(e in b)c.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}if(f=u.getElementById(e[2]),f&&f.parentNode){if(f.id!==e[2])return d.find(a);this.length=1;this[0]=f}return this.context=u,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):c.isFunction(a)?d.ready(a):(a.selector!==l&&(this.selector=a.selector,this.context= 19 | a.context),c.makeArray(a,this))},selector:"",length:0,size:function(){return this.length},toArray:function(){return ha.call(this)},get:function(a){return null==a?this.toArray():0>a?this[this.length+a]:this[a]},pushStack:function(a){a=c.merge(this.constructor(),a);return a.prevObject=this,a.context=this.context,a},each:function(a,b){return c.each(this,a,b)},ready:function(a){return c.ready.promise().done(a),this},slice:function(){return this.pushStack(ha.apply(this,arguments))},first:function(){return this.eq(0)}, 20 | last:function(){return this.eq(-1)},eq:function(a){var b=this.length;a=+a+(0>a?b:0);return this.pushStack(0<=a&&b>a?[this[a]]:[])},map:function(a){return this.pushStack(c.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:Na,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a,b,d,e,f,g,h=arguments[0]||{},k=1,m=arguments.length,v=!1;"boolean"==typeof h&&(v=h,h=arguments[1]||{},k=2);"object"== 21 | typeof h||c.isFunction(h)||(h={});for(m===k&&(h=this,--k);m>k;k++)if(null!=(a=arguments[k]))for(b in a)d=h[b],e=a[b],h!==e&&(v&&e&&(c.isPlainObject(e)||(f=c.isArray(e)))?(f?(f=!1,g=d&&c.isArray(d)?d:[]):g=d&&c.isPlainObject(d)?d:{},h[b]=c.extend(v,g,e)):e!==l&&(h[b]=e));return h};c.extend({noConflict:function(a){return n.$===c&&(n.$=Ob),a&&n.jQuery===c&&(n.jQuery=Nb),c},isReady:!1,readyWait:1,holdReady:function(a){a?c.readyWait++:c.ready(!0)},ready:function(a){if(!0===a?!--c.readyWait:!c.isReady){if(!u.body)return setTimeout(c.ready); 22 | c.isReady=!0;!0!==a&&0<--c.readyWait||(Fa.resolveWith(u,[c]),c.fn.trigger&&c(u).trigger("ready").off("ready"))}},isFunction:function(a){return"function"===c.type(a)},isArray:Array.isArray||function(a){return"array"===c.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?Ga[Pb.call(a)]||"object":typeof a},isPlainObject:function(a){if(!a||"object"!==c.type(a)|| 23 | a.nodeType||c.isWindow(a))return!1;try{if(a.constructor&&!Oa.call(a,"constructor")&&!Oa.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(b){return!1}for(var d in a);return d===l||Oa.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw Error(a);},parseHTML:function(a,b,d){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(d=b,b=!1);b=b||u;var e=kb.exec(a);d=!d&&[];return e?[b.createElement(e[1])]:(e=c.buildFragment([a],b,d),d&&c(d).remove(), 24 | c.merge([],e.childNodes))},parseJSON:function(a){return n.JSON&&n.JSON.parse?n.JSON.parse(a):null===a?a:"string"==typeof a&&(a=c.trim(a),a&&Sb.test(a.replace(Ub,"@").replace(Vb,"]").replace(Tb,"")))?Function("return "+a)():(c.error("Invalid JSON: "+a),l)},parseXML:function(a){var b,d;if(!a||"string"!=typeof a)return null;try{n.DOMParser?(d=new DOMParser,b=d.parseFromString(a,"text/xml")):(b=new ActiveXObject("Microsoft.XMLDOM"),b.async="false",b.loadXML(a))}catch(e){b=l}return b&&b.documentElement&& 25 | !b.getElementsByTagName("parsererror").length||c.error("Invalid XML: "+a),b},noop:function(){},globalEval:function(a){a&&c.trim(a)&&(n.execScript||function(a){n.eval.call(n,a)})(a)},camelCase:function(a){return a.replace(Wb,"ms-").replace(Xb,Yb)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var e,f=0,g=a.length,h=p(a);if(c)if(h)for(;g>f&&(e=b.apply(a[f],c),!1!==e);f++);else for(f in a){if(e=b.apply(a[f],c),!1===e)break}else if(h)for(;g> 26 | f&&(e=b.call(a[f],f,a[f]),!1!==e);f++);else for(f in a)if(e=b.call(a[f],f,a[f]),!1===e)break;return a},trim:Pa&&!Pa.call("\ufeff\u00a0")?function(a){return null==a?"":Pa.call(a)}:function(a){return null==a?"":(a+"").replace(Qb,"")},makeArray:function(a,b){var d=b||[];return null!=a&&(p(Object(a))?c.merge(d,"string"==typeof a?[a]:a):Na.call(d,a)),d},inArray:function(a,b,c){var e;if(b){if(jb)return jb.call(b,a,c);e=b.length;for(c=c?0>c?Math.max(0,e+c):c:0;e>c;c++)if(c in b&&b[c]===a)return c}return-1}, 27 | merge:function(a,b){var c=b.length,e=a.length,f=0;if("number"==typeof c)for(;c>f;f++)a[e++]=b[f];else for(;b[f]!==l;)a[e++]=b[f++];return a.length=e,a},grep:function(a,b,c){var e,f=[],g=0,h=a.length;for(c=!!c;h>g;g++)e=!!b(a[g],g),c!==e&&f.push(a[g]);return f},map:function(a,b,c){var e,f=0,g=a.length,h=[];if(p(a))for(;g>f;f++)e=b(a[f],f,c),null!=e&&(h[h.length]=e);else for(f in a)e=b(a[f],f,c),null!=e&&(h[h.length]=e);return ib.apply([],h)},guid:1,proxy:function(a,b){var d,e,f;return"string"==typeof b&& 28 | (d=a[b],b=a,a=d),c.isFunction(a)?(e=ha.call(arguments,2),f=function(){return a.apply(b||this,e.concat(ha.call(arguments)))},f.guid=a.guid=a.guid||c.guid++,f):l},access:function(a,b,d,e,f,g,h){var k=0,m=a.length,v=null==d;if("object"===c.type(d))for(k in f=!0,d)c.access(a,b,k,d[k],!0,g,h);else if(e!==l&&(f=!0,c.isFunction(e)||(h=!0),v&&(h?(b.call(a,e),b=null):(v=b,b=function(a,b,d){return v.call(c(a),d)})),b))for(;m>k;k++)b(a[k],d,h?e:e.call(a[k],k,b(a[k],d)));return f?a:v?b.call(a):m?b(a[0],d):g}, 29 | now:function(){return(new Date).getTime()}});c.ready.promise=function(a){if(!Fa)if(Fa=c.Deferred(),"complete"===u.readyState)setTimeout(c.ready);else if(u.addEventListener)u.addEventListener("DOMContentLoaded",Ia,!1),n.addEventListener("load",c.ready,!1);else{u.attachEvent("onreadystatechange",Ia);n.attachEvent("onload",c.ready);var b=!1;try{b=null==n.frameElement&&u.documentElement}catch(d){}b&&b.doScroll&&function f(){if(!c.isReady){try{b.doScroll("left")}catch(a){return setTimeout(f,50)}c.ready()}}()}return Fa.promise(a)}; 30 | c.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){Ga["[object "+b+"]"]=b.toLowerCase()});hb=c(u);var bb={};c.Callbacks=function(a){a="string"==typeof a?bb[a]||t(a):c.extend({},a);var b,d,e,f,g,h,k=[],m=!a.once&&[],v=function(c){b=a.memory&&c;d=!0;h=f||0;f=0;g=k.length;for(e=!0;k&&g>h;h++)if(!1===k[h].apply(c[0],c[1])&&a.stopOnFalse){b=!1;break}e=!1;k&&(m?m.length&&v(m.shift()):b?k=[]:s.disable())},s={add:function(){if(k){var d=k.length;(function Zb(b){c.each(b, 31 | function(b,d){var e=c.type(d);"function"===e?a.unique&&s.has(d)||k.push(d):d&&d.length&&"string"!==e&&Zb(d)})})(arguments);e?g=k.length:b&&(f=d,v(b))}return this},remove:function(){return k&&c.each(arguments,function(a,b){for(var d;-1<(d=c.inArray(b,k,d));)k.splice(d,1),e&&(g>=d&&g--,h>=d&&h--)}),this},has:function(a){return-1<c.inArray(a,k)},empty:function(){return k=[],this},disable:function(){return k=m=b=l,this},disabled:function(){return!k},lock:function(){return m=l,b||s.disable(),this},locked:function(){return!m}, 32 | fireWith:function(a,b){return b=b||[],b=[a,b.slice?b.slice():b],!k||d&&!m||(e?m.push(b):v(b)),this},fire:function(){return s.fireWith(this,arguments),this},fired:function(){return!!d}};return s};c.extend({Deferred:function(a){var b=[["resolve","done",c.Callbacks("once memory"),"resolved"],["reject","fail",c.Callbacks("once memory"),"rejected"],["notify","progress",c.Callbacks("memory")]],d="pending",e={state:function(){return d},always:function(){return f.done(arguments).fail(arguments),this},then:function(){var a= 33 | arguments;return c.Deferred(function(d){c.each(b,function(b,m){var l=m[0],s=c.isFunction(a[b])&&a[b];f[m[1]](function(){var a=s&&s.apply(this,arguments);a&&c.isFunction(a.promise)?a.promise().done(d.resolve).fail(d.reject).progress(d.notify):d[l+"With"](this===e?d.promise():this,s?[a]:arguments)})});a=null}).promise()},promise:function(a){return null!=a?c.extend(a,e):e}},f={};return e.pipe=e.then,c.each(b,function(a,c){var k=c[2],m=c[3];e[c[1]]=k.add;m&&k.add(function(){d=m},b[1^a][2].disable,b[2][2].lock); 34 | f[c[0]]=function(){return f[c[0]+"With"](this===f?e:this,arguments),this};f[c[0]+"With"]=k.fireWith}),e.promise(f),a&&a.call(f,f),f},when:function(a){var b,d,e,f=0,g=ha.call(arguments),h=g.length,k=1!==h||a&&c.isFunction(a.promise)?h:0,m=1===k?a:c.Deferred(),l=function(a,c,d){return function(e){c[a]=this;d[a]=1<arguments.length?ha.call(arguments):e;d===b?m.notifyWith(c,d):--k||m.resolveWith(c,d)}};if(1<h)for(b=Array(h),d=Array(h),e=Array(h);h>f;f++)g[f]&&c.isFunction(g[f].promise)?g[f].promise().done(l(f, 35 | e,g)).fail(m.reject).progress(l(f,d,b)):--k;return k||m.resolveWith(e,g),m.promise()}});c.support=function(){var a,b,d,e,f,g,h,k=u.createElement("div");if(k.setAttribute("className","t"),k.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",b=k.getElementsByTagName("*"),d=k.getElementsByTagName("a")[0],!b||!d||!b.length)return{};e=u.createElement("select");f=e.appendChild(u.createElement("option"));b=k.getElementsByTagName("input")[0];d.style.cssText="top:1px;float:left;opacity:.5"; 36 | a={getSetAttribute:"t"!==k.className,leadingWhitespace:3===k.firstChild.nodeType,tbody:!k.getElementsByTagName("tbody").length,htmlSerialize:!!k.getElementsByTagName("link").length,style:/top/.test(d.getAttribute("style")),hrefNormalized:"/a"===d.getAttribute("href"),opacity:/^0.5/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,checkOn:!!b.value,optSelected:f.selected,enctype:!!u.createElement("form").enctype,html5Clone:"<:nav></:nav>"!==u.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"=== 37 | u.compatMode,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1};b.checked=!0;a.noCloneChecked=b.cloneNode(!0).checked;e.disabled=!0;a.optDisabled=!f.disabled;try{delete k.test}catch(m){a.deleteExpando=!1}b=u.createElement("input");b.setAttribute("value","");a.input=""===b.getAttribute("value");b.value="t";b.setAttribute("type","radio");a.radioValue="t"===b.value;b.setAttribute("checked","t");b.setAttribute("name", 38 | "t");d=u.createDocumentFragment();d.appendChild(b);a.appendChecked=b.checked;a.checkClone=d.cloneNode(!0).cloneNode(!0).lastChild.checked;k.attachEvent&&(k.attachEvent("onclick",function(){a.noCloneEvent=!1}),k.cloneNode(!0).click());for(h in{submit:!0,change:!0,focusin:!0})k.setAttribute(d="on"+h,"t"),a[h+"Bubbles"]=d in n||!1===k.attributes[d].expando;return k.style.backgroundClip="content-box",k.cloneNode(!0).style.backgroundClip="",a.clearCloneStyle="content-box"===k.style.backgroundClip,c(function(){var b, 39 | c,d,e=u.getElementsByTagName("body")[0];e&&(b=u.createElement("div"),b.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",e.appendChild(b).appendChild(k),k.innerHTML="<table><tr><td></td><td>t</td></tr></table>",d=k.getElementsByTagName("td"),d[0].style.cssText="padding:0;margin:0;border:0;display:none",g=0===d[0].offsetHeight,d[0].style.display="",d[1].style.display="none",a.reliableHiddenOffsets=g&&0===d[0].offsetHeight,k.innerHTML="",k.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;", 40 | a.boxSizing=4===k.offsetWidth,a.doesNotIncludeMarginInBodyOffset=1!==e.offsetTop,n.getComputedStyle&&(a.pixelPosition="1%"!==(n.getComputedStyle(k,null)||{}).top,a.boxSizingReliable="4px"===(n.getComputedStyle(k,null)||{width:"4px"}).width,c=k.appendChild(u.createElement("div")),c.style.cssText=k.style.cssText="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",c.style.marginRight=c.style.width="0",k.style.width="1px",a.reliableMarginRight= 41 | !parseFloat((n.getComputedStyle(c,null)||{}).marginRight)),k.style.zoom!==l&&(k.innerHTML="",k.style.cssText="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;width:1px;padding:1px;display:inline;zoom:1",a.inlineBlockNeedsLayout=3===k.offsetWidth,k.style.display="block",k.innerHTML="<div></div>",k.firstChild.style.width="5px",a.shrinkWrapBlocks=3!==k.offsetWidth,e.style.zoom=1),e.removeChild(b),k=null)}),b=e=d=f=d=b=null,a}(); 42 | var Fb=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,Eb=/([A-Z])/g;c.extend({cache:{},expando:"jQuery"+("1.9.0"+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){return a=a.nodeType?c.cache[a[c.expando]]:a[c.expando],!!a&&!U(a)},data:function(a,b,c){return F(a,b,c,!1)},removeData:function(a,b){return z(a,b,!1)},_data:function(a,b,c){return F(a,b,c,!0)},_removeData:function(a,b){return z(a,b,!0)},acceptData:function(a){var b=a.nodeName&& 43 | c.noData[a.nodeName.toLowerCase()];return!b||!0!==b&&a.getAttribute("classid")===b}});c.fn.extend({data:function(a,b){var d,e,f=this[0],g=0,h=null;if(a===l){if(this.length&&(h=c.data(f),1===f.nodeType&&!c._data(f,"parsedAttrs"))){for(d=f.attributes;d.length>g;g++)e=d[g].name,e.indexOf("data-")||(e=c.camelCase(e.substring(5)),I(f,e,h[e]));c._data(f,"parsedAttrs",!0)}return h}return"object"==typeof a?this.each(function(){c.data(this,a)}):c.access(this,function(b){return b===l?f?I(f,a,c.data(f,a)):null: 44 | (this.each(function(){c.data(this,a,b)}),l)},null,b,1<arguments.length,null,!0)},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){var e;return a?(b=(b||"fx")+"queue",e=c._data(a,b),d&&(!e||c.isArray(d)?e=c._data(a,b,c.makeArray(d)):e.push(d)),e||[]):l},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),e=d.length,f=d.shift(),g=c._queueHooks(a,b),h=function(){c.dequeue(a,b)};"inprogress"===f&&(f=d.shift(),e--);(g.cur=f)&&("fx"===b&&d.unshift("inprogress"), 45 | delete g.stop,f.call(a,h,g));!e&&g&&g.empty.fire()},_queueHooks:function(a,b){var d=b+"queueHooks";return c._data(a,d)||c._data(a,d,{empty:c.Callbacks("once memory").add(function(){c._removeData(a,b+"queue");c._removeData(a,d)})})}});c.fn.extend({queue:function(a,b){var d=2;return"string"!=typeof a&&(b=a,a="fx",d--),d>arguments.length?c.queue(this[0],a):b===l?this:this.each(function(){var d=c.queue(this,a,b);c._queueHooks(this,a);"fx"===a&&"inprogress"!==d[0]&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this, 46 | a)})},delay:function(a,b){return a=c.fx?c.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var f=setTimeout(b,a);c.stop=function(){clearTimeout(f)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var d,e=1,f=c.Deferred(),g=this,h=this.length,k=function(){--e||f.resolveWith(g,[g])};"string"!=typeof a&&(b=a,a=l);for(a=a||"fx";h--;)(d=c._data(g[h],a+"queueHooks"))&&d.empty&&(e++,d.empty.add(k));return k(),f.promise(b)}});var la,lb,Qa=/[\t\r\n]/g,$b=/\r/g,ac=/^(?:input|select|textarea|button|object)$/i, 47 | bc=/^(?:a|area)$/i,mb=/^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,Ra=/^(?:checked|selected)$/i,ia=c.support.getSetAttribute,Sa=c.support.input;c.fn.extend({attr:function(a,b){return c.access(this,c.attr,a,b,1<arguments.length)},removeAttr:function(a){return this.each(function(){c.removeAttr(this,a)})},prop:function(a,b){return c.access(this,c.prop,a,b,1<arguments.length)},removeProp:function(a){return a=c.propFix[a]|| 48 | a,this.each(function(){try{this[a]=l,delete this[a]}catch(b){}})},addClass:function(a){var b,d,e,f,g,h=0,k=this.length;b="string"==typeof a&&a;if(c.isFunction(a))return this.each(function(b){c(this).addClass(a.call(this,b,this.className))});if(b)for(b=(a||"").match(Q)||[];k>h;h++)if(d=this[h],e=1===d.nodeType&&(d.className?(" "+d.className+" ").replace(Qa," "):" ")){for(g=0;f=b[g++];)0>e.indexOf(" "+f+" ")&&(e+=f+" ");d.className=c.trim(e)}return this},removeClass:function(a){var b,d,e,f,g,h=0,k= 49 | this.length;b=0===arguments.length||"string"==typeof a&&a;if(c.isFunction(a))return this.each(function(b){c(this).removeClass(a.call(this,b,this.className))});if(b)for(b=(a||"").match(Q)||[];k>h;h++)if(d=this[h],e=1===d.nodeType&&(d.className?(" "+d.className+" ").replace(Qa," "):"")){for(g=0;f=b[g++];)for(;0<=e.indexOf(" "+f+" ");)e=e.replace(" "+f+" "," ");d.className=a?c.trim(e):""}return this},toggleClass:function(a,b){var d=typeof a,e="boolean"==typeof b;return c.isFunction(a)?this.each(function(d){c(this).toggleClass(a.call(this, 50 | d,this.className,b),b)}):this.each(function(){if("string"===d)for(var f,g=0,h=c(this),k=b,m=a.match(Q)||[];f=m[g++];)k=e?k:!h.hasClass(f),h[k?"addClass":"removeClass"](f);else("undefined"===d||"boolean"===d)&&(this.className&&c._data(this,"__className__",this.className),this.className=this.className||!1===a?"":c._data(this,"__className__")||"")})},hasClass:function(a){a=" "+a+" ";for(var b=0,c=this.length;c>b;b++)if(1===this[b].nodeType&&0<=(" "+this[b].className+" ").replace(Qa," ").indexOf(a))return!0; 51 | return!1},val:function(a){var b,d,e,f=this[0];if(arguments.length)return e=c.isFunction(a),this.each(function(d){var f,k=c(this);1===this.nodeType&&(f=e?a.call(this,d,k.val()):a,null==f?f="":"number"==typeof f?f+="":c.isArray(f)&&(f=c.map(f,function(a){return null==a?"":a+""})),b=c.valHooks[this.type]||c.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&b.set(this,f,"value")!==l||(this.value=f))});if(f)return b=c.valHooks[f.type]||c.valHooks[f.nodeName.toLowerCase()],b&&"get"in b&&(d=b.get(f,"value"))!== 52 | l?d:(d=f.value,"string"==typeof d?d.replace($b,""):null==d?"":d)}});c.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){for(var b,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,k=0>e?h:f?e:0;h>k;k++)if(b=d[k],!(!b.selected&&k!==e||(c.support.optDisabled?b.disabled:null!==b.getAttribute("disabled"))||b.parentNode.disabled&&c.nodeName(b.parentNode,"optgroup"))){if(a=c(b).val(),f)return a; 53 | g.push(a)}return g},set:function(a,b){var d=c.makeArray(b);return c(a).find("option").each(function(){this.selected=0<=c.inArray(c(this).val(),d)}),d.length||(a.selectedIndex=-1),d}}},attr:function(a,b,d){var e,f,g,h=a.nodeType;if(a&&3!==h&&8!==h&&2!==h)return a.getAttribute===l?c.prop(a,b,d):(g=1!==h||!c.isXMLDoc(a),g&&(b=b.toLowerCase(),f=c.attrHooks[b]||(mb.test(b)?lb:la)),d===l?f&&g&&"get"in f&&null!==(e=f.get(a,b))?e:(a.getAttribute!==l&&(e=a.getAttribute(b)),null==e?l:e):null!==d?f&&g&&"set"in 54 | f&&(e=f.set(a,d,b))!==l?e:(a.setAttribute(b,d+""),d):(c.removeAttr(a,b),l))},removeAttr:function(a,b){var d,e,f=0,g=b&&b.match(Q);if(g&&1===a.nodeType)for(;d=g[f++];)e=c.propFix[d]||d,mb.test(d)?!ia&&Ra.test(d)?a[c.camelCase("default-"+d)]=a[e]=!1:a[e]=!1:c.attr(a,d,""),a.removeAttribute(ia?d:e)},attrHooks:{type:{set:function(a,b){if(!c.support.radioValue&&"radio"===b&&c.nodeName(a,"input")){var d=a.value;return a.setAttribute("type",b),d&&(a.value=d),b}}}},propFix:{tabindex:"tabIndex",readonly:"readOnly", 55 | "for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,b,d){var e,f,g,h=a.nodeType;if(a&&3!==h&&8!==h&&2!==h)return g=1!==h||!c.isXMLDoc(a),g&&(b=c.propFix[b]||b,f=c.propHooks[b]),d!==l?f&&"set"in f&&(e=f.set(a,d,b))!==l?e:a[b]=d:f&&"get"in f&&null!==(e=f.get(a,b))?e:a[b]},propHooks:{tabIndex:{get:function(a){var b= 56 | a.getAttributeNode("tabindex");return b&&b.specified?parseInt(b.value,10):ac.test(a.nodeName)||bc.test(a.nodeName)&&a.href?0:l}}}});lb={get:function(a,b){var d=c.prop(a,b),e="boolean"==typeof d&&a.getAttribute(b);return(d="boolean"==typeof d?Sa&&ia?null!=e:Ra.test(b)?a[c.camelCase("default-"+b)]:!!e:a.getAttributeNode(b))&&!1!==d.value?b.toLowerCase():l},set:function(a,b,d){return!1===b?c.removeAttr(a,d):Sa&&ia||!Ra.test(d)?a.setAttribute(!ia&&c.propFix[d]||d,d):a[c.camelCase("default-"+d)]=a[d]= 57 | !0,d}};Sa&&ia||(c.attrHooks.value={get:function(a,b){var d=a.getAttributeNode(b);return c.nodeName(a,"input")?a.defaultValue:d&&d.specified?d.value:l},set:function(a,b,d){return c.nodeName(a,"input")?(a.defaultValue=b,l):la&&la.set(a,b,d)}});ia||(la=c.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&("id"===b||"name"===b||"coords"===b?""!==c.value:c.specified)?c.value:l},set:function(a,b,c){var e=a.getAttributeNode(c);return e||a.setAttributeNode(e=a.ownerDocument.createAttribute(c)), 58 | e.value=b+="","value"===c||b===a.getAttribute(c)?b:l}},c.attrHooks.contenteditable={get:la.get,set:function(a,b,c){la.set(a,""===b?!1:b,c)}},c.each(["width","height"],function(a,b){c.attrHooks[b]=c.extend(c.attrHooks[b],{set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):l}})}));c.support.hrefNormalized||(c.each(["href","src","width","height"],function(a,b){c.attrHooks[b]=c.extend(c.attrHooks[b],{get:function(a){a=a.getAttribute(b,2);return null==a?l:a}})}),c.each(["href","src"],function(a, 59 | b){c.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}));c.support.style||(c.attrHooks.style={get:function(a){return a.style.cssText||l},set:function(a,b){return a.style.cssText=b+""}});c.support.optSelected||(c.propHooks.selected=c.extend(c.propHooks.selected,{get:function(a){a=a.parentNode;return a&&(a.selectedIndex,a.parentNode&&a.parentNode.selectedIndex),null}}));c.support.enctype||(c.propFix.enctype="encoding");c.support.checkOn||c.each(["radio","checkbox"],function(){c.valHooks[this]= 60 | {get:function(a){return null===a.getAttribute("value")?"on":a.value}}});c.each(["radio","checkbox"],function(){c.valHooks[this]=c.extend(c.valHooks[this],{set:function(a,b){return c.isArray(b)?a.checked=0<=c.inArray(c(a).val(),b):l}})});var Ta=/^(?:input|select|textarea)$/i,cc=/^key/,dc=/^(?:mouse|contextmenu)|click/,nb=/^(?:focusinfocus|focusoutblur)$/,ob=/^([^.]*)(?:\.(.+)|)$/;c.event={global:{},add:function(a,b,d,e,f){var g,h,k,m,v,s,q,p,r;if(v=3!==a.nodeType&&8!==a.nodeType&&c._data(a)){d.handler&& 61 | (g=d,d=g.handler,f=g.selector);d.guid||(d.guid=c.guid++);(m=v.events)||(m=v.events={});(h=v.handle)||(h=v.handle=function(a){return c===l||a&&c.event.triggered===a.type?l:c.event.dispatch.apply(h.elem,arguments)},h.elem=a);b=(b||"").match(Q)||[""];for(v=b.length;v--;)k=ob.exec(b[v])||[],p=s=k[1],r=(k[2]||"").split(".").sort(),k=c.event.special[p]||{},p=(f?k.delegateType:k.bindType)||p,k=c.event.special[p]||{},s=c.extend({type:p,origType:s,data:e,handler:d,guid:d.guid,selector:f,needsContext:f&&c.expr.match.needsContext.test(f), 62 | namespace:r.join(".")},g),(q=m[p])||(q=m[p]=[],q.delegateCount=0,k.setup&&!1!==k.setup.call(a,e,r,h)||(a.addEventListener?a.addEventListener(p,h,!1):a.attachEvent&&a.attachEvent("on"+p,h))),k.add&&(k.add.call(a,s),s.handler.guid||(s.handler.guid=d.guid)),f?q.splice(q.delegateCount++,0,s):q.push(s),c.event.global[p]=!0;a=null}},remove:function(a,b,d,e,f){var g,h,k,m,l,s,q,p,r,n,t,M=c.hasData(a)&&c._data(a);if(M&&(m=M.events)){b=(b||"").match(Q)||[""];for(l=b.length;l--;)if(k=ob.exec(b[l])||[],r=t= 63 | k[1],n=(k[2]||"").split(".").sort(),r){q=c.event.special[r]||{};r=(e?q.delegateType:q.bindType)||r;p=m[r]||[];k=k[2]&&RegExp("(^|\\.)"+n.join("\\.(?:.*\\.|)")+"(\\.|$)");for(h=g=p.length;g--;)s=p[g],!f&&t!==s.origType||d&&d.guid!==s.guid||k&&!k.test(s.namespace)||e&&e!==s.selector&&("**"!==e||!s.selector)||(p.splice(g,1),s.selector&&p.delegateCount--,q.remove&&q.remove.call(a,s));h&&!p.length&&(q.teardown&&!1!==q.teardown.call(a,n,M.handle)||c.removeEvent(a,r,M.handle),delete m[r])}else for(r in m)c.event.remove(a, 64 | r+b[l],d,e,!0);c.isEmptyObject(m)&&(delete M.handle,c._removeData(a,"events"))}},trigger:function(a,b,d,e){var f,g,h,k,m,p,s=[d||u],q=a.type||a;m=a.namespace?a.namespace.split("."):[];if(g=f=d=d||u,3!==d.nodeType&&8!==d.nodeType&&!nb.test(q+c.event.triggered)&&(0<=q.indexOf(".")&&(m=q.split("."),q=m.shift(),m.sort()),k=0>q.indexOf(":")&&"on"+q,a=a[c.expando]?a:new c.Event(q,"object"==typeof a&&a),a.isTrigger=!0,a.namespace=m.join("."),a.namespace_re=a.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+ 65 | "(\\.|$)"):null,a.result=l,a.target||(a.target=d),b=null==b?[a]:c.makeArray(b,[a]),p=c.event.special[q]||{},e||!p.trigger||!1!==p.trigger.apply(d,b))){if(!e&&!p.noBubble&&!c.isWindow(d)){h=p.delegateType||q;for(nb.test(h+q)||(g=g.parentNode);g;g=g.parentNode)s.push(g),f=g;f===(d.ownerDocument||u)&&s.push(f.defaultView||f.parentWindow||n)}for(f=0;(g=s[f++])&&!a.isPropagationStopped();)a.type=1<f?h:p.bindType||q,(m=(c._data(g,"events")||{})[a.type]&&c._data(g,"handle"))&&m.apply(g,b),(m=k&&g[k])&&c.acceptData(g)&& 66 | m.apply&&!1===m.apply(g,b)&&a.preventDefault();if(a.type=q,!(e||a.isDefaultPrevented()||p._default&&!1!==p._default.apply(d.ownerDocument,b)||"click"===q&&c.nodeName(d,"a"))&&c.acceptData(d)&&k&&d[q]&&!c.isWindow(d)){(f=d[k])&&(d[k]=null);c.event.triggered=q;try{d[q]()}catch(r){}c.event.triggered=l;f&&(d[k]=f)}return a.result}},dispatch:function(a){a=c.event.fix(a);var b,d,e,f,g,h=[],k=ha.call(arguments);b=(c._data(this,"events")||{})[a.type]||[];var m=c.event.special[a.type]||{};if(k[0]=a,a.delegateTarget= 67 | this,!m.preDispatch||!1!==m.preDispatch.call(this,a)){h=c.event.handlers.call(this,a,b);for(b=0;(f=h[b++])&&!a.isPropagationStopped();)for(a.currentTarget=f.elem,d=0;(g=f.handlers[d++])&&!a.isImmediatePropagationStopped();)a.namespace_re&&!a.namespace_re.test(g.namespace)||(a.handleObj=g,a.data=g.data,e=((c.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,k),e===l||!1!==(a.result=e)||(a.preventDefault(),a.stopPropagation()));return m.postDispatch&&m.postDispatch.call(this,a),a.result}}, 68 | handlers:function(a,b){var d,e,f,g,h=[],k=b.delegateCount,m=a.target;if(k&&m.nodeType&&(!a.button||"click"!==a.type))for(;m!=this;m=m.parentNode||this)if(!0!==m.disabled||"click"!==a.type){e=[];for(d=0;k>d;d++)g=b[d],f=g.selector+" ",e[f]===l&&(e[f]=g.needsContext?0<=c(f,this).index(m):c.find(f,this,null,[m]).length),e[f]&&e.push(g);e.length&&h.push({elem:m,handlers:e})}return b.length>k&&h.push({elem:this,handlers:b.slice(k)}),h},fix:function(a){if(a[c.expando])return a;var b,d,e=a,f=c.event.fixHooks[a.type]|| 69 | {},g=f.props?this.props.concat(f.props):this.props;a=new c.Event(e);for(b=g.length;b--;)d=g[b],a[d]=e[d];return a.target||(a.target=e.srcElement||u),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,f.filter?f.filter(a,e):a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:["char","charCode","key","keyCode"],filter:function(a,b){return null==a.which&&(a.which= 70 | null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,e,f,g=b.button,h=b.fromElement;return null==a.pageX&&null!=b.clientX&&(c=a.target.ownerDocument||u,e=c.documentElement,f=c.body,a.pageX=b.clientX+(e&&e.scrollLeft||f&&f.scrollLeft||0)-(e&&e.clientLeft||f&&f.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||f&&f.scrollTop||0)-(e&&e.clientTop||f&&f.clientTop|| 71 | 0)),!a.relatedTarget&&h&&(a.relatedTarget=h===a.target?b.toElement:h),a.which||g===l||(a.which=1&g?1:2&g?3:4&g?2:0),a}},special:{load:{noBubble:!0},click:{trigger:function(){return c.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):l}},focus:{trigger:function(){if(this!==u.activeElement&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===u.activeElement&&this.blur?(this.blur(),!1):l},delegateType:"focusout"}, 72 | beforeunload:{postDispatch:function(a){a.result!==l&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,d,e){a=c.extend(new c.Event,d,{type:a,isSimulated:!0,originalEvent:{}});e?c.event.trigger(a,null,b):c.event.dispatch.call(b,a);a.isDefaultPrevented()&&d.preventDefault()}};c.removeEvent=u.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){b="on"+b;a.detachEvent&&(a[b]===l&&(a[b]=null),a.detachEvent(b,c))};c.Event=function(a,b){return this instanceof 73 | c.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||!1===a.returnValue||a.getPreventDefault&&a.getPreventDefault()?da:aa):this.type=a,b&&c.extend(this,b),this.timeStamp=a&&a.timeStamp||c.now(),this[c.expando]=!0,l):new c.Event(a,b)};c.Event.prototype={isDefaultPrevented:aa,isPropagationStopped:aa,isImmediatePropagationStopped:aa,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=da;a&&(a.preventDefault?a.preventDefault():a.returnValue= 74 | !1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=da;a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=da;this.stopPropagation()}};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={delegateType:b,bindType:b,handle:function(a){var e,f=a.relatedTarget,g=a.handleObj;return(!f||f!==this&&!c.contains(this,f))&&(a.type=g.origType,e=g.handler.apply(this, 75 | arguments),a.type=b),e}}});c.support.submitBubbles||(c.event.special.submit={setup:function(){return c.nodeName(this,"form")?!1:(c.event.add(this,"click._submit keypress._submit",function(a){a=a.target;(a=c.nodeName(a,"input")||c.nodeName(a,"button")?a.form:l)&&!c._data(a,"submitBubbles")&&(c.event.add(a,"submit._submit",function(a){a._submit_bubble=!0}),c._data(a,"submitBubbles",!0))}),l)},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&c.event.simulate("submit", 76 | this.parentNode,a,!0))},teardown:function(){return c.nodeName(this,"form")?!1:(c.event.remove(this,"._submit"),l)}});c.support.changeBubbles||(c.event.special.change={setup:function(){return Ta.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(c.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),c.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1);c.event.simulate("change", 77 | this,a,!0)})),!1):(c.event.add(this,"beforeactivate._change",function(a){a=a.target;Ta.test(a.nodeName)&&!c._data(a,"changeBubbles")&&(c.event.add(a,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||c.event.simulate("change",this.parentNode,a,!0)}),c._data(a,"changeBubbles",!0))}),l)},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type?a.handleObj.handler.apply(this,arguments):l},teardown:function(){return c.event.remove(this, 78 | "._change"),!Ta.test(this.nodeName)}});c.support.focusinBubbles||c.each({focus:"focusin",blur:"focusout"},function(a,b){var d=0,e=function(a){c.event.simulate(b,a.target,c.event.fix(a),!0)};c.event.special[b]={setup:function(){0===d++&&u.addEventListener(a,e,!0)},teardown:function(){0===--d&&u.removeEventListener(a,e,!0)}}});c.fn.extend({on:function(a,b,d,e,f){var g,h;if("object"==typeof a){"string"!=typeof b&&(d=d||b,b=l);for(h in a)this.on(h,b,d,a[h],f);return this}if(null==d&&null==e?(e=b,d=b= 79 | l):null==e&&("string"==typeof b?(e=d,d=l):(e=d,d=b,b=l)),!1===e)e=aa;else if(!e)return this;return 1===f&&(g=e,e=function(a){return c().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=c.guid++)),this.each(function(){c.event.add(this,a,e,d,b)})},one:function(a,b,c,e){return this.on(a,b,c,e,1)},off:function(a,b,d){var e,f;if(a&&a.preventDefault&&a.handleObj)return e=a.handleObj,c(a.delegateTarget).off(e.namespace?e.origType+"."+e.namespace:e.origType,e.selector,e.handler),this;if("object"==typeof a){for(f in a)this.off(f, 80 | b,a[f]);return this}return(!1===b||"function"==typeof b)&&(d=b,b=l),!1===d&&(d=aa),this.each(function(){c.event.remove(this,a,d,b)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,e){return this.on(b,a,c,e)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){var d=this[0];return d? 81 | c.event.trigger(a,b,d,!0):l},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){c.fn[b]=function(a,c){return 0<arguments.length?this.on(b,null,a,c):this.trigger(b)};cc.test(b)&&(c.event.fixHooks[b]=c.event.keyHooks);dc.test(b)&&(c.event.fixHooks[b]=c.event.mouseHooks)}); 82 | (function(a,b){function d(a){return ja.test(a+"")}function e(){var a,b=[];return a=function(c,d){return b.push(c+=" ")>A.cacheLength&&delete a[b.shift()],a[c]=d}}function f(a){return a[L]=!0,a}function g(a){var b=V.createElement("div");try{return a(b)}catch(c){return!1}finally{}}function h(a,b,c,d){var e,f,g,h,k;if((b?b.ownerDocument||b:ra)!==V&&ua(b),b=b||V,c=c||[],!a||"string"!=typeof a)return c;if(1!==(h=b.nodeType)&&9!==h)return[];if(!ba&&!d){if(e=ka.exec(a))if(g=e[1])if(9===h){if(f=b.getElementById(g), 83 | !f||!f.parentNode)return c;if(f.id===g)return c.push(f),c}else{if(b.ownerDocument&&(f=b.ownerDocument.getElementById(g))&&z(b,f)&&f.id===g)return c.push(f),c}else{if(e[2])return P.apply(c,Q.call(b.getElementsByTagName(a),0)),c;if((g=e[3])&&N.getByClassName&&b.getElementsByClassName)return P.apply(c,Q.call(b.getElementsByClassName(g),0)),c}if(N.qsa&&!ea.test(a)){if(e=!0,f=L,g=b,k=9===h&&a,1===h&&"object"!==b.nodeName.toLowerCase()){h=q(a);(e=b.getAttribute("id"))?f=e.replace(pa,"\\$&"):b.setAttribute("id", 84 | f);f="[id='"+f+"'] ";for(g=h.length;g--;)h[g]=f+r(h[g]);g=ca.test(a)&&b.parentNode||b;k=h.join(",")}if(k)try{return P.apply(c,Q.call(g.querySelectorAll(k),0)),c}catch(m){}finally{e||b.removeAttribute("id")}}}var l;a:{a=a.replace(Y,"$1");var p,s,v;e=q(a);if(!d&&1===e.length){if(l=e[0]=e[0].slice(0),2<l.length&&"ID"===(p=l[0]).type&&9===b.nodeType&&!ba&&A.relative[l[1].type]){if(b=A.find.ID(p.matches[0].replace(ma,na),b)[0],!b){l=c;break a}a=a.slice(l.shift().value.length)}for(h=Z.needsContext.test(a)? 85 | -1:l.length-1;0<=h&&(p=l[h],!A.relative[s=p.type]);h--)if((v=A.find[s])&&(d=v(p.matches[0].replace(ma,na),ca.test(l[0].type)&&b.parentNode||b))){if(l.splice(h,1),a=d.length&&r(l),!a){l=(P.apply(c,Q.call(d,0)),c);break a}break}}l=(D(a,e)(d,b,ba,c,ca.test(a)),c)}return l}function k(a,b){for(var c=a&&b&&a.nextSibling;c;c=c.nextSibling)if(c===b)return-1;return a?1:-1}function m(a){return function(b){return"input"===b.nodeName.toLowerCase()&&b.type===a}}function l(a){return function(b){var c=b.nodeName.toLowerCase(); 86 | return("input"===c||"button"===c)&&b.type===a}}function p(a){return f(function(b){return b=+b,f(function(c,d){for(var e,f=a([],c.length,b),g=f.length;g--;)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function q(a,b){var c,d,e,f,g,k,m;if(g=R[a+" "])return b?0:g.slice(0);g=a;k=[];for(m=A.preFilter;g;){c&&!(d=fa.exec(g))||(d&&(g=g.slice(d[0].length)||g),k.push(e=[]));c=!1;(d=ga.exec(g))&&(c=d.shift(),e.push({value:c,type:d[0].replace(Y," ")}),g=g.slice(c.length));for(f in A.filter)!(d=Z[f].exec(g))||m[f]&&!(d= 87 | m[f](d))||(c=d.shift(),e.push({value:c,type:f,matches:d}),g=g.slice(c.length));if(!c)break}return b?g.length:g?h.error(a):R(a,k).slice(0)}function r(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function n(a,b,c){var d=b.dir,e=c&&"parentNode"===b.dir,f=T++;return b.first?function(b,c,f){for(;b=b[d];)if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,k,Ua,m=G+" "+f;if(g)for(;b=b[d];){if((1===b.nodeType||e)&&a(b,c,g))return!0}else for(;b=b[d];)if(1===b.nodeType||e)if(Ua=b[L]|| 88 | (b[L]={}),(k=Ua[d])&&k[0]===m){if(!0===(h=k[1])||h===E)return!0===h}else if(k=Ua[d]=[m],k[1]=a(b,c,g)||E,!0===k[1])return!0}}function t(a){return 1<a.length?function(b,c,d){for(var e=a.length;e--;)if(!a[e](b,c,d))return!1;return!0}:a[0]}function M(a,b,c,d,e){for(var f,g=[],h=0,k=a.length,m=null!=b;k>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),m&&b.push(h));return g}function u(a,b,c,d,e,g){return d&&!d[L]&&(d=u(d)),e&&!e[L]&&(e=u(e,g)),f(function(f,g,k,m){var l,q,p=[],s=[],r=g.length,v;if(!(v=f)){v= 89 | b||"*";for(var n=k.nodeType?[k]:k,t=[],u=0,w=n.length;w>u;u++)h(v,n[u],t);v=t}v=!a||!f&&b?v:M(v,p,a,k,m);n=c?e||(f?a:r||d)?[]:g:v;if(c&&c(v,n,k,m),d)for(l=M(n,s),d(l,[],k,m),k=l.length;k--;)(q=l[k])&&(n[s[k]]=!(v[s[k]]=q));if(f){if(e||a){if(e){l=[];for(k=n.length;k--;)(q=n[k])&&l.push(v[k]=q);e(null,n=[],l,m)}for(k=n.length;k--;)(q=n[k])&&-1<(l=e?U.call(f,q):p[k])&&(f[l]=!(g[l]=q))}}else n=M(n===g?n.splice(r,n.length):n),e?e(null,g,n,m):P.apply(g,n)})}function w(a){var b,c,d,e=a.length,f=A.relative[a[0].type]; 90 | c=f||A.relative[" "];for(var g=f?1:0,h=n(function(a){return a===b},c,!0),k=n(function(a){return-1<U.call(b,a)},c,!0),m=[function(a,c,d){return!f&&(d||c!==F)||((b=c).nodeType?h(a,c,d):k(a,c,d))}];e>g;g++)if(c=A.relative[a[g].type])m=[n(t(m),c)];else{if(c=A.filter[a[g].type].apply(null,a[g].matches),c[L]){for(d=++g;e>d&&!A.relative[a[d].type];d++);return u(1<g&&t(m),1<g&&r(a.slice(0,g-1)).replace(Y,"$1"),c,d>g&&w(a.slice(g,d)),e>d&&w(a=a.slice(d)),e>d&&r(a))}m.push(c)}return t(m)}function B(a,b){var c= 91 | 0,d=0<b.length,e=0<a.length,g=function(f,g,k,m,l){var q,p,s=[],v=0,r="0",n=f&&[],t=null!=l,u=F,w=f||e&&A.find.TAG("*",l&&g.parentNode||g),x=G+=null==u?1:Math.E;for(t&&(F=g!==V&&g,E=c);null!=(l=w[r]);r++){if(e&&l){for(q=0;p=a[q];q++)if(p(l,g,k)){m.push(l);break}t&&(G=x,E=++c)}d&&((l=!p&&l)&&v--,f&&n.push(l))}if(v+=r,d&&r!==v){for(q=0;p=b[q];q++)p(n,s,g,k);if(f){if(0<v)for(;r--;)n[r]||s[r]||(s[r]=da.call(m));s=M(s)}P.apply(m,s);t&&!f&&0<s.length&&1<v+b.length&&h.uniqueSort(m)}return t&&(G=x,F=u),n}; 92 | return d?f(g):g}function x(){}var y,E,A,Ja,O,D,C,F,ua,V,W,ba,ea,X,J,z,I,L="sizzle"+-new Date,ra=a.document,N={},G=0,T=0,aa=e(),R=e(),S=e(),H=typeof b,K=[],da=K.pop,P=K.push,Q=K.slice,U=K.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},K="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+".replace("w","w#"),ta="\\[[\\x20\\t\\r\\n\\f]*((?:\\\\.|[\\w-]|[^\\x00-\\xa0])+)[\\x20\\t\\r\\n\\f]*(?:([*^$|!~]?=)[\\x20\\t\\r\\n\\f]*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+K+")|)|)[\\x20\\t\\r\\n\\f]*\\]", 93 | $=":((?:\\\\.|[\\w-]|[^\\x00-\\xa0])+)(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+ta.replace(3,8)+")*)|.*)\\)|)",Y=RegExp("^[\\x20\\t\\r\\n\\f]+|((?:^|[^\\\\])(?:\\\\.)*)[\\x20\\t\\r\\n\\f]+$","g"),fa=/^[\x20\t\r\n\f]*,[\x20\t\r\n\f]*/,ga=/^[\x20\t\r\n\f]*([\x20\t\r\n\f>+~])[\x20\t\r\n\f]*/,ha=RegExp($),ia=RegExp("^"+K+"$"),Z={ID:/^#((?:\\.|[\w-]|[^\x00-\xa0])+)/,CLASS:/^\.((?:\\.|[\w-]|[^\x00-\xa0])+)/,NAME:/^\[name=['"]?((?:\\.|[\w-]|[^\x00-\xa0])+)['"]?\]/,TAG:RegExp("^("+ 94 | "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+".replace("w","w*")+")"),ATTR:RegExp("^"+ta),PSEUDO:RegExp("^"+$),CHILD:/^:(only|first|last|nth|nth-last)-(child|of-type)(?:\([\x20\t\r\n\f]*(even|odd|(([+-]|)(\d*)n|)[\x20\t\r\n\f]*(?:([+-]|)[\x20\t\r\n\f]*(\d+)|))[\x20\t\r\n\f]*\)|)/i,needsContext:/^[\x20\t\r\n\f]*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\([\x20\t\r\n\f]*((?:-\d)?\d*)[\x20\t\r\n\f]*\)|)(?=[^-]|$)/i},ca=/[\x20\t\r\n\f]*[+~]/,ja=/\{\s*\[native code\]\s*\}/,ka=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, 95 | la=/^(?:input|select|textarea|button)$/i,oa=/^h\d$/i,pa=/'|\\/g,qa=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,ma=/\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,na=function(a,b){var c="0x"+b-65536;return c!==c?b:0>c?String.fromCharCode(c+65536):String.fromCharCode(55296|c>>10,56320|1023&c)};try{Q.call(W.childNodes,0)[0].nodeType}catch(sa){Q=function(a){for(var b,c=[];b=this[a];a++)c.push(b);return c}}O=h.isXML=function(a){return(a=a&&(a.ownerDocument||a).documentElement)?"HTML"!==a.nodeName:!1};ua=h.setDocument= 96 | function(a){var c=a?a.ownerDocument||a:ra;return c!==V&&9===c.nodeType&&c.documentElement?(V=c,W=c.documentElement,ba=O(c),N.tagNameNoComments=g(function(a){return a.appendChild(c.createComment("")),!a.getElementsByTagName("*").length}),N.attributes=g(function(a){a.innerHTML="<select></select>";a=typeof a.lastChild.getAttribute("multiple");return"boolean"!==a&&"string"!==a}),N.getByClassName=g(function(a){return a.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",a.getElementsByClassName&& 97 | a.getElementsByClassName("e").length?(a.lastChild.className="e",2===a.getElementsByClassName("e").length):!1}),N.getByName=g(function(a){a.id=L+0;a.innerHTML="<a name='"+L+"'></a><div name='"+L+"'></div>";W.insertBefore(a,W.firstChild);var b=c.getElementsByName&&c.getElementsByName(L).length===2+c.getElementsByName(L+0).length;return N.getIdNotName=!c.getElementById(L),W.removeChild(a),b}),A.attrHandle=g(function(a){return a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!== 98 | H&&"#"===a.firstChild.getAttribute("href")})?{}:{href:function(a){return a.getAttribute("href",2)},type:function(a){return a.getAttribute("type")}},N.getIdNotName?(A.find.ID=function(a,b){if(typeof b.getElementById!==H&&!ba){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},A.filter.ID=function(a){var b=a.replace(ma,na);return function(a){return a.getAttribute("id")===b}}):(A.find.ID=function(a,c){if(typeof c.getElementById!==H&&!ba){var d=c.getElementById(a);return d?d.id===a||typeof d.getAttributeNode!== 99 | H&&d.getAttributeNode("id").value===a?[d]:b:[]}},A.filter.ID=function(a){var b=a.replace(ma,na);return function(a){return(a=typeof a.getAttributeNode!==H&&a.getAttributeNode("id"))&&a.value===b}}),A.find.TAG=N.tagNameNoComments?function(a,c){return typeof c.getElementsByTagName!==H?c.getElementsByTagName(a):b}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){for(;c=f[e];e++)1===c.nodeType&&d.push(c);return d}return f},A.find.NAME=N.getByName&&function(a,c){return typeof c.getElementsByName!== 100 | H?c.getElementsByName(name):b},A.find.CLASS=N.getByClassName&&function(a,c){return typeof c.getElementsByClassName===H||ba?b:c.getElementsByClassName(a)},X=[],ea=[":focus"],(N.qsa=d(c.querySelectorAll))&&(g(function(a){a.innerHTML="<select><option selected=''></option></select>";a.querySelectorAll("[selected]").length||ea.push("\\[[\\x20\\t\\r\\n\\f]*(?:checked|disabled|ismap|multiple|readonly|selected|value)");a.querySelectorAll(":checked").length||ea.push(":checked")}),g(function(a){a.innerHTML= 101 | "<input type='hidden' i=''/>";a.querySelectorAll("[i^='']").length&&ea.push("[*^$]=[\\x20\\t\\r\\n\\f]*(?:\"\"|'')");a.querySelectorAll(":enabled").length||ea.push(":enabled",":disabled");a.querySelectorAll("*,:x");ea.push(",.*:")})),(N.matchesSelector=d(J=W.matchesSelector||W.mozMatchesSelector||W.webkitMatchesSelector||W.oMatchesSelector||W.msMatchesSelector))&&g(function(a){N.disconnectedMatch=J.call(a,"div");J.call(a,"[s!='']:x");X.push("!=",$)}),ea=RegExp(ea.join("|")),X=RegExp(X.join("|")), 102 | z=d(W.contains)||W.compareDocumentPosition?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)for(;b=b.parentNode;)if(b===a)return!0;return!1},I=W.compareDocumentPosition?function(a,b){var d;return a===b?(C=!0,0):(d=b.compareDocumentPosition&&a.compareDocumentPosition&&a.compareDocumentPosition(b))?1&d||a.parentNode&&11===a.parentNode.nodeType? 103 | a===c||z(ra,a)?-1:b===c||z(ra,b)?1:0:4&d?-1:1:a.compareDocumentPosition?-1:1}:function(a,b){var d,e=0;d=a.parentNode;var f=b.parentNode,g=[a],h=[b];if(a===b)return C=!0,0;if(a.sourceIndex&&b.sourceIndex)return(~b.sourceIndex||-2147483648)-(z(ra,a)&&~a.sourceIndex||-2147483648);if(!d||!f)return a===c?-1:b===c?1:d?-1:f?1:0;if(d===f)return k(a,b);for(d=a;d=d.parentNode;)g.unshift(d);for(d=b;d=d.parentNode;)h.unshift(d);for(;g[e]===h[e];)e++;return e?k(g[e],h[e]):g[e]===ra?-1:h[e]===ra?1:0},C=!1,[0,0].sort(I), 104 | N.detectDuplicates=C,V):V};h.matches=function(a,b){return h(a,null,null,b)};h.matchesSelector=function(a,b){if((a.ownerDocument||a)!==V&&ua(a),b=b.replace(qa,"='$1']"),!(!N.matchesSelector||ba||X&&X.test(b)||ea.test(b)))try{var c=J.call(a,b);if(c||N.disconnectedMatch||a.document&&11!==a.document.nodeType)return c}catch(d){}return 0<h(b,V,null,[a]).length};h.contains=function(a,b){return(a.ownerDocument||a)!==V&&ua(a),z(a,b)};h.attr=function(a,b){var c;return(a.ownerDocument||a)!==V&&ua(a),ba||(b= 105 | b.toLowerCase()),(c=A.attrHandle[b])?c(a):ba||N.attributes?a.getAttribute(b):((c=a.getAttributeNode(b))||a.getAttribute(b))&&!0===a[b]?b:c&&c.specified?c.value:null};h.error=function(a){throw Error("Syntax error, unrecognized expression: "+a);};h.uniqueSort=function(a){var b,c=[],d=1,e=0;if(C=!N.detectDuplicates,a.sort(I),C){for(;b=a[d];d++)b===a[d-1]&&(e=c.push(d));for(;e--;)a.splice(c[e],1)}return a};Ja=h.getText=function(a){var b,c="",d=0;if(b=a.nodeType)if(1===b||9===b||11===b){if("string"==typeof a.textContent)return a.textContent; 106 | for(a=a.firstChild;a;a=a.nextSibling)c+=Ja(a)}else{if(3===b||4===b)return a.nodeValue}else for(;b=a[d];d++)c+=Ja(b);return c};A=h.selectors={cacheLength:50,createPseudo:f,match:Z,find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ma,na),a[3]=(a[4]||a[5]||"").replace(ma,na),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(), 107 | "nth"===a[1].slice(0,3)?(a[3]||h.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&h.error(a[0]),a},PSEUDO:function(a){var b,c=!a[5]&&a[2];return Z.CHILD.test(a[0])?null:(a[4]?a[2]=a[4]:c&&ha.test(c)&&(b=q(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){return"*"===a?function(){return!0}:(a=a.replace(ma,na).toLowerCase(),function(b){return b.nodeName&&b.nodeName.toLowerCase()=== 108 | a})},CLASS:function(a){var b=aa[a+" "];return b||(b=RegExp("(^|[\\x20\\t\\r\\n\\f])"+a+"([\\x20\\t\\r\\n\\f]|$)"))&&aa(a,function(a){return b.test(a.className||typeof a.getAttribute!==H&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){d=h.attr(d,a);return null==d?"!="===b:b?(d+="","="===b?d===c:"!="===b?d!==c:"^="===b?c&&0===d.indexOf(c):"*="===b?c&&-1<d.indexOf(c):"$="===b?c&&d.substr(d.length-c.length)===c:"~="===b?-1<(" "+d+" ").indexOf(c):"|="===b?d===c||d.substr(0,c.length+ 109 | 1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,k){var m,l,q,p,s;c=f!==g?"nextSibling":"previousSibling";var r=b.parentNode,v=h&&b.nodeName.toLowerCase();k=!k&&!h;if(r){if(f){for(;c;){for(l=b;l=l[c];)if(h?l.nodeName.toLowerCase()===v:1===l.nodeType)return!1;s=c="only"===a&&!s&&"nextSibling"}return!0}if(s=[g?r.firstChild:r.lastChild],g&&k)for(k=r[L]||(r[L]={}),m=k[a]|| 110 | [],p=m[0]===G&&m[1],q=m[0]===G&&m[2],l=p&&r.childNodes[p];l=++p&&l&&l[c]||(q=p=0)||s.pop();){if(1===l.nodeType&&++q&&l===b){k[a]=[G,p,q];break}}else if(k&&(m=(b[L]||(b[L]={}))[a])&&m[0]===G)q=m[1];else for(;(l=++p&&l&&l[c]||(q=p=0)||s.pop())&&((h?l.nodeName.toLowerCase()!==v:1!==l.nodeType)||!++q||(k&&((l[L]||(l[L]={}))[a]=[G,q]),l!==b)););return q-=e,q===d||0===q%d&&0<=q/d}}},PSEUDO:function(a,b){var c,d=A.pseudos[a]||A.setFilters[a.toLowerCase()]||h.error("unsupported pseudo: "+a);return d[L]?d(b): 111 | 1<d.length?(c=[a,a,"",b],A.setFilters.hasOwnProperty(a.toLowerCase())?f(function(a,c){for(var e,f=d(a,b),g=f.length;g--;)e=U.call(a,f[g]),a[e]=!(c[e]=f[g])}):function(a){return d(a,0,c)}):d}},pseudos:{not:f(function(a){var b=[],c=[],d=D(a.replace(Y,"$1"));return d[L]?f(function(a,b,c,e){var f;c=d(a,null,e,[]);for(e=a.length;e--;)(f=c[e])&&(a[e]=!(b[e]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:f(function(a){return function(b){return 0<h(a,b).length}}),contains:f(function(a){return function(b){return-1< 112 | (b.textContent||b.innerText||Ja(b)).indexOf(a)}}),lang:f(function(a){return ia.test(a||"")||h.error("unsupported lang: "+a),a=a.replace(ma,na).toLowerCase(),function(b){var c;do if(c=ba?b.getAttribute("xml:lang")||b.getAttribute("lang"):b.lang)return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===W},focus:function(a){return a===V.activeElement&& 113 | (!V.hasFocus||V.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return!1===a.disabled},disabled:function(a){return!0===a.disabled},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,!0===a.selected},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if("@"<a.nodeName||3===a.nodeType||4===a.nodeType)return!1;return!0},parent:function(a){return!A.pseudos.empty(a)}, 114 | header:function(a){return oa.test(a.nodeName)},input:function(a){return la.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||b.toLowerCase()===a.type)},first:p(function(){return[0]}),last:p(function(a,b){return[b-1]}),eq:p(function(a,b,c){return[0>c?c+b:c]}),even:p(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}), 115 | odd:p(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:p(function(a,b,c){for(b=0>c?c+b:c;0<=--b;)a.push(b);return a}),gt:p(function(a,b,c){for(c=0>c?c+b:c;b>++c;)a.push(c);return a})}};for(y in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})A.pseudos[y]=m(y);for(y in{submit:!0,reset:!0})A.pseudos[y]=l(y);D=h.compile=function(a,b){var c,d=[],e=[],f=S[a+" "];if(!f){b||(b=q(a));for(c=b.length;c--;)f=w(b[c]),f[L]?d.push(f):e.push(f);f=S(a,B(e,d))}return f};A.pseudos.nth=A.pseudos.eq;A.filters= 116 | x.prototype=A.pseudos;A.setFilters=new x;ua();h.attr=c.attr;c.find=h;c.expr=h.selectors;c.expr[":"]=c.expr.pseudos;c.unique=h.uniqueSort;c.text=h.getText;c.isXMLDoc=h.isXML;c.contains=h.contains})(n);var ec=/Until$/,fc=/^(?:parents|prev(?:Until|All))/,Gb=/^.[^:#\[\.,]*$/,pb=c.expr.match.needsContext,gc={children:!0,contents:!0,next:!0,prev:!0};c.fn.extend({find:function(a){var b,d,e;if("string"!=typeof a)return e=this,this.pushStack(c(a).filter(function(){for(b=0;e.length>b;b++)if(c.contains(e[b], 117 | this))return!0}));d=[];for(b=0;this.length>b;b++)c.find(a,this[b],d);return d=this.pushStack(c.unique(d)),d.selector=(this.selector?this.selector+" ":"")+a,d},has:function(a){var b,d=c(a,this),e=d.length;return this.filter(function(){for(b=0;e>b;b++)if(c.contains(this,d[b]))return!0})},not:function(a){return this.pushStack(ya(this,a,!1))},filter:function(a){return this.pushStack(ya(this,a,!0))},is:function(a){return!!a&&("string"==typeof a?pb.test(a)?0<=c(a,this.context).index(this[0]):0<c.filter(a, 118 | this).length:0<this.filter(a).length)},closest:function(a,b){for(var d,e=0,f=this.length,g=[],h=pb.test(a)||"string"!=typeof a?c(a,b||this.context):0;f>e;e++)for(d=this[e];d&&d.ownerDocument&&d!==b&&11!==d.nodeType;){if(h?-1<h.index(d):c.find.matchesSelector(d,a)){g.push(d);break}d=d.parentNode}return this.pushStack(1<g.length?c.unique(g):g)},index:function(a){return a?"string"==typeof a?c.inArray(this[0],c(a)):c.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length: 119 | -1},add:function(a,b){var d="string"==typeof a?c(a,b):c.makeArray(a&&a.nodeType?[a]:a),d=c.merge(this.get(),d);return this.pushStack(c.unique(d))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});c.fn.andSelf=c.fn.addBack;c.each({parent:function(a){return(a=a.parentNode)&&11!==a.nodeType?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return xa(a,"nextSibling")},prev:function(a){return xa(a, 120 | "previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.merge([],a.childNodes)}},function(a, 121 | b){c.fn[a]=function(d,e){var f=c.map(this,b,d);return ec.test(a)||(e=d),e&&"string"==typeof e&&(f=c.filter(e,f)),f=1<this.length&&!gc[a]?c.unique(f):f,1<this.length&&fc.test(a)&&(f=f.reverse()),this.pushStack(f)}});c.extend({filter:function(a,b,d){return d&&(a=":not("+a+")"),1===b.length?c.find.matchesSelector(b[0],a)?[b[0]]:[]:c.find.matches(a,b)},dir:function(a,b,d){var e=[];for(a=a[b];a&&9!==a.nodeType&&(d===l||1!==a.nodeType||!c(a).is(d));)1===a.nodeType&&e.push(a),a=a[b];return e},sibling:function(a, 122 | b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}});var cb="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",hc=/ jQuery\d+="(?:null|\d+)"/g,qb=RegExp("<(?:"+cb+")[\\s/>]","i"),Va=/^\s+/,rb=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,sb=/<([\w:]+)/,tb=/<tbody/i,ic=/<|&#?\w+;/,jc=/<(?:script|style|link)/i,La=/^(?:checkbox|radio)$/i,kc=/checked\s*(?:[^=]|=\s*.checked.)/i, 123 | ub=/^$|\/(?:java|ecma)script/i,Hb=/^true\/(.*)/,lc=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,H={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:c.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]}, 124 | Wa=za(u).appendChild(u.createElement("div"));H.optgroup=H.option;H.tbody=H.tfoot=H.colgroup=H.caption=H.thead;H.th=H.td;c.fn.extend({text:function(a){return c.access(this,function(a){return a===l?c.text(this):this.empty().append((this[0]&&this[0].ownerDocument||u).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapAll(a.call(this,b))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]); 125 | b.map(function(){for(var a=this;a.firstChild&&1===a.firstChild.nodeType;)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return c.isFunction(a)?this.each(function(b){c(this).wrapInner(a.call(this,b))}):this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){var b=c.isFunction(a);return this.each(function(d){c(this).wrapAll(b?a.call(this,d):a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")|| 126 | c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||this.insertBefore(a,this.firstChild)})},before:function(){return this.domManip(arguments,!1,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments, 127 | !1,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var d,e=0;null!=(d=this[e]);e++)(!a||0<c.filter(a,[d]).length)&&(b||1!==d.nodeType||c.cleanData(r(d)),d.parentNode&&(b&&c.contains(d.ownerDocument,d)&&qa(r(d,"script")),d.parentNode.removeChild(d)));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){for(1===a.nodeType&&c.cleanData(r(a,!1));a.firstChild;)a.removeChild(a.firstChild);a.options&&c.nodeName(a,"select")&&(a.options.length= 128 | 0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return c.clone(this,a,b)})},html:function(a){return c.access(this,function(a){var d=this[0]||{},e=0,f=this.length;if(a===l)return 1===d.nodeType?d.innerHTML.replace(hc,""):l;if(!("string"!=typeof a||jc.test(a)||!c.support.htmlSerialize&&qb.test(a)||!c.support.leadingWhitespace&&Va.test(a)||H[(sb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(rb,"<$1></$2>");try{for(;f>e;e++)d=this[e]||{},1===d.nodeType&& 129 | (c.cleanData(r(d,!1)),d.innerHTML=a);d=0}catch(g){}}d&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(a){return c.isFunction(a)||"string"==typeof a||(a=c(a).not(this).detach()),this.domManip([a],!0,function(a){var d=this.nextSibling,e=this.parentNode;(e&&1===this.nodeType||11===this.nodeType)&&(c(this).remove(),d?d.parentNode.insertBefore(a,d):e.appendChild(a))})},detach:function(a){return this.remove(a,!0)},domManip:function(a,b,d){a=ib.apply([],a);var e,f,g,h,k=0,m=this.length, 130 | p=this,s=m-1,q=a[0],n=c.isFunction(q);if(n||!(1>=m||"string"!=typeof q||c.support.checkClone)&&kc.test(q))return this.each(function(c){var e=p.eq(c);n&&(a[0]=q.call(this,c,b?e.html():l));e.domManip(a,b,d)});if(m&&(e=c.buildFragment(a,this[0].ownerDocument,!1,this),f=e.firstChild,1===e.childNodes.length&&(e=f),f)){b=b&&c.nodeName(f,"tr");f=c.map(r(e,"script"),pa);for(g=f.length;m>k;k++)h=e,k!==s&&(h=c.clone(h,!0,!0),g&&c.merge(f,r(h,"script"))),d.call(b&&c.nodeName(this[k],"table")?Aa(this[k],"tbody"): 131 | this[k],h,k);if(g)for(e=f[f.length-1].ownerDocument,c.map(f,Ba),k=0;g>k;k++)h=f[k],ub.test(h.type||"")&&!c._data(h,"globalEval")&&c.contains(e,h)&&(h.src?c.ajax({url:h.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):c.globalEval((h.text||h.textContent||h.innerHTML||"").replace(lc,"")));e=f=null}return this}});c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(a){for(var e=0,f=[],g=c(a), 132 | h=g.length-1;h>=e;e++)a=e===h?this:this.clone(!0),c(g[e])[b](a),Na.apply(f,a.get());return this.pushStack(f)}});c.extend({clone:function(a,b,d){var e,f,g,h,k,m=c.contains(a.ownerDocument,a);if(c.support.html5Clone||c.isXMLDoc(a)||!qb.test("<"+a.nodeName+">")?k=a.cloneNode(!0):(Wa.innerHTML=a.outerHTML,Wa.removeChild(k=Wa.firstChild)),!(c.support.noCloneEvent&&c.support.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||c.isXMLDoc(a)))for(e=r(k),f=r(a),h=0;null!=(g=f[h]);++h)if(e[h]){var l=e[h],p=void 0, 133 | q=void 0,n=void 0;if(1===l.nodeType){if(p=l.nodeName.toLowerCase(),!c.support.noCloneEvent&&l[c.expando]){q=c._data(l);for(n in q.events)c.removeEvent(l,n,q.handle);l.removeAttribute(c.expando)}"script"===p&&l.text!==g.text?(pa(l).text=g.text,Ba(l)):"object"===p?(l.parentNode&&(l.outerHTML=g.outerHTML),c.support.html5Clone&&g.innerHTML&&!c.trim(l.innerHTML)&&(l.innerHTML=g.innerHTML)):"input"===p&&La.test(g.type)?(l.defaultChecked=l.checked=g.checked,l.value!==g.value&&(l.value=g.value)):"option"=== 134 | p?l.defaultSelected=l.selected=g.defaultSelected:("input"===p||"textarea"===p)&&(l.defaultValue=g.defaultValue)}}if(b)if(d)for(f=f||r(a),e=e||r(k),h=0;null!=(g=f[h]);h++)ja(g,e[h]);else ja(a,k);return e=r(k,"script"),0<e.length&&qa(e,!m&&r(a,"script")),k},buildFragment:function(a,b,d,e){for(var f,g,h,k,l,p,s,q=a.length,n=za(b),t=[],u=0;q>u;u++)if(g=a[u],g||0===g)if("object"===c.type(g))c.merge(t,g.nodeType?[g]:g);else if(ic.test(g)){k=k||n.appendChild(b.createElement("div"));h=(sb.exec(g)||["",""])[1].toLowerCase(); 135 | l=H[h]||H._default;k.innerHTML=l[1]+g.replace(rb,"<$1></$2>")+l[2];for(s=l[0];s--;)k=k.lastChild;if(!c.support.leadingWhitespace&&Va.test(g)&&t.push(b.createTextNode(Va.exec(g)[0])),!c.support.tbody)for(s=(g="table"!==h||tb.test(g)?"<table>"!==l[1]||tb.test(g)?0:k:k.firstChild)&&g.childNodes.length;s--;)c.nodeName(p=g.childNodes[s],"tbody")&&!p.childNodes.length&&g.removeChild(p);c.merge(t,k.childNodes);for(k.textContent="";k.firstChild;)k.removeChild(k.firstChild);k=n.lastChild}else t.push(b.createTextNode(g)); 136 | k&&n.removeChild(k);c.support.appendChecked||c.grep(r(t,"input"),M);for(u=0;g=t[u++];)if((!e||-1===c.inArray(g,e))&&(f=c.contains(g.ownerDocument,g),k=r(n.appendChild(g),"script"),f&&qa(k),d))for(s=0;g=k[s++];)ub.test(g.type||"")&&d.push(g);return n},cleanData:function(a,b){for(var d,e,f,g,h=0,k=c.expando,m=c.cache,p=c.support.deleteExpando,r=c.event.special;null!=(f=a[h]);h++)if((b||c.acceptData(f))&&(e=f[k],d=e&&m[e])){if(d.events)for(g in d.events)r[g]?c.event.remove(f,g):c.removeEvent(f,g,d.handle); 137 | m[e]&&(delete m[e],p?delete f[k]:f.removeAttribute!==l?f.removeAttribute(k):f[k]=null,ca.push(e))}}});var ga,fa,sa,Xa=/alpha\([^)]*\)/i,mc=/opacity\s*=\s*([^)]*)/,nc=/^(top|right|bottom|left)$/,oc=/^(none|table(?!-c[ea]).+)/,vb=/^margin/,Ib=RegExp("^("+Ha+")(.*)$","i"),Ca=RegExp("^("+Ha+")(?!px)[a-z%]+$","i"),pc=RegExp("^([+-])=("+Ha+")","i"),eb={BODY:"block"},qc={position:"absolute",visibility:"hidden",display:"block"},wb={letterSpacing:0,fontWeight:400},Y=["Top","Right","Bottom","Left"],db=["Webkit", 138 | "O","Moz","ms"];c.fn.extend({css:function(a,b){return c.access(this,function(a,b,f){var g,h={},k=0;if(c.isArray(b)){f=fa(a);for(g=b.length;g>k;k++)h[b[k]]=c.css(a,b[k],!1,f);return h}return f!==l?c.style(a,b,f):c.css(a,b)},a,b,1<arguments.length)},show:function(){return X(this,!0)},hide:function(){return X(this)},toggle:function(a){var b="boolean"==typeof a;return this.each(function(){(b?a:B(this))?c(this).show():c(this).hide()})}});c.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=ga(a, 139 | "opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":c.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,d,e){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var f,g,h,k=c.camelCase(b),m=a.style;if(b=c.cssProps[k]||(c.cssProps[k]=O(m,k)),h=c.cssHooks[b]||c.cssHooks[k],d===l)return h&&"get"in h&&(f=h.get(a,!1,e))!==l?f:m[b];if(g=typeof d,"string"===g&&(f=pc.exec(d))&&(d= 140 | (f[1]+1)*f[2]+parseFloat(c.css(a,b)),g="number"),!(null==d||"number"===g&&isNaN(d)||("number"!==g||c.cssNumber[k]||(d+="px"),c.support.clearCloneStyle||""!==d||0!==b.indexOf("background")||(m[b]="inherit"),h&&"set"in h&&(d=h.set(a,d,e))===l)))try{m[b]=d}catch(p){}}},css:function(a,b,d,e){var f,g,h,k=c.camelCase(b);return b=c.cssProps[k]||(c.cssProps[k]=O(a.style,k)),h=c.cssHooks[b]||c.cssHooks[k],h&&"get"in h&&(f=h.get(a,!0,d)),f===l&&(f=ga(a,b,e)),"normal"===f&&b in wb&&(f=wb[b]),d?(g=parseFloat(f), 141 | !0===d||c.isNumeric(g)?g||0:f):f},swap:function(a,b,c,e){var f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];c=c.apply(a,e||[]);for(f in b)a.style[f]=g[f];return c}});n.getComputedStyle?(fa=function(a){return n.getComputedStyle(a,null)},ga=function(a,b,d){var e,f,g,h=(d=d||fa(a))?d.getPropertyValue(b)||d[b]:l,k=a.style;return d&&(""!==h||c.contains(a.ownerDocument,a)||(h=c.style(a,b)),Ca.test(h)&&vb.test(b)&&(e=k.width,f=k.minWidth,g=k.maxWidth,k.minWidth=k.maxWidth=k.width=h,h=d.width,k.width= 142 | e,k.minWidth=f,k.maxWidth=g)),h}):u.documentElement.currentStyle&&(fa=function(a){return a.currentStyle},ga=function(a,b,c){var e,f,g;c=(c=c||fa(a))?c[b]:l;var h=a.style;return null==c&&h&&h[b]&&(c=h[b]),Ca.test(c)&&!nc.test(b)&&(e=h.left,f=a.runtimeStyle,g=f&&f.left,g&&(f.left=a.currentStyle.left),h.left="fontSize"===b?"1em":c,c=h.pixelLeft+"px",h.left=e,g&&(f.left=g)),""===c?"auto":c});c.each(["height","width"],function(a,b){c.cssHooks[b]={get:function(a,e,f){return e?0===a.offsetWidth&&oc.test(c.css(a, 143 | "display"))?c.swap(a,qc,function(){return w(a,b,f)}):w(a,b,f):l},set:function(a,e,f){var g=f&&fa(a);return y(a,e,f?C(a,b,f,c.support.boxSizing&&"border-box"===c.css(a,"boxSizing",!1,g),g):0)}}});c.support.opacity||(c.cssHooks.opacity={get:function(a,b){return mc.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var d=a.style,e=a.currentStyle,f=c.isNumeric(b)?"alpha(opacity="+100*b+")":"",g=e&&e.filter||d.filter||"";d.zoom=1; 144 | (1<=b||""===b)&&""===c.trim(g.replace(Xa,""))&&d.removeAttribute&&(d.removeAttribute("filter"),""===b||e&&!e.filter)||(d.filter=Xa.test(g)?g.replace(Xa,f):g+" "+f)}});c(function(){c.support.reliableMarginRight||(c.cssHooks.marginRight={get:function(a,b){return b?c.swap(a,{display:"inline-block"},ga,[a,"marginRight"]):l}});!c.support.pixelPosition&&c.fn.position&&c.each(["top","left"],function(a,b){c.cssHooks[b]={get:function(a,e){return e?(e=ga(a,b),Ca.test(e)?c(a).position()[b]+"px":e):l}}})});c.expr&& 145 | c.expr.filters&&(c.expr.filters.hidden=function(a){return 0===a.offsetWidth&&0===a.offsetHeight||!c.support.reliableHiddenOffsets&&"none"===(a.style&&a.style.display||c.css(a,"display"))},c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)});c.each({margin:"",padding:"",border:"Width"},function(a,b){c.cssHooks[a+b]={expand:function(c){var e=0,f={};for(c="string"==typeof c?c.split(" "):[c];4>e;e++)f[a+Y[e]+b]=c[e]||c[e-2]||c[0];return f}};vb.test(a)||(c.cssHooks[a+b].set=y)});var rc= 146 | /%20/g,Jb=/\[\]$/,xb=/\r?\n/g,sc=/^(?:submit|button|image|reset)$/i,tc=/^(?:input|select|textarea|keygen)/i;c.fn.extend({serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=c.prop(this,"elements");return a?c.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!c(this).is(":disabled")&&tc.test(this.nodeName)&&!sc.test(a)&&(this.checked||!La.test(a))}).map(function(a,b){var d=c(this).val();return null==d?null:c.isArray(d)? 147 | c.map(d,function(a){return{name:b.name,value:a.replace(xb,"\r\n")}}):{name:b.name,value:d.replace(xb,"\r\n")}}).get()}});c.param=function(a,b){var d,e=[],f=function(a,b){b=c.isFunction(b)?b():null==b?"":b;e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(b===l&&(b=c.ajaxSettings&&c.ajaxSettings.traditional),c.isArray(a)||a.jquery&&!c.isPlainObject(a))c.each(a,function(){f(this.name,this.value)});else for(d in a)ta(d,a[d],b,f);return e.join("&").replace(rc,"+")};var Z,$,Ya=c.now(),Za= 148 | /\?/,uc=/#.*$/,yb=/([?&])_=[^&]*/,vc=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,wc=/^(?:GET|HEAD)$/,xc=/^\/\//,zb=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Ab=c.fn.load,Bb={},Ma={},Cb="*/".concat("*");try{$=Mb.href}catch(Cc){$=u.createElement("a"),$.href="",$=$.href}Z=zb.exec($.toLowerCase())||[];c.fn.load=function(a,b,d){if("string"!=typeof a&&Ab)return Ab.apply(this,arguments);var e,f,g,h=this,k=a.indexOf(" ");return 0<=k&&(e=a.slice(k,a.length),a=a.slice(0,k)),c.isFunction(b)?(d=b,b=l):b&&"object"==typeof b&& 149 | (f="POST"),0<h.length&&c.ajax({url:a,type:f,dataType:"html",data:b}).done(function(a){g=arguments;h.html(e?c("<div>").append(c.parseHTML(a)).find(e):a)}).complete(d&&function(a,b){h.each(d,g||[a.responseText,b,a])}),this};c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){c.fn[b]=function(a){return this.on(b,a)}});c.each(["get","post"],function(a,b){c[b]=function(a,e,f,g){return c.isFunction(e)&&(g=g||f,f=e,e=l),c.ajax({url:a,type:b,dataType:g,data:e, 150 | success:f})}});c.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:$,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(Z[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Cb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":n.String, 151 | "text html":!0,"text json":c.parseJSON,"text xml":c.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?D(D(a,c.ajaxSettings),b):D(c.ajaxSettings,a)},ajaxPrefilter:K(Bb),ajaxTransport:K(Ma),ajax:function(a,b){function d(a,b,d,h){var m,r,s,x,y,A=b;if(2!==B){B=2;k&&clearTimeout(k);e=l;g=h||"";E.readyState=0<a?4:0;if(d){x=q;h=E;var C,D,O,F,X=x.contents,z=x.dataTypes,J=x.responseFields;for(D in J)D in d&&(h[J[D]]=d[D]);for(;"*"===z[0];)z.shift(),C===l&&(C=x.mimeType||h.getResponseHeader("Content-Type")); 152 | if(C)for(D in X)if(X[D]&&X[D].test(C)){z.unshift(D);break}if(z[0]in d)O=z[0];else{for(D in d){if(!z[0]||x.converters[D+" "+z[0]]){O=D;break}F||(F=D)}O=O||F}x=O?(O!==z[0]&&z.unshift(O),d[O]):l}if(200<=a&&300>a||304===a)if(q.ifModified&&(y=E.getResponseHeader("Last-Modified"),y&&(c.lastModified[f]=y),y=E.getResponseHeader("etag"),y&&(c.etag[f]=y)),304===a)m=!0,A="notmodified";else{var G;a:{d=q;m=x;var H,K;s={};y=0;A=d.dataTypes.slice();C=A[0];if(d.dataFilter&&(m=d.dataFilter(m,d.dataType)),A[1])for(G in d.converters)s[G.toLowerCase()]= 153 | d.converters[G];for(;r=A[++y];)if("*"!==r){if("*"!==C&&C!==r){if(G=s[C+" "+r]||s["* "+r],!G)for(H in s)if(K=H.split(" "),K[1]===r&&(G=s[C+" "+K[0]]||s["* "+K[0]])){!0===G?G=s[H]:!0!==s[H]&&(r=K[0],A.splice(y--,0,r));break}if(!0!==G)if(G&&d["throws"])m=G(m);else try{m=G(m)}catch(I){G={state:"parsererror",error:G?I:"No conversion from "+C+" to "+r};break a}}C=r}G={state:"success",data:m}}m=G;A=m.state;r=m.data;s=m.error;m=!s}else s=A,(a||!A)&&(A="error",0>a&&(a=0));E.status=a;E.statusText=(b||A)+""; 154 | m?u.resolveWith(n,[r,A,E]):u.rejectWith(n,[E,A,s]);E.statusCode(w);w=l;p&&t.trigger(m?"ajaxSuccess":"ajaxError",[E,q,m?r:s]);M.fireWith(n,[E,A]);p&&(t.trigger("ajaxComplete",[E,q]),--c.active||c.event.trigger("ajaxStop"))}}"object"==typeof a&&(b=a,a=l);b=b||{};var e,f,g,h,k,m,p,r,q=c.ajaxSetup({},b),n=q.context||q,t=q.context&&(n.nodeType||n.jquery)?c(n):c.event,u=c.Deferred(),M=c.Callbacks("once memory"),w=q.statusCode||{},x={},y={},B=0,C="canceled",E={readyState:0,getResponseHeader:function(a){var b; 155 | if(2===B){if(!h)for(h={};b=vc.exec(g);)h[b[1].toLowerCase()]=b[2];b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===B?g:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return B||(a=y[c]=y[c]||a,x[a]=b),this},overrideMimeType:function(a){return B||(q.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>B)for(b in a)w[b]=[w[b],a[b]];else E.always(a[E.status]);return this},abort:function(a){a=a||C;return e&&e.abort(a),d(0,a),this}};if(u.promise(E).complete= 156 | M.add,E.success=E.done,E.error=E.fail,q.url=((a||q.url||$)+"").replace(uc,"").replace(xc,Z[1]+"//"),q.type=b.method||b.type||q.method||q.type,q.dataTypes=c.trim(q.dataType||"*").toLowerCase().match(Q)||[""],null==q.crossDomain&&(m=zb.exec(q.url.toLowerCase()),q.crossDomain=!(!m||m[1]===Z[1]&&m[2]===Z[2]&&(m[3]||("http:"===m[1]?80:443))==(Z[3]||("http:"===Z[1]?80:443)))),q.data&&q.processData&&"string"!=typeof q.data&&(q.data=c.param(q.data,q.traditional)),R(Bb,q,b,E),2===B)return E;(p=q.global)&& 157 | 0===c.active++&&c.event.trigger("ajaxStart");q.type=q.type.toUpperCase();q.hasContent=!wc.test(q.type);f=q.url;q.hasContent||(q.data&&(f=q.url+=(Za.test(f)?"&":"?")+q.data,delete q.data),!1===q.cache&&(q.url=yb.test(f)?f.replace(yb,"$1_="+Ya++):f+(Za.test(f)?"&":"?")+"_="+Ya++));q.ifModified&&(c.lastModified[f]&&E.setRequestHeader("If-Modified-Since",c.lastModified[f]),c.etag[f]&&E.setRequestHeader("If-None-Match",c.etag[f]));(q.data&&q.hasContent&&!1!==q.contentType||b.contentType)&&E.setRequestHeader("Content-Type", 158 | q.contentType);E.setRequestHeader("Accept",q.dataTypes[0]&&q.accepts[q.dataTypes[0]]?q.accepts[q.dataTypes[0]]+("*"!==q.dataTypes[0]?", "+Cb+"; q=0.01":""):q.accepts["*"]);for(r in q.headers)E.setRequestHeader(r,q.headers[r]);if(q.beforeSend&&(!1===q.beforeSend.call(n,E,q)||2===B))return E.abort();C="abort";for(r in{success:1,error:1,complete:1})E[r](q[r]);if(e=R(Ma,q,b,E)){E.readyState=1;p&&t.trigger("ajaxSend",[E,q]);q.async&&0<q.timeout&&(k=setTimeout(function(){E.abort("timeout")},q.timeout)); 159 | try{B=1,e.send(x,d)}catch(A){if(!(2>B))throw A;d(-1,A)}}else d(-1,"No Transport");return E},getScript:function(a,b){return c.get(a,l,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")}});c.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return c.globalEval(a),a}}});c.ajaxPrefilter("script",function(a){a.cache===l&&(a.cache=!1);a.crossDomain&& 160 | (a.type="GET",a.global=!1)});c.ajaxTransport("script",function(a){if(a.crossDomain){var b,d=u.head||c("head")[0]||u.documentElement;return{send:function(c,f){b=u.createElement("script");b.async=!0;a.scriptCharset&&(b.charset=a.scriptCharset);b.src=a.url;b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||f(200,"success"))};d.insertBefore(b,d.firstChild)},abort:function(){b&& 161 | b.onload(l,!0)}}}});var Db=[],$a=/(=)\?(?=&|$)|\?\?/;c.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Db.pop()||c.expando+"_"+Ya++;return this[a]=!0,a}});c.ajaxPrefilter("json jsonp",function(a,b,d){var e,f,g,h=!1!==a.jsonp&&($a.test(a.url)?"url":"string"==typeof a.data&&!(a.contentType||"").indexOf("application/x-www-form-urlencoded")&&$a.test(a.data)&&"data");return h||"jsonp"===a.dataTypes[0]?(e=a.jsonpCallback=c.isFunction(a.jsonpCallback)?a.jsonpCallback():a.jsonpCallback,h?a[h]= 162 | a[h].replace($a,"$1"+e):!1!==a.jsonp&&(a.url+=(Za.test(a.url)?"&":"?")+a.jsonp+"="+e),a.converters["script json"]=function(){return g||c.error(e+" was not called"),g[0]},a.dataTypes[0]="json",f=n[e],n[e]=function(){g=arguments},d.always(function(){n[e]=f;a[e]&&(a.jsonpCallback=b.jsonpCallback,Db.push(e));g&&c.isFunction(f)&&f(g[0]);g=f=l}),"script"):l});var oa,wa,yc=0,ab=n.ActiveXObject&&function(){for(var a in oa)oa[a](l,!0)};c.ajaxSettings.xhr=n.ActiveXObject?function(){var a;if(!(a=!this.isLocal&& 163 | S()))a:{try{a=new n.ActiveXObject("Microsoft.XMLHTTP");break a}catch(b){}a=void 0}return a}:S;wa=c.ajaxSettings.xhr();c.support.cors=!!wa&&"withCredentials"in wa;(wa=c.support.ajax=!!wa)&&c.ajaxTransport(function(a){if(!a.crossDomain||c.support.cors){var b;return{send:function(d,e){var f,g,h=a.xhr();if(a.username?h.open(a.type,a.url,a.async,a.username,a.password):h.open(a.type,a.url,a.async),a.xhrFields)for(g in a.xhrFields)h[g]=a.xhrFields[g];a.mimeType&&h.overrideMimeType&&h.overrideMimeType(a.mimeType); 164 | a.crossDomain||d["X-Requested-With"]||(d["X-Requested-With"]="XMLHttpRequest");try{for(g in d)h.setRequestHeader(g,d[g])}catch(k){}h.send(a.hasContent&&a.data||null);b=function(d,g){var k,p,r,n,t;try{if(b&&(g||4===h.readyState))if(b=l,f&&(h.onreadystatechange=c.noop,ab&&delete oa[f]),g)4!==h.readyState&&h.abort();else{n={};k=h.status;t=h.responseXML;r=h.getAllResponseHeaders();t&&t.documentElement&&(n.xml=t);"string"==typeof h.responseText&&(n.text=h.responseText);try{p=h.statusText}catch(u){p=""}k|| 165 | !a.isLocal||a.crossDomain?1223===k&&(k=204):k=n.text?200:404}}catch(M){g||e(-1,M)}n&&e(k,p,n,r)};a.async?4===h.readyState?setTimeout(b):(f=++yc,ab&&(oa||(oa={},c(n).unload(ab)),oa[f]=b),h.onreadystatechange=b):b()},abort:function(){b&&b(l,!0)}}}});var ka,Ka,zc=/^(?:toggle|show|hide)$/,Ac=RegExp("^(?:([+-])=|)("+Ha+")([a-z%]*)$","i"),Bc=/queueHooks$/,Da=[function(a,b,d){var e,f,g,h,k,l,p=this,r=a.style,q={},n=[],t=a.nodeType&&B(a);d.queue||(k=c._queueHooks(a,"fx"),null==k.unqueued&&(k.unqueued=0,l= 166 | k.empty.fire,k.empty.fire=function(){k.unqueued||l()}),k.unqueued++,p.always(function(){p.always(function(){k.unqueued--;c.queue(a,"fx").length||k.empty.fire()})}));1===a.nodeType&&("height"in b||"width"in b)&&(d.overflow=[r.overflow,r.overflowX,r.overflowY],"inline"===c.css(a,"display")&&"none"===c.css(a,"float")&&(c.support.inlineBlockNeedsLayout&&"inline"!==x(a.nodeName)?r.zoom=1:r.display="inline-block"));d.overflow&&(r.overflow="hidden",c.support.shrinkWrapBlocks||p.done(function(){r.overflow= 167 | d.overflow[0];r.overflowX=d.overflow[1];r.overflowY=d.overflow[2]}));for(e in b)(g=b[e],zc.exec(g))&&(delete b[e],f=f||"toggle"===g,g!==(t?"hide":"show"))&&n.push(e);if(b=n.length)for(g=c._data(a,"fxshow")||c._data(a,"fxshow",{}),("hidden"in g)&&(t=g.hidden),f&&(g.hidden=!t),t?c(a).show():p.done(function(){c(a).hide()}),p.done(function(){var b;c._removeData(a,"fxshow");for(b in q)c.style(a,b,q[b])}),e=0;b>e;e++)f=n[e],h=p.createTween(f,t?g[f]:0),q[f]=g[f]||c.style(a,f),f in g||(g[f]=h.start,t&&(h.end= 168 | h.start,h.start="width"===f||"height"===f?1:0))}],va={"*":[function(a,b){var d,e,f=this.createTween(a,b),g=Ac.exec(b),h=f.cur(),k=+h||0,l=1,p=20;if(g){if(d=+g[2],e=g[3]||(c.cssNumber[a]?"":"px"),"px"!==e&&k){k=c.css(f.elem,a,!0)||d||1;do l=l||".5",k/=l,c.style(f.elem,a,k+e);while(l!==(l=f.cur()/h)&&1!==l&&--p)}f.unit=e;f.start=k;f.end=g[1]?k+(g[1]+1)*d:d}return f}]};c.Animation=c.extend(fb,{tweener:function(a,b){c.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var d,e=0,f=a.length;f>e;e++)d=a[e], 169 | va[d]=va[d]||[],va[d].unshift(b)},prefilter:function(a,b){b?Da.unshift(a):Da.push(a)}});c.Tween=T;T.prototype={constructor:T,init:function(a,b,d,e,f,g){this.elem=a;this.prop=d;this.easing=f||"swing";this.options=b;this.start=this.now=this.cur();this.end=e;this.unit=g||(c.cssNumber[d]?"":"px")},cur:function(){var a=T.propHooks[this.prop];return a&&a.get?a.get(this):T.propHooks._default.get(this)},run:function(a){var b,d=T.propHooks[this.prop];return this.pos=b=this.options.duration?c.easing[this.easing](a, 170 | this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),d&&d.set?d.set(this):T.propHooks._default.set(this),this}};T.prototype.init.prototype=T.prototype;T.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=c.css(a.elem,a.prop,"auto"),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){c.fx.step[a.prop]?c.fx.step[a.prop](a):a.elem.style&& 171 | (null!=a.elem.style[c.cssProps[a.prop]]||c.cssHooks[a.prop])?c.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}};T.propHooks.scrollTop=T.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}};c.each(["toggle","show","hide"],function(a,b){var d=c.fn[b];c.fn[b]=function(a,c,g){return null==a||"boolean"==typeof a?d.apply(this,arguments):this.animate(Ea(b,!0),a,c,g)}});c.fn.extend({fadeTo:function(a,b,c,e){return this.filter(B).css("opacity",0).show().end().animate({opacity:b}, 172 | a,c,e)},animate:function(a,b,d,e){var f=c.isEmptyObject(a),g=c.speed(b,d,e),h=function(){var b=fb(this,c.extend({},a),g);h.finish=function(){b.stop(!0)};(f||c._data(this,"finish"))&&b.stop(!0)};return h.finish=h,f||!1===g.queue?this.each(h):this.queue(g.queue,h)},stop:function(a,b,d){var e=function(a){var b=a.stop;delete a.stop;b(d)};return"string"!=typeof a&&(d=b,b=a,a=l),b&&!1!==a&&this.queue(a||"fx",[]),this.each(function(){var b=!0,g=null!=a&&a+"queueHooks",h=c.timers,k=c._data(this);if(g)k[g]&& 173 | k[g].stop&&e(k[g]);else for(g in k)k[g]&&k[g].stop&&Bc.test(g)&&e(k[g]);for(g=h.length;g--;)h[g].elem!==this||null!=a&&h[g].queue!==a||(h[g].anim.stop(d),b=!1,h.splice(g,1));!b&&d||c.dequeue(this,a)})},finish:function(a){return!1!==a&&(a=a||"fx"),this.each(function(){var b,d=c._data(this),e=d[a+"queue"];b=d[a+"queueHooks"];var f=c.timers,g=e?e.length:0;d.finish=!0;c.queue(this,a,[]);b&&b.cur&&b.cur.finish&&b.cur.finish.call(this);for(b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0), 174 | f.splice(b,1));for(b=0;g>b;b++)e[b]&&e[b].finish&&e[b].finish.call(this);delete d.finish})}});c.each({slideDown:Ea("show"),slideUp:Ea("hide"),slideToggle:Ea("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){c.fn[a]=function(a,c,f){return this.animate(b,a,c,f)}});c.speed=function(a,b,d){var e=a&&"object"==typeof a?c.extend({},a):{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};return e.duration=c.fx.off?0:"number"== 175 | typeof e.duration?e.duration:e.duration in c.fx.speeds?c.fx.speeds[e.duration]:c.fx.speeds._default,(null==e.queue||!0===e.queue)&&(e.queue="fx"),e.old=e.complete,e.complete=function(){c.isFunction(e.old)&&e.old.call(this);e.queue&&c.dequeue(this,e.queue)},e};c.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}};c.timers=[];c.fx=T.prototype.init;c.fx.tick=function(){var a,b=c.timers,d=0;for(ka=c.now();b.length>d;d++)a=b[d],a()||b[d]!==a||b.splice(d--,1);b.length|| 176 | c.fx.stop();ka=l};c.fx.timer=function(a){a()&&c.timers.push(a)&&c.fx.start()};c.fx.interval=13;c.fx.start=function(){Ka||(Ka=setInterval(c.fx.tick,c.fx.interval))};c.fx.stop=function(){clearInterval(Ka);Ka=null};c.fx.speeds={slow:600,fast:200,_default:400};c.fx.step={};c.expr&&c.expr.filters&&(c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length});c.fn.offset=function(a){if(arguments.length)return a===l?this:this.each(function(b){c.offset.setOffset(this, 177 | a,b)});var b,d,e={top:0,left:0},f=this[0],g=f&&f.ownerDocument;if(g)return b=g.documentElement,c.contains(b,f)?(f.getBoundingClientRect!==l&&(e=f.getBoundingClientRect()),d=gb(g),{top:e.top+(d.pageYOffset||b.scrollTop)-(b.clientTop||0),left:e.left+(d.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):e};c.offset={setOffset:function(a,b,d){var e=c.css(a,"position");"static"===e&&(a.style.position="relative");var f,g,h=c(a),k=h.offset(),l=c.css(a,"top"),p=c.css(a,"left"),r={},q={};("absolute"===e||"fixed"=== 178 | e)&&-1<c.inArray("auto",[l,p])?(q=h.position(),f=q.top,g=q.left):(f=parseFloat(l)||0,g=parseFloat(p)||0);c.isFunction(b)&&(b=b.call(a,d,k));null!=b.top&&(r.top=b.top-k.top+f);null!=b.left&&(r.left=b.left-k.left+g);"using"in b?b.using.call(a,r):h.css(r)}};c.fn.extend({position:function(){if(this[0]){var a,b,d={top:0,left:0},e=this[0];return"fixed"===c.css(e,"position")?b=e.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),c.nodeName(a[0],"html")||(d=a.offset()),d.top+=c.css(a[0],"borderTopWidth", 179 | !0),d.left+=c.css(a[0],"borderLeftWidth",!0)),{top:b.top-d.top-c.css(e,"marginTop",!0),left:b.left-d.left-c.css(e,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||u.documentElement;a&&!c.nodeName(a,"html")&&"static"===c.css(a,"position");)a=a.offsetParent;return a||u.documentElement})}});c.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var d=/Y/.test(b);c.fn[a]=function(e){return c.access(this,function(a,e,h){var k=gb(a);return h=== 180 | l?k?b in k?k[b]:k.document.documentElement[e]:a[e]:(k?k.scrollTo(d?c(k).scrollLeft():h,d?h:c(k).scrollTop()):a[e]=h,l)},a,e,arguments.length,null)}});c.each({Height:"height",Width:"width"},function(a,b){c.each({padding:"inner"+a,content:b,"":"outer"+a},function(d,e){c.fn[e]=function(e,g){var h=arguments.length&&(d||"boolean"!=typeof e),k=d||(!0===e||!0===g?"margin":"border");return c.access(this,function(b,d,e){var f;return c.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(f=b.documentElement, 181 | Math.max(b.body["scroll"+a],f["scroll"+a],b.body["offset"+a],f["offset"+a],f["client"+a])):e===l?c.css(b,d,k):c.style(b,d,e,k)},b,h?e:l,h,null)}})});n.jQuery=n.$=c;"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return c})})(window);(function(n,l){n.extend({jsonRPC:{version:"2.0",endPoint:null,namespace:null,setup:function(p){this._validateConfigParams(p);this.endPoint=p.endPoint;this.namespace=p.namespace;this.cache=p.cache!==l?cache:!0;return this},withOptions:function(p,n){this._validateConfigParams(p);if(n===l)throw"No callback specified";origParams={endPoint:this.endPoint,namespace:this.namespace};this.setup(p);n.call(this);this.setup(origParams)},request:function(p,n){n===l&&(n={id:1});n.id===l&&(n.id=1);n.cache===l&&(n.cache= 182 | this.cache);this._validateRequestMethod(p);this._validateRequestParams(n.params);this._validateRequestCallbacks(n.success,n.error);this._doRequest(JSON.stringify(this._requestDataObj(p,n.params,n.id)),n);return!0},batchRequest:function(p,t){t===l&&(t={});if(!n.isArray(p)||0===p.length)throw"Invalid requests supplied for jsonRPC batchRequest. Must be an array object that contain at least a method attribute";var F=this;n.each(p,function(p,n){F._validateRequestMethod(n.method);F._validateRequestParams(n.params); 183 | n.id===l&&(n.id=p+1)});this._validateRequestCallbacks(t.success,t.error);for(var z=[],I,U=0;U<p.length;U++)I=p[U],z.push(this._requestDataObj(I.method,I.params,I.id));this._doRequest(JSON.stringify(z),t)},_validateConfigParams:function(p){if(p===l)throw"No params specified";if(p.endPoint&&"string"!==typeof p.endPoint)throw"endPoint must be a string";if(p.namespace&&"string"!==typeof p.namespace)throw"namespace must be a string";},_validateRequestMethod:function(l){if("string"!==typeof l)throw"Invalid method supplied for jsonRPC request"; 184 | return!0},_validateRequestParams:function(p){if(null!==p&&p!==l&&"object"!==typeof p&&!n.isArray(p))throw"Invalid params supplied for jsonRPC request. It must be empty, an object or an array.";return!0},_validateRequestCallbacks:function(p,n){if(p!==l&&"function"!==typeof p)throw"Invalid success callback supplied for jsonRPC request";if(n!==l&&"function"!==typeof n)throw"Invalid error callback supplied for jsonRPC request";return!0},_doRequest:function(l,t){var F=this;n.ajax({type:"POST",async:!1!== 185 | t.async,dataType:"json",contentType:"application/json",url:this._requestUrl(t.endPoint||t.url,t.cache),data:l,cache:t.cache,processData:!1,error:function(l){F._requestError.call(F,l,t.error)},success:function(l){F._requestSuccess.call(F,l,t.success,t.error)}})},_requestUrl:function(l,n){l=l||this.endPoint;n||(l=0>l.indexOf("?")?l+("?tm="+(new Date).getTime()):l+("&tm="+(new Date).getTime()));return l},_requestDataObj:function(p,n,F){p={jsonrpc:this.version,method:this.namespace?this.namespace+"."+ 186 | p:p,id:F};n!==l&&(p.params=n);return p},_requestError:function(p,n){if(n!==l&&"function"===typeof n)if("string"===typeof p.responseText)try{n(eval("("+p.responseText+")"))}catch(F){n(this._response())}else n(this._response())},_requestSuccess:function(l,n,F){l=this._response(l);l.error&&"function"===typeof F?F(l):"function"===typeof n&&n(l)},_response:function(p){if(p===l)return{error:"Internal server error",version:"2.0"};try{"string"===typeof p&&(p=eval("("+p+")"));if(n.isArray(p)&&0<p.length&& 187 | "2.0"!==p[0].jsonrpc||!n.isArray(p)&&"2.0"!==p.jsonrpc)throw"Version error";return p}catch(t){return{error:"Internal server error: "+t,version:"2.0"}}}}})})(jQuery);(function(n,l){if("object"===typeof exports&&exports)l(exports);else{var p={};l(p);"function"===typeof define&&define.amd?define(p):n.Mustache=p}})(this,function(n){function l(l){return"function"===typeof l}function p(l){return l.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function t(l){if(!da(l)||2!==l.length)throw Error("Invalid tags: "+l);return[new RegExp(p(l[0])+"\\s*"),new RegExp("\\s*"+p(l[1]))]}function F(l){this.tail=this.string=l;this.pos=0}function z(l,n){this.view=null==l?{}:l;this.cache= 188 | {".":this.view};this.parent=n}function I(){this.cache={}}var U=Object.prototype.toString,da=Array.isArray||function(l){return"[object Array]"===U.call(l)},aa=RegExp.prototype.test,xa=/\S/,ya={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},za=/\s*/,Aa=/\s+/,pa=/\s*=/,Ba=/\s*\}/,qa=/#|\^|\/|>|\{|&|=|!/;F.prototype.eos=function(){return""===this.tail};F.prototype.scan=function(l){l=this.tail.match(l);if(!l||0!==l.index)return"";l=l[0];this.tail=this.tail.substring(l.length); 189 | this.pos+=l.length;return l};F.prototype.scanUntil=function(l){l=this.tail.search(l);var n;switch(l){case -1:n=this.tail;this.tail="";break;case 0:n="";break;default:n=this.tail.substring(0,l),this.tail=this.tail.substring(l)}this.pos+=n.length;return n};z.prototype.push=function(l){return new z(l,this)};z.prototype.lookup=function(n){var p;if(n in this.cache)p=this.cache[n];else{for(var t=this,B,F;t;){if(0<n.indexOf("."))for(p=t.view,B=n.split("."),F=0;null!=p&&F<B.length;)p=p[B[F++]];else p=t.view[n]; 190 | if(null!=p)break;t=t.parent}this.cache[n]=p}l(p)&&(p=p.call(this.view));return p};I.prototype.clearCache=function(){this.cache={}};I.prototype.parse=function(l,M){var O=this.cache,B=O[l];if(null==B){var z;var y;if(l){y=M||n.tags;"string"===typeof y&&(y=y.split(Aa));for(var C=t(y),w=new F(l),x=[],B=[],J=[],I=!1,K=!1,R,D,S,P;!w.eos();){R=w.pos;if(S=w.scanUntil(C[0])){P=0;for(var U=S.length;P<U;++P)if(D=S.charAt(P),aa.call(xa,D)?K=!0:J.push(B.length),B.push(["text",D,R,R+1]),R+=1,"\n"===D){if(I&&!K)for(;J.length;)delete B[J.pop()]; 191 | else J=[];K=I=!1}}if(!w.scan(C[0]))break;I=!0;D=w.scan(qa)||"name";w.scan(za);"="===D?(S=w.scanUntil(pa),w.scan(pa),w.scanUntil(C[1])):"{"===D?(S=w.scanUntil(new RegExp("\\s*"+p("}"+y[1]))),w.scan(Ba),w.scanUntil(C[1]),D="&"):S=w.scanUntil(C[1]);if(!w.scan(C[1]))throw Error("Unclosed tag at "+w.pos);P=[D,S,R,w.pos];B.push(P);if("#"===D||"^"===D)x.push(P);else if("/"===D){D=x.pop();if(!D)throw Error('Unopened section "'+S+'" at '+R);if(D[1]!==S)throw Error('Unclosed section "'+D[1]+'" at '+R);}else"name"=== 192 | D||"{"===D||"&"===D?K=!0:"="===D&&(C=t(y=S.split(Aa)))}if(D=x.pop())throw Error('Unclosed section "'+D[1]+'" at '+w.pos);y=[];w=0;for(x=B.length;w<x;++w)if(C=B[w])"text"===C[0]&&z&&"text"===z[0]?(z[1]+=C[1],z[3]=C[3]):(y.push(C),z=C);J=z=[];B=[];w=0;for(x=y.length;w<x;++w)switch(C=y[w],C[0]){case "#":case "^":J.push(C);B.push(C);J=C[4]=[];break;case "/":J=B.pop();J[5]=C[2];J=0<B.length?B[B.length-1][4]:z;break;default:J.push(C)}}else z=[];B=O[l]=z}return B};I.prototype.render=function(l,n,p){var t= 193 | this.parse(l);n=n instanceof z?n:new z(n);return this.renderTokens(t,n,p,l)};I.prototype.renderTokens=function(p,t,z,B){function F(l){return C.render(l,t,z)}for(var y="",C=this,w,x,J=0,I=p.length;J<I;++J)switch(w=p[J],w[0]){case "#":x=t.lookup(w[1]);if(!x)continue;if(da(x))for(var K=0,R=x.length;K<R;++K)y+=this.renderTokens(w[4],t.push(x[K]),z,B);else if("object"===typeof x||"string"===typeof x)y+=this.renderTokens(w[4],t.push(x),z,B);else if(l(x)){if("string"!==typeof B)throw Error("Cannot use higher-order sections without the original template"); 194 | x=x.call(t.view,B.slice(w[3],w[5]),F);null!=x&&(y+=x)}else y+=this.renderTokens(w[4],t,z,B);break;case "^":x=t.lookup(w[1]);if(!x||da(x)&&0===x.length)y+=this.renderTokens(w[4],t,z,B);break;case ">":if(!z)continue;x=l(z)?z(w[1]):z[w[1]];null!=x&&(y+=this.renderTokens(this.parse(x),t,z,x));break;case "&":x=t.lookup(w[1]);null!=x&&(y+=x);break;case "name":x=t.lookup(w[1]);null!=x&&(y+=n.escape(x));break;case "text":y+=w[1]}return y};n.name="mustache.js";n.version="0.8.1";n.tags=["{{","}}"];var ja=new I; 195 | n.clearCache=function(){return ja.clearCache()};n.parse=function(l,n){return ja.parse(l,n)};n.render=function(l,n,p){return ja.render(l,n,p)};n.to_html=function(p,t,z,B){p=n.render(p,t,z);if(l(B))B(p);else return p};n.escape=function(l){return String(l).replace(/[&<>"'\/]/g,function(l){return ya[l]})};n.Scanner=F;n.Context=z;n.Writer=I}); -------------------------------------------------------------------------------- /lib/store.js: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2011 Frank Kohlhepp 3 | // https://github.com/frankkohlhepp/store-js 4 | // License: MIT-license 5 | // 6 | (function () { 7 | var Store = this.Store = function (name, defaults) { 8 | var key; 9 | this.name = name; 10 | 11 | if (defaults !== undefined) { 12 | for (key in defaults) { 13 | if (defaults.hasOwnProperty(key) && this.get(key) === undefined) { 14 | this.set(key, defaults[key]); 15 | } 16 | } 17 | } 18 | }; 19 | 20 | Store.prototype.get = function (name) { 21 | name = "store." + this.name + "." + name; 22 | if (localStorage.getItem(name) === null) { return undefined; } 23 | try { 24 | return JSON.parse(localStorage.getItem(name)); 25 | } catch (e) { 26 | return null; 27 | } 28 | }; 29 | 30 | Store.prototype.set = function (name, value) { 31 | if (value === undefined) { 32 | this.remove(name); 33 | } else { 34 | if (typeof value === "function") { 35 | value = null; 36 | } else { 37 | try { 38 | value = JSON.stringify(value); 39 | } catch (e) { 40 | value = null; 41 | } 42 | } 43 | 44 | localStorage.setItem("store." + this.name + "." + name, value); 45 | } 46 | 47 | return this; 48 | }; 49 | 50 | Store.prototype.remove = function (name) { 51 | localStorage.removeItem("store." + this.name + "." + name); 52 | return this; 53 | }; 54 | 55 | Store.prototype.removeAll = function () { 56 | var name, 57 | i; 58 | 59 | name = "store." + this.name + "."; 60 | for (i = (localStorage.length - 1); i >= 0; i--) { 61 | if (localStorage.key(i).substring(0, name.length) === name) { 62 | localStorage.removeItem(localStorage.key(i)); 63 | } 64 | } 65 | 66 | return this; 67 | }; 68 | 69 | Store.prototype.toObject = function () { 70 | var values, 71 | name, 72 | i, 73 | key, 74 | value; 75 | 76 | values = {}; 77 | name = "store." + this.name + "."; 78 | for (i = (localStorage.length - 1); i >= 0; i--) { 79 | if (localStorage.key(i).substring(0, name.length) === name) { 80 | key = localStorage.key(i).substring(name.length); 81 | value = this.get(key); 82 | if (value !== undefined) { values[key] = value; } 83 | } 84 | } 85 | 86 | return values; 87 | }; 88 | 89 | Store.prototype.fromObject = function (values, merge) { 90 | if (merge !== true) { this.removeAll(); } 91 | for (var key in values) { 92 | if (values.hasOwnProperty(key)) { 93 | this.set(key, values[key]); 94 | } 95 | } 96 | 97 | return this; 98 | }; 99 | }()); 100 | -------------------------------------------------------------------------------- /main.js: -------------------------------------------------------------------------------- 1 | var settings = new Store('settings', { 2 | "rpcpath" : "http://localhost:6800/jsonrpc", 3 | "rpcuser" : "", 4 | "rpctoken" : "", 5 | "filesizesetting" : "500M", 6 | "whitelisttype" : "", 7 | "whitelistsite" : "", 8 | "blacklistsite" : "", 9 | "captureCheckbox" : true, 10 | "sizecaptureCheckbox" : true 11 | }); 12 | 13 | chrome.storage.local.set({"rpcpath":settings.get('rpcpath')}); 14 | chrome.storage.local.set({"rpcuser":settings.get('rpcuser')}); 15 | chrome.storage.local.set({"rpctoken":settings.get('rpctoken')}); 16 | 17 | //Binux 18 | //https://github.com/binux 19 | 20 | var ARIA2 = (function () { 21 | "use strict"; 22 | function get_auth(url) { 23 | return url.match(/^(?:(?![^:@]+:[^:@\/]*@)[^:\/?#.]+:)?(?:\/\/)?(?:([^:@]*(?::[^:@]*)?)?@)?/)[1]; 24 | } 25 | 26 | function request(jsonrpc_path, method, params) { 27 | var jsonrpc_version = '2.0', xhr = new XMLHttpRequest(), auth = get_auth(jsonrpc_path); 28 | var request_obj = { 29 | jsonrpc: jsonrpc_version, 30 | method: method, 31 | id: (new Date()).getTime().toString() 32 | }; 33 | if (params) { 34 | request_obj.params = params; 35 | } 36 | xhr.open("POST", jsonrpc_path + "?tm=" + (new Date()).getTime().toString(), true); 37 | xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); 38 | if (settings.get('rpcuser')) { 39 | xhr.setRequestHeader("Authorization", "Basic " + btoa(settings.get('rpcuser') + ':' + settings.get('rpctoken'))); 40 | } else { 41 | if (settings.get('rpctoken')) { 42 | request_obj.params = ['token:' + settings.get('rpctoken')].concat(request_obj.params); 43 | } 44 | } 45 | xhr.send(JSON.stringify(request_obj)); 46 | } 47 | return function (jsonrpc_path) { 48 | this.jsonrpc_path = jsonrpc_path; 49 | this.addUri = function (uri, options) { 50 | request(this.jsonrpc_path, 'aria2.addUri', [[uri], options]); 51 | }; 52 | return this; 53 | }; 54 | }()); 55 | 56 | 57 | function showNotification() { 58 | "use strict"; 59 | var notfopt = { 60 | type: "basic", 61 | title: "Aria2 Integration", 62 | iconUrl: "icons/notificationicon.png", 63 | message: "The download has been sent to aria2 queue" 64 | }; 65 | chrome.notifications.create("senttoaria2", notfopt, function () {return; }); 66 | window.setTimeout(function () {chrome.notifications.clear("senttoaria2", function () {return; }); }, 3000); 67 | } 68 | 69 | // context menu module 70 | chrome.contextMenus.create( 71 | { 72 | title: 'Download with aria2', 73 | id: "linkclick", 74 | contexts: ['link'] 75 | } 76 | ); 77 | 78 | chrome.contextMenus.onClicked.addListener(function (info, tab) { 79 | "use strict"; 80 | if (info.menuItemId === "linkclick") { 81 | chrome.tabs.query({active: true, currentWindow: true}, function (tabs) { 82 | chrome.tabs.sendMessage(tabs[0].id, {range: "cookie"}, function (response) { 83 | var aria2 = new ARIA2(settings.get('rpcpath')), 84 | params = {}; 85 | params.referer = tab.url; 86 | params.header = "Cookie:" + response.pagecookie; 87 | aria2.addUri(info.linkUrl, params); 88 | showNotification(); 89 | }); 90 | }); 91 | } 92 | }); 93 | 94 | //Auto capture module 95 | function sitelistProc(list) { 96 | var re_list; 97 | if (list === '') { 98 | re_list = new RegExp('^\\s$', "g"); 99 | } else { 100 | list = list.replace(/\./g, "\\."); 101 | list = list.replace(/\,/g, "|"); 102 | list = list.replace(/\*/g, "[^ ]*"); 103 | re_list = new RegExp(list, "gi"); 104 | } 105 | return re_list; 106 | } 107 | 108 | function isCapture(size, taburl, url, name) { 109 | "use strict"; 110 | var bsites = settings.get('blacklistsite'), wsites = settings.get('whitelistsite'); 111 | var re_bsites = sitelistProc(bsites), re_wsites = sitelistProc(wsites); 112 | 113 | var ftypes = settings.get('whitelisttype').toLowerCase(); 114 | var Intype = ftypes.indexOf(name.split('.').pop().toLowerCase()); 115 | 116 | var thsize = settings.get('filesizesetting'); 117 | var thsizeprec = ['K', 'M', 'G', 'T']; 118 | var thsizebytes = thsize.match(/[\d\.]+/)[0] * Math.pow(1024, thsizeprec.indexOf(thsize.match(/[a-zA-Z]+/)[0].toUpperCase()) + 1); 119 | 120 | var res; 121 | switch (true) { 122 | case url.substring(0,5) === 'blob:': 123 | res = 0; 124 | break; 125 | case re_bsites.test(taburl): 126 | res = 0; 127 | break; 128 | case re_wsites.test(taburl): 129 | res = 1; 130 | break; 131 | case (Intype !== -1): 132 | res = 1; 133 | break; 134 | case (size >= thsizebytes && settings.get('sizecaptureCheckbox')): 135 | res = 1; 136 | break; 137 | default: 138 | res = 0; 139 | } 140 | 141 | return res; 142 | } 143 | 144 | function captureAdd(Item, resp) { 145 | "use strict"; 146 | if (isCapture(Item.fileSize, resp.taburl, Item.url, Item.filename) === 1) { 147 | var aria2 = new ARIA2(settings.get('rpcpath')), params = {}; 148 | params.referer = resp.taburl; 149 | params.header = "Cookie:" + resp.pagecookie; 150 | params.out = Item.filename; 151 | chrome.downloads.cancel(Item.id, function() {aria2.addUri(Item.url, params);}); 152 | //console.log(Item); 153 | showNotification(); 154 | } 155 | } 156 | 157 | 158 | chrome.downloads.onDeterminingFilename.addListener(function (Item, s) { 159 | "use strict"; 160 | //console.log(Item); 161 | if (settings.get('captureCheckbox')) { 162 | chrome.tabs.query({active: true, currentWindow: true}, function (tabs) { 163 | chrome.tabs.sendMessage(tabs[0].id, {range: "both"}, function (response) { 164 | if (response === undefined) { 165 | chrome.tabs.sendMessage(tabs[0].openerTabId, {range: "both"}, function (response) { 166 | captureAdd(Item, response); 167 | chrome.tabs.remove(tabs[0].id); 168 | }); 169 | } else { 170 | captureAdd(Item, response); 171 | } 172 | }); 173 | }); 174 | } 175 | }); -------------------------------------------------------------------------------- /manifest.js: -------------------------------------------------------------------------------- 1 | this.manifest = { 2 | "name": "Aria2c Integration", 3 | "icon": "icons/icon64.png", 4 | "settings": [ 5 | { 6 | "tab": i18n.get("RPC"), 7 | "name": "rpcpath", 8 | "type": "text", 9 | "label": i18n.get("JSONRPCPath"), 10 | "text": i18n.get("JSONRPCPathExample") 11 | }, 12 | { 13 | "tab": i18n.get("RPC"), 14 | "name": "rpcuser", 15 | "type": "text", 16 | "label": i18n.get("RPCUser") 17 | }, 18 | { 19 | "tab": i18n.get("RPC"), 20 | "name": "rpcuserDescription", 21 | "type": "description", 22 | "text": i18n.get("rpcuserDescription") 23 | }, 24 | { 25 | "tab": i18n.get("RPC"), 26 | "name": "rpctoken", 27 | "type": "text", 28 | "label": i18n.get("RPCToken"), 29 | "masked": true 30 | }, 31 | { 32 | "tab": i18n.get("RPC"), 33 | "name": "rpctokenDescription", 34 | "type": "description", 35 | "text": i18n.get("rpctokenDescription") 36 | }, 37 | { 38 | "tab": i18n.get("RPC"), 39 | "name": "rpcsettingsDescription", 40 | "type": "description", 41 | "text": i18n.get("rpcsettingsDescription") 42 | }, 43 | { 44 | "tab": i18n.get("capture"), 45 | "name": "captureCheckbox", 46 | "type": "checkbox", 47 | "label": i18n.get("enablecap") 48 | }, 49 | { 50 | "tab": i18n.get("capture"), 51 | "group": i18n.get("sizerule"), 52 | "name": "sizecaptureCheckbox", 53 | "type": "checkbox", 54 | "label": "Enable" 55 | }, 56 | { 57 | "tab": i18n.get("capture"), 58 | "group": i18n.get("sizerule"), 59 | "name": "filesizesetting", 60 | "type": "text", 61 | "label": i18n.get("filesize"), 62 | "text": "500M" 63 | }, 64 | { 65 | "tab": i18n.get("capture"), 66 | "group": i18n.get("sizerule"), 67 | "name": "filesizeDescription", 68 | "type": "description", 69 | "text": i18n.get("filesizeDescription") 70 | }, 71 | { 72 | "tab": i18n.get("capture"), 73 | "group": i18n.get("whitelisttype"), 74 | "name": "whitelisttype", 75 | "type": "textarea", 76 | }, 77 | { 78 | "tab": i18n.get("capture"), 79 | "group": i18n.get("whitelisttype"), 80 | "name": "whitelisttypeDescription", 81 | "type": "description", 82 | "text": i18n.get("whitelisttypeDescription") 83 | }, 84 | { 85 | "tab": i18n.get("capture"), 86 | "group": i18n.get("whitelistsite"), 87 | "name": "whitelistsite", 88 | "type": "textarea", 89 | }, 90 | { 91 | "tab": i18n.get("capture"), 92 | "group": i18n.get("whitelistsite"), 93 | "name": "whitelistsiteDescription", 94 | "type": "description", 95 | "text": i18n.get("whitelistsiteDescription") 96 | }, 97 | { 98 | "tab": i18n.get("capture"), 99 | "group": i18n.get("blacklistsite"), 100 | "name": "blacklistsite", 101 | "type": "textarea", 102 | }, 103 | { 104 | "tab": i18n.get("capture"), 105 | "group": i18n.get("blacklistsite"), 106 | "name": "blacklistsiteDescription", 107 | "type": "description", 108 | "text": i18n.get("blacklistsiteDescription") 109 | }, 110 | ], 111 | "alignment": [ 112 | [ 113 | "rpcpath", 114 | "rpcuser", 115 | "rpctoken" 116 | ], 117 | [ 118 | "filesizesetting", 119 | ], 120 | ] 121 | }; 122 | -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Aria2c Integration", 3 | "version": "1.7.0", 4 | "manifest_version": 2, 5 | "minimum_chrome_version": "31", 6 | "description": "Download files with aria2", 7 | "icons": { 8 | "16": "icons/icon16.png", 9 | "48": "icons/icon48.png", 10 | "128": "icons/icon128.png" 11 | }, 12 | "default_locale": "en", 13 | "background": { 14 | "scripts": [ "lib/store.js", "main.js" ], 15 | "persistent": false 16 | }, 17 | "options_page": "settings.html", 18 | "permissions": [ 19 | "contextMenus", 20 | "activeTab", 21 | "downloads", 22 | "notifications", 23 | "storage" 24 | ], 25 | "browser_action": { 26 | "default_icon": { 27 | "19": "icons/icon19.png" 28 | }, 29 | "default_popup": "popup.html" 30 | }, 31 | "content_scripts": [ 32 | { 33 | "matches": [ 34 | "http://*/*", 35 | "https://*/*" 36 | ], 37 | "js": [ 38 | "inject.js" 39 | ] 40 | } 41 | ], 42 | "content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'" 43 | } -------------------------------------------------------------------------------- /popup.html: -------------------------------------------------------------------------------- 1 | <!DOCTYPE html> 2 | <html> 3 | <head> 4 | <link rel="stylesheet" href="lib/popup/popup.css"> 5 | <script src="lib/popup/popuplib.min.js"></script> 6 | </head> 7 | <body> 8 | <div id="globalstat"></div> 9 | <input type="button" id="purgebtn" value="Purge!" /><input type="button" id="addbtn" value="Add" /> 10 | <br /><hr> 11 | <div id="addtaskcontainer" style="display:none"><form id="addtask"><input type="text" id="taskaddbox" /><textarea id="taskaddbatch" rows="5"></textarea><input type="button" id="addmore" value=">>" /><input type="submit" id="addsubmit" value="+ Task" /><div style="clear: both;"></div></form></div> 12 | <div id="tasklist"></div> 13 | <script id="headInfo" type="x-tmpl-mustache"> 14 | {{> globspeed}} 15 | </script> 16 | <script id="taskInfo" type="x-tmpl-mustache"> 17 | <div id=taskInfo_{{gid}}> 18 | <div class=tasktitle>{{> displayName}}<button id=removebtn_{{gid}} class="{{status}} removebtn">remove</button></div> 19 | <div class={{status}}_info1>{{> statusUpper}}, {{> clengthPrec}}/{{> tlengthPrec}}/{{> completeRatio}}%</div> 20 | <div class={{status}}_info2>{{connections}} conns{{^numSeedersf}}{{> numSeedersf}}{{/numSeedersf}}, {{> dlspeedPrec}}/s{{^upspeedPrec}}{{> upspeedPrec}}{{/upspeedPrec}}, ETA: {{> eta}}</div> 21 | </div> 22 | <div id=taskBar_{{gid}} class="{{status}} progbar" style=width:{{>p}}></div> 23 | </script> 24 | <script src="lib/popup/popup.min.js"></script> 25 | </body> 26 | </html> -------------------------------------------------------------------------------- /settings.html: -------------------------------------------------------------------------------- 1 | <!-- 2 | // Copyright (c) 2011 Frank Kohlhepp 3 | // https://github.com/frankkohlhepp/fancy-settings 4 | // License: LGPL v2.1 5 | --> 6 | <!DOCTYPE html> 7 | <html> 8 | <head> 9 | <meta charset="utf-8"> 10 | <title id="title"> 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 40 |
41 |
42 |

43 |
44 |
45 | 46 | 47 | -------------------------------------------------------------------------------- /settings.js: -------------------------------------------------------------------------------- 1 | window.addEvent("domready", function () { 2 | new FancySettings.initWithManifest(); 3 | }); 4 | --------------------------------------------------------------------------------