MediaWiki:AddCategories.js

!function($,mw){var conf=mw.config.values;if((!window.HotCat||window.HotCat.nodeName)&&"edit"!==conf.wgAction){var HC=window.HotCat={messages:{cat_removed:"removed ",template_removed:"removed ",cat_added:"added ",cat_keychange:'new key for : "$2"',cat_notFound:'Category "$1" not found',cat_exists:'Category "$1" already exists; not added.',cat_resolved:" (redirect resolved)",uncat_removed:"removed ",separator:"; ",prefix:"",using:"",multi_change:"$1 categories",commit:"Save",ok:"OK",cancel:"Cancel",multi_error:"Could not retrieve the page text from the server. Therefore, your category changes cannot be saved. We apologize for the inconvenience.",short_catchange:null},categories:"Categories",disambig_category:"Disambiguation",redir_category:"Category redirects",links:{change:"(±)",remove:"(−)",add:"(+)",restore:"(×)",undo:"(×)",down:"(↓)",up:"(↑)"},changeTag:conf.wgUserName?"HotCat":"",tooltips:{change:"Modify",remove:"Remove",add:"Add a new category",restore:"Undo changes",undo:"Undo changes",down:"Open for modifying and display subcategories",up:"Open for modifying and display parent categories"},addmulti:" ++ ",multi_tooltip:"Modify several categories",disable:function{var e=conf.wgNamespaceNumber,t=conf.wgNamespaceIds;return e<0||10===e||828===e||8===e||6===e&&!conf.wgArticleId||2===e&&/\.(js|css)$/.test(conf.wgTitle)||t&&(e===t.creator||e===t.timedtext||e===t.institution)},uncat_regexp:/\{\{\s*[Uu]ncategorized\s*[^}]*\}\}\s*(\s*)?/g,existsYes:"//upload.wikimedia.org/wikipedia/commons/thumb/b/be/P_yes.svg/20px-P_yes.svg.png",existsNo:"//upload.wikimedia.org/wikipedia/commons/thumb/4/42/P_no.svg/20px-P_no.svg.png",template_categories:{},engine_names:{searchindex:"Search index",pagelist:"Page list",combined:"Combined search",subcat:"Subcategories",parentcat:"Parent categories"},capitalizePageNames:null,upload_disabled:!1,blacklist:null,bg_changed:"#FCA",no_autocommit:!1,del_needs_diff:!1,suggest_delay:100,editbox_width:40,suggestions:"combined",fixed_search:!1,use_up_down:!0,listSize:5,single_minor:!0,dont_add_to_watchlist:!1,shortcuts:null,addShortcuts:function(e){if(e)for(var t in window.HotCat.shortcuts=window.HotCat.shortcuts||{},e)if(e.hasOwnProperty(t)&&"string"==typeof t){var i=e[t];"string"==typeof i&&(t=t.replace(/^\s+|\s+$/g,""),i=i.replace(/^\s+|\s+$/g,""),t.length&&i.length&&(window.HotCat.shortcuts[t]=i))}}},ua=navigator.userAgent.toLowerCase,is_webkit=/applewebkit\/\d+/.test(ua)&&ua.indexOf("spoofer")<0,cat_prefix=null,noSuggestions=!1,loadTrigger=new LoadTrigger(2);loadJS("MediaWiki:Gadget-HotCat.js/local_defaults",loadTrigger.loaded),"en"!==conf.wgUserLanguage?(void 0===window.hotcat_translations_from_commons&&(window.hotcat_translations_from_commons=!0),window.hotcat_translations_from_commons&&conf.wgServer.indexOf("//commons")<0?loadURI("//commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-HotCat.js/"+conf.wgUserLanguage+"&action=raw&ctype=text/javascript",loadTrigger.loaded):loadJS("MediaWiki:Gadget-HotCat.js/"+conf.wgUserLanguage,loadTrigger.loaded)):loadTrigger.loaded;var wikiTextBlank="[\\t _\\xA0\\u1680\\u180E\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000]+",wikiTextBlankRE=new RegExp(wikiTextBlank,"g"),wikiTextBlankOrBidi="[\\t _\\xA0\\u1680\\u180E\\u2000-\\u200B\\u200E\\u200F\\u2028-\\u202F\\u205F\\u3000]*",formattedNamespaces=conf.wgFormattedNamespaces,namespaceIds=conf.wgNamespaceIds;HC.category_canonical=formattedNamespaces[14],HC.category_regexp=autoLocalize(14,"category"),formattedNamespaces[10]&&(HC.template_regexp=autoLocalize(10,"template"));var substitute=substituteFactory,replaceShortcuts=(replaceHash=substituteFactory({indicator:"#",lbrace:"[",rbrace:"]"}),function(e,t){var i=replaceHash(e,t);return HC.capitalizePageNames?capitalize(i):i}),replaceHash,findCatsRE=new RegExp("\\[\\["+wikiTextBlankOrBidi+"(?:"+HC.category_regexp+")"+wikiTextBlankOrBidi+":[^\\]]+\\]\\]","g"),interlanguageRE=null,catLine=null,onUpload=!1,editors=[],commitButton=null,commitForm=null,multiSpan=null,pageText=null,pageTime=null,pageWatched=!1,watchCreate=!1,watchEdit=!1,minorEdits=!1,editToken=null,is_rtl=!1,serverTime=null,lastRevId=null,pageTextRevId=null,conflictingUser=null,newDOM=!1,saveInProgress=!1,suggestionEngines={opensearch:{uri:"/api.php?format=json&action=opensearch&namespace=14&limit=30&search=Category:$1",handler:function(e,t){if(e&&e.length>=2){var i=e[0].substring(e[0].indexOf(":")+1),n=e[1],s=!1;cat_prefix||(cat_prefix=new RegExp("^("+HC.category_regexp+"):"));for(var a=0;a1?(n[a]=n[a].substring(n[a].indexOf(":")+1),i===n[a]&&(s=!0)):(n.splice(a,1),a--)}return n.exists=s,t!==i&&(n.normalized=i),n}return null}},internalsearch:{uri:"/api.php?format=json&action=query&list=allpages&apnamespace=14&aplimit=30&apfrom=$1&apprefix=$1",handler:function(e){if(e&&e.query&&e.query.allpages){for(var t=e.query.allpages,i=0;i<t.length;i++)t[i]=t[i].title.substring(t[i].title.indexOf(":")+1);return t}return null}},exists:{uri:"/api.php?format=json&action=query&prop=info&titles=Category:$1",handler:function(e,t){if(e&&e.query&&e.query.pages&&!e.query.pages[-1])for(var i in e.query.pages){var n=e.query.pages[i].title,s=[n=n.substring(n.indexOf(":")+1)];return s.exists=!0,t!==n&&(s.normalized=n),s}return null}},subcategories:{uri:"/api.php?format=json&action=query&list=categorymembers&cmtype=subcat&cmlimit=max&cmtitle=Category:$1",handler:function(e){if(e&&e.query&&e.query.categorymembers){for(var t=e.query.categorymembers,i=0;i<t.length;i++)t[i]=t[i].title.substring(t[i].title.indexOf(":")+1);return t}return null}},parentcategories:{uri:"/api.php?format=json&action=query&prop=categories&titles=Category:$1&cllimit=max",handler:function(e){if(e&&e.query&&e.query.pages)for(var t in e.query.pages)if(e.query.pages[t].categories){for(var i=e.query.pages[t].categories,n=0;n<i.length;n++)i[n]=i[n].title.substring(i[n].title.indexOf(":")+1);return i}return null}}},suggestionConfigs={searchindex:{name:"Search index",engines:["opensearch"],cache:{},show:!0,temp:!1,noCompletion:!1},pagelist:{name:"Page list",engines:["internalsearch","exists"],cache:{},show:!0,temp:!1,noCompletion:!1},combined:{name:"Combined search",engines:["opensearch","internalsearch"],cache:{},show:!0,temp:!1,noCompletion:!1},subcat:{name:"Subcategories",engines:["subcategories"],cache:{},show:!0,temp:!0,noCompletion:!0},parentcat:{name:"Parent categories",engines:["parentcategories"],cache:{},show:!0,temp:!0,noCompletion:!0}};CategoryEditor.UNCHANGED=0,CategoryEditor.OPEN=1,CategoryEditor.CHANGE_PENDING=2,CategoryEditor.CHANGED=3,CategoryEditor.DELETED=4;var dummyElement=make(" ",!0),BS=8,TAB=9,RET=13,ESC=27,SPACE=32,PGUP=33,PGDOWN=34,UP=38,DOWN=40,DEL=46,IME=229;CategoryEditor.prototype={initialize:function(e,t,i,n,s){if(t)is_rtl&&(t.dir="rtl"),this.isAddCategory=!1,this.catLink=t.firstChild,this.originalCategory=i,this.originalKey=n&&n.length>1?n.substr(1):null,this.originalExists=!hasClass(this.catLink,"new"),this.makeLinkSpan,!this.originalExists&&this.upDownLinks&&(this.upDownLinks.style.display="none"),t.appendChild(this.linkSpan);else{this.isAddCategory=!0,this.originalCategory="",this.originalKey=null,this.originalExists=!1,newDOM||((t=make("span")).className="noprint",n?(t.appendChild(make(" | ",!0)),i?(i.parentNode.insertBefore(t,i.nextSibling),i=i.nextSibling):e.appendChild(t)):e.firstChild&&(t.appendChild(make(" ",!0)),e.appendChild(t))),this.linkSpan=make("span"),this.linkSpan.className="noprint nopopups hotcatlink";var a=make("a");a.href="#catlinks",a.onclick=this.open.bind(this),a.appendChild(make(HC.links.add,!0)),a.title=HC.tooltips.add,this.linkSpan.appendChild(a),(t=make(newDOM?"li":"span")).className="noprint",is_rtl&&(t.dir="rtl"),t.appendChild(this.linkSpan),i?i.parentNode.insertBefore(t,i.nextSibling):e.appendChild(t),this.normalLinks=null,this.undelLink=null,this.catLink=null}this.originalHidden=s,this.line=e,this.engine=HC.suggestions,this.span=t,this.currentCategory=this.originalCategory,this.currentExists=this.originalExists,this.currentHidden=this.originalHidden,this.currentKey=this.originalKey,this.state=CategoryEditor.UNCHANGED,this.lastSavedState=CategoryEditor.UNCHANGED,this.lastSavedCategory=this.originalCategory,this.lastSavedKey=this.originalKey,this.lastSavedExists=this.originalExists,this.lastSavedHidden=this.originalHidden,this.catLink&&this.currentKey&&(this.catLink.title=this.currentKey),editors[editors.length]=this},makeLinkSpan:function{this.normalLinks=make("span");var e=null;this.originalCategory&&this.originalCategory.length&&((e=make("a")).href="#catlinks",e.onclick=this.remove.bind(this),e.appendChild(make(HC.links.remove,!0)),e.title=HC.tooltips.remove,this.normalLinks.appendChild(make(" ",!0)),this.normalLinks.appendChild(e)),HC.template_categories[this.originalCategory]||((e=make("a")).href="#catlinks",e.onclick=this.open.bind(this),e.appendChild(make(HC.links.change,!0)),e.title=HC.tooltips.change,this.normalLinks.appendChild(make(" ",!0)),this.normalLinks.appendChild(e),!noSuggestions&&HC.use_up_down&&(this.upDownLinks=make("span"),(e=make("a")).href="#catlinks",e.onclick=this.down.bind(this),e.appendChild(make(HC.links.down,!0)),e.title=HC.tooltips.down,this.upDownLinks.appendChild(make(" ",!0)),this.upDownLinks.appendChild(e),(e=make("a")).href="#catlinks",e.onclick=this.up.bind(this),e.appendChild(make(HC.links.up,!0)),e.title=HC.tooltips.up,this.upDownLinks.appendChild(make(" ",!0)),this.upDownLinks.appendChild(e),this.normalLinks.appendChild(this.upDownLinks))),this.linkSpan=make("span"),this.linkSpan.className="noprint nopopups hotcatlink",this.linkSpan.appendChild(this.normalLinks),this.undelLink=make("span"),this.undelLink.className="nopopups hotcatlink",this.undelLink.style.display="none",(e=make("a")).href="#catlinks",e.onclick=this.restore.bind(this),e.appendChild(make(HC.links.restore,!0)),e.title=HC.tooltips.restore,this.undelLink.appendChild(make(" ",!0)),this.undelLink.appendChild(e),this.linkSpan.appendChild(this.undelLink)},invokeSuggestions:function(e){this.engine&&suggestionConfigs[this.engine]&&suggestionConfigs[this.engine].temp&&!e&&(this.engine=HC.suggestions),this.state=CategoryEditor.CHANGE_PENDING;var t=this;window.setTimeout(function{t.textchange(e)},HC.suggest_delay)},makeForm:function{var e=make("form");e.method="POST",e.onsubmit=this.accept.bind(this),this.form=e;var t=this,i=make("input");if(i.type="text",i.size=HC.editbox_width,!noSuggestions){i.onkeyup=function(e){var i=e.keyCode||0;if(!t.ime||t.lastKey!==IME||t.usesComposition||i!==TAB&&i!==RET&&i!==ESC&&i!==SPACE||(t.ime=!1),t.ime)return!0;if(i===UP||i===DOWN||i===PGUP||i===PGDOWN){if(0===t.keyCount)return t.processKey(e)}else{if(i===ESC&&t.lastKey!==IME&&!t.resetKeySelection)return void t.cancel;t.invokeSuggestions(i===BS||i===DEL||i===ESC)}return!0},i.onkeydown=function(e){var i=e.keyCode||0;return t.lastKey=i,t.keyCount=0,t.ime||i!==IME||t.usesComposition?t.ime&&i!==IME&&!(i>=16&&i<=20||i>=91&&i<=93||144===i)&&(t.ime=!1):t.ime=!0,!!t.ime||(i===RET?t.accept(e):i!==ESC||evtKill(e))},i.onkeypress=function(e){return t.keyCount++,t.processKey(e)},$(i).on("focus",function{makeActive(t)}),$(i).on(void 0!==i.onbeforedeactivate&&i.createTextRange?"beforedeactivate":"blur",this.saveView.bind(this));try{$(i).on("compositionstart",function{t.lastKey=IME,t.usesComposition=!0,t.ime=!0}),$(i).on("compositionend",function{t.lastKey=IME,t.usesComposition=!0,t.ime=!1}),$(i).on("textInput",function{t.ime=!1,t.invokeSuggestions(!1)})}catch(e){}$(i).on("blur",function{t.usesComposition=!1,t.ime=!1})}this.text=i,this.icon=make("img");var n=null;if(!noSuggestions&&((n=make("select")).onclick=function{t.highlightSuggestion(0)&&t.textchange(!1,!0)},n.ondblclick=function(e){t.highlightSuggestion(0)&&t.accept(e)},n.onchange=function{t.highlightSuggestion(0),t.text.focus},n.onkeyup=function(e){e.keyCode===ESC?(t.resetKeySelection,t.text.focus,window.setTimeout(function{t.textchange(!0)},HC.suggest_delay)):e.keyCode===RET&&t.accept(e)},!HC.fixed_search)){var s=make("select");for(var a in suggestionConfigs)if(suggestionConfigs[a].show){var o=make("option");o.value=a,a===this.engine&&(o.selected=!0),o.appendChild(make(suggestionConfigs[a].name,!0)),s.appendChild(o)}s.onchange=function{t.engine=t.engineSelector.options[t.engineSelector.selectedIndex].value,t.text.focus,t.textchange(!0,!0)},this.engineSelector=s}function l(e,t){var i=null;if(onUpload&&void 0!==window.UFUI&&void 0!==window.UIElements&&UFUI.getLabel instanceof Function)try{for(i=UFUI.getLabel(e,!0);i&&3!==i.nodeType;)i=i.firstChild}catch(e){i=null}return i&&i.data?i.data:t}this.list=n;var r=make("input");r.type="button",r.value=l("wpOkUploadLbl",HC.messages.ok),r.onclick=this.accept.bind(this),this.ok=r;var c=make("input");c.type="button",c.value=l("wpCancelUploadLbl",HC.messages.cancel),c.onclick=this.cancel.bind(this),this.cancelButton=c;var u=make("span");u.className="hotcatinput",u.style.position="relative",u.appendChild(i),u.appendChild(make(" ",!0)),u.style.whiteSpace="nowrap",n&&u.appendChild(n),this.engineSelector&&u.appendChild(this.engineSelector),noSuggestions||u.appendChild(this.icon),u.appendChild(r),u.appendChild(c),e.appendChild(u),e.style.display="none",this.span.appendChild(e)},display:function(e){if(this.isAddCategory&&!onUpload&&new CategoryEditor(this.line,null,this.span,!0),!commitButton&&!onUpload)for(var t=0;t<editors.length;t++)if(editors[t].state!==CategoryEditor.UNCHANGED){setMultiInput;break}this.form||this.makeForm,this.list&&(this.list.style.display="none"),this.engineSelector&&(this.engineSelector.style.display="none"),this.currentCategory=this.lastSavedCategory,this.currentExists=this.lastSavedExists,this.currentHidden=this.lastSavedHidden,this.currentKey=this.lastSavedKey,this.icon.src=this.currentExists?HC.existsYes:HC.existsNo,this.text.value=this.currentCategory+(null!==this.currentKey?"|"+this.currentKey:""),this.originalState=this.state,this.lastInput=this.currentCategory,this.inputExists=this.currentExists,this.state=this.state===CategoryEditor.UNCHANGED?CategoryEditor.OPEN:CategoryEditor.CHANGE_PENDING,this.lastSelection={start:this.currentCategory.length,end:this.currentCategory.length},this.showsList=!1,this.catLink&&(this.catLink.style.display="none"),this.linkSpan.style.display="none",this.form.style.display="inline",this.ok.disabled=!1;var i=evtKill(e);return this.text.focus,this.text.readOnly=!1,checkMultiInput,i},show:function(e,t,i){var n=this.display(e);return this.lastSavedCategory.length?(this.text.readOnly=!!i,this.engine=t,this.textchange(!1,!0),forceRedraw,n):n},open:function(e){return this.show(e,this.engine&&suggestionConfigs[this.engine].temp?HC.suggestions:this.engine)},down:function(e){return this.show(e,"subcat",!0)},up:function(e){return this.show(e,"parentcat")},cancel:function{if(!this.isAddCategory||onUpload){if(this.inactivate,this.form.style.display="none",this.catLink&&(this.catLink.style.display=""),this.linkSpan.style.display="",this.state=this.originalState,this.currentCategory=this.lastSavedCategory,this.currentKey=this.lastSavedKey,this.currentExists=this.lastSavedExists,this.currentHidden=this.lastSavedHidden,this.catLink&&(this.currentKey&&this.currentKey.length?this.catLink.title=this.currentKey:this.catLink.title=""),this.state===CategoryEditor.UNCHANGED)this.catLink&&(this.catLink.style.backgroundColor="transparent");else if(!onUpload)try{this.catLink.style.backgroundColor=HC.bg_changed}catch(e){}checkMultiInput,forceRedraw}else this.removeEditor},removeEditor:function{if(!newDOM){var e=this.span.nextSibling;e&&e.parentNode.removeChild(e)}this.span.parentNode.removeChild(this.span);for(var t=0;t<editors.length;t++)if(editors[t]===this){editors.splice(t,1);break}checkMultiInput},rollback:function(e){return this.undoLink.parentNode.removeChild(this.undoLink),this.undoLink=null,this.currentCategory=this.originalCategory,this.currentKey=this.originalKey,this.currentExists=this.originalExists,this.currentHidden=this.originalHidden,this.lastSavedCategory=this.originalCategory,this.lastSavedKey=this.originalKey,this.lastSavedExists=this.originalExists,this.lastSavedHidden=this.originalHidden,this.state=CategoryEditor.UNCHANGED,this.currentCategory&&this.currentCategory.length?(this.catLink.removeChild(this.catLink.firstChild),this.catLink.appendChild(make(this.currentCategory,!0)),this.catLink.href=wikiPagePath(HC.category_canonical+":"+this.currentCategory),this.catLink.title=this.currentKey||"",this.catLink.className=this.currentExists?"":"new",this.catLink.style.backgroundColor="transparent",this.upDownLinks&&(this.upDownLinks.style.display=this.currentExists?"":"none"),checkMultiInput):this.removeEditor,evtKill(e)},inactivate:function{this.list&&(this.list.style.display="none"),this.engineSelector&&(this.engineSelector.style.display="none"),this.is_active=!1},acceptCheck:function(e){this.sanitizeInput;var t=this.text.value.split("|"),i=null;t.length>1&&(i=t[1]);var n=t[0].replace(/_/g," ").replace(/^\s+|\s+$/g,"");return HC.capitalizePageNames&&(n=capitalize(n)),this.lastInput=n,(n=replaceShortcuts(n,HC.shortcuts)).length?!e&&(14===conf.wgNamespaceNumber&&n===conf.wgTitle||HC.blacklist&&HC.blacklist.test(n))?(this.cancel,!1):(this.currentCategory=n,this.currentKey=i,this.currentExists=this.inputExists,!0):(this.cancel,!1)},accept:function(e){this.noCommit=0!=(1&evtKeys(e));var t=evtKill(e);if(this.acceptCheck){var i=[this],n=this.currentCategory;resolveMulti(i,function(e){e[0].dab?showDab(e[0]):e[0].acceptCheck(!0)&&e[0].commit(e[0].currentCategory!==n?HC.messages.cat_resolved.replace(/\$1/g,n):null)})}return t},close:function{if(this.catLink||(this.catLink=make("a"),this.catLink.appendChild(make("foo",!0)),this.catLink.style.display="none",this.span.insertBefore(this.catLink,this.span.firstChild.nextSibling)),this.catLink.removeChild(this.catLink.firstChild),this.catLink.appendChild(make(this.currentCategory,!0)),this.catLink.href=wikiPagePath(HC.category_canonical+":"+this.currentCategory),this.catLink.className=this.currentExists?"":"new",this.lastSavedCategory=this.currentCategory,this.lastSavedKey=this.currentKey,this.lastSavedExists=this.currentExists,this.lastSavedHidden=this.currentHidden,this.inactivate,this.form.style.display="none",this.catLink.title=this.currentKey||"",this.catLink.style.display="",this.isAddCategory&&(onUpload&&new CategoryEditor(this.line,null,this.span,!0),this.isAddCategory=!1,this.linkSpan.parentNode.removeChild(this.linkSpan),this.makeLinkSpan,this.span.appendChild(this.linkSpan)),!this.undoLink){var e=make("span"),t=make("a");if(t.href="#catlinks",t.onclick=this.rollback.bind(this),t.appendChild(make(HC.links.undo,!0)),t.title=HC.tooltips.undo,e.appendChild(make(" ",!0)),e.appendChild(t),this.normalLinks.appendChild(e),this.undoLink=e,!onUpload)try{this.catLink.style.backgroundColor=HC.bg_changed}catch(e){}}this.upDownLinks&&(this.upDownLinks.style.display=this.lastSavedExists?"":"none"),this.linkSpan.style.display="",this.state=CategoryEditor.CHANGED,checkMultiInput,forceRedraw},commit:function{if(this.currentCategory===this.originalCategory&&(this.currentKey===this.originalKey||null===this.currentKey&&!this.originalKey.length)||14===conf.wgNamespaceNumber&&this.currentCategory===conf.wgTitle||HC.blacklist&&HC.blacklist.test(this.currentCategory))this.cancel;else if(this.close,!commitButton&&!onUpload){var e=this;initiateEdit(function(t){performChanges(t,e)},function(e){alert(e)})}},remove:function(e){return this.doRemove(1&evtKeys(e)),evtKill(e)},doRemove:function(e){if(this.isAddCategory)this.cancel;else{if(!commitButton&&!onUpload)for(var t=0;t<editors.length;t++)if(editors[t].state!==CategoryEditor.UNCHANGED){setMultiInput;break}if(commitButton){this.catLink.title="",this.catLink.style.cssText+="; text-decoration : line-through !important;";try{this.catLink.style.backgroundColor=HC.bg_changed}catch(e){}this.originalState=this.state,this.state=CategoryEditor.DELETED,this.normalLinks.style.display="none",this.undelLink.style.display="",checkMultiInput}else if(onUpload)this.removeEditor;else{this.originalState=this.state,this.state=CategoryEditor.DELETED,this.noCommit=e||HC.del_needs_diff;var i=this;initiateEdit(function(e){performChanges(e,i)},function(e){i.state=i.originalState,alert(e)})}}},restore:function(e){if(this.catLink.title=this.currentKey||"",this.catLink.style.textDecoration="",this.state=this.originalState,this.state===CategoryEditor.UNCHANGED)this.catLink.style.backgroundColor="transparent";else try{this.catLink.style.backgroundColor=HC.bg_changed}catch(e){}return this.normalLinks.style.display="",this.undelLink.style.display="none",checkMultiInput,evtKill(e)},selectEngine:function(e){if(this.engineSelector)for(var t=0;t<this.engineSelector.options.length;t++)this.engineSelector.options[t].selected=this.engineSelector.options[t].value===e},sanitizeInput:function{var e=this.text.value||"";e=e.replace(/^(\s|_)+/,""),new RegExp("^("+HC.category_regexp+"):").test(e)&&(e=e.substring(e.indexOf(":")+1).replace(/^(\s|_)+/,"")),HC.capitalizePageNames&&(e=capitalize(e)),null!==this.text.value&&this.text.value!==e&&(this.text.value=e)},makeCall:function(e,t,i,n,s){var a=t,o=i,l=n,r=s,c=this;function u{a.callsMade++,a.callsMade===a.nofCalls&&(a.exists&&(a.allTitles.exists=!0),a.normalized&&(a.allTitles.normalized=a.normalized),a.dontCache||suggestionConfigs[a.engineName].cache[r]||(suggestionConfigs[a.engineName].cache[r]=a.allTitles),c.text.readOnly=!1,a.cancelled||c.showSuggestions(a.allTitles,a.noCompletion,l,a.engineName),a===c.callbackObj&&(c.callbackObj=null),a=void 0)}$.getJSON(e,function(e){var t=o.handler(e,r);t&&t.length&&(null===a.allTitles?a.allTitles=t:a.allTitles=a.allTitles.concat(t),t.exists&&(a.exists=!0),t.normalized&&(a.normalized=t.normalized)),u}).fail(function(e){e||(noSuggestions=!0),a.dontCache=!0,u})},callbackObj:null,textchange:function(e,t){makeActive(this),this.sanitizeInput;var i=this.text.value,n=i.indexOf("|");if(n>=0?(this.currentKey=i.substring(n+1),i=i.substring(0,n)):this.currentKey=null,this.lastInput!==i||t){if(this.lastInput!==i&&checkMultiInput,this.lastInput=i,this.lastRealInput=i,this.ok.disabled=i.length&&HC.blacklist&&HC.blacklist.test(i),noSuggestions)return this.list&&(this.list.style.display="none"),this.engineSelector&&(this.engineSelector.style.display="none"),void(this.icon&&(this.icon.style.display="none"));if(i.length){var s=i.replace(/[\u200E\u200F\u202A-\u202E]/g,"").replace(wikiTextBlankRE," ");if((s=(s=replaceShortcuts(s,HC.shortcuts)).replace(/^\s+|\s+$/g,"")).length){this.callbackObj&&(this.callbackObj.cancelled=!0);var a=suggestionConfigs[this.engine]?this.engine:"combined";if(e=e||suggestionConfigs[a].noCompletion,suggestionConfigs[a].cache[s])this.showSuggestions(suggestionConfigs[a].cache[s],e,i,a);else{var o=suggestionConfigs[a].engines;this.callbackObj={allTitles:null,callsMade:0,nofCalls:o.length,noCompletion:e,engineName:a},this.makeCalls(o,this.callbackObj,i,s)}}else this.showSuggestions([])}else this.showSuggestions([])}},makeCalls:function(e,t,i,n){for(var s=0;s<e.length;s++){var a=suggestionEngines[e[s]],o=conf.wgServer+conf.wgScriptPath+a.uri.replace(/\$1/g,encodeURIComponent(n));this.makeCall(o,t,a,i,n)}},showSuggestions:function(e,t,i,n){if(this.text.readOnly=!1,this.dab=null,this.showsList=!1,this.list){if(noSuggestions)return this.list&&(this.list.style.display="none"),this.engineSelector&&(this.engineSelector.style.display="none"),this.icon&&(this.icon.style.display="none"),void(this.inputExists=!0);if(this.engineName=n,n?this.engineSelector||(this.engineName=null):this.engineSelector&&(this.engineSelector.style.display="none"),i){if(this.lastInput.indexOf(i))return;if(this.lastQuery&&0===this.lastInput.indexOf(this.lastQuery)&&this.lastQuery.length>i.length)return}this.lastQuery=i;var s,a=this.text.value.split("|"),o=a.length>1?"|"+a[1]:"",l=a=HC.capitalizePageNames?capitalize(a[0]):a[0],r=e&&e.exists;if(e){e.normalized&&0===a.indexOf(i)&&(l=e.normalized+a.substring(i.length));var c=l.toLowerCase;if(HC.blacklist)for(s=0;s<e.length;s++)HC.blacklist.test(e[s])&&(e.splice(s,1),s--);for(e.sort(function(e,t){if(e===t)return 0;if(0===e.indexOf(t))return 1;if(0===t.indexOf(e))return-1;var i=0===e.indexOf(l)?1:0,n=0===t.indexOf(l)?1:0;if(i!==n)return n-i;var s=e.toLowerCase,a=t.toLowerCase;return(i=0===s.indexOf(c)?1:0)!==(n=0===a.indexOf(c)?1:0)?n-i:e<t?-1:t<e?1:0}),s=0;s<e.length;s++)(s+1<e.length&&e[s]===e[s+1]||14===conf.wgNamespaceNumber&&e[s]===conf.wgTitle)&&(e.splice(s,1),s--)}if(!e||!e.length)return this.list&&(this.list.style.display="none"),this.engineSelector&&(this.engineSelector.style.display="none"),void(n&&suggestionConfigs[n]&&!suggestionConfigs[n].temp&&(this.icon&&(this.icon.src=HC.existsNo),this.inputExists=!1));var u=e[0],d=this.autoComplete(u,a,l,o,t),h=d||r||u===replaceShortcuts(a,HC.shortcuts);if(n&&suggestionConfigs[n]&&!suggestionConfigs[n].temp&&(this.icon.src=h?HC.existsYes:HC.existsNo,this.inputExists=h),d&&(this.lastInput=u,1===e.length))return this.list.style.display="none",void(this.engineSelector&&(this.engineSelector.style.display="none"));for(this.list.firstChild;)this.list.removeChild(this.list.firstChild);for(s=0;sHC.listSize?HC.listSize:this.list.options.length;e<=1&&(e=2),this.list.size=e,this.list.style.align=is_rtl?"right":"left",this.list.style.zIndex=5,this.list.style.position="absolute";var t=is_rtl?"right":"left",i=0;"none"===this.list.style.display?(this.list.style.top=this.text.offsetTop+"px",this.list.style[t]="-10000px",this.list.style.display="",i=this.list.offsetHeight,this.list.style.display="none"):i=this.list.offsetHeight;var n=i;function s(e){if(is_webkit&&!document.evaluate)return window["inner"+e];var t="client"+e;return window.opera?document.body[t]:(document.documentElement?document.documentElement[t]:0)||document.body[t]||0}function a(e){var t="scroll"+e,i=(document.documentElement?document.documentElement[t]:0)||document.body[t]||0;return is_rtl&&"Left"===e&&(i<0&&(i=-i),is_webkit||(i=a("Width")-s("Width")-i)),i}function o(e){if(e.getBoundingClientRect){var t=e.getBoundingClientRect;return{x:Math.round(t.left+a("Left")),y:Math.round(t.top+a("Top"))}}var i=0,n=0;do{i+=e.offsetTop||0,n+=e.offsetLeft||0,e=e.offsetParent}while(e);return{x:n,y:i}}e<HC.listSize&&(n=i/e*HC.listSize);var l=o(this.text),r=0,c=0,u=this.text.offsetWidth||this.text.clientWidth;if(this.engineName&&(this.engineSelector.style.zIndex=5,this.engineSelector.style.position="absolute",this.engineSelector.style.width=u+"px","none"===this.engineSelector.style.display?(this.engineSelector.style[t]="-10000px",this.engineSelector.style.top="0",this.engineSelector.style.display="",c=this.engineSelector.offsetHeight,this.engineSelector.style.display="none"):c=this.engineSelector.offsetHeight,this.engineSelector.style[t]="0px"),l.y<n+c+1?(r=this.text.offsetHeight+c+1,this.engineName&&(this.engineSelector.style.top=this.text.offsetHeight+"px")):(r=-i-c-1,this.engineName&&(this.engineSelector.style.top=-(c+1)+"px")),this.list.style.top=r+"px",this.list.style.width="",this.list.style[t]="0px",this.engineName&&(this.selectEngine(this.engineName),this.engineSelector.style.display=""),this.list.style.display="block",this.list.offsetWidthd+h){g>h&&(g=h,this.list.style.width=g+"px",is_rtl?p=m-g:m=p+g);var f=0;pd+h&&(f=-(m-d-h)),is_rtl&&(f=-f),f&&(this.list.style[t]=0+f+"px")}}},autoComplete:function(e,t,i,n,s){if(e===t)return!0;if(s||this.ime||!this.canSelect)return!1;if(e.indexOf(t)){if(!i||0!==e.indexOf(i))return!1;this.lastRealInput===t&&(this.lastRealInput=i),t=i}return this.text.focus,this.text.value=e+n,this.setSelection(t.length,e.length),!0},canSelect:function{return this.text.setSelectionRange||this.text.createTextRange||void 0!==this.text.selectionStart&&void 0!==this.text.selectionEnd},setSelection:function(e,t){if(this.text.value)if(this.text.setSelectionRange)this.text.setSelectionRange(e,t);else if(void 0!==this.text.selectionStart)e>this.text.selectionStart?(this.text.selectionEnd=t,this.text.selectionStart=e):(this.text.selectionStart=e,this.text.selectionEnd=t);else if(this.text.createTextRange){var i=this.text.createTextRange;i.move("character",e),i.moveEnd("character",t-e),i.select}},getSelection:function{var e=0,t=0;if(this.text.value){if(void 0!==this.text.selectionStart)e=this.text.selectionStart,t=this.text.selectionEnd;else if(document.selection&&document.selection.createRange){var i=document.selection.createRange.duplicate;if(i.parentElement===this.text)try{var n=this.text.createTextRange;n.move("character",0),n.setEndPoint("EndToEnd",i),t=n.text.length,n.setEndPoint("EndToStart",i),e=n.text.length}catch(i){t=e=this.text.value.length}}}else;return{start:e,end:t}},saveView:function{this.lastSelection=this.getSelection},processKey:function(e){var t=0;switch(this.lastKey){case UP:t=-1;break;case DOWN:t=1;break;case PGUP:t=-HC.listSize;break;case PGDOWN:t=HC.listSize;break;case ESC:return evtKill(e)}if(t){if("none"!==this.list.style.display)return this.highlightSuggestion(t),evtKill(e);this.keyCount<=1&&(!this.callbackObj||this.callbackObj.callsMade===this.callbackObj.nofCalls)&&this.textchange}return!0},highlightSuggestion:function(e){if(noSuggestions||!this.list||"none"===this.list.style.display)return!1;var t=this.list.selectedIndex,i=-1;if(0===e){if(t<0||t>=this.list.options.length)return!1;i=t}else(i=(i=t<0?0:t+e)<0?0:i)>=this.list.options.length&&(i=this.list.options.length-1);if(i!==t||0===e){t>=0&&t1?"|"+n[1]:"";this.autoComplete(this.list.options[i].text,this.lastRealInput,null,s,!1)&&this.list.options[i].text!==this.lastRealInput||(this.text.value=this.list.options[i].text+s,this.canSelect&&this.setSelection(this.list.options[i].text.length,this.list.options[i].text.length)),this.lastInput=this.list.options[i].text,this.inputExists=!0,this.icon&&(this.icon.src=HC.existsYes),this.state=CategoryEditor.CHANGE_PENDING}return!0},resetKeySelection:function{if(noSuggestions||!this.list||"none"===this.list.style.display)return!1;var e=this.list.selectedIndex;if(e>=0&&e1?"|"+t[1]:"",n=t[0]!==this.lastInput;return t[0]!==this.lastRealInput&&(this.text.value=this.lastRealInput+i,n=!0),this.lastInput=this.lastRealInput,n}return!1}};var cleanedText=null,initialized=!1,setupTimeout=null;window.hotcat_get_state=function{return getState},window.hotcat_set_state=function(e){return setState(e)},window.hotcat_close_form=function{closeForm},HC.runWhenReady=function(e){mw.hook("hotcat.ready").add(e)},mw.config.set("disableAJAXCategories",!0),"Upload"!==conf.wgCanonicalSpecialPageName&&mw.hook("postEdit").add(function{catLine=null,editors=[],initialized=!1,HC.started=!1,run}),$.when(mw.loader.using("user"),$.ready).always(run)}function LoadTrigger(e){var t=this;t.queue=[],t.needed=e,t.register=function(e){t.needed<=0?e:t.queue.push(e)},t.loaded=function{if(t.needed--,0===t.needed){for(var e=0;e<t.queue.length;e++)t.queue[e];t.queue=[]}}}function load(e,t){var i=document.createElement("script");i.src=e;var n=!1;i.onload=i.onerror=function{!n&&t&&(n=!0,t),i.parentNode&&i.parentNode.removeChild(i)},document.head.appendChild(i)}function loadJS(e,t){load(conf.wgServer+conf.wgScript+"?title="+encodeURIComponent(e)+"&action=raw&ctype=text/javascript",t)}function loadURI(e,t){var i=e;"//"===i.substring(0,2)?i=window.location.protocol+i:"/"===i.substring(0,1)&&(i=conf.wgServer+i),load(i,t)}function autoLocalize(e,t){function i(e){if(!e||!e.length)return"";for(var t="",i=0;i<e.length;i++){var n=e.charAt(i),s=n.toLowerCase,a=n.toUpperCase;t+=s===a?n:"["+s+a+"]"}return t.replace(/([\\^$.?*+])/g,"\\$1").replace(wikiTextBlankRE,wikiTextBlank)}t=t.toLowerCase;var n=formattedNamespaces[String(e)].toLowerCase,s=i(n);if(t&&n!==t&&(s+="|"+i(t)),namespaceIds)for(var a in namespaceIds)"string"==typeof a&&a.toLowerCase!==n&&a.toLowerCase!==t&&namespaceIds[a]===e&&(s+="|"+i(a));return s}function make(e,t){return e?t?document.createTextNode(e):document.createElement(e):null}function param(e,t){t=t||document.location.href;var i=new RegExp("[&?]"+e+"=([^&#]*)").exec(t);return i&&i.length>1?decodeURIComponent(i[1]):null}function title(e){if(!e)return null;var t=conf.wgScript+"?";if(0===e.indexOf(t)||0===e.indexOf(conf.wgServer+t)||"//"===conf.wgServer.substring(0,2)&&0===e.indexOf(document.location.protocol+conf.wgServer+t))return param("title",e);var i=conf.wgArticlePath.replace("$1","");return e.indexOf(i)&&(i=conf.wgServer+i),e.indexOf(i)&&"//"===i.substring(0,2)&&(i=document.location.protocol+i),0===e.indexOf(i)?decodeURIComponent(e.substring(i.length)):null}function hasClass(e,t){return(" "+e.className+" ").indexOf(" "+t+" ")>=0}function capitalize(e){return e&&e.length?e.substr(0,1).toUpperCase+e.substr(1):e}function wikiPagePath(e){return conf.wgArticlePath.replace("$1",encodeURIComponent(e).replace(/%3A/g,":").replace(/%2F/g,"/"))}function escapeRE(e){return e.replace(/([\\^$.?*+[\]])/g,"\\$1")}function substituteFactory(e){var t,i=(e=e||{}).indicator||"$",n=escapeRE(i),s=escapeRE(e.lbrace||"{"),a=escapeRE(e.rbrace||"}");return t=new RegExp("(?:"+n+"("+n+"))|(?:"+n+"(\\d+))|(?:"+n+"(?:"+s+"([^"+s+a+"]+)"+a+"))|(?:"+n+"(?!(?:["+n+s+"]|\\d))(\\S+?)\\b)","g"),function(e,n){return n?e.replace(t,function(e,t,s,a,o){if(t===i)return i;var l=o||a||s,r="function"==typeof n[l]?n[l](e,l):n[l];return"string"==typeof r?r:r||e}):e}}function replaceByBlanks(e){return e.replace(/(\s|\S)/g," ")}function find_category(e,t,i){var n=null;if(HC.template_categories[t])n=new RegExp("\\{\\{"+wikiTextBlankOrBidi+"("+HC.template_regexp+"(?="+wikiTextBlankOrBidi+":))?"+wikiTextBlankOrBidi+"(?:"+HC.template_categories[t]+")"+wikiTextBlankOrBidi+"(\\|.*?)?\\}\\}","g");else{var s=escapeRE(t),a=s.substr(0,1);n=new RegExp("\\[\\["+wikiTextBlankOrBidi+"("+HC.category_regexp+")"+wikiTextBlankOrBidi+":"+wikiTextBlankOrBidi+("\\"!==a&&HC.capitalizePageNames?"["+a.toUpperCase+a.toLowerCase+"]":a)+s.substring(1).replace(wikiTextBlankRE,wikiTextBlank)+wikiTextBlankOrBidi+"(\\|.*?)?\\]\\]","g")}if(i)return n.exec(e);for(var o=e.replace(//g,replaceByBlanks).replace(/ (\s|\S)*?<\/nowiki>/g,replaceByBlanks),l=[],r=null;null!==(r=n.exec(o));)l.push({match:r});return l.re=n,l}function change_category(e,t,i,n,s){var a,o=[],l=HC.category_canonical,r=-1,c=t&&i&&t===i&&i.length;if(n&&(n="|"+n),t&&t.length){if(!(a=find_category(e,t))||!a.length)return{text:e,summary:o,error:HC.messages.cat_notFound.replace(/\$1/g,t)};var u=e.substring(0,a[0].match.index),d=e.substring(a[0].match.index+a[0].match[0].length);a.length>1&&(a.re.lastIndex=0,d=d.replace(a.re,"")),i&&null===n&&(n=a[0].match[2]);for(var h=u.length-1;h>=0&&"\n"!==u.charAt(h)&&u.substr(h,1).search(/\s/)>=0;)h--;for(var g=0;g=0;)g++;h>=0&&"\n"===u.charAt(h)&&(!d.length||g=0?u.substring(0,h+1):"",d=g=0&&d.length&&d.substr(0,1).search(/\S/)>=0&&(u+=" "),0===(r=u.length)&&d.length&&"\n"===d.substr(0,1)&&(d=d.substr(1)),e=u+d,c||(HC.template_categories[t]?o.push(HC.messages.template_removed.replace(/\$1/g,t)):o.push(HC.messages.cat_removed.replace(/\$1/g,t)))}if(i&&i.length){if((a=find_category(e,i))&&a.length)return{text:e,summary:o,error:HC.messages.cat_exists.replace(/\$1/g,i)};var p=!1;if(r<0){var m=function(e){var t=e.replace(//g,replaceByBlanks).replace(/ (\s|\S)*?<\/nowiki>/g,replaceByBlanks),i=-1;for(findCatsRE.lastIndex=0;null!==findCatsRE.exec(t);)i=findCatsRE.lastIndex;if(i<0){var n=null;return(n=interlanguageRE?interlanguageRE.exec(t):/((^|\n\r?)(\[\[\s*(([a-z]{2,3}(-[a-z]+)*)|simple|tokipona)\s*:[^\]]+\]\]\s*))+$/.exec(t))&&(i=n.index),{idx:i,onCat:!1}}return{idx:i,onCat:i>=0}}(e);r=m.idx,p=m.onCat}else p=!0;var f="|"")+"";if(r>=0){var C=e.substring(r);e=e.substring(0,r)+(r>0?"\n":"")+f+(p?"":"\n"),C.length&&"\n"!==C.substr(0,1)?e+="\n"+C:e+=C}else e.length&&"\n"!==e.substr(e.length-1,1)&&(e+="\n"),e+=(e.length?"\n":"")+f;if(c){var y=n||"";y.length&&(y=y.substr(1)),o.push(substitute(HC.messages.cat_keychange,[null,i,y]))}else o.push(HC.messages.cat_added.replace(/\$1/g,i));if(HC.uncat_regexp&&!s){var v=e.replace(HC.uncat_regexp,"");v.length!==e.length&&(e=v,o.push(HC.messages.uncat_removed))}}return{text:e,summary:o,error:null}}function evtKeys(e){var t=0;return e.ctrlKey&&((e.ctrlKey||e.metaKey)&&(t|=1),e.shiftKey&&(t|=2)),t}function evtKill(e){return e.preventDefault?(e.preventDefault,e.stopPropagation):e.cancelBubble=!0,!1}function CategoryEditor{this.initialize.apply(this,arguments)}function setPage(e){var t=null;if(e&&e.query){if(e.query.pages){var i=e.query.pages[conf.wgArticleId?String(conf.wgArticleId):"-1"];if(i&&(i.revisions&&i.revisions.length&&(pageText=i.revisions[0]["*"],i.revisions[0].timestamp&&(pageTime=i.revisions[0].timestamp.replace(/\D/g,"")),i.revisions[0].revid&&(pageTextRevId=i.revisions[0].revid),i.revisions.length>1&&(conflictingUser=i.revisions[1].user)),i.lastrevid&&(lastRevId=i.lastrevid),i.starttimestamp&&(t=i.starttimestamp.replace(/\D/g,"")),pageWatched="string"==typeof i.watched,editToken=i.edittoken,i.langlinks&&(!e["query-continue"]||!e["query-continue"].langlinks))){for(var n="",s=0;s0?"|":"")+i.langlinks[s].lang.replace(/([\\^$.?*+])/g,"\\$1");n.length&&(interlanguageRE=new RegExp("((^|\\n\\r?)(\\[\\[\\s*("+n+")\\s*:[^\\]]+\\]\\]\\s*))+$"))}}e.query.general&&(e.query.general.time&&!t&&(t=e.query.general.time.replace(/\D/g,"")),null===HC.capitalizePageNames&&(HC.capitalizePageNames="first-letter"===e.query.general.case)),serverTime=t,e.query.userinfo&&e.query.userinfo.options&&(watchCreate=!HC.dont_add_to_watchlist&&"1"===e.query.userinfo.options.watchcreations,watchEdit=!HC.dont_add_to_watchlist&&"1"===e.query.userinfo.options.watchdefault,(minorEdits=1===e.query.userinfo.options.minordefault)&&(HC.single_minor=!0))}}function initiateEdit(e,t){var i;saveInProgress||(saveInProgress=!0,commitButton&&(i=commitButton.disabled,commitButton.disabled=!0),$.getJSON(conf.wgServer+conf.wgScriptPath+"/api.php?format=json&action=query&rawcontinue=&titles="+encodeURIComponent(conf.wgPageName)+"&prop=info%7Crevisions%7Clanglinks&inprop=watched&intoken=edit&rvprop=content%7Ctimestamp%7Cids%7Cuser&lllimit=500&rvlimit=2&rvdir=newer&rvstartid="+conf.wgCurRevisionId+"&meta=siteinfo%7Cuserinfo&uiprop=options",function(t){setPage(t),e(n)}).fail(function(e){n(e.status+" "+e.statusText)}));function n{saveInProgress=!1,commitButton&&(commitButton.disabled=i),t.apply(this,arguments)}}function multiChangeMsg(e){var t=HC.messages.multi_change;return"string"!=typeof t&&t.length&&(t=mw.language&&mw.language.convertPlural?mw.language.convertPlural(e,t):t[t.length-1]),substitute(t,[null,String(e)])}function currentTimestamp{var e=new Date,t=String(e.getUTCFullYear);function i(e){return e.substr(e.length-2)}return t+=i("0"+(e.getUTCMonth+1))+i("0"+e.getUTCDate)+i("00"+e.getUTCHours)+i("00"+e.getUTCMinutes)+i("00"+e.getUTCSeconds)}function performChanges(e,t){if(null!==pageText){var i;HC.messages.cat_keychange.indexOf("$2")<0&&(HC.messages.cat_keychange+='"$2"'),HC.messages.short_catchange||(HC.messages.short_catchange=""+HC.category_canonical+":$1");var n=(null!==lastRevId&&lastRevId!==conf.wgCurRevisionId||null!==pageTextRevId&&pageTextRevId!==conf.wgCurRevisionId)&&conflictingUser&&conflictingUser===conf.wgUserName;!t||t.noCommit||HC.no_autocommit||!editToken||n?(i=commitForm.wpSave)&&(i.name=i.value="wpDiff"):(commitForm.wpEditToken.value=editToken,(i=commitForm.wpDiff)&&(i.name=i.value="wpSave"));var s,a,o={text:pageText},l=[],r=[],c=[],u=0,d=t?[t]:editors,h=null;for(a=0;a<d.length;a++)(s=d[a]).state===CategoryEditor.CHANGED?(o=change_category(o.text,s.originalCategory,s.currentCategory,s.currentKey,s.currentHidden)).error?null===h&&(h=o.error):(u++,s.originalCategory&&s.originalCategory.length?l.push({from:s.originalCategory,to:s.currentCategory}):r.push(s.currentCategory)):s.state===CategoryEditor.DELETED&&s.originalCategory&&s.originalCategory.length&&((o=change_category(o.text,s.originalCategory,null,null,!1)).error?null===h&&(h=o.error):(u++,c.push(s.originalCategory)));if(null!==h&&(i=commitForm.wpSave)&&(i.name=i.value="wpDiff"),commitForm.wpMinoredit.checked=minorEdits,commitForm.wpWatchthis.checked=!conf.wgArticleId&&watchCreate||watchEdit||pageWatched,conf.wgArticleId||t)if(i&&"wpSave"===i.value?HC.changeTag&&(commitForm.wpChangeTags.value=HC.changeTag,HC.messages.using="",HC.messages.prefix=""):commitForm.wpAutoSummary.value=HC.changeTag,1===u)o.summary&&o.summary.length&&(commitForm.wpSummary.value=HC.messages.prefix+o.summary.join(HC.messages.separator)+HC.messages.using),commitForm.wpMinoredit.checked=HC.single_minor||minorEdits;else if(u){var g=[],p=[];for(a=0;a<c.length;a++)g.push("-"+substitute(HC.messages.short_catchange,[null,c[a]]));for(1===c.length?p.push("-"+substitute(HC.messages.short_catchange,[null,c[0]])):c.length&&p.push("- "+multiChangeMsg(c.length)),a=0;a<r.length;a++)g.push("+"+substitute(HC.messages.short_catchange,[null,r[a]]));1===r.length?p.push("+"+substitute(HC.messages.short_catchange,[null,r[0]])):r.length&&p.push("+ "+multiChangeMsg(r.length));var m=is_rtl?"←":"→";for(a=0;a<l.length;a++)l[a].from!==l[a].to?g.push("±"+substitute(HC.messages.short_catchange,[null,l[a].from])+m+substitute(HC.messages.short_catchange,[null,l[a].to])):g.push("±"+substitute(HC.messages.short_catchange,[null,l[a].from]));1===l.length?l[0].from!==l[0].to?p.push("±"+substitute(HC.messages.short_catchange,[null,l[0].from])+m+substitute(HC.messages.short_catchange,[null,l[0].to])):p.push("±"+substitute(HC.messages.short_catchange,[null,l[0].from])):l.length&&p.push("± "+multiChangeMsg(l.length)),g.length&&((g=g.join(HC.messages.separator)).length>200-HC.messages.prefix.length-HC.messages.using.length&&(g=p.join(HC.messages.separator)),commitForm.wpSummary.value=HC.messages.prefix+g+HC.messages.using)}commitForm.wpTextbox1.value=o.text,commitForm.wpStarttime.value=serverTime||currentTimestamp,commitForm.wpEdittime.value=pageTime||commitForm.wpStarttime.value,n&&(commitForm.oldid.value=String(pageTextRevId||conf.wgCurRevisionId)),commitForm.hcCommit.click}else e(HC.messages.multi_error)}function resolveOne(e,t){var i,n=e.categories,s=e.links,a=!1,o="string"==typeof e.redirect,l=e.categoryinfo&&"string"==typeof e.categoryinfo.hidden,r="string"==typeof e.missing;for(i=0;i<t.length;i++)i&&t[i].dabInputCleaned!==e.title.substring(e.title.indexOf(":")+1)||(t[i].currentHidden=l,t[i].inputExists=!r,t[i].icon.src=r?HC.existsNo:HC.existsYes);if(!r){if(!o&&n&&(HC.disambig_category||HC.redir_category))for(var c=0;c<n.length;c++){var u=n[c].title;if(u){if((u=u.substring(u.indexOf(":")+1).replace(/_/g," "))===HC.disambig_category){a=!0;break}if(u===HC.redir_category){o=!0;break}}}if((o||a)&&s&&s.length){var d=[];for(i=0;i1?t[i].dab=d:t[i].text.value=d[0]+(null!==t[i].currentKey?"|"+t[i].currentKey:""))}}}function resolveRedirects(e,t){if(t&&t.query&&t.query.pages)for(var i in t.query.pages)resolveOne(t.query.pages[i],e)}function resolveMulti(e,t){var i;for(i=0;i<e.length;i++)e[i].dab=null,e[i].dabInput=e[i].lastInput;if(noSuggestions)t(e);else{var n="action=query&prop=info%7Clinks%7Ccategories%7Ccategoryinfo&plnamespace=14&pllimit="+10*e.length+"&cllimit="+10*e.length+"&format=json&titles=";for(i=0;i<e.length;i++){var s=e[i].dabInput;s=replaceShortcuts(s,HC.shortcuts),e[i].dabInputCleaned=s,n+=encodeURIComponent("Category:"+s),i+11&&(e.currentKey=s[1]),e.lastSelection&&(e.lastSelection={start:s[0].length,end:s[0].length})}e.showsList&&e.displayList,e.lastSelection&&(is_webkit?window.setTimeout(function{e.setSelection(e.lastSelection.start,e.lastSelection.end)},1):e.setSelection(e.lastSelection.start,e.lastSelection.end))}}}function showDab(e){e.is_active?(e.showSuggestions(e.dab,!1,null,null),e.dab=null):makeActive(e)}function multiSubmit{for(var e=[],t=0;t<editors.length;t++)editors[t].state!==CategoryEditor.CHANGE_PENDING&&editors[t].state!==CategoryEditor.OPEN||e.push(editors[t]);e.length?resolveMulti(e,function(e){for(var t=null,i=!1,n=0;n<e.length;n++)e[n].lastInput!==e[n].dabInput?i=!0:e[n].dab?t||(t=e[n]):e[n].acceptCheck(!0)&&e[n].commit;t?showDab(t):i||initiateEdit(function(e){performChanges(e)},function(e){alert(e)})}):initiateEdit(function(e){performChanges(e)},function(e){alert(e)})}function setMultiInput{commitButton||onUpload||((commitButton=make("input")).type="button",commitButton.value=HC.messages.commit,commitButton.onclick=multiSubmit,multiSpan?multiSpan.parentNode.replaceChild(commitButton,multiSpan):catLine.appendChild(commitButton))}function checkMultiInput{if(commitButton){for(var e=!1,t=0;t<editors.length;t++)if(editors[t].state!==CategoryEditor.UNCHANGED){e=!0;break}commitButton.disabled=!e}}function forceRedraw{dummyElement.parentNode?document.body.removeChild(dummyElement):document.body.appendChild(dummyElement)}function initialize{var e=void 0!==window.JSconfig&&JSconfig.keys?JSconfig.keys:{};if(HC.dont_add_to_watchlist=void 0!==window.hotcat_dont_add_to_watchlist?!!window.hotcat_dont_add_to_watchlist:void 0!==e.HotCatDontAddToWatchlist?e.HotCatDontAddToWatchlist:HC.dont_add_to_watchlist,HC.no_autocommit=void 0!==window.hotcat_no_autocommit?!!window.hotcat_no_autocommit:void 0!==e.HotCatNoAutoCommit?e.HotCatNoAutoCommit:!!(conf.wgNamespaceNumber%2)||HC.no_autocommit,HC.del_needs_diff=void 0!==window.hotcat_del_needs_diff?!!window.hotcat_del_needs_diff:void 0!==e.HotCatDelNeedsDiff?e.HotCatDelNeedsDiff:HC.del_needs_diff,HC.suggest_delay=window.hotcat_suggestion_delay||e.HotCatSuggestionDelay||HC.suggest_delay,HC.editbox_width=window.hotcat_editbox_width||e.HotCatEditBoxWidth||HC.editbox_width,HC.suggestions=window.hotcat_suggestions||e.HotCatSuggestions||HC.suggestions,"string"==typeof HC.suggestions&&suggestionConfigs[HC.suggestions]||(HC.suggestions="combined"),HC.fixed_search=void 0!==window.hotcat_suggestions_fixed?!!window.hotcat_suggestions_fixed:void 0!==e.HotCatFixedSuggestions?e.HotCatFixedSuggestions:HC.fixed_search,HC.single_minor=void 0!==window.hotcat_single_changes_are_minor?!!window.hotcat_single_changes_are_minor:void 0!==e.HotCatMinorSingleChanges?e.HotCatMinorSingleChanges:HC.single_minor,HC.bg_changed=window.hotcat_changed_background||e.HotCatChangedBackground||HC.bg_changed,HC.use_up_down=void 0!==window.hotcat_use_category_links?!!window.hotcat_use_category_links:void 0!==e.HotCatUseCategoryLinks?e.HotCatUseCategoryLinks:HC.use_up_down,HC.listSize=window.hotcat_list_size||e.HotCatListSize||HC.listSize,"commonswiki"!==conf.wgDBname&&(HC.changeTag=e.HotCatChangeTag||""),HC.changeTag){var t,i=document.editform,n=new RegExp("^\\[\\[("+HC.category_regexp+"):");if("submit"===conf.wgAction&&conf.wgArticleId&&i&&i.wpSummary&&document.getElementById("wikiDiff")){var s=i.wpSummary,a=i.wpAutoSummary;if(s.value&&a.value===HC.changeTag){a.value=a.value.replace(HC.changeTag,"d41d8cd98f00b204e9800998ecf8427e");var o=$('').val(HC.changeTag);$(i).append(o),t=i.wpTextbox1.value,$("#wpSave").one("click",function{o.val&&(s.value=s.value.replace(HC.messages.using||HC.messages.prefix,""))});var l=function{$(i.wpTextbox1).add(s).one("input",function{window.setTimeout(function{!function{var e=i.wpTextbox1;if(e){var s;return e=e.value,(s=function(e,t){var i,n,s=[];e.length<t.length?(i=t,n=e):(i=e,n=t);for(var a=0;a<i.length;a++){var o=i[a],l=$.inArray(o,n);-1===l?s.push(o):n.splice(l,1)}return s.concat(n)}(t.match(/^.*$/gm),e.match(/^.*$/gm))).length&&(s=$.grep(s,function(e){return(e=$.trim(e))&&!n.test(e)})),s.length?void 0:(t=e,!0)}}?o.val(""):l},500)})};l}}}if(HC.listSize=parseInt(HC.listSize,10),(isNaN(HC.listSize)||HC.listSize<5)&&(HC.listSize=5),HC.listSize=Math.min(HC.listSize,30),HC.engine_names)for(var r in HC.engine_names)suggestionConfigs[r]&&HC.engine_names[r]&&(suggestionConfigs[r].name=HC.engine_names[r]);(is_rtl=hasClass(document.body,"rtl"))||(is_rtl="rtl"===(is_rtl=document.defaultView&&document.defaultView.getComputedStyle?document.defaultView.getComputedStyle(document.body,null).getPropertyValue("direction"):document.body.currentStyle?document.body.currentStyle.direction:document.body.style.direction))}function can_edit{var e=null;switch(mw.config.get("skin")){case"cologneblue":e=document.getElementById("quickbar");case"standard":case"nostalgia":e||(e=document.getElementById("topbar"));for(var t=e.getElementsByTagName("a"),i=0;i1&&(n=i[1]);var s=i[0].replace(/_/g," ").replace(/^\s+|\s+$/g,"");s.length?(t.currentCategory=s,t.currentKey=n,t.currentExists=this.inputExists,t.close):t.cancel}}}function setup_upload{onUpload=!0;var ip=document.getElementById("mw-htmlform-description")||document.getElementById("wpDestFile");if(!ip)for(ip=document.getElementById("wpDestFile");ip&&"table"!==ip.nodeName.toLowerCase;)ip=ip.parentNode;if(ip){var reupload=document.getElementById("wpForReUpload"),destFile=document.getElementById("wpDestFile");if(!(reupload&&reupload.value||destFile&&(destFile.disabled||destFile.readOnly))){var labelCell=make("td"),lineCell=make("td");catLine=make("div"),catLine.className="catlinks",catLine.id="catlinks",catLine.style.textAlign=is_rtl?"right":"left",catLine.style.margin="0",catLine.style.border="none",lineCell.appendChild(catLine);var label=null;if(window.UFUI&&window.UIElements&&UFUI.getLabel instanceof Function)try{label=UFUI.getLabel("wpCategoriesUploadLbl")}catch(e){label=null}label?(labelCell.id="hotcatLabelTranslated",labelCell.appendChild(label)):(labelCell.id="hotcatLabel",labelCell.appendChild(make(HC.categories,!0))),labelCell.className="mw-label",labelCell.style.textAlign="right",labelCell.style.verticalAlign="middle";var form=document.getElementById("upload")||document.getElementById("mw-upload-form");if(form){var newRow=ip.insertRow(-1);newRow.appendChild(labelCell),newRow.appendChild(lineCell),form.onsubmit=function(oldSubmit){return function{var do_submit=!0;if(oldSubmit&&("string"==typeof oldSubmit?do_submit=eval(oldSubmit):oldSubmit instanceof Function&&(do_submit=oldSubmit.apply(form,arguments))),!do_submit)return!1;closeForm;for(var eb=document.getElementById("wpUploadDescription")||document.getElementById("wpDesc"),addedOne=!1,i=0;i/g,"");find_category(cleanedText,t,!0)||(eb.value+="\n"+new_cat,addedOne=!0)}}return addedOne&&(eb.value=eb.value.replace(/\{\{subst:unc\}\}/g,"")),!0}}(form.onsubmit)}}}}function isOnPage(e){if(e.firstChild.nodeType!==Node.ELEMENT_NODE)return null;var t=title(e.firstChild.getAttribute("href"));if(!t)return null;if(t=t.substr(t.indexOf(":")+1).replace(/_/g," "),HC.blacklist&&HC.blacklist.test(t))return null;var i={title:t,match:["","",""]};return null===pageText?i:(null===cleanedText&&(cleanedText=pageText.replace(//g,"").replace(/ (\s|\S)*?<\/nowiki>/g,"")),i.match=find_category(cleanedText,t,!0),i)}function findByClass(e,t,i){var n=$(e).find(t+"."+i);return n&&n.length?n[0]:null}function setup(e){if(!initialized){initialized=!0,setupTimeout&&(window.clearTimeout(setupTimeout),setupTimeout=null),catLine=catLine||document.getElementById("mw-normal-catlinks");var t=document.getElementById("mw-hidden-catlinks");if(!catLine){var i=null;if(!t&&!(i=findByClass(document,"div","printfooter")))return;(catLine=make("div")).id="mw-normal-catlinks",catLine.style.textAlign=is_rtl?"right":"left";var n=make("a");n.href=conf.wgArticlePath.replace("$1","Special:Categories"),n.title=HC.categories,n.appendChild(make(HC.categories,!0)),catLine.appendChild(n),catLine.appendChild(make(":",!0));var s=t?t.parentNode:document.getElementById("catlinks");s||((s=make("div")).id="catlinks",i.parentNode.insertBefore(s,i.nextSibling)),s.className="catlinks noprint",s.style.display="",t?s.insertBefore(catLine,t):s.appendChild(catLine)}is_rtl&&(catLine.dir="rtl");var a=r(catLine,!1);if(new CategoryEditor(newDOM?catLine.getElementsByTagName("ul")[0]:catLine,null,null,null!==a,!1),!onUpload){null!==pageText&&t&&(is_rtl&&(t.dir="rtl"),r(t,!0));var o=make("span");o.className="noprint",is_rtl&&(o.dir="rtl"),catLine.insertBefore(o,catLine.firstChild.nextSibling),o.appendChild(make(" ",!0)),multiSpan=make("span"),o.appendChild(multiSpan),multiSpan.innerHTML="("+HC.addmulti+"</a>)";var l=multiSpan.getElementsByTagName("a")[0];l.onclick=function(e){return setMultiInput,checkMultiInput,evtKill(e)},l.title=HC.multi_tooltip,l.style.cursor="pointer"}cleanedText=null,e instanceof Function&&e,mw.hook("hotcat.ready").fire,$("body").trigger("hotcatSetupCompleted")}function r(e,t){var i,n=e.getElementsByTagName("li");n.length?(newDOM=!0,e=n[0].parentNode):n=e.getElementsByTagName("span");var s=new Array(n.length);for(i=0;i<n.length;i++)s[i]=n[i];for(i=0;i<s.length;i++){var a=isOnPage(s[i]);null!==a&&null!==a.match&&new CategoryEditor(e,s[i],a.title,a.match[2],t)}return s.length?s[s.length-1]:null}}function createCommitForm{if(!commitForm){var e=make("div");e.style.display="none",document.body.appendChild(e),e.innerHTML='<form id="hotcatCommitForm" method="post" enctype="multipart/form-data" action="'+conf.wgScript+"?title="+encodeURIComponent(conf.wgPageName)+'&action=submit"><input type="hidden" name="wpTextbox1"><input type="hidden" name="model" value="'+conf.wgPageContentModel+'"><input type="hidden" name="format" value="text/x-wiki"><input type="hidden" name="wpSummary" value=""><input type="checkbox" name="wpMinoredit" value="1"><input type="checkbox" name="wpWatchthis" value="1"><input type="hidden" name="wpAutoSummary" value="d41d8cd98f00b204e9800998ecf8427e"><input type="hidden" name="wpEdittime"><input type="hidden" name="wpStarttime"><input type="hidden" name="wpDiff" value="wpDiff"><input type="hidden" name="oldid" value="0"><input type="submit" name="hcCommit" value="hcCommit"><input type="hidden" name="wpEditToken"><input type="hidden" name="wpUltimateParam" value="1"><input type="hidden" name="wpChangeTags"><input type="hidden" value="ℳ𝒲♥𝓊𝓃𝒾𝒸ℴ𝒹ℯ" name="wpUnicodeCheck"> ',commitForm=document.getElementById("hotcatCommitForm")}}function getPage{if(conf.wgArticleId){var e=conf.wgServer+conf.wgScriptPath+"/api.php?format=json&callback=HotCat.start&action=query&rawcontinue=&titles="+encodeURIComponent(conf.wgPageName)+"&prop=info%7Crevisions&rvprop=content%7Ctimestamp%7Cids&meta=siteinfo&rvlimit=1&rvstartid="+conf.wgCurRevisionId,t=make("script");t.src=e,HC.start=function(e){setPage(e),setup(createCommitForm)},document.getElementsByTagName("head")[0].appendChild(t),setupTimeout=window.setTimeout(function{setup(createCommitForm)},4e3)}else{if(2===conf.wgNamespaceNumber)return;pageText="",pageTime=null,setup(createCommitForm)}}function setState(e){var t=e.split("\n");if(!t.length)return null;if(initialized&&1===editors.length&&editors[0].isAddCategory){var i,n=[],s=1===editors.length?editors[0].span:null;for(i=0;i<t.length;i++)if(t[i].length){var a=t[i].split("|"),o=a.length>1?a[1]:null;a=a[0];var l=make("a");l.href=wikiPagePath(HC.category_canonical+":"+a),l.appendChild(make(a,!0)),l.title=a;var r=make("span");r.appendChild(l),i||catLine.insertBefore(make(" ",!0),s),catLine.insertBefore(r,s),s&&i+1<t.length&&parent.insertBefore(make(" | ",!0),s),n.push({element:r,title:a,key:o})}for(s&&s.parentNode.insertBefore(make(" | ",!0),s),i=0;i<n.length;i++)new CategoryEditor(catLine,n[i].element,n[i].title,n[i].key)}return null}function getState{for(var e=null,t=0;t<editors.length;t++){var i=editors[t].currentCategory,n=editors[t].currentKey;i&&i.length&&(null!==n&&(i+="|"+n),null===e?e=i:e+="\n"+i)}return e}function really_run{if(initialize,!HC.upload_disabled&&-1===conf.wgNamespaceNumber&&"Upload"===conf.wgCanonicalSpecialPageName&&conf.wgUserName)setup_upload,setup(function{window.UploadForm&&UploadForm.previous_hotcat_state&&(UploadForm.previous_hotcat_state=setState(UploadForm.previous_hotcat_state))});else{if(!conf.wgIsArticle||"view"!==conf.wgAction||null!==param("diff")||null!==param("oldid")||!can_edit||HC.disable)return;getPage}}function run{HC.started||(HC.started=!0,loadTrigger.register(really_run))}}(jQuery,mediaWiki);