window.requestFileSystem||(window.requestFileSystem=window.webkitRequestFileSystem);
Registry.require("promise layout convert xmlhttprequest crcrc curtain cache layout/default/tabview layout/default/htmlutil helper statistics i18n syncinfo uri layout/default/layout_helper porter hinter cloud".split(" "),function(){var y=rea.FEATURES,D=Registry.get("promise"),v=Registry.get("crcrc").cr,h=Registry.get("crcrc").crc,Ma=Registry.get("layout/default/tabview"),q=Registry.get("layout/default/htmlutil"),eb=Registry.get("statistics"),xa=Registry.get("syncinfo"),fb=Registry.get("convert"),ya=
Registry.get("cache"),p=Registry.get("curtain"),e=Registry.get("i18n"),x=Registry.get("helper"),za=Registry.get("uri"),X=Registry.get("porter"),Aa=Registry.get("hinter"),ra=Registry.get("cloud"),Na=Registry.get("layout"),ka=Registry.get("layout/default/layout_helper"),S=ka.images;Na.render(function(){ka.addStyle();var sa={},u={},E=[],Ba="0.0.0",Z={},Oa={},T={},ba=!0,la=!1,G,t={},H=function(a,b){var c,d;if((c=t[a])&&(d=c[b]))return d.apply(this,Array.prototype.slice.call(arguments,2))},ca=-1!=window.navigator.userAgent.indexOf("Mac")?
"mac":"other";window.addEventListener("keydown",function(a){var b,c=!1;if("keydown"==a.type){if(27==a.keyCode){b=G.getTabById("dashboard");if(!b.isSelected())return;if(a.target&&"text"==a.target.type){$(a.target).blur();return}t.multiselect.toggleRow(!1);c=!0}else if(("mac"!=ca&&39==a.keyCode||"mac"==ca&&40==a.keyCode)&&!a.ctrlKey&&a.altKey&&!a.shiftKey){if(b=G.getNextTab())b.select(),c=!0}else("mac"!=ca&&37==a.keyCode||"mac"==ca&&38==a.keyCode)&&!a.ctrlKey&&a.altKey&&!a.shiftKey&&(b=G.getPreviousTab())&&
(b.select(),c=!0);if(c)return a.stopPropagation(),a.preventDefault(),!1}},!0);window.addEventListener("keydown",function(a){var b,c,d=!1;if("keydown"==a.type){if(112==a.keyCode)(b=G.getTabById("help"))&&b.select(),d=!0;else if((38==a.keyCode||40==a.keyCode)&&a.shiftKey){b=G.getTabById("dashboard");if(!b.isSelected())return;if((b=I.length&&I[I.length-1])&&(b=$(b))&&(d=!0,c=b.closest("tr"),c.length)){var n;38==a.keyCode?(c=c.prevAll("tr:visible:first"),n=!0):(c=c.nextAll("tr:visible:first"),n=!1);if(c.length){var g,
f=c.find('input[name="scriptselectors"]');-1!=I.indexOf(f[0])?(I.pop(),b.prop("checked",!1),b.removeClass("selected"),g=b):f.length&&(f.prop("checked",!0),f.addClass("selected"),I.push(f[0]),void 0===I.direction&&(I.direction=n),g=f);g&&(q.isScrolledIntoView(c,{padding:100})||$("html, body").animate({scrollTop:n?c.offset().top-100-c.height():c.offset().top-$(window).height()+100+2*c.height()},0),t.multiselect.single_click())}}}else if(70==a.keyCode&&(a.ctrlKey||a.metaKey)){b=G.getTabById("dashboard");
if(!b.isSelected())return;t.multiselect.toggleRow(!0,!0);d=!0}else if(65==a.keyCode&&(a.ctrlKey||a.metaKey)){b=G.getTabById("dashboard");if(!b.isSelected()||a.target&&"text"==a.target.type)return;t.multiselect.un_selectAll(!0);d=!0}if(d)return a.stopPropagation(),a.preventDefault(),!1}},!1);var W,J=function(){var a={};window.onhashchange=function(){W=x.getUrlArgs(!0);Object.keys(a).forEach(function(d){d=a[d];b.is(d.main,d.sub)&&d.fn()})};window.onhashchange();var b={set:function(a){var c=b.get(),
g;g="object"===typeof a?[a.main,a.sub].filter(function(a){return a}):arguments;if(c.main!==g[0]||c.sub!==g[1])!g[0]&&g[1]?b.setSub(g[1]):window.location.hash="nav="+Array.prototype.join.call(g,"+")},setSub:function(a){var c=b.get();c.sub!==a&&(window.location.hash="nav="+(c.main?c.main:"")+"+"+a)},get:function(){var a=W.nav?W.nav.split("+"):[];return{main:a[0],sub:a[1]}},is:function(a,c){var g=b.get(),f=!c||g.sub===c;return(!a||g.main===a)&&f},isSub:function(a){return b.is(null,a)},registerListener:function(d,
c,g){void 0===g&&(g=c,c=null);var f=[d,c].join("+");a[f]={main:d,sub:c,fn:g};b.is(d,c)&&g();return f},unregisterListener:function(b){delete a[b]},clear:function(){b.set("")}},c=b.get();E.push(function(){var a=G.getTabById(c.main);if(a)return a.select();if(c.main)(a=G.getTabById("dashboard"))&&a.select(),E.push(function(){window.setTimeout(function(){b.set(c)},1)});else window.onhashchange()});return b}();(function(){E.push(function(){u.statistics_enabled&&eb.init("opt",Ba)})})();var Ca=x.getDebouncer(1E3),
Da=function(){for(;E.length;)try{E.shift()()}catch(a){console.warn("doneListeners:",a)}},gb=function(a,b){var c=v("input",a.name,a.id,"Save");c.inserted||(c.type="button",c.section=a,c.value=e.getMessage("Save"),c.addEventListener("click",function(){if(!b||!b.warning||ma(b.warning)){var a=Array.prototype.slice.call(this.section.getElementsByTagName("textarea")),c=function(b){b.each(function(b,c){a.push(c)})};c($("#"+this.section.id).find("input"));c($("#"+this.section.id).find("select"));for(var c=
[],g=[],f=0;f<a.length;f++){var l=null,k=a[f],e=k.key;if(-1==g.indexOf(k)){if("textarea"==k.tagName.toLowerCase())k.named?(k=document.getElementsByName(k.name),l=[],x.each(k,function(a){l.push({name:a.named_name,value:a.value});g.push(a)})):l=k.array?k.value.split("\n").map(function(a){return a.trim()}).filter(function(a){return a}):k.value;else if("checkbox"==k.getAttribute("type"))l=k.checked;else if("select"==k.getAttribute("type")){var m=0;0<=k.selectedIndex&&k.selectedIndex<k.options.length&&
(m=k.selectedIndex);l=k[m]?k[m].value:k.options[0].value}else"button"!=k.getAttribute("type")&&(l=k.value);e&&c.push(ta(e,l,b&&b.reload))}}b&&b.reload&&(p.wait(),D.when(c).done(function(){rea.page.reload()}))}},!1));return c},jb=function(a){var b=function(a,b,c,d,k){var l,f=h("th","settingsth",a.name,a.id,b),e=h("a","settingsth_a",a.name,a.id,b+"_a");e.setAttribute("name","settingsth_a"+a.name);var g=h("a","settingsth_a_up",a.name,a.id,b+"_a_up");g.setAttribute("name","settingsth_a_up"+a.name);var n=
h("a","settingsth_a_down",a.name,a.id,b+"_a_down");n.setAttribute("name","settingsth_a_down"+a.name);var z=function(){var b=document.getElementsByName("settingsth_a_up"+a.name),c=document.getElementsByName("settingsth_a_down"+a.name);for(l=0;l<b.length;l++)b[l].style.display="none";for(l=0;l<c.length;l++)c[l].style.display="none";"up"==ea()?g.style.display="":n.style.display=""},m=function(){z()};b=function(){window.setTimeout(function(){aa()==d?Sa("down"==ea()?"up":"down"):Ta(d);Ua(m)},1)};f.inserted||
(f.appendChild(e),f.appendChild(n),f.appendChild(g),e.addEventListener("click",b),g.addEventListener("click",b),n.addEventListener("click",b),e.textContent=c+" ",e.href="#",g.innerHTML="&#x25B4;",g.href="#",n.innerHTML="&#x25BE;",n.href="#");k&&!aa()?(Ta(d),Sa("up"),window.setTimeout(z,1)):d==aa()&&window.setTimeout(z,1);return f},c,d,n,g,f;g=v("tbody",a.name,a.id,"body");f=v("thead",a.name,a.id,"head");if(a.scriptTab){var l=hb(a),k=ib(a);c=v("table",a.name,a.id,"main");c.inserted||c.setAttribute("class",
"scripttable multiselect");var r=h("th","script_sel",a.name,a.id,"thead_sel");r.appendChild(l.selAllm);var m=h("th","left",a.name,a.id,"thead_multi_action");m.setAttribute("colspan","12");m.appendChild(l.actionBox);m.appendChild(k);m.appendChild(l.close);n=h("tr","multiselectrow scripttr",a.name,a.id,"filler_multi");n.appendChild([r,m]);k=h("th","script_sel",a.name,a.id,"thead_sel");k.appendChild(l.selAll);var l=b(a,"thead_pos","#","pos"),r=b(a,"thead_en","","enabled"),m=b(a,"thead_name",e.getMessage("Name"),
"name",!0),B=b(a,"thead_ver",e.getMessage("Version"),"ver"),N=h("th","settingsth",a.name,a.id,"thead_type");N.textContent=e.getMessage("Type");var z=h("th","settingsth",a.name,a.id,"thead_sync");z.textContent="";var q=b(a,"thead_sites",e.getMessage("Sites"),"sites");q.width="25%";var F=h("th","settingsth",a.name,a.id,"thead_features");F.textContent=e.getMessage("Features");var C=b(a,"thead_homepage",e.getMessage("Homepage"),"homepage"),b=b(a,"thead_updated",e.getMessage("Last_updated"),"updated"),
w=h("th","settingsth",a.name,a.id,"thead_sort"),p=h("span","sorting",a.name,a.id,"thead_sort_span");p.textContent=e.getMessage("Sort");"pos"==aa()&&"up"==ea()||p.setAttribute("style","display: none;");w.appendChild(p);p=h("th","settingsth",a.name,a.id,"thead_del");p.textContent=e.getMessage("Actions");E.push(function(){u.sync_enabled&&(z.textContent=e.getMessage("Imported"))});d=h("tr","scripttr multiselectreplaced",a.name,a.id,"filler");x.each([k,l,r,m,B,N,z,q,F,C,b,w,p],function(a){d.appendChild(a)});
f.appendChild(n);f.appendChild(d);d.inserted||(t.multiselect.checkScroll=function(){var a=$(f).is(":visible")&&$(n).is(":visible")&&$(window).scrollTop()>$(f).offset().top;$(n).toggleClass("multiscrolling",a)},$(window).scroll(t.multiselect.checkScroll))}else c=h("table","settingstable",a.name,a.id,"main");c.appendChild(f);c.appendChild(g);return{table:c,head:f,body:g}},Va=function(a,b,c,d){var e,g,f,l,k,r=[];if(b.divider)return null;b.image&&(b.imageURL=S.get(b.image));if(b.checkbox)f=function(){var a=
!0,b=this;b.warning&&(a=ma(b.warning),a||(b.checked=!b.checked));a&&ta(this.key,b.checked,b.reload).always(function(){b.reload&&rea.page.reload()})},c&&c.need_save&&(f=g=null),e=q.createCheckbox(b.name,b,f),r.push(e.elem);else if(b.button)e=q.createButton(b.name,b,function(){var a=!0,b=this;b.warning&&(a=ma(b.warning));a&&kb(b.key,b.data,b.ignore).always(function(){b.reload&&rea.page.reload()})}),r.push(e);else if(b.named)e=q.createNamedSettings(b.name,b),r.push({element:e.elem,validation:e.label}),
c&&(c.need_save=!0);else if(b.input)e=q.createTextarea(b.name,b),r.push({element:e.elem,validation:e.label}),c&&(c.need_save=!0);else if(b.text)e=q.createInput(b.name,b),r.push(e.elem),c&&(c.need_save=!0);else if(b.color)e=q.createColorChooser(b.name,b),r.push(e.elem),c&&(c.need_save=!0);else if(b.password)e=q.createPassword(b.name,b),r.push(e.elem),c&&(c.need_save=!0);else if(b.select)g=function(){var a=!0,b=this;b.warning&&(a=ma(b.warning),a||(b.value=b.oldvalue));a&&ta(b.key,q.getValue(b),b.reload).always(function(){b.reload&&
rea.page.reload()})},c&&c.need_save&&(g=b.enabler?function(){var a=document.getElementsByName("enabled_by_"+this.key),b=(this.selectedIndex<this.options.length?this.options[this.selectedIndex]:this.options[0]).getAttribute("enables"),c=b?JSON.parse(b):{};x.each(a,function(a){void 0===c[a.key]||c[a.key]?a.setAttribute("style",x.staticVars.visible):a.setAttribute("style",x.staticVars.invisible)})}:null),e=q.createDropDown(b.name,b,b.select,g,function(){var a=!0;this.selectedOptions.length&&this.selectedOptions[0].warning&&
this.selectedOptions[0].value!==this.oldvalue&&(a=ma(this.selectedOptions[0].warning),a||(this.value=this.previousValue||this.oldvalue));this.previousValue=this.value}),r.push(e.elem),a&&b.enabler&&function(){var a=g,b=e;E.push(function(){a.apply(b.select,[])})}();else if(b.url)f=v("a",b.name,b.id),f.href="#",f.url=b.url,f.newtab=b.newtab,f.inserted||(g=function(){Fa(this.url,this.newtab)},f.addEventListener("click",g)),f.textContent=b.name,r=Array(13),r[3]=f;else if(b.main_menu_item){f=v("div",b.name,
b.id);f.textContent=b.name;l=jb(b);k=v("div",b.name,b.id,"tab_content");k.appendChild(l.table);var m=null,B=d.appendTab(b.id,f,k,function(){m&&(sa.global?m():E.push(m));J.set(b.id)});J.registerListener(b.id,function(){B.select()});b.referrer&&(m=function(){m=null;p.wait();oa({referrer:b.referrer},function(b){b.items&&b.items.forEach(function(b){Va(a,b,c,d)});Da();p.hide()})});b.items&&ua(l.body,b.items,null,d);!sa.global&&b.selected_default&&E.push(function(){d.getSelectedTab()||B.select()})}else b.sub_menu_item?
(l=h("div","section",b.name,b.id,"section"),f=h("div","section_head",b.name,b.id,"head"),k=h("table","section_content",b.name,b.id,"content"),f.textContent=b.name,l.appendChild(f),b.desc&&q.setHelp(b.desc,f,f,b),l.appendChild(k),ua(k,b.items,b,d),b.need_save&&k.appendChild(gb(k,b)),r.push(l)):b.userscript||b.nativeScript?(r=lb(b,a,d),b.userscript&&(T[b.uuid]={dom:a,script:b}),a.setAttribute("class","scripttr"),b.nnew?a.setAttribute("style","display: none;"):Ca.is("script_refresh")||(E.push(function(){Ga.init(x.map(T,
function(a){return a.script}));t.multiselect.single_click();Ua();sa.scripts=!0;Ca.clear()}),Ca.add("script_refresh"))):b.version?(Ba=b.value,h("div","version","version","version").textContent="v"+Ba+" by Jan Biniok"):b.globalhint?Wa({text:b.value,title:b.description,onclick:b.info_url?function(){Fa(b.info_url,!0)}:null,image:b.image}):(f=v("span","",b.uuid||b.id+b.name),f.textContent=b.name,r=Array(13),r[3]=f);r.forEach(function(a){if(a){void 0!==b.level&&(a.element||a).setAttribute("style",b.level>
u.configMode?x.staticVars.invisible:x.staticVars.visible||"");if(b.hint){var c=v("span","",b.uuid||b.id+b.name,"hint");c.textContent=b.hint;a.appendChild(c)}b.validation&&mb(b,a.validation||a.element||a);b.width&&a.setAttribute("class","width-172-"+b.width)}});a&&(k=a.getAttribute("class"),f=" hide",!1===b.visible?k=(k||"")+f:k&&(k=k.replace(f,"")),a.setAttribute("class",k));return r},ua=function(a,b,c,d){Object.keys(b).forEach(function(e){var g=b[e],f=a?h("tr","settingstr",g.uuid||g.id+g.name,"pi"):
null;(e=Va(f,g,c,d))&&e.length&&(a&&a.appendChild(f),x.each(e,function(a,b){var c=a,d="";"Object"===x.toType(a)&&(c=a.element,d=a.style||"");d=h("td",d+"settingstd","",g.uuid||g.id+g.name,b);a&&d.appendChild(c);f&&f.appendChild(d)}))})},ma=function(a){var b=a.msg||a;if(a.once){if(Oa[b])return!0;Oa[b]=!0}var b=confirm(b),c={};b&&a.ok?c=a.ok:!b&&a.cancel&&(c=a.cancel);if(a.ok||a.cancel)b=!0;c.url&&sendMessage({method:"newTab",url:c.url},function(){});return b},mb=function(a,b){var c;a.validation&&(a.validation.url&&
(c=function(){Fa(this.url,!0)}),a.validation.image&&(a.validation.imageURL=S.get(a.validation.image)),c=q.createAfterIcon(a,c))&&(c.url=a.validation?a.validation.url:void 0,b.appendChild(c))},nb=function(a){return{source:a.code,meta:{name:a.name,uuid:a.uuid,modified:a.lastModified,file_url:a.file_url&&a.file_url.trim()?a.file_url:void 0},storage:a.storage,options:a.options,settings:{enabled:a.enabled,position:a.position}}},va=function(a,b){var c=D(),d=[];ob(a,b).done(function(a){a.scripts.forEach(function(a){a.uuid&&
a.userscript&&!a.system&&!a.nnew&&(a.code&&""!=a.code.trim()?d.push(nb(a)):console.log("options: Strange script: "+a.name))});c.resolve({scripts:d,global_settings:a.global_settings})}).fail(function(){c.reject()});return c.promise()},pb=function(a){var b,c,d=v("div","help","help","tab_help_h");d.textContent=e.getMessage("Help");var n=v("div","help","help","tab_help");return a.appendTab("help",d,n,function(){J.set("help");if(!c){p.wait();var a=h("div","section","help","help","ta"),d=h("div","section_head",
"help","help","head_ta"),l=h("div","section_content","help","help","content_ta");d.textContent=e.getMessage("Editor");a.appendChild([d,l]);var k=h("dl","dl-horizontal shortcuts","help","help","dl");l.appendChild(k);d=h("dt","keymapping","help","help","dt_mapping");b=h("dd","keymapping","help","help","dd_mapping");d.textContent=e.getMessage("Key_Mapping");b.textContent=u.editor_keyMap;k.appendChild([d,b]);if("vim"==u.editor_keyMap)b=h("dd","keymapping","help","help","dd_unsup"),b.textContent=e.getMessage("Please_check_the_0editor0_documentation_for_more_details_",
"VIM"),k.appendChild(b);else if("emacs"==u.editor_keyMap)b=h("dd","keymapping","help","help","dd_unsup"),b.textContent=e.getMessage("Please_check_the_0editor0_documentation_for_more_details_","Emacs"),k.appendChild(b);else{var r=[];c={};var m=function(a){a=a.split(/-+/);var b=a.pop(),c=[],d="";-1!=(d=["up","down","left","right"].indexOf(b.toLowerCase()))&&c.push("#cursor");b.toLowerCase().match(/f[0-9]{1,2}/)&&c.push("#function");return c.length?c.join("-")+a.join("-")+d+b:("0000"+(100-Math.min(b.length,
4))).slice(-4)+b+a.join("-")};[x.assign({Esc:"backOrClose"},"mac"!=ca?{"Alt-Left":"previousTab","Alt-Right":"nextTab"}:{"Alt-Up":"previousTab","Alt-Down":"nextTab"}),CodeMirror.keyMap[u.editor_keyMap],"mac"!=ca?CodeMirror.keyMap.pcDefault:CodeMirror.keyMap.macDefault,CodeMirror.keyMap["default"]].forEach(function(a){Object.keys(a).forEach(function(b){c[b]||"fallthrough"==b||(r.push({name:b,fn:a[b].replace?a[b].replace(/([A-Z])/g," $1").replace(/ [A-Z]/g,function(a){return a.toLowerCase()}):a[b],sort:m(b)}),
c[b]=!0)})});r.sort(function(a,b){return a.sort<b.sort?-1:a.sort>b.sort?1:0});r.forEach(function(a){var b=v("dt","help","help","dt_"+a.sort),c=v("dd","help","help","dd_"+a.sort);b.textContent=a.name;c.textContent=a.fn;k.appendChild([b,c])})}n.appendChild(a);p.hide()}})},pa=function(){var a=D();Registry.vendor(["vendor/saveas/filesaver"],function(){pa=D.Pledge;a.resolve()});return a.promise()},rb=function(a){var b=v("div","utils","utils","tab_util_h");b.textContent=e.getMessage("Utilities");var c=
v("div","utils","utils","tab_util");a.appendTab("utils",b,c,function(){J.set("utils")}).show();a=h("div","tv_util","utils","utils","tab_util_cont");var d=function(){return va(null,{storage:ba,global_settings:la}).then(function(a){p.wait();return X.zip.create(a.scripts,a.global_settings).progress(p.wait)})},n=function(a){var b=D(),c=new FileReader;c.onload=function(a){b.resolve(a.target.result)};c.readAsText(a);return b.promise()},g=function(a){for(var b=0,c;c=a[b];b++)X.zip.read(c).progress(p.wait).then(function(a){return Ha({scripts:x.map(a.scripts,
function(a){var b=a.meta||{},c=a.settings||{};return{source:a.source,name:b.name,uuid:b.uuid,file_url:b.file_url,options:a.options,storage:a.storage,lastModified:b.modified,enabled:c.enabled,position:c.position}}),global_settings:a.global_settings},{reload:!0})}).done(function(a){a.err&&x.alert(a.err)}).fail(function(){x.alert(e.getMessage("Unable_to_parse_this_"))}).always(p.hide)},f=q.createButton("utils","utils_i_ta",e.getMessage("Import"),function(){X.json.read(C.value).then(function(a){return Ha(a,
{reload:!0})}).done(function(a){a.err&&x.alert(a.err)}).fail(function(){x.alert(e.getMessage("Unable_to_parse_this_"))})}),l=q.createFileSelect(e.getMessage("Import"),{name:"zip",id:"utils"},function(a){p.wait();return g(a)}),k=q.createFileSelect(e.getMessage("Import"),{name:"file",id:"utils"},function(a){p.wait();for(var b,c=0;b=a[c];c++)n(b).then(function(a){return X.json.read(a)}).then(function(a){return Ha(a,{reload:!0})}).done(function(a){a.err&&x.alert(a.err)}).fail(function(){x.alert(e.getMessage("Unable_to_parse_this_"))}).always(p.hide)}),
r=q.createButton("utils","utils_i_cloud",e.getMessage("Show_backups"),function(){p.wait();var a=na.select.value,b=na.select.selectedOptions[0].text;ra[a].list().progress(function(a){0<a.total&&p.wait(b+": "+Math.floor(a.loaded/a.total*100)+"%")}).then(function(a){a=a.filter(function(a){return a.name.match(/\.zip$/)});return a.length?a:D().reject("empty")}).then(function(b){var c=D(),d=$('<table class="nowrap file_select">');$('<thead><tr><th colspan="3">'+e.getMessage("Please_select_a_file")+":</th></tr></thead>").appendTo(d);
b.sort(function(a,b){return a.modified.getTime()-b.modified.getTime()}).forEach(function(b){var k=$('<input class="button" type="button" value="'+e.getMessage("Import")+'">').click(function(){c.resolve(b);p.hideDialog();p.wait()}),l=$('<input class="button" type="button" value="'+e.getMessage("Delete")+'">').click(function(){f.hide();ra[a].delete(b)}),f=$("<tr><td>"+[q.safeTagsReplace(b.name),ka.formatBytes(b.size,2),b.modified.toLocaleString().replace((new Date).toLocaleDateString(),e.getMessage("Today"))].join("</td><td>")+
"</td></tr>");$("<td>").append(k,l).appendTo(f);f.appendTo(d)});b=$('<input class="button" type="button" value="'+e.getMessage("Cancel")+'">').click(function(){c.reject("cancel");p.hideDialog()});$("<tfoot>").append($("<tr>").append($('<td colspan="3">').append(b))).appendTo(d);p.hide();p.dialog(d[0]);return c.promise()}).then(function(c){return ra[a].get(c).progress(function(a){0<a.total&&p.wait(b+": "+Math.floor(a.loaded/a.total*100)+"%")})}).then(function(a){return g([a])}).fail(function(a){var b;
"empty"===a?b=e.getMessage("No_backups_found"):"cancel"!=a&&("auth_failed"==a?console.warn("cloud: Authentication failed"):b=e.getMessage("Error")+": "+a);b&&x.alert(b);p.hide()})}),b=q.createButton("utils","utils_i_url",e.getMessage("Import"),function(){p.wait();return qb(K.value,{reload:!0}).fail(function(a){a=a.err?a.err:e.getMessage("Unable_to_parse_this_");x.alert(a)}).always(p.hide)}),m=q.createButton("utils","utils_e_ta",e.getMessage("Export"),function(){p.wait();va(null,{storage:ba,global_settings:la}).then(function(a){return X.json.create(a.scripts,
a.global_settings)}).done(function(a){C.value=a}).always(p.hide)}),B=q.createButton("utils","utils_e_file",e.getMessage("Export"),function(){p.wait();va(null,{storage:ba,global_settings:la}).then(function(a){return X.json.create(a.scripts,a.global_settings).then(function(a){return pa().done(function(){var b=new Blob([a],{type:"text/plain"});saveAs(b,"tampermonkey-backup-"+y.RUNTIME.BROWSER+"-"+(new Date).toISOString()+".txt")})})}).always(p.hide)}),N=q.createButton("utils","utils_e_zip",e.getMessage("Export"),
function(){return d().then(function(a){return pa().done(function(){saveAs(a,"tampermonkey-backup-"+y.RUNTIME.BROWSER+"-"+(new Date).toISOString()+".zip")})}).always(p.hide)}),z=q.createButton("utils","utils_e_zip",e.getMessage("Export"),function(){var a=D(),b=na.select.value,c=na.select.selectedOptions[0].text,k=function(a){return d().then(function(d){p.wait(c+"...");return ra[b].put(a+".zip",d).progress(function(a){0<a.total&&p.wait(c+":"+Math.floor(a.loaded/a.total*100)+"%")})}).fail(function(a){x.alert(e.getMessage("Error")+
": "+a)}).always(p.hide)};x.prompt(e.getMessage("Name"),"backup-"+y.RUNTIME.BROWSER+"-"+(new Date).toISOString(),function(b){b?a.consume(k(b)):a.reject("aborted")});return a.promise()}),A=q.createCheckbox(e.getMessage("Include_TM_settings"),{id:"utils_e_export_tm_settings",enabled:"true"},function(){la=this.checked});A.elem.setAttribute("style","padding-left: 2px");A.input.checked=la;var F=q.createCheckbox(e.getMessage("Include_script_storage"),{id:"utils_e_export_storage",enabled:"true"},function(){ba=
this.checked});F.elem.setAttribute("style","padding-left: 2px; display: inline");F.input.checked=ba;var C=h("textarea","importta","utils","utils","ta");C.setAttribute("spellcheck","false");var w=h("div","section","utils","utils","ta"),t=h("div","section_head","utils","utils","head_ta"),Ea=h("div","section_content","utils","utils","content_ta");t.textContent=e.getMessage("General");Ea.appendChild(F.elem);Ea.appendChild(A.elem);w.appendChild(t);w.appendChild(Ea);A=h("div","section","utils","utils",
"ta");F=h("div","section_head","utils","utils","head_ta");t=h("div","section_content","utils","utils","content_ta");F.textContent=e.getMessage("TextArea");t.appendChild(m);t.appendChild(f);t.appendChild(C);A.appendChild(F);A.appendChild(t);f=h("div","section","utils","utils","sb");m=h("div","section_head","utils","utils","head_sb");F=h("div","section_content","utils","utils","content_sb");m.textContent=e.getMessage("Zip");f.appendChild(m);f.appendChild(F);F.appendChild(N);F.appendChild(l.elem);var l=
h("div","section","utils","utils","sb"),N=h("div","section_head","utils","utils","head_sb"),m=h("div","section_content","utils","utils","content_sb"),na=q.createDropDown(e.getMessage("Type"),{id:"cloud_type",value:"edge"==y.RUNTIME.BROWSER?"onedrive":"drive"},[{name:"Google Drive",value:"drive"},"safari"==y.RUNTIME.BROWSER?null:{name:"Dropbox",value:"dropbox"},{name:"OneDrive",value:"onedrive"}].filter(function(a){return a}),function(){});N.textContent=e.getMessage("Cloud");l.appendChild(N);l.appendChild(m);
m.appendChild(na.elem);m.appendChild(z);m.appendChild(r);r=h("div","section","utils","utils","fi");z=h("div","section_head","utils","utils","head_fi");N=h("div","section_content","utils","utils","content_fi");z.textContent=e.getMessage("File");r.appendChild(z);r.appendChild(N);N.appendChild(B);N.appendChild(k.elem);var K=h("input","updateurl_input","utils","utils","url");K.setAttribute("type","text");K.setAttribute("spellcheck","false");k=h("div","section","utils","utils","ur");B=h("div","section_head",
"utils","utils","head_ur");z=h("div","section_content","utils","utils","content_ur");B.textContent=e.getMessage("URL");k.appendChild(B);k.appendChild(z);z.appendChild(K);z.appendChild(b);a.appendChild(w);"undefined"!==typeof Blob&&a.appendChild(l);y.RUNTIME.CAN_SAVEAS_ZIP&&a.appendChild(f);"undefined"!==typeof Blob&&a.appendChild(r);a.appendChild(A);a.appendChild(k);x.each([A],function(a){var b=a.getAttribute("class"),b=50>u.configMode?b+" hide":b.replace(" hide","");a.setAttribute("class",b)});c.appendChild(a)},
sb=function(){var a=document.getElementById("options"),b=h("div","content_wrapper","options","main");if(a){var c=a.parentNode;c.removeChild(a);c.appendChild(b);document.body.setAttribute("class","main")}var a=h("div","head_container","opt","head_container"),c=h("div","tv_container_fit","opt","tv_container"),d=v("a","head_link","heads","head_link");d.href="http://tampermonkey.net";d.target="_blank";var e=h("div","float","heads","head1"),g=h("img","banner","heads");g.src=rea.extension.getURL("images/icon128.png");
var f=h("div","float head","heads","head2"),l=h("div","header_title","heads"),k=h("div","version","version","version");k.textContent=" by Jan Biniok";var r=v("div","search","box","");l.textContent="Tampermonkey";e.appendChild(g);f.appendChild(l);f.appendChild(k);d.appendChild(e);d.appendChild(f);a.appendChild(d);a.appendChild(r);b.appendChild(a);b.appendChild(c);G=Ma.create("_main",c);E.unshift(function(){rb(G);pb(G)});E.push(function(){void 0!==W.contribute&&window.setTimeout(Xa,100);sa.global=!0})},
V=function(a,b,c,d){void 0===d&&(d={});var n=b.item,g=n.uuid+(d.orig||"")+b.id,f=(d.orig?"orig_":"use_")+b.id,l=function(a){return"select_"+x.createUniqueId(a,n.uuid)+"_sel1"},k=h("div","cludes",a,g,"cb1"),r=v("span",a,g,"cb2");if(d.orig){var m="merge_"+b.id,m=q.createCheckbox(a,{id:m,uuid:n.uuid,enabled:n.options&&n.options.override&&n.options.override[m]?!0:!1},function(){if("checkbox"==this.type){var a={};a[this.key]=this.checked;ga(this.uuid,a)}});r.appendChild(m.elem)}else r.textContent=a;var B=
h("select","cludes",f,n.uuid,"sel1");B.innerHTML="";B.setAttribute("size","6");B.setAttribute("multiple","true");for(f=0;f<c.length;f++)m=document.createElement("option"),m.value=m.text=c[f],B.appendChild(m);k.appendChild(r);n.desc&&q.setHelp(n.desc,k,r,n);k.appendChild(B);var p=function(a){var b=[];a=a&&a.options;for(var c=0,d=a.length;c<d;c++)a[c].selected&&b.push(a[c]);return b},f=function(){var a=l("use_"+("excludes"==b.id?"includes":"excludes")),c=document.getElementById(a),a=p(B),d=!1,e="matches"==
b.id;a.forEach(function(a){var b=e?"/"+za.getRegExpFromMatch(a.value)+"/":a.value;a&&!c.querySelector('option[value="'+b+'"]')&&(a=a.cloneNode(!0),e&&(a.value=b,a.textContent=b),c.appendChild(a),d=!0)});d&&A()},m=function(){var a=prompt(e.getMessage("Enter_the_new_rule"));if(a){var b=document.createElement("option");b.value=b.text=a.trim();B.appendChild(b);A()}},r=function(){var a=B.options[B.selectedIndex];if(a){var b=prompt(e.getMessage("Enter_the_new_rule"),a.value);b&&(a.value=a.text=b.trim(),
A())}};c=function(){var a=!1;p(B).forEach(function(b){b&&(b.parentNode.removeChild(b),a=!0)});a&&A()};var z=function(a){for(var b=[],c=0;c<a.options.length;c++)b.push(a.options[c].value);return b},A=function(){var a={includes:z(document.getElementById(l("use_includes"))),matches:z(document.getElementById(l("use_matches"))),excludes:z(document.getElementById(l("use_excludes"))),connects:z(document.getElementById(l("use_connects"))),temp_connects:z(document.getElementById(l("use_temp_connects"))),blockers:z(document.getElementById(l("use_blockers")))};
ga(n.uuid,a);return!0};d.other_name?(a=v("button",a,g,"btn1",!0),a.textContent=e.getMessage("Add_as_0clude0",d.other_name),a.addEventListener("click",f,!1),k.appendChild(a)):d.orig||(d=v("button",a,g,"btn2",!0),d.textContent=e.getMessage("Add")+"...",d.addEventListener("click",m,!1),k.appendChild(d),d=v("button",a,g,"btn3",!0),d.textContent=e.getMessage("Edit")+"...",d.addEventListener("click",r,!1),k.appendChild(d),a=v("button",a,g,"btn4",!0),a.textContent=e.getMessage("Remove"),a.addEventListener("click",
c,!1),k.appendChild(a));return{elem:k}},Ia=function(a){return a.homepage?a.homepage:a.namespace&&0==a.namespace.search(/https?:\/\//)?a.namespace:null};ya.create("sites").setOptions({timeout:600,check_interval:300,retimeout_on_get:!0}).init();var Ga=function(){var a={},b=function(a){return 7>a.toString().length?b("0"+a):a},c=function(a){if(a.includes||a.matches){for(var b={},c=[],e=a.includes.length?a.includes:a.matches,l=0;l<e.length;l++){var k=e[l];if(k){var h=ya.items.sites.get(k),m=void 0!==h?
h:q.getInfoFromUrl(k);void 0===h&&ya.items.sites.set(k,m);m&&m.dom?b[m.dom]||(b[m.dom]=!0,c.push({include:k,info:m})):c.push({include:k})}else console.log("o: Warn: script '"+a.name+"' has invalid include (index: "+l+")")}return c}};return{init:function(b){a={};b.forEach(function(b){(b=c(b))&&b.length&&b.forEach(function(b){b.info&&(a[b.info.dom]=(a[b.info.dom]||0)+1)})})},get:function(d){d=c(d);if(!d||!d.length)return b(0);d=x.map(d,function(b){return b.info?{score:1E3*a[b.info.dom]+b.info.dom.charCodeAt(0)||
0,dom:b.info.dom}:{score:0,dom:""}}).sort(function(a,b){return b.score-a.score})[0];return b(d.score)+d.dom},topIcons:function(b,e){var g,f=[],l=c(b);if(!l||!l.length)return[];l=x.map(l,function(b){b.score=b.info?a[b.info.dom]||0:0;return b}).sort(function(a,b){return b.score-a.score});x.each(l,function(a){var c=a.info;if(0==e--)return a=h("span","",b.uuid,"tbc"),a.textContent="...",f.push(a),!1;if(c){if("*"==c.tld)return g=q.createImage(rea.extension.getURL("/layout/default/images/web.png"),"",b.uuid,
a.include,a.include),f.push(g),!1;var l="com",B="";"*"!=c.tld&&"tld"!=c.tld&&(l=c.tld);c.subdom.length&&(B=c.subdom.join(".")+".");var p=("chrome://favicon/http://"+B+c.dom+"."+l+"/").replace(/\*/g,""),c=("http://"+B+c.dom+"."+l+"/favicon.ico").replace(/\*/g,""),p=[c,p];if(0==c.search("http://userscripts.org/")||0==c.search("http://userscripts.com/"))p=S.origin("uso");g=q.createFavicon(p,"",b.uuid,a.include,a.include)}else g=q.createFavicon("?","",b.uuid,a.include,a.include);f.push(g)});return f}}}(),
aa=function(){if(y.HTML5.LOCALSTORAGE)return y.HTML5.LOCALSTORAGE.getItem("sort_key")},ea=function(){if(y.HTML5.LOCALSTORAGE)return y.HTML5.LOCALSTORAGE.getItem("sort_sequence")},Ta=function(a){if(y.HTML5.LOCALSTORAGE)return y.HTML5.LOCALSTORAGE.setItem("sort_key",a)},Sa=function(a){if(y.HTML5.LOCALSTORAGE)return y.HTML5.LOCALSTORAGE.setItem("sort_sequence",a)},Ua=function(a){var b=function(a,c){return a.tagName==c?a:a.parentNode?b(a.parentNode,c):null},c=null,d=[],n=0,g=Date.now();Object.keys(T).forEach(function(a){var f=
T[a];if(f)if(a=b(f.dom,"TR")){var h=b(a,"TBODY");c?h&&c!=h&&console.warn("options: different parents?!?!"):c=h;n++;h=g-parseInt(f.script.lastUpdated);isNaN(h)&&(h=0);var m=parseInt(f.script.version);isNaN(m)&&(m=0);d.push({tr:a,sites:Ga.get(f.script),position:f.script.position?f.script.position:1E3+n,name:e.getTranslation(f.script,"name").toLowerCase(),homepage:[f.script.origin?za.parse(f.script.origin.url).hostname:"z",Ia(f.script)?za.parse(Ia(f.script)).hostname:"z"].join("_"),updated:h,version:m});
a.inserted=!1;a.parentNode&&a.parentNode.removeChild(a)}else console.log("options: unable to sort script at pos "+f.pos);else console.warn("options: something went wrong!",a)});d=function(a){var b;b=function(a){return function(b,c){return b[a]-c[a]}};var c=function(a){return function(b,c){return b[a]<c[a]?-1:b[a]>c[a]?1:0}},d=aa();b="pos"==d?b("position"):"ver"==d?b("version"):"updated"==d?b("updated"):c(d);a.sort(b);return a}(d);"down"==ea()&&(d=d.reverse());for(var f=0;f<n;f++)c.appendChild(d[f].tr);
$(".sorting").each(function(a,b){var c=$(b),d="pos"==aa()&&"up"==ea();c[d?"fadeIn":"fadeOut"]()});a&&a()},xb=function(a,b,c,d,n){c=v("div",b.uuid,"script_tab_head");var g=c.inserted,f=h("div","heading",b.uuid,"heading"),l=h("img","nameNicon64",b.uuid,"heading_icon"),k=b.icon64?b.icon64:b.icon;l.src=k;var r=h("div","nameNname64",b.uuid,"heading_name");r.textContent=e.getTranslation(b,"name");k&&f.appendChild(l);f.appendChild(r);l=h("div","author",b.uuid,"author");b.author?l.textContent="by "+b.author:
b.copyright&&(l.innerHTML="&copy; ",l.textContent+=b.copyright);var k=h("table","noborder p100100",b.uuid,"table"),r=h("tr","script_tab_head",b.uuid,"tr1"),m=h("tr","details",b.uuid,"tr2"),q=h("td","",b.uuid,"td1"),p=h("td","",b.uuid,"td2");f.appendChild(l);c.appendChild(f);q.appendChild(c);r.appendChild(q);m.appendChild(p);k.appendChild(r);k.appendChild(m);d.appendChild(k);var z=Ma.create("_details"+b.uuid,p,{tv:"tv tv_alt",tv_table:"tv_table tv_table_alt",tr_tabs:"tr_tabs tr_tabs_alt",tr_content:"tr_content tr_content_alt",
td_content:"td_content td_content_alt",td_tabs:"td_tabs td_tabs_alt",tv_tabs_align:"tv_tabs_align tv_tabs_align_alt",tv_tabs_fill:"tv_tabs_fill tv_tabs_fill_alt",tv_tabs_table:"tv_tabs_table tv_tabs_table_alt",tv_contents:"tv_contents tv_contents_alt",tv_tab_selected:"tv_tab tv_selected tv_tab_alt tv_selected_alt",tv_tab_close:"",tv_tab:"tv_tab tv_tab_alt",tv_content:"tv_content tv_content_alt"}),A=tb(b,z,n),F=b.nnew||b.system?{}:ub(b,z),C=b.nnew||b.system||!b.storage_key_count||80>u.configMode?{}:
vb(b,z),w=b.nnew||b.system||!b.requires.length&&!b.resources.length?{}:wb(b,z);if(g)return Z["tab"+b.uuid];var t=function(b){var c=!1;if("keydown"==b.type&&a.isSelected()){if(27==b.keyCode)u.editor_enabled&&"vim"==u.editor_keyMap||(window.setTimeout(n,1),c=!0);else if(u.editor_enabled){var d={save:!0,find:!0,findNext:!0,findPrev:!0,replace:!0,replaceAll:!0},e=A.getEditor(),f=CodeMirror.keyName(b);e&&!e.hasFocus()&&"handled"==CodeMirror.lookupKey(f,e.getOption("keyMap"),function(a){if(d[a])return e.execCommand(a),
!0})&&(c=!0)}else 83==b.keyCode&&(b.ctrlKey||b.metaKey)&&(f=A.getEditor())&&(f.save(),c=!0);if(c)return b.stopPropagation(),b.preventDefault(),!1}};d={onShow:function(){x.each([F,A,C,w],function(a){if(a.onShow)a.onShow()});window.addEventListener("keydown",t,!1)},onClose:function(a){var b;x.each([F,A,C,w],function(c){if(c.onClose&&c.onClose(a))return b=!0,!1});b||window.removeEventListener("keydown",t,!0);return b},afterSelect:function(){if(b.uuid){var a=J.get().sub,c=z.getTabById(a);J.set(b.uuid,
(c?a:null)||"editor")}x.each([F,A,w],function(a){a.afterSelect&&a.afterSelect()})}};return Z["tab"+b.uuid]=d},ub=function(a,b){var c=v("div",a.uuid,"script_setting_h"),d=v("div",a.uuid,"script_settings_c");c.textContent=e.getMessage("Settings");var n,g=function(){if("checkbox"==this.type||"button"==this.type)n={},n[this.key]=!this.oldvalue,ga(this.uuid,n);else if("text"==this.type||"textarea"==this.type||"select-one"==this.type){var a=q.getValue(this);n={};n[this.key]=a;ga(this.uuid,n)}},f=q.createPosition(e.getMessage("Position_")+
": ",{id:"position",uuid:a.uuid,name:"pos",pos:a.position,posof:a.positionof},g),l=q.createDropDown(e.getMessage("Run_at"),{id:"run_at",uuid:a.uuid,name:"run-at",value:a.run_at},[{name:"document-start",value:"document-start"},{name:"document-body",value:"document-body"},{name:"document-end",value:"document-end"},{name:"document-idle",value:"document-idle"},{name:"context-menu",value:"context-menu"},{name:e.getMessage("Default"),value:null}],g),k=q.createDropDown(e.getMessage("No_frames"),{id:"noframes",
uuid:a.uuid,name:"no_frames",value:a.noframes},[{name:e.getMessage("Yes"),value:!0},{name:e.getMessage("No"),value:!1},{name:e.getMessage("Default"),value:null}],g),r=q.createCheckbox(e.getMessage("Check_for_Updates"),{id:"check_for_updates",uuid:a.uuid,name:"upd",enabled:a.check_for_updates},g),m=function(b){return(a.options&&a.options.override?a.options.override[b]:null)||[]},p=V(e.getMessage("Original_includes"),{id:"includes",item:a},m("orig_includes"),{orig:!0,other_name:e.getMessage("User_excludes")}),
t=V(e.getMessage("Original_matches"),{id:"matches",item:a},m("orig_matches"),{orig:!0,other_name:e.getMessage("User_excludes")}),z=V(e.getMessage("Original_excludes"),{id:"excludes",item:a},m("orig_excludes"),{orig:!0,other_name:e.getMessage("User_includes")}),A=h("div","clear",a.uuid,"clear"),F=V(e.getMessage("User_includes"),{id:"includes",item:a},m("use_includes")),C=V(e.getMessage("User_matches"),{id:"matches",item:a},m("use_matches")),w=V(e.getMessage("User_excludes"),{id:"excludes",item:a},
m("use_excludes")),u=V(e.getMessage("Original_domain_whitelist"),{id:"connects",item:a},a.connects,{orig:!0}),x=V(e.getMessage("Temporary_domain_whitelist"),{id:"temp_connects",item:a},a.temp_connects),D=V(e.getMessage("User_domain_whitelist"),{id:"connects",item:a},m("use_connects")),m=V(e.getMessage("User_domain_blacklist"),{id:"blockers",item:a},m("use_blockers")),K=q.createCheckbox(e.getMessage("Apply_compatibility_options_to_required_script_too"),{id:"compatopts_for_requires",uuid:a.uuid,name:"",
enabled:a.compatopts_for_requires},g),L=q.createCheckbox(e.getMessage("Fix_wrappedJSObject_property_access"),{id:"compat_wrappedjsobject",uuid:a.uuid,name:"",enabled:a.compat_wrappedjsobject},g),U=q.createCheckbox(e.getMessage("Convert_CDATA_sections_into_a_chrome_compatible_format"),{id:"compat_metadata",uuid:a.uuid,name:"",enabled:a.compat_metadata},g),Y=q.createCheckbox(e.getMessage("Replace_for_each_statements"),{id:"compat_foreach",uuid:a.uuid,name:"",enabled:a.compat_foreach},g),O=q.createCheckbox(e.getMessage("Fix_for_var_in_statements"),
{id:"compat_forvarin",uuid:a.uuid,name:"",enabled:a.compat_forvarin},g),da=q.createCheckbox(e.getMessage("Convert_Array_Assignements"),{id:"compat_arrayleft",uuid:a.uuid,name:"",enabled:a.compat_arrayleft},g),y=q.createCheckbox(e.getMessage("Add_toSource_function_to_Object_Prototype"),{id:"compat_prototypes",uuid:a.uuid,name:"",enabled:a.compat_prototypes},g),E=[K,L,U,Y,O,da,y],K=h("div","section",a.uuid,"ta_opt"),U=h("div","section_head",a.uuid,"head_ta_opt"),L=h("div","section_content",a.uuid,"content_ta_opt");
U.textContent=e.getMessage("Settings");K.appendChild(U);K.appendChild(L);U=h("div","section",a.uuid,"ta_upd");O=h("div","section_head",a.uuid,"head_ta_upd");Y=h("div","section_content",a.uuid,"content_ta_upd");O.textContent=e.getMessage("Updates");U.appendChild(O);U.appendChild(Y);O=h("div","section",a.uuid,"ta_cludes");y=h("div","section_head",a.uuid,"head_ta_cludes");da=h("div","section_content",a.uuid,"content_ta_cludes");y.textContent=e.getMessage("Includes_Excludes");O.appendChild(y);O.appendChild(da);
var y=h("div","section",a.uuid,"ta_security"),fa=h("div","section_head",a.uuid,"head_ta_security"),Ra=h("div","section_content",a.uuid,"content_ta_security");fa.textContent=e.getMessage("XHR_Security");y.appendChild(fa);y.appendChild(Ra);var fa=h("div","section",a.uuid,"ta_compat"),Pa=h("div","section_head",a.uuid,"head_ta_compat"),Qa=h("div","section_content",a.uuid,"content_ta_compat");Pa.textContent=e.getMessage("GM_compat_options_");fa.appendChild(Pa);fa.appendChild(Qa);L.appendChild(f);L.appendChild(l.elem);
L.appendChild(k.elem);Y.appendChild(r.elem);da.appendChild([p.elem,t.elem,z.elem,A,F.elem,C.elem,w.elem]);Ra.appendChild([u.elem,x.elem,D.elem,m.elem]);d.appendChild([K,U,O,y]);for(f=0;f<E.length;f++)Qa.appendChild(E[f].elem);a.awareOfChrome&&Object.keys(E).forEach(function(a){E[a].input.setAttribute("disabled","disabled");E[a].elem.setAttribute("title",e.getMessage("This_script_runs_in_Chrome_mode"))});d.appendChild(fa);var H=q.createTextarea(null,{name:"",uuid:a.uuid,id:"comment",value:a.options.comment});
H.elem.setAttribute("class","script_setting_wrapper");f=v("div",a.uuid,"save");l=q.createButton("save_button",a.uuid,e.getMessage("Save"),function(){g.apply(H.textarea,[])});f.appendChild(l);l=h("div","section",a.uuid,"ta_comment");k=h("div","section_head",a.uuid,"head_ta_comment");r=h("div","section_content",a.uuid,"content_ta_comment");k.textContent=e.getMessage("Comment");l.appendChild(k);l.appendChild(r);r.appendChild(H.elem);r.appendChild(f);d.appendChild(l);f=h("div","section",a.uuid,"ta_det");
l=h("div","section_head",a.uuid,"head_ta_det");k=h("div","section_content",a.uuid,"content_ta_det");l.textContent=e.getMessage("Details");f.appendChild(l);f.appendChild(k);l.textContent=e.getMessage("Details");var G=h("table","script_details",a.uuid,"script_details");[{label:e.getMessage("Size"),value:ka.formatBytes((a.code?a.code:a).length,2)},{label:e.getMessage("UUID"),value:a.uuid}].forEach(function(b){var c=h("tr","external_desc",a.uuid,b.label,"tr"),d=h("td","external_desc",a.uuid,b.label,"td1"),
e=h("td","",a.uuid,b.label,"td2");d.textContent=b.label;e.textContent=b.value;c.appendChild(d);c.appendChild(e);G.appendChild(c)});k.appendChild(G);d.appendChild(f);var I=b.appendTab("settings",c,d,function(){J.setSub("settings")});J.registerListener(a.uuid,"settings",function(){I.select()});return{}},Ya=function(a,b){var c=h("table","script_desc",a.uuid,"outer_req2html"),d=0,n=[{label:e.getMessage("URL"),prop:"display_url"},{label:e.getMessage("Size"),prop:"data",fn:function(a){var b="?";a&&(void 0!==
a.length?b=a.length:void 0!==a.content&&(b=a.content.length));return ka.formatBytes(b,2)}},{label:e.getMessage("Subresource_Integrity"),prop:"sri",fn:function(a){return a?a.type+"="+a.value:e.getMessage("_not_set_")}},{label:e.getMessage("Last_updated"),prop:"ts",fn:function(a){return a?(new Date(a)).toString():"?"}}];a[b].forEach(function(f){var g=d+b;n.forEach(function(b){var d=h("tr","external_desc",a.uuid,b.prop,"tr"+g),e=h("td","external_desc",a.uuid,b.prop,"td1"+g),n=h("td","",a.uuid,b.prop,
"td2"+g);e.textContent=b.label;n.textContent=(b.fn?b.fn:function(a){return a})(f[b.prop]);d.appendChild(e);d.appendChild(n);c.appendChild(d)});var r=h("tr","external_desc_buttons",a.uuid,f.url,"tr"+g),m=h("td","",a.uuid,"buttons","td"+g);r.appendChild(m);c.appendChild(r);if(f.ts){var r=v("div",a.uuid,"delete_external"+g),p=q.createButton(a.uuid,"delete_external"+x.createUniqueId(f.url)+g,e.getMessage("Delete"),function(){yb(a.uuid,f.url);p.parentNode&&p.parentNode.removeChild(p)});r.appendChild(p);
m.appendChild(r)}d++});if(!d){var g=h("tr","script_desc",a.uuid,d,"tr"),f=h("td","script_desc",a.uuid,d,"td1");f.textContent=e.getMessage("No_entry_found");g.appendChild(f);c.appendChild(g)}return c},wb=function(a,b){var c=v("div","",a.uuid,"script_external_h");c.textContent=e.getMessage("Externals");var d=v("div","",a.uuid,"script_externals_c"),n=h("div","section",a.uuid,"ta_requires"),g=h("div","section_head",a.uuid,"head_ta_requires"),f=h("div","section_content",a.uuid,"content_ta_requires");g.textContent=
e.getMessage("Requires");n.appendChild(g);n.appendChild(f);f.appendChild(Ya(a,"requires"));var g=h("div","section",a.uuid,"ta_resources"),f=h("div","section_head",a.uuid,"head_ta_resources"),l=h("div","section_content",a.uuid,"content_ta_resources");f.textContent=e.getMessage("Resources");g.appendChild(f);g.appendChild(l);l.appendChild(Ya(a,"resources"));d.appendChild(n);d.appendChild(g);var k=b.appendTab("externals",c,d,function(){J.setSub("externals")});J.registerListener(a.uuid,"externals",function(){k.select()});
return{}},vb=function(a,b){var c=function(a,b){if("string"===typeof a){var c=a[0];a=a.substr(1);switch(c){case "b":return"true"===a;case "n":return Number(a);case "o":try{return JSON.parse(a)}catch(d){console.log("values: parseValueFromStorage: "+d)}return b;default:return a}}else return b},d=v("div","",a.uuid,"script_storage_h");d.textContent=e.getMessage("Storage");var n=v("div","",a.uuid,"script_storages_c"),g=h("div","section",a.uuid,"ta_storage"),f=h("div","section_head",a.uuid,"head_ta_storage"),
l=h("div","section_content",a.uuid,"content_ta_storage");f.textContent=e.getMessage("Storage");g.appendChild(f);g.appendChild(l);var k=h("textarea","storageta",a.uuid,"storage");k.setAttribute("wrap","off");k.setAttribute("wrap","off");k.setAttribute("spellcheck","false");f=q.createButton("storage_save_button",a.uuid,e.getMessage("Save"),function(){var b=null;try{b=JSON.parse(k.value)}catch(c){x.alert(e.getMessage("Unable_to_parse_this_"));return}var d=Object.keys(b),f=Object.keys(a.storage);d.concat(f).filter(function(a,
b,c){return c.lastIndexOf(a)===b}).forEach(function(c){if(-1==d.indexOf(c))Za(a.uuid,c);else if(-1==f.indexOf(c)||b[c]!==a.storage[c]){var e=Za,g=a.uuid,l;a:{l=b[c];var k=(typeof l)[0];switch(k){case "o":try{l=k+JSON.stringify(l)}catch(n){console.log(n);l=void 0;break a}break;default:l=k+l}}e(g,c,l)}})});l.appendChild(k);l.appendChild(f);n.appendChild(g);var r=b.appendTab("storage",d,n,function(){J.setSub("storage")});J.registerListener(a.uuid,"storage",function(){(function(){if(a.referrer&&void 0===
a.storage){var b=D();oa({referrer:a.referrer+".storage",uuid:a.uuid},function(a){if(a.items){var d={},e=a.items[0];Object.keys(e).forEach(function(a){d[a]=c(e[a])});b.resolve(d)}else b.reject();p.hide()});return b.promise()}return D.Pledge(a.storage)})().done(function(b){k.value=JSON.stringify(b,null,4);a.storage=b;k.removeAttribute("disabled")}).fail(function(){k.setAttribute("disabled",!0)});r.select()});return{}},$a=function(a){return a.replace("<$URL$>",W.url?fb.Base64.decode(W.url):"http://*/*")},
tb=function(a,b,c){var d=h("tr","editor_container p100100",a.uuid,"container");if(!a.nnew&&H(a.uuid,"lastI"))return Z["editor"+a.uuid]||{};a.nnew&&(a.code=$a(u.script_templates[0].value));var n=v("div",a.uuid,"script_editor_h"),g=n.inserted;n.textContent=e.getMessage("Editor");var f=v("div",a.uuid,"script_editor_c"),l=h("tr","editormenubar",a.uuid,"container_menu"),k=h("table","editor_container_o p100100 noborder",a.uuid,"container_o");k.appendChild(l);k.appendChild(d);f.appendChild(k);var r=function(){var b=
!1;d.editor&&(b=u.editor_enabled?b|(d.editor.changed&&d.editor.mirror.historySize().undo):d.editor.value!=a.code);return b},m=function(){H(a.uuid,"saveEm")},B=function(a,b,d){c&&c(b,d)},k=q.createImageButton(a.uuid,"save_to_disk",e.getMessage("Save_to_disk"),rea.extension.getURL("/layout/default/images/harddrive2.png"),function(){H(a.uuid,"saveToDisk")}),N=q.createImageButton(a.uuid,"save",e.getMessage("Save"),rea.extension.getURL("/layout/default/images/filesave.png"),m),z=q.createImageButton(a.uuid,
"cancel",e.getMessage("Editor_reset"),rea.extension.getURL("/layout/default/images/editor_cancel.png"),function(){confirm(e.getMessage("Really_reset_all_changes_"))&&d.editor&&(u.editor_enabled?d.editor.mirror.setValue(a.code):d.editor.value=a.code)}),A=q.createImageButton(a.uuid,"reset",e.getMessage("Full_reset"),rea.extension.getURL("/layout/default/images/script_cancel.png"),function(){confirm(e.getMessage("Really_factory_reset_this_script_"))&&t[a.uuid].fullReset(function(a){a.cleaned&&B(null,
!0,!1)})}),F=q.createImageButton(a.uuid,"close_script",e.getMessage("Close"),rea.extension.getURL("/layout/default/images/exit.png"),B),C=q.createImageButton(a.uuid,"lint_script",e.getMessage("Run_syntax_check"),rea.extension.getURL("/layout/default/images/check.png"),function(){window.setTimeout(function(){var a;u.editor_enabled&&(a=d.editor)&&(p.wait(),window.setTimeout(function(){a.mirror.performLint(!0);var b=window.JSHINT.errors;if(b&&b.length){1===b.length?ab(e.getMessage("One_error_or_hint_was_found_")):
ab(e.getMessage("0count0_errors_or_hints_were_found_",b.length));for(var c,d=0;c=b[d];d++)if(1<c.line){a.mirror.setCursor(c.line-1,c.character-1);a.mirror.focus();break}}else bb(e.getMessage("No_syntax_errors_were_found_"));p.hide()},100))},1)}),w;a.nnew&&(w=q.createDropDown(null,{value:u.script_templates[0].name,uuid:"template-select",name:"template-select"},u.script_templates.map(function(a){return{name:a.name,value:a.name}}),function(){var a=this;if(r()&&!confirm(e.getMessage("Really_reset_all_changes_")))a.value=
a.oldvalue;else{var b=null;u.script_templates.map(function(c){c.name===a.value&&(b=$a(c.value))});b?(this.oldvalue=a.value,d.editor&&(u.editor_enabled?(d.editor.mirror.setValue(b),d.editor.changed=!1):d.editor.value=b)):a.value=a.oldvalue}}));var y=q.createInput(e.getMessage("Update_URL_"),{id:"file_url",uuid:a.uuid,name:"uu",value:a.file_url});y.input.setAttribute("class","updateurl_input");y.elem.setAttribute("class","updateurl");var E=h("textarea","editorta",a.uuid,"editor");E.setAttribute("wrap",
"off");E.setAttribute("spellcheck","false");var G=h("td","editor_outer",a.uuid,"edit"),K=h("div","editor_100 editor_border",a.uuid,"edit"),L=h("div","editormenu",a.uuid,"editormenu");G.appendChild(K);l.appendChild(L);l.appendChild(y.elem);d.inserted||(K.appendChild(E),d.appendChild(G));t[a.uuid].saveToDisk=function(){if(d.editor){var b=u.editor_enabled?d.editor.mirror.getValue():d.editor.value;p.wait();return pa().done(function(){var c=new Blob([b],{type:"text/plain"});saveAs(c,a.name+".user.js")}).always(function(){p.hide()})}};
a.system||(t[a.uuid].saveEm=function(b){if(d.editor){var c=!0;u.showFixedSrc&&(c=confirm(e.getMessage("Do_you_really_want_to_store_fixed_code_",e.getMessage("Show_fixed_source"))));var f=u.editor_enabled?d.editor.mirror.getValue():d.editor.value;c&&Ja(a.uuid,f,{old_url:y.input?y.input.oldvalue:"",new_url:y.input?y.input.value:"",clean:!1,new_script:a.nnew,auto_save:b&&b.auto_save,reload:!0,lastModified:t[a.uuid].saveEm_lastModified}).done(function(c){c.installed?a.nnew?B(null,!0,!1):(d.editor.changed=
!1,c.lastModified&&(a.lastModified=c.lastModified)):c.aborted||b&&b.auto_save||(c.messages&&c.messages.errors&&c.messages.errors.length?x.alert(c.messages.errors.join("\n")):x.alert(e.getMessage("Unable_to_parse_this_")))});return c}},L.appendChild(k),L.appendChild(N),L.appendChild(z));a.nnew||L.appendChild(A);L.appendChild(F);!a.system&&u.editor_enabled&&L.appendChild(C);a.nnew&&L.appendChild(w.elem);var U=b.appendTab("editor",n,f,function(){J.setSub("editor")});J.registerListener(a.uuid,"editor",
function(){U.select();u.editor_enabled&&d.editor&&(d.editor.refresh(),d.editor.mirror.focus())});if(g)return Z["editor"+a.uuid];var Y,O,da=function(a,b,c,d){a=d.getValue();if(a.length<u.editor_autoLintMaxLen){if(!O){var e=d.getHelper(CodeMirror.Pos(0,0),"lint");O=window.setTimeout(function(){O=null;Y=!0;var f=e(a,c,d);b(f)},1)}}else Y&&(b([]),Y=!1)},I=function(a){ta("editor_theme",a,!0).done(function(){bb("Theme switched to "+a)})},M=function(){u.editor_autoSave&&r()&&H(a.uuid,"saveEm",{auto_save:!0})};
b={getEditor:function(){if(d.editor)return u.editor_enabled?d.editor.mirror:{save:m}},onShow:function(){(function(){if(a.referrer&&void 0===a.code){var b=D();oa({referrer:a.referrer+".source",uuid:a.uuid},function(c){c.items?(a.code=c.items[0],b.resolve()):b.reject();p.hide()});return b.promise()}return D.Pledge()})().done(function(){var b=f.getElementsByTagName("textarea");t[a.uuid].lastI=function(){return a};if(b.length&&!d.editor){var b=b[0],c=function(){d.editor&&(d.editor.changed=!0)};if(u.editor_enabled){var g=
b.parentNode;g.removeChild(b);d.editor=new MirrorFrame(g,{theme:u.editor_theme,fontSize:u.editor_fontSize,themeOptions:{all:Na.editorThemes,onChange:I},value:a.code,indentUnit:Number(u.editor_indentUnit),indentWithTabs:"tabs"==u.editor_indentWithTabs,smartIndent:"classic"!=u.editor_tabMode,indentByTab:"indent"==u.editor_tabMode,electricChars:"true"==u.editor_electricChars.toString(),lineNumbers:!0,lineWrapping:u.editor_lineWrapping,extraKeys:{Enter:"newlineAndIndentContinueComment"},keyMap:u.editor_keyMap,
bookmarkGutter:!0,gutters:["gutter","CodeMirror-linenumbers","CodeMirror-foldgutter","CodeMirror-lint-markers","CodeMirror-bookmarks"],matchBrackets:!0,foldGutter:!0,styleActiveLine:!0,specifyMoreJsTokens:!0,styleSelectedText:!0,hintOptions:{keywords:Aa.globals},lint:{lintOnChange:u.editor_autoLint,async:u.editor_autoLint,getAnnotations:da,globals:Aa.globals,jshint_options:Aa.options},showTrailingSpace:u.editor_highlightTrailingWhitespace},{save:m,close:B},{change:c,blur:M},e.getMessage)}else d.editor=
b,b.value=a.code}}).fail(function(){B(null,!1,!0)})},onClose:function(b){var c=function(){d.editor=null;delete t[a.uuid].lastI};if(!b&&r())return(b=confirm(e.getMessage("There_are_unsaved_changed_")))&&c(),!b;c();return!1}};return Z["editor"+a.uuid]=b},lb=function(a,b,c){t[a.uuid]||(t[a.uuid]={});var d,n,g=a.icon&&!a.nativeScript,f=["script_name"];a.nativeScript||f.push("clickable");a.blacklisted&&f.push("crossedout");var l=h("span",f.join(" "),a.uuid,"sname"),k=h("img","nameNicon16 icon16",a.uuid,
"sname_img"),r=h("span",g?"nameNname16":"",a.uuid,"sname_name"),m=Ia(a),f=e.getTranslation(a,"name");r.textContent=35<f.length?f.substr(0,35)+"...":f;f=v("span",a.uuid,"spos");f.textContent=a.position||"";var p=v("span",a.uuid,"sversion");p.textContent=a.version?a.version:"";g&&(k.src=a.icon,l.appendChild(k));var g=[],y=function(){window.setTimeout(function(){for(var d=Object.keys(T),e,f=0;e=d[f];f++)if(e=T[e].script,e.uuid==a.uuid){ua(b,[e],null,c);break}Da()},1)},z=function(b,c){void 0===c&&(c=
!b);a.uuid&&J.is(a.uuid)&&J.clear();n&&n.onClose&&n.onClose(b)||(d&&(d.remove(),d=null),delete Z["tab"+a.uuid],delete Z["editor"+a.uuid],l.parentNode&&l.parentNode.removeChild(l),c&&y())},A=function(){n&&n.afterSelect&&n.afterSelect()},F=t[a.uuid].scriptClick=function(f,g){if(!d){var l=null;a.nnew?(l=h("div","head_icon",a.uuid,"details_h"),l.appendChild(q.createImage(a.imageURL,"",a.uuid,"new_script_head"))):l=v("div",a.uuid,"details_h");var k=v("div",a.uuid,"details_c");d=c.insertTab(null,a.uuid,
l,k,A,a.nnew?null:z);a.nnew||d.setHeading(e.getMessage("Edit")+" - "+(25<a.name.length?a.name.substr(0,25)+"...":a.name));n=xb(d,a,b,k,z)}if(n&&n.onShow)n.onShow();d.show();f&&1==f.button||g||d.select();r.setAttribute("open","true")};"true"==r.getAttribute("open")&&F(null,!0);var k=function(a,b){var c=a.getTime(),d=b.getTime(),e=Math.abs(c-d),c=Math.round(e/6E4),d=Math.round(e/36E5),e=Math.round(e/864E5);return 60>=c?c+" min":48>=d?d+" h":e+" d"},C=v("span","",a.uuid,"last_updated",!0),w="";if(a.nativeScript||
a.nnew||a.system)w="";else if(t[a.uuid].scriptUpdate=function(){var b=C.textContent;C.textContent="";C.appendChild(q.createImage(rea.extension.getURL("/layout/default/images/download.gif"),"down",a.uuid));zb(a.uuid,function(c){C.textContent=b;c?(C.style.color="green",C.title=e.getMessage("There_is_an_update_for_0name0_avaiable_",a.name),z(!0),cb()):(C.style.color="red",C.title=e.getMessage("No_update_found__sry_"))})},a.options.check_for_updates&&a.file_url?(C.addEventListener("click",function(){H(a.uuid,
"scriptUpdate")}),C.setAttribute("class","clickable"),C.title=e.getMessage("Check_for_Updates")):(C.setAttribute("class","greyed italic"),C.title=e.getMessage("Update_check_is_disabled")),a.lastUpdated)try{w=k(new Date,new Date(a.lastUpdated))}catch(L){console.log("o: error calculating time "+L.message)}else w="?";C.textContent=w;var D=v("div",a.uuid,"imported"),G="";E.push(function(){u.sync_enabled&&(G=a.nativeScript||a.nnew||a.system?"":a.sync&&a.sync.imported?!0===a.sync.imported||a.sync.imported==
xa.types.ePASTEBIN?'<img src="https://pastebin.com/favicon.ico" class="icon16" title="pastebin.com"/>':a.sync.imported==xa.types.eCHROMESYNC?'<img src="https://www.google.com/images/icons/product/chrome-16.png" class="icon16" title="Google Sync"/>':a.sync.imported==xa.types.eGOOGLE_DRIVE?'<img src="https://www.google.com/images/icons/product/drive-16.png" class="icon16" title="Google Drive"/>':'<img src="'+rea.extension.getURL("/layout/default/images/update.png")+'" class="icon16" />':"",D.innerHTML=
G,D=null)});k=v("span",a.uuid,"hp");if(a.origin){w=v("a",a.uuid,"hp");w.setAttribute("href",a.origin.url);w.setAttribute("target","_blank");var I=q.createImage(S.origin(a.origin.token),"",a.uuid,a.origin.token,"");w.appendChild(I);k.appendChild(w)}m&&(w=v("a",a.uuid,"hp"),w.setAttribute("href",m),w.setAttribute("target","_blank"),m=q.createImage(rea.extension.getURL("/layout/default/images/home.png"),"",a.uuid,"hp",""),w.appendChild(m),k.appendChild(w));t[a.uuid].saveEm_lastModified=a.lastModified;
t[a.uuid].fullReset=function(c){Ja(a.uuid,null,{clean:!0,reload:!0}).done(c||function(){});b.parentNode.removeChild(b)};t[a.uuid].reportAnIssue=function(b){Ab(a.uuid,b)};t[a.uuid].deleteScript=function(c,d){var f;a.nativeScript?(f=d||confirm(e.getMessage("Really_delete_0name0__",a.name)),1==f&&(Ka(a.uuid,"installed","false"),b.parentNode.removeChild(b))):(f=d||confirm(e.getMessage("Really_delete_0name0__",a.name)),1==f&&(Ja(a.uuid,null,{reload:!d}),b.parentNode.removeChild(b)))};m=[];if(a.nativeScript){t[a.uuid].importNativeScript=
function(c,d){1==(d||confirm(e.getMessage("Really_import_0name0__",a.name)))&&(Ka(a.uuid,"imported","true"),b.parentNode.removeChild(b))};var K=q.createImage(S.get("import"),"",a.uuid,"import",e.getMessage("Import"),function(){H(a.uuid,"importNativeScript")});q.addClass(K,"hidden");m.push(K);E.push(function(){u.native_import&&q.toggleClass(K,"hidden")})}a.nnew||a.system||a.nativeScript||(w=q.createImage(S.get("edit"),"",a.uuid,"edit",e.getMessage("Edit"),function(){H(a.uuid,"scriptClick")}),m.push(w));
a.nnew||a.system||(w=q.createImage(S.get("delete"),"",a.uuid,"delete",e.getMessage("Delete"),function(){H(a.uuid,"deleteScript")}),m.push(w));a.nnew||a.system||!a.origin||a.supportURL===a.origin.issue_url||(w=q.createImage(S.get("flag"),"",a.uuid,"issue",e.getMessage("Report_an_issue_to_the_script_hoster_"),function(){H(a.uuid,"reportAnIssue","hoster")}),m.push(w));a.nnew||a.system||!a.supportURL||(w=q.createImage(S.get("bug"),"",a.uuid,"bug",e.getMessage("Report_a_bug"),function(){H(a.uuid,"reportAnIssue",
"author")}),m.push(w));l.inserted||a.nativeScript||(l.addEventListener("click",F),l.addEventListener("auxclick",F));l.appendChild(r);w=[a.name];a.description&&w.push(e.getTranslation(a,"description"));a.blacklisted&&(w=[e.getMessage("This_script_is_blacklisted_")]);l.title=w.join("\n\n").replace(/\"/g,'"');g.push(a.nnew||a.system?null:{element:Bb(a),style:"script_sel"});g.push(f);g.push(function(){var b=null,b=a.blacklisted?"enabler_warning":a.enabled?a.contexter?"enabler_enabled enabler_later":"enabler_enabled":
"enabler_disabled",c=a.blacklisted?e.getMessage("This_script_is_blacklisted_"):a.enabled?e.getMessage("Enabled"):e.getMessage("Disabled"),b=q.createEnabler(b,a.uuid,"enabled",{append:"enabled",disabled:a.blacklisted,title:c,on:e.getMessage("On"),off:e.getMessage("Off")},function(){H(a.uuid,a.nativeScript?"switchNativeEnabled":"switchEnabled")});t[a.uuid].switchEnabled=function(b,c,d){void 0===c&&(c=!a.enabled);ga(a.uuid,{enabled:c},d)};t[a.uuid].switchNativeEnabled=function(b,c,d){void 0===c&&(c=
!a.enabled);Ka(a.uuid,"enabled",c,d)};return b}());g.push(l);g.push(p);g.push(Cb(a));g.push(D);g.push(Db(a));g.push(Eb(a));g.push(k);g.push(C);g.push(Fb(a));g.push(function(a,b){var c=v("span",a.uuid,"wrap");b&&("Array"===x.toType(b)?x.each(b,function(a){c.appendChild(a)}):c.appendChild(b));return c}(a,m));for(f=g.length;10>f;f++)g.push(null);J.registerListener(a.uuid,function(){F()});a.nnew&&E.push(function(){F(null,!0)});return g},Cb=function(a){var b=v("span","",a.uuid,"pos_type",!0);if(a.nnew)return b;
a.nativeScript?(a=q.createImage(a.icon,"",a.uuid,"chrome_ext",e.getMessage("This_is_a_chrome_extension")),b.appendChild(a)):a.userscript&&(a=q.createImage("images/txt.png","",a.uuid,"user_script",e.getMessage("This_is_a_userscript")),b.appendChild(a));return b},Eb=function(a){var b,c,d=v("span","",a.uuid,"pos_features",!0);if(a.nnew)return d;a.system&&(b=q.createImage(rea.extension.getURL("/layout/default/images/lock.png"),"",a.uuid,"lock",e.getMessage("This_is_a_system_script")),d.appendChild(b));
a.warnings&&a.warnings.forEach(function(a,c){b=q.createImage(rea.extension.getURL("/layout/default/images/critical.png"),"compat",c.uuid,"warning_"+c,a);$(b).addClass("flashing");d.appendChild(b)});if(a.awareOfChrome||a.nativeScript)b=q.createImage("https://www.google.com/images/icons/product/chrome-16.png","",a.uuid,"chrome_mode",e.getMessage("This_script_runs_in_Chrome_mode")),d.appendChild(b);if(a.nativeScript)return d;a.requires.length&&(b=q.createImage(rea.extension.getURL("/layout/default/images/script_download.png"),
"",a.uuid,"requires",x.map(x.select(a.requires,function(a){return a&&a.url}),function(a){return a.url}).join("\n")),d.appendChild(b));a.resources.length&&(b=q.createImage(rea.extension.getURL("/layout/default/images/resources.png"),"",a.uuid,"resources",x.map(x.select(a.resources,function(a){return a&&a.url}),function(a){return a.url}).join("\n")),d.appendChild(b));var n=!1,g={includes:!0,matches:!0};for(c in g)if(a[c]){for(g=0;g<a[c].length;g++)if(a[c][g]&&(-1!=a[c][g].search("https")||-1!=a[c][g].search(/^\*:\/\//))){b=
q.createImage(rea.extension.getURL("/layout/default/images/halfencrypted.png"),"",a.uuid,"encrypt",e.getMessage("This_script_has_access_to_https_pages"));d.appendChild(b);n=!0;break}if(n)break}var f={};a.grant.forEach(function(a){f[a]=!0});f.GM_xmlhttpRequest&&(b=q.createImage(rea.extension.getURL("/layout/default/images/web.png"),"",a.uuid,"web",e.getMessage("This_script_has_full_web_access")),d.appendChild(b));f.GM_setValue&&(b=q.createImage(rea.extension.getURL("/layout/default/images/db.png"),
"",a.uuid,"db",e.getMessage("This_script_stores_data")),d.appendChild(b));f.unsafeWindow&&(b=q.createImage(rea.extension.getURL("/layout/default/images/windowlist.png"),"",a.uuid,"unsafeWindow",e.getMessage("This_script_has_access_to_webpage_scripts")),d.appendChild(b));for(c in a.options)if(-1!=c.search("compat_")&&a.options[c]){b=q.createImage(rea.extension.getURL("/layout/default/images/critical.png"),"compat",a.uuid,"crit",e.getMessage("One_or_more_compatibility_options_are_set"));d.appendChild(b);
break}return d},Wa=function(a){var b="global_hint_"+(a.class?a.class:"warning"),c=Date.now(),d=h("span",["global_hint",b].join(" "),"globalhint",c),b=v("span","globalhint_c",c),e=v("span","globalhint_t",c);a.title&&(e.title=a.title);a.image&&b.appendChild(q.createImage(S.get(a.image),"globalhint","icon"+c));e.textContent=a.text;a.onclick&&!e.inserted&&e.addEventListener("click",a.onclick);b.appendChild(e);d.appendChild(b);var g=$(d).hide().appendTo(document.body);window.setTimeout(function(){g.slideDown()},
g.delay?g.delay:1);a.timeout&&window.setTimeout(function(){g.slideUp(function(){g.remove()});a.done&&a.done(d)},a.timeout);return g},db=!1,Xa=function(){if(!db){var a=e.getLocale(),b=$("<div>").hide(),c=function(a){a?(b.html(""),b.append($('<div class="contrib_iframe" style="font-size: 2.5em;"></div>').append($('<div style="padding-top: 150px;">').text(a))),window.setTimeout(c,1E3)):(b.fadeOut(1E3),window.setTimeout(p.hideDialog,1E3))},a=$('<iframe src="https://tampermonkey.net/contrib.php?embedded=true'+
(a?"&locale="+a:"")+'" class="contrib_iframe"></iframe>'),d=[$('<button class="contrib_button">').html(e.getMessage("Remind_me_later")).click(function(){ha("later",{});c(e.getMessage("Ok"))}),$('<button class="contrib_button">').html(e.getMessage("I_contributed_already")).click(function(){ha("contributed",{});c(e.getMessage("Thank_you_very_much_"))}),$('<button class="contrib_button">').html(e.getMessage("I_dont_want_to_contribute")).click(function(){ha("hide",{});c(e.getMessage("Ok"))})],n=function(){g&&
window.clearTimeout(g);d.forEach(function(a){a.prop("disabled",!1)})};d.forEach(function(a){a.prop("disabled",!0)});b.append(a,d);a.bind("load",n);var g=window.setTimeout(function(){g=null;n()},15E3),f=function(){var a=p.dialog(b[0]);!0===a?(b.fadeIn(1E3),ha("dialog",{})):void 0===a&&window.setTimeout(f,500);db=!0};f();window.addEventListener("message",function(a){var d=a.data.clicked||a.data.type,f=a.data.amount,g=a.data.currency;d&&(a.data.success?"stripe"==d&&(a=$(".contrib_iframe"),d=a.data("oheight"),
!d||0>d||1E3<d||a.animate({height:d},1E3)):(ha("clicked",d,{amount:f||"?",currency:g||"?"}),$(".contrib_button").remove(),b.append($('<button class="contrib_button">').html(e.getMessage("Ok")).click(function(){ha("contributed",{});c()})),"stripe"==d&&(a=$(".contrib_iframe"),a.data("oheight",a.height()),a.animate({height:740},1E3))))},!1)}},Gb=function(){var a=null,b=null,c=null,d=0,e=0,g=0,f=function(b){var d=c.x+b.pageX;a.style.top=c.y+b.pageY+"px";a.style.left=d+"px"},l,k,h,m=function(c){if(a&&
!l){var A,t=null,u,w,v,x;f(c);k&&(window.clearTimeout(k),k=null);for(;t!=g;)t=g,u=b.previousSibling,w=b.nextSibling,v=b.parentNode,x=p(b),c.pageY>x.y+d+e&&w?(v.removeChild(w),v.insertBefore(w,b),g++,A=!1):c.pageY<x.y&&1<g&&(v.removeChild(u),w?v.insertBefore(u,w):v.appendChild(u),g--,A=!0);t=Math.min(.03*document.documentElement.clientHeight,100);if(void 0!==A){w=A?$(u):$(w);if(w.length&&!q.isScrolledIntoView(w,{padding:t})){A=A?w.offset().top-t-w.height():w.offset().top-document.documentElement.clientHeight+
t+2*w.height();l=!0;var y=A-document.body.scrollTop;$("html, body").animate({scrollTop:A},0,function(){window.setTimeout(function(){l=!1;k=window.setTimeout(function(){k=null;h===c&&m({pageX:h.pageX,pageY:h.pageY+y})},100)},100)})}c.stopPropagation&&(c.stopPropagation(),c.preventDefault());h=c;return!1}}},p=function(a){a=a.getBoundingClientRect();return{x:a.left+window.pageXOffset,y:a.top+window.pageYOffset}},t=function(d){a.style.position="static";var e={};e[a.key]=g;ga(a.uuid,e);a=b=c=null;document.removeEventListener("mousemove",
m);document.removeEventListener("scroll",m);document.removeEventListener("mouseup",t);d.stopPropagation();d.preventDefault();return!1};return{start:function(k,l){var h=this.parentNode.parentNode,q=h.parentNode,r=q.parentNode.parentNode;a=this;b=q;d=b.offsetHeight;e=b.offsetHeight-h.clientHeight;c=p(r);c.x=-c.x-a.offsetWidth/2;c.y=-c.y-b.offsetHeight/2+2*e;a.style.position="absolute";f(k);g=l;document.addEventListener("mousemove",m);document.addEventListener("scroll",m);document.addEventListener("mouseup",
t);k.stopPropagation();k.preventDefault();return!1}}}(),Fb=function(a){var b=h("span","sorting","",a.uuid,"pos_images",!0);if(a.nnew||a.nativeScript)return b;"pos"==aa()&&"up"==ea()||b.setAttribute("style","display: none;");if(1<a.position||a.position<a.positionof){var c=h("span","clickable movable","position",a.uuid,!0);c.innerHTML="&#9776;";c.title=e.getMessage("Click_here_to_move_this_script");c.uuid=a.uuid;c.key="position";c.addEventListener("mousedown",function(b){Gb.start.apply(this,[b,a.position])});
b.appendChild(c)}return b},Db=function(a){var b=v("span","",a.uuid,"site_images"),c=null;b.inserted&&(c=b,c.setAttribute("id",c.id+"foo"),b=v("span","",a.uuid,"site_images"));Ga.topIcons(a,7).forEach(function(a){b.appendChild(a,!0)});c&&c.parentNode.removeChild(c);return b},ib=function(a){var b=v("div",a.name,a.id,"filter");if(b.inserted)return b;var c=!1;t.filter={onShow:function(a){c||(m.value="",c=!0);g(!0);a&&$(m).focus()},onHide:function(){c=!1;g(!0,1)}};var d=null,n,g=function(a,b){if(!n||a)d&&
window.clearTimeout(d),y.show(),d=window.setTimeout(function(){for(var a=document.getElementsByName("scriptselectors"),b=[],d=0;d<a.length;d++)b.push(a[d]);n=!0;"matching_url"!=l&&"auto"!=l||!m.value.match(f.matching_url.match)?a=D.Pledge():(k=f.matching_url.update_interval||k,a=Hb(m.value));a.always(function(){n=!1;y.fadeOut()}).then(function(a){var d=new RegExp(x.escapeForRegExp(m.value),"i"),e=m.value;b.forEach(function(b){var g,k,h,n;(g=T[b.s_id])&&(k=g.script)&&(h=g.dom)&&(c?"auto"==l?Object.keys(f).every(function(b){var c=
f[b];return"auto"==b?!0:(n=c.check(k,c.ignore_case?d:e,a))?!1:!0}):(g=f[l],n=g.check(k,g.ignore_case?d:e,a)):n=!0,$(h).toggle(!!n),b.is_hidden=!n)})})},b||k)},f={auto:{name:e.getMessage("Auto"),update_interval:500},name:{name:"@name",check:function(a,b){return-1!=a.name.search(b)},ignore_case:!0},namespace:{name:"@namespace",check:function(a,b){return a.namespace&&-1!=a.namespace.search(b)},ignore_case:!0},author:{name:"@author",check:function(a,b){return a.author&&-1!=a.author.search(b)},ignore_case:!0},
grant:{name:"@grant",default:"GM_",check:function(a,b){return a.grant&&0<a.grant.filter(function(a){return-1!=a.search(b)}).length},ignore_case:!0},includes:{name:"@include/@match",check:function(a,b){return a.includes&&0<a.includes.filter(function(a){return-1!=a.search(b)}).length||a.matches&&0<a.matches.filter(function(a){return-1!=a.search(b)}).length},ignore_case:!0},comment:{name:e.getMessage("Comment"),check:function(a,b){return a.comment&&-1!=a.comment.search(b)},ignore_case:!0},url:{name:e.getMessage("Update_URL_"),
default:"https://",check:function(a,b){return a.file_url&&-1!=a.file_url.search(b)},ignore_case:!0},matching_url:{name:e.getMessage("Matching_URL"),update_interval:1500,default:"http://",match:/^https?:\/\/.*/,check:function(a,b,c){return c&&-1!=c.indexOf(a.uuid)}}},l="auto",k=f.auto.update_interval,p=q.createDropDown(e.getMessage("Filter_by"),{value:0,uuid:"sms-filter",name:"select"},Object.keys(f).map(function(a){return{name:f[a].name,value:a}}),function(){var a;a=this.value;a!=l&&(l=a,k=((a=f[l])?
a.update_interval:null)||f.auto.update_interval,a=(a?a.default:null)||"",m.value=m.value||a,g())});p.elem.setAttribute("class","float");p.elem.setAttribute("style","display: inline; text-align: right; padding-left: 10px;");var m=h("input","filter_text","sms","all",null);m.setAttribute("spellcheck","false");var u="";m.inserted||m.addEventListener("keyup",function(){u!=m.value&&(u=m.value,g())});var y=$(q.createImage(rea.extension.getURL("/layout/default/images/download.gif"),"wait_for_filter",a.uuid));
y.attr("style","vertical-align: middle;");y.hide();b.setAttribute("style","display: inline-block; position: relative;");b.appendChild(p.elem);b.appendChild(m);b.appendChild(y[0]);W.filter&&E.push(function(){t.multiselect.toggleRow(!0,!0);m.value=W.filter});return b},I=[],Bb=function(a){var b=v("input","",a.uuid,"sel");b.type="checkbox";b.s_id=a.uuid;b.name="scriptselectors";b.s_type=a.nativeScript?"n":"s";b.inserted||b.addEventListener("click",function(a){I=[];b&&I.push(b);a.ctrlKey||a.metaKey?t.multiselect.un_selectAll():
t.multiselect.single_click()});return b},hb=function(a){var b=h("input","multiselectcb","sms","all",null),c=h("div","filter multiselectcb clickable","sms2","all",null);b.inserted||(b.type="checkbox",b.addEventListener("click",t.multiselect.un_selectAll),c.addEventListener("click",function(){t.multiselect.toggleRow()}));var d=0,n=[{name:e.getMessage("__Please_choose__"),value:0},{name:e.getMessage("Enable"),value:1},{name:e.getMessage("Disable"),value:2},{name:e.getMessage("Toggle_Enable"),value:7}];
(y.RUNTIME.CAN_SAVEAS_ZIP||"undefined"!==typeof Blob)&&n.push({name:e.getMessage("Export"),value:3});n=n.concat([{name:e.getMessage("Trigger_Update"),value:5},{name:e.getMessage("Factory_Reset"),value:8},{name:e.getMessage("Remove"),value:6}]);n=q.createDropDown(e.getMessage("Apply_this_action_to_the_selected_scripts"),{value:0,uuid:"sms-select",name:"select"},n,function(){0==this.value?g.setAttribute("disabled","true"):g.removeAttribute("disabled");d=this.value});n.elem.setAttribute("class","float");
n.elem.setAttribute("style","display: inline-block;");var g=q.createButton("MultiSelectButton","start_button",e.getMessage("Start"),function(){if(0==d)console.log("option: ?!?!");else{var a=null;6==d?a=e.getMessage("Really_delete_the_selected_items_"):8==d&&(a=e.getMessage("Really_factory_reset_the_selected_items_"));if(!a||confirm(a)){for(var b=document.getElementsByName("scriptselectors"),c=[],a=0;a<b.length;a++)c.push(b[a]);for(var b={},g,h=!1,n=100,a=0;a<c.length;a++)if(c[a].checked&&!c[a].is_hidden)if(1==
d||2==d||7==d){g="n"==c[a].s_type?"switchNativeEnabled":"switchEnabled";var q;if(7==d){var t=T[c[a].s_id]?T[c[a].s_id].script:null;t&&(q=!t.enabled)}else q=1==d;void 0!==q&&(H(c[a].s_id,g,null,q,!1),h=!0)}else 3==d?b[c[a].s_id]=!0:5==d?(g="scriptUpdate",H(c[a].s_id,g)):6==d?(g="deleteScript",H(c[a].s_id,g,null,!0),h=!0,n=1500):8==d&&(g="fullReset",H(c[a].s_id,g),h=!0,n=1500);3==d&&(p.wait(),va(b,{storage:ba}).then(function(a){p.wait();return y.RUNTIME.CAN_SAVEAS_ZIP?X.zip.create(a.scripts).progress(p.wait):
X.json.create(a.scripts).then(function(a){return new Blob([a],{type:"text/plain"})})}).then(function(a){return pa().done(function(){saveAs(a,"tampermonkey_scripts"+(y.RUNTIME.CAN_SAVEAS_ZIP?".zip":".txt"))})}).always(function(){p.hide()}));h&&(p.wait(e.getMessage("Please_wait___")),window.setTimeout(function(){cb()},n))}}});g.setAttribute("class","action_button");g.setAttribute("disabled","true");a=v("div",a.name,a.id,"actions");a.setAttribute("style","display: inline-block;");a.appendChild(n.elem);
a.appendChild(g);n=q.createButton("MultiSelectButton","close_button",e.getMessage("Close"),function(){t.multiselect.toggleRow(!1)});n.setAttribute("style","right: 10px; position: absolute;");$(n).addClass("close_button");return{selAllm:b,selAll:c,actionBox:a,close:n}};(function(){var a=0;t.multiselect={};var b=!1;t.multiselect.toggleRow=function(a,d){var e=$(".multiselect");void 0===a&&(a=!b);a?(b=!0,e.addClass("multiselectvisible"),t.filter.onShow(d)):(b=!1,e.removeClass("multiselectvisible"),t.filter.onHide(),
t.multiselect.un_selectAll(!1))};t.multiselect.single_click=function(){for(var b=0,d=document.getElementsByName("scriptselectors"),e=!0,g=!1,f=!1,h=!0,k=!1,q=!1,m=0,p=0;p<d.length;p++){"n"==d[p].s_type?(f=!0,e=e&&d[p].checked,g=g||d[p].checked):"s"==d[p].s_type&&(q=!0,h=h&&d[p].checked,k=k||d[p].checked);var u=$(d[p]).closest("tr");d[p].checked?(m++,u.addClass("selected")):u.removeClass("selected")}!f||!e||q&&!h&&k||(b+=1);!q||!h||f&&!e&&g||(b+=2);b!=a&&(a=b,$(".multiselectcb").prop("checked",0!=
b?"checked":""));m&&t.multiselect.toggleRow(!0);t.multiselect.checkScroll&&t.multiselect.checkScroll()};t.multiselect.un_selectAll=function(b){3<++a&&(a=0);var d=!1,e=0,g=document.getElementsByName("scriptselectors");I=[];!0===b&&(a=2);for(var f=0;f<g.length;f++){var h=$(g[f]).closest("tr");!1===b?(g[f].checked=!1,h.removeClass("selected")):(0!=f||1!=a&&3!=a||"s"!=g[f].s_type||3<++a&&(a=0),d|="s"==g[f].s_type,g[f].checked=3==a||1==a&&"n"==g[f].s_type||2==a&&"s"==g[f].s_type,g[f].checked?(e++,h.addClass("selected"),
I.push(g[f])):h.removeClass("selected"));e&&t.multiselect.toggleRow(!0)}void 0===b?1<a&&!d&&(a=0):b||(a=0);$(".multiselectcb").prop("checked",0!=a?"checked":"")}})();var ia=null,P=function(){ia&&(window.clearTimeout(ia),ia=null)},wa=null,Q=function(){La(e.getMessage("Operation_completed_successfully"),"button_ok","notice")},bb=function(a,b){void 0===b&&(b="button_ok");La(a,b,"information",8E3)},ab=function(a,b){void 0===b&&(b="error");La(a,b,"warning",8E3)},La=function(a,b,c,d){void 0===d&&(d=3E3);
wa&&$(wa).remove();wa=Wa({text:a,image:b,class:c,delay:500,timeout:d,done:function(){wa=null}})},R=function(){ia||(ia=window.setTimeout(function(){ia=null;p.wait(e.getMessage("Please_wait___"))},500))},qa=null,ja=null,M=function(a,b){null!=qa?(window.clearTimeout(qa),qa=null,M(a?a:ja.items,a?b:ja.with_scripts)):(ja={items:a,with_scripts:b},qa=window.setTimeout(function(){qa=null;ja.with_scripts&&(T={});ua(null,ja.items,null,G);p.hide();Da();ja=null},50))},Hb=function(a){var b=D();sendMessage({method:"determineScriptsToRun",
url:a},function(a){b.resolve(a.scripts||[])});return b.promise()},ha=function(a,b,c){var d=D();sendMessage({method:"begEvent",action:a,type:b,extra:c},function(a){d.resolve(a)});return d.promise()},Fa=function(a,b){try{var c=function(){b&&y.OPTIONPAGE.CLOSE_ALLOWED&&window.close()};b?sendMessage({method:"newTab",url:a},c):rea.tabs.getSelected(null,function(d){rea.tabs.sendMessage(d.id,{method:"loadUrl",url:a,newtab:b},c)})}catch(d){console.log("lU: "+d.message)}},qb=function(a,b){var c=D();try{R(),
sendMessage({method:"installScript",url:a,reload:b.reload},function(a){P();a.items?(Q(),M(a.items,!1)):p.hide();a.err?c.reject(a):c.resolve(a)})}catch(d){console.log("sS: "+d.message),c.reject({err:d.message})}return c.promise()},ob=function(a,b){var c=D();try{R(),sendMessage({method:"exportToJson",ids:a,options:b},function(a){Q();P();p.hide();a.json?c.resolve(a.json):c.reject()})}catch(d){console.log("eJ: "+d.message),c.reject({})}return c.promise()},Ha=function(a,b){var c=D();try{R(),sendMessage({method:"importFromJson",
json:a,reload:b.reload},function(a){P();a.reload?window.setTimeout(function(){rea.page.reload()},500):a.items?(Q(),M(a.items,!0)):p.hide();a.err?c.reject(a):c.resolve(a)})}catch(d){console.log("sS: "+d.message),c.reject({err:d.message})}return c.promise()},Ja=function(a,b,c){var d=D();void 0===c.reload&&(c.reload=!0);try{var e=c.new_url&&c.new_url!=c.old_url?c.new_url:"";c.auto_save||R();sendMessage({method:"saveScript",uuid:a,code:b,clean:c.clean,force:c.force,new_script:c.new_script,auto_save:c.auto_save,
force_url:e,lastModified:c.lastModified,reload:c.reload},function(a){c.auto_save||(Q(),P());a.items?M(a.items,!0):p.hide();!b&&c.reload&&p.hide();d.resolve(a)})}catch(g){console.log("sS: "+g.message),d.reject({err:g.message})}return d.promise()},ta=function(a,b,c){var d=D();try{R(),sendMessage({method:"setOption",name:a,value:b},function(a){P();Q();u=a.options||u;!c&&a.items?M(a.items,!1):p.hide();d.resolve(a)})}catch(e){console.log("sO: "+e.message),d.reject({err:e.message})}return d.promise()},
kb=function(a,b,c){var d=D();try{R(),sendMessage({method:"buttonPress",name:a,data:b},function(a){P();!c&&a.items?(Q(),M(a.items,!1)):p.hide();d.resolve(a)})}catch(e){console.log("sO: "+e.message),d.reject({err:e.message})}return d.promise()},oa=function(a,b){R();sendMessage({method:"loadTree",complete:a.complete,uuid:a.uuid,referrer:a.referrer},function(a){P();u=a.options||u;a.i18n&&e.setLocale(a.i18n);a.items?a.begging&&E.push(function(){window.setTimeout(Xa,100)}):a.error?alert(a.error):confirm(e.getOriginalMessage("An_internal_error_occured_Do_you_want_to_visit_the_forum_"))&&
(window.location.href="http://tampermonkey.net/bug");b(a)})},cb=function(){oa({referrer:"options.scripts"},function(a){a.items?M(a.items,!0):p.hide()})},ga=function(a,b,c){void 0==c&&(c=!0);try{a={method:"modifyScriptOptions",uuid:a,reload:c};for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);R();sendMessage(a,function(a){P();u=a.options||u;a.i18n&&e.setLocale(a.i18n);Q();a.items?M(a.items,!0):p.hide()})}catch(h){console.log("mSo: "+h.message)}},Ka=function(a,b,c,d){void 0===d&&(d=!0);try{a={method:"modifyNativeScript",
nid:a,actionid:b,value:c,reload:d},R(),sendMessage(a,function(a){P();Q();a.items?M(a.items,!0):p.hide()})}catch(e){console.log("mSo: "+e.message)}},Za=function(a,b,c){try{a={method:"saveStorageKey",uuid:a,key:b,value:c,id:"options"},R(),sendMessage(a,function(){P();Q();p.hide()})}catch(d){console.log("sSk: "+d.message)}},yb=function(a,b){try{R(),sendMessage({method:"buttonPress",name:"externals_delete",scriptuid:a,safe_url:b},function(a){P();Q();a.items?M(a.items,!1):p.hide()})}catch(c){console.log("dEx: "+
c.message)}},zb=function(a,b){try{sendMessage({method:"buttonPress",name:"run_script_updates",scriptuid:a},function(a){Q();b&&b(a.updatable)})}catch(c){console.log("rSu: "+c.message)}},Ab=function(a,b,c){try{sendMessage({method:"reportAnIssue",uuid:a,to:b},function(){c&&c()})}catch(d){console.log("rRi: "+d.message)}};rea.extension.onMessage.addListener(function(a,b,c){if("updateOptions"==a.method)u=a.options||u,M(a.items,!1),c({});else if("confirm"==a.method)x.confirm(a.msg,function(a){c({confirm:a})});
else if("showMsg"==a.method)x.alert(a.msg),c({});else return!1;return!0});(function(){oa({referrer:"options"},function(a){sb();if(a.options&&a.options.layout_user_css&&"reset"!==W.layout){var b=document.createElement("style");b.innerHTML=a.options.layout_user_css;(document.head||document.body||document.documentElement||document).appendChild(b)}a.items?M(a.items,!1):p.hide()})})()})});
