User:L10nM4st3r/wToolCore/Unstable.js: Difference between revisions

Content deleted Content added
Minifying content and importing external scripts (see template) [Code Trimmer]
Minifying content and importing external scripts (see template) [Code Trimmer]
Line 1:
/*THIS FILE IS MINIFIED, PLEASE DO NOT MODIFY IT!
To view the raw source code, see [[User:L10nM4st3r/wToolCore/Unstable.js/template.js]].
*/var mwAPI=new mw.Api();var wTools={serverName:mw.config.get("wgServerName"),script:mw.config.get("wgScript"),action:mw.config.get("wgAction"),isEditable:mw.config.get("wgRelevantPageIsProbablyEditable"),namespacesIdToString:mw.config.get("wgFormattedNamespaces"),scriptPath:mw.config.get("wgServer")+mw.config.get("wgScript"),articlePath:mw.config.get("wgServer")+mw.config.get("wgArticlePath"),getArticlePath:(title)=>{return wTools.articlePath.replace("$1",makeStringPathSafe(title))},viewingUserName:mw.config.get("wgRelevantUserName"),pageName:mw.config.get("wgRelevantPageName"),pathSafeFilename:makeStringPathSafe(mw.config.get("wgRelevantPageName")),namespace:mw.config.get("wgNamespaceNumber"),realNamespaceName:mw.config.get("wgCanonicalNamespace"),isPageWatched:document.getElementById("ca-watch")!==null,canProtectPage:mw.config.get("wgRestrictionEdit")!==null,userName:mw.config.get("wgUserName"),userGroups:mw.config.get("wgUserGroups")};wTools.relevantNamespace=mw.config.get("wgNamespaceIds")[wTools.pageName.slice(0,wTools.pageName.indexOf(":")).toLowerCase()];wTools.pageExists=mw.config.get("wgArticleId")!==0&&wTools.namespace>=0;wTools.pageTitle=wTools.pageName.replace(/_/g," ").replace(wTools.namespacesIdToString[wTools.namespace]+":","");wTools.isSpecialPage=!(wTools.namespace>=0||["Contributions","userrights","protectpage","purge","deletepage","pageinfo","permamentlink"].includes(mw.config.get("wgCanonicalSpecialPageName").toLowerCase()));var wikEdDiffConfig={clipLinesRightMax:4,clipLinesLeftMax:2};var isAdmin=containsAny(wTools.userGroups,["admin","sysop","bureaucrat","steward","global-admin","global-sysop","bot"]);var canProtectPages=isAdmin||wTools.userGroups.includes("interface-admin");if(window.___location.href.match(/^https?:\/\/[^.]+\.m\./)){var desktopUrl=$('#mw-mf-display-toggle').attr('href');if(desktopUrl)window.___location.href=desktopUrl}var wTools_config=window.wTools_config;if(wTools_config===undefined)wTools_config={};wTools_config.editTags="";if(["en.uncyclopedia.co"].includes(wTools.serverName)){wTools_config.editAd="";wTools_config.editTags="1337 H4X"}else if(wTools_config.editAd===undefined)wTools_config.editAd=" [Using [[w:meta:User:L10nM4st3r/wToolCore|wTools]]]";if(wTools_config.speedyDeleteShouldRedirect===undefined)wTools_config.speedyDeleteShouldRedirect=false;if(wTools_config.sidebarEnabled===undefined)wTools_config.sidebarEnabled=true;if(wTools_config.editorEnabled===undefined)wTools_config.editorEnabled=true;if(wTools_config.rollbackAllEditSummary===undefined)wTools_config.rollbackAllEditSummary="Reverted edits by [[Special:Contributions/$2|$2]] ([[User talk:$2|talk]]) to last version by $1 {reason} (Mass Rollback)";if(wTools_config.rollbackAllDefaultReason===undefined)wTools_config.rollbackAllDefaultReason="Vandalism";window.wTools_config=wTools_config;if(___location.href.endsWith("#bottom"))$('html').animate({scrollTop:$(document).height()});function containsAny(arr1,arr2){return arr1.some(item=>arr2.includes(item))}function escapeRegex(text){return text.replace(/([^\\]|^)\\n/g,"$1\n").replace(/([^\\]|^)\\t/g,"$1\t").replace(/\\\\n/g,"\\n").replace(/\\\\t/g,"\\t").replace(/\\/g,"\\\\").replace(/\//g,"/").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/\{/g,"\\{").replace(/\}/g,"\\}").replace(/\(/g,"\\(").replace(/\)/g,"\\)").replace(/\-/g,"\\-").replace(/\^/g,"\\^").replace(/\>/g,"\\>").replace(/\*/g,"\\*").replace(/\./g,"\\.").replace(/\,/g,"\\,").replace(/\*/g,"\\*").replace(/\?/g,"\\?").replace(/\$/g,"\\$").replace(/\|/g,"\\|").replace(/\+/g,"\\+")}if(___location.href.includes("&diff=")||___location.href.includes("&oldid="))mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEdDiff.js&action=raw&ctype=text/javascript');function simpleAjaxRequest(requestMethod,requestUrl,postFields,overrideMimeType,ResponseHandler,FailHandler){var request;var headers={};var formData;if(requestMethod=='POST'){if(typeof FormData!='function'){var boundary=wEditor_CreateRandomString(12);headers['Content-Type']='multipart/form-data; charset=UTF-8; boundary='+boundary;formData='';for(let fieldName of postFields){if(Object.prototype.hasOwnProperty.call(postFields,fieldName)===true){formData+='--'+boundary+'\r\n';formData+='Content-Disposition: form-data; name="'+fieldName+'"\r\n\r\n'+postFields[fieldName]+'\r\n'}}formData+='--'+boundary+'--\r\n'}else{formData=new window.FormData();for(var fieldName in postFields){if(Object.prototype.hasOwnProperty.call(postFields,fieldName)===true)formData.append(fieldName,postFields[fieldName])}}}request=new window.XMLHttpRequest();request.open(requestMethod,requestUrl,true);for(var headerName in headers){if(Object.prototype.hasOwnProperty.call(headers,headerName)===true){request.setRequestHeader(headerName,headers[headerName])}}if((request.overrideMimeType!==undefined)&&(typeof overrideMimeType=='string')){request.overrideMimeType(overrideMimeType)}try{request.send(formData)}catch(exception){FailHandler();return}request.onreadystatechange=()=>{if(request.readyState!=4)return;ResponseHandler(request)}}function createProgressBar(style,id,height){var div=document.createElement("div");div.id=id;div.style=`width: 100%; background: #5e5d5d; height: ${height}px`;var progress=document.createElement("div");progress.name="progress";progress.style=style;progress.style.width="0%";progress.style.height="100%";progress.style.transition="width 0.1s linear";div.maxValue=100;div.currentValue=100;div.lastSetTime=Date.now();div.lastDelayTime=0;div.setMaxValue=(maxValue)=>{div.maxValue=maxValue;div.setCompletion((div.currentValue/ div.maxValue) * 100)};div.setValue = (currentValue, animated = true) => {div.currentValue = currentValue;div.setCompletion((div.currentValue /div.maxValue)*100);if(animated){var thisTime=Date.now();var newDelayTime=(thisTime-div.lastSetTime)/ 1000;var averageDelayTime = (newDelayTime + div.lastDelayTime) /2;div.lastDelayTime=averageDelayTime;progress.style.transition=`width ${averageDelayTime*1.3}s linear`;div.lastSetTime=thisTime}else{progress.style.transition=null}};div.setCompletion=(amount)=>{progress.style.width=amount.toString()+"%"};div.appendChild(progress);return div}function getAllReidrectsToPage(pageName,then){var output=[];window.mwAPI.get({"action":"query","prop":"redirects","titles":pageName,"formatversion":2}).then((data)=>{if("redirects"in data.query.pages[0])output=data.query.pages[0].redirects;if(then)then(output)})}function getWikitextForPages(pageNames,then){let gotPagesIndex=0;let pageContent=[];function getWikitextForPage(pageName){simpleAjaxRequest('GET',`https://${mw.config.get("wgServerName")}/w/index.php?title=${makeStringPathSafe(pageName)}&action=raw&ctype=text/plain`,{},'text/plain',(ret)=>{pageContent.push(ret.responseText);gotPagesIndex++;if(gotPagesIndex<pageNames.length)getWikitextForPage(pageNames[gotPagesIndex]);else if(then)then(pageContent)})}if(pageNames.length>0){getWikitextForPage(pageNames[0])}else if(then)then([])}function makeStringPathSafe(string){return string.replace(/&/g,"%26").replace(/=/g,"%3F").replace(/\+/g,"%3D").replace(/&/g,"%26")}function createForm(title,content,replaceEntireBody=true){let form=document.createElement("div");if(title){let header=document.createElement("h1");header.innerText=title;form.appendChild(header)}if(replaceEntireBody){let backlink=document.createElement("p");backlink.innerHTML=`&lt; <a onclick="___location.reload()" style="font-size:85%">${wTools.pageName}</a>`;form.appendChild(backlink)}for(let item of content){let element;if(typeof item!=="object"){}if(item.type==="label"){element=document.createElement("p");element.innerHTML=item.text}else if(item.type==="link"){element=document.createElement("a");var br=document.createElement("br");if("href"in item)element.href=item.href;element.innerText=item.text;element.appendChild(br)}else if(item.type==="button"){element=document.createElement("button");element.innerText=item.text}else if(item.type==="checkbox"){element=document.createElement("p");let randomName=Math.random().toString();element.innerHTML=`<input type="checkbox" id="${randomName}" ${"name"in item ?`name="${item.name}-input"`:""}${"value"in item&&item.value ?"checked='true'":""}"/><label style="user-select: none" for="${randomName}"> ${"text"in item ? item.text:""}</label>`}else if(item.type==="textarea"){element=document.createElement("p");element.innerHTML=`<label style="user-select: none">${"text"in item ? item.text:""}</label><br/><textarea style="width:100%; padding: 5px;" ${"name"in item ?`name="${item.name}-input"`:""}${"placeholder"in item ?` placeholder="${item.placeholder}"`:""}">${"value"in item ? item.value:""}</textarea>`}else if(item.type==="textbox"){element=document.createElement("p");let randomName=Math.random().toString();element.innerHTML=`<label style="user-select: none" for="${randomName}">${"text"in item ? item.text:""}</label><br/><input style="width:100%; padding: 5px;" type="text" id="${randomName}" ${"name"in item ?`name="${item.name}-input"`:""}${"value"in item ?` value="${item.value}"`:""}${"placeholder"in item ?` placeholder="${item.placeholder}"`:""}"/>`;if("onenter"in item)element.addEventListener("onkeydown",(event)=>{if(event.key==="Enter")item.onenter()})}else if(item.type==="raw"){element=document.createElement(item.element ? item.element:"p");element.innerHTML=item.text}else if(item.type==="list"){element=document.createElement("lu");element.innerHTML="<li>"+item.items.join("</li><li>")+"</li>"}if(element){form.appendChild(element);if("tooltip"in item)element.title=item.tooltip;if("class"in item)element.class=item.class;if("id"in item)element.id=item.id;if("name"in item)element.setAttribute("name",item.name);if("style"in item)element.style=item.style;if("onclick"in item)element.addEventListener("click",item.onclick)}}if(replaceEntireBody){document.getElementById("content").innerHTML="";document.getElementById("content").appendChild(form)}else document.getElementById("bodyContent").prepend(form)}var toolbarDiv;if(!toolbarDiv)toolbarDiv=$('<div>').prependTo($('#bodyContent'));var ToolbarButtonCount;if(!ToolbarButtonCount)ToolbarButtonCount=0;function addToolbarButton(text,tooltip="",id=""){ToolbarButtonCount++;return $(`<span id="${id}" title="${tooltip}">${ToolbarButtonCount>1 ?" / ":""}<a>${text}</a></span>`).appendTo(toolbarDiv)}function restoreRevid(revid,summary){return new mw.Api().get({action:'query',revids:revid,prop:'revisions',rvprop:'user',format:'json',formatversion:'2'}).then((res)=>{var user=res.query.pages[0].revisions[0].user;var pageid=res.query.pages[0].pageid;if(!summary)summary='Restored revision [[Special:Diff/$ID|$ID]] by [[Special:Contributions/$USER|$USER]]';return new mw.Api().postWithEditToken({action:'edit',pageid:pageid,undo:mw.config.get('wgCurRevisionId'),undoafter:revid,nocreate:true,summary:summary.replace(/\$ID/g,revid).replace(/\$USER/g,user)+(wTools_config ? wTools_config.editAd:""),tags:wTools_config ? wTools_config.editTags:""})}).then(()=>{mw.notify('Restored revision successfully.');___location.reload()},(e)=>{mw.notify(JSON.stringify(e),{type:'error'})})}function undoRevid(revid){return new mw.Api().get({action:'query',revids:revid,prop:'revisions',rvprop:'user|ids',format:'json',formatversion:'2'}).then((res)=>{var user=res.query.pages[0].revisions[0].user;var oldid=res.query.pages[0].revisions[0].parentid;var pageid=res.query.pages[0].pageid;return new mw.Api().postWithEditToken({action:'edit',pageid:pageid,undoafter:oldid,undo:revid,nocreate:true,summary:"Undoing revision $ID by $USER".replace(/\$ID/,revid).replace(/\$USER/,user),tags:wTools_config ? wTools_config.editTags:""})}).then(()=>{mw.notify('Reverted revision successfully.')},(e)=>{mw.notify(JSON.stringify(e),{type:'error'})})}function rollbackRevid(revid,editSummary){return new mw.Api().get({action:'query',revids:revid,prop:'revisions',rvprop:'user',format:'json',formatversion:'2'}).then((res)=>{let user=res.query.pages[0].revisions[0].user;let pageName=res.query.pages[0].title;return rollbackEdit(pageName,user,editSummary)})}function rollbackEdit(pageName,userName,editSummary){let params={watchlist:"nochange",tags:wTools_config ? wTools_config.editTags:""};if(editSummary)params.summary=editSummary;return new mw.Api().rollback(pageName,userName,params)}var CHANGELOG=[{"type":"raw","element":"h2","text":"0.1.3 - "},{"type":"list","items":["Made it so if you press tab while multiple lines are selected, it will indent all the selected lines.","Made it so if you press shift+tab while multiple lines are selected, it will un-indent all the selected lines.","Fixed some of the jank with the link autocompletion menu.",]},{"type":"raw","element":"h2","text":"0.1.2 - 2 Febuary 2025"},{"type":"list","items":["Optimized script for loading.","Removed the user setting `useExperimental`."]},{"type":"raw","element":"h2","text":"0.1.1 - 31 January 2025"},{"type":"list","items":["Fixed a bug where typing a colon or a slash would close the auto-completion link menu.","Added a search bar to the editor for searching for text.","Fixed some jank that could occur if you spam press the tab button.","Added a search and replace feature for the editor."]},{"type":"raw","element":"h2","text":"0.1.0 - 30 January 2025"},{"type":"list","items":["Created the wTools <a href='https://meta.wikimedia.org/wiki/User:L10nM4st3r/wToolCore'\u003Edocumentation page\u003C/a\u003E.","Made optimization to the source code, now it should load faster.","Made it fix all links to all moved pages in a single edit, instead of doing it over multiple edits per page.","Fixed a bug where moving sub-pages wouldn't update links to the page, nor would it redirect you to the new page.","Changed some of the icons in the sidebar.","Added a changelog button to the bottom of the sidebar.","Now the scripts are loaded into local storage, which should help with loading speeds on slower hardware or internet connections.","Added 2 buttons to the top of contribution pages, allowing you to rollback all edits made by a user, or to rollback only the selected edits.","Added a new edit tag, which appears for supported wikis. (You can request more wikis to use the tag at <a href='https://meta.wikimedia.org/wiki/User talk:L10nM4st3r'\u003Emy meta-wiki talkpage\u003C/a\u003E.)","Fixed several bugs."]}];document.getElementById("about")? document.getElementById("about").remove():null;document.getElementById("copyright")? document.getElementById("copyright").remove():null;document.getElementById("disclaimer")? document.getElementById("disclaimer").remove():null;document.getElementById("footer")? document.getElementById("footer").remove():null;var sidebar=`<style>.fixed {position: fixed !important} .wSidebar-button {cursor:pointer; display:inline; width:32px; height:32px; border:1px solid}</style><div id="wSidebar-main" class="fixed" style="float:left;top:0em;offset-top:0;margin-top:0;background-color:#f0f9fa;width:150px;height:99%;z-index:999999 !important;border:3px double black"><div id="wSidebar-logo" style="height:155px"></div><div id="wSidebar-pageActions">${getPageActionButtons()+getUserActionButtons()+getOtherActionButtons()+getSimpleButtons()+getwToolButtons()}</div></div>`;if(document.getElementById("p-navigation")!=null)document.getElementById("p-navigation").parentElement.innerHTML=sidebar;else if(document.getElementById("p-nav")!=null)document.getElementById("p-nav").parentElement.innerHTML=sidebar;else if(document.getElementById("p-lang")!=null)document.getElementById("p-lang").parentElement.innerHTML=sidebar;else if(document.getElementById("p-search")!=null)document.getElementById("p-search").parentElement.innerHTML=sidebar;document.getElementById('wSidebar-logo').appendChild(document.getElementById("p-logo"));document.getElementById('p-logo').style="margin-left:-8px";function getPageActionButtons(){var output="";var isEditing=wTools.action==="edit"||wTools.action==="submit";if(wTools.isEditable&&wTools.namespace>=0&&!isEditing)output+=`<input style="background:url(https://upload.wikimedia.org/wikipedia/commons/5/5c/Codex_icon_edit.svg); background-size: 100% 100%" class="wSidebar-button" title="Edit Page" type="button" onclick="editPage()"></input>`;else if(!wTools.isEditable&&wTools.namespace>=0&&!isEditing)output+=`<input style="background:url(https://upload.wikimedia.org/wikipedia/commons/2/2f/OOjs_UI_icon_editLock-ltr.svg); background-size: 100% 100%" class="wSidebar-button" title="Page Protected (View Source)" type="button" onclick="editPage()"></input>`;if(!wTools.isSpecialPage){if(wTools.namespace<0||wTools.action!=="view"||___location.href.includes("&diff="))output+=`<input style="background:url(https://upload.wikimedia.org/wikipedia/commons/5/58/Document_text.svg); background-size: 100% 100%" class="wSidebar-button" title="View Page" type="button" onclick="viewPage()"></input>`;if(wTools.namespace<0||wTools.realNamespaceName.toLowerCase().includes("talk"))output+=`<input style="background:url(https://upload.wikimedia.org/wikipedia/commons/6/66/Codex_icon_speech_bubbles.svg); background-size: 100% 100%" class="wSidebar-button" title="Return to page" type="button" onclick="returnFromTalkPage()"></input>`;else output+=`<input style="background:url(https://upload.wikimedia.org/wikipedia/commons/6/66/Codex_icon_speech_bubbles.svg); background-size: 100% 100%" class="wSidebar-button" title="Go to talkpage" type="button" onclick="goToTalkPage()"></input>`;if(wTools.canProtectPage&&(isAdmin||canProtectPages))output+=`<input style="background:url(https://upload.wikimedia.org/wikipedia/commons/8/8f/Codex_icon_linkSecure.svg); background-size: 100% 100%" class="wSidebar-button" title="${mw.config.get("wgRestrictionEdit").length>0 ?"Change protection settings":"Protect page"}" type="button" onclick="protectPage()"></input>`;output+=`<input style="background:url(https://upload.wikimedia.org/wikipedia/commons/1/14/PICOL_icon_Refresh.svg); background-size: 100% 100%" class="wSidebar-button" title="Purge page" type="button" onclick="purgePage()"></input>`;if(wTools.pageExists)output+=`<input style="background:url(https://upload.wikimedia.org/wikipedia/commons/2/22/OOjs_UI_icon_pageSettings.svg); background-size: 100% 100%" class="wSidebar-button" title="Page information" type="button" onclick="pageInfo()"></input>`}if((wTools.pageExists&&wTools.canProtectPage)&&(mw.config.get("wgRestrictionMove").length===0||containsAny(mw.config.get("wgRestrictionMove"),wTools.userGroups)))output+=`<input style="background:url(https://upload.wikimedia.org/wikipedia/commons/4/4f/OOjs_UI_icon_mandatory_constraint_violation.svg); background-size: 100% 100%" class="wSidebar-button" title="Move page" type="button" onclick="movePage()"></input>`;output+=`<input style="background:url(https://upload.wikimedia.org/wikipedia/commons/2/27/OOjs_UI_icon_history.svg); background-size: 100% 100%" class="wSidebar-button" title="View page history" type="button" onclick="history()"></input>`;if(wTools.namespace>=0){output+=`<input id="wSidebar-unwatch" style="background:url(https://upload.wikimedia.org/wikipedia/commons/9/99/OOjs_UI_icon_star.svg); background-size: 100% 100%; display:${wTools.isPageWatched ?"inline":"none"}" class="wSidebar-button" title="Unwatch page" type="button" onclick="watch()"></input>`;output+=`<input id="wSidebar-watch" style="background:url(https://upload.wikimedia.org/wikipedia/commons/c/c3/OOjs_UI_icon_unStar.svg); background-size: 100% 100%; display:${wTools.isPageWatched ?"none":"inline"}" class="wSidebar-button" title="Watch page" type="button" onclick="unwatch()"></input>`}return`<div style="margin-top:8px">${output}</div>`}function getUserActionButtons(){var output="";output+=`<input style="background:url(https://upload.wikimedia.org/wikipedia/commons/9/98/OOjs_UI_icon_userAvatar.svg); background-size: 100% 100%" class="wSidebar-button" title="View your user page" type="button" onclick="userPage()"></input>`;output+=`<input style="background:url(https://upload.wikimedia.org/wikipedia/commons/b/b6/OOjs_UI_icon_userTalk-ltr.svg); background-size: 100% 100%" class="wSidebar-button" title="View your user talk page" type="button" onclick="userTalkPage()"></input>`;output+=`<input style="background:url(https://upload.wikimedia.org/wikipedia/commons/3/31/OOjs_UI_icon_clock_apex.svg); background-size: 100% 100%" class="wSidebar-button" title="View the recent changes" type="button" onclick="recentChangesPage()"></input>`;output+=`<input style="background:url(https://upload.wikimedia.org/wikipedia/commons/8/8e/OOjs_UI_icon_watchlist-ltr.svg); background-size: 100% 100%" class="wSidebar-button" title="View your watchlist" type="button" onclick="watchlistPage()"></input>`;return`<div style="margin-top:8px">${output}</div>`}function getOtherActionButtons(){var output="";output+=`<input style="background:url(https://upload.wikimedia.org/wikipedia/commons/6/6b/OOjs_UI_icon_upload.svg); background-size: 100% 100%" class="wSidebar-button" title="Upload file" type="button" onclick="uploadFile()"></input>`;output+=`<input style="background:url(https://upload.wikimedia.org/wikipedia/commons/d/de/OOjs_UI_icon_search-ltr.svg); background-size: 100% 100%" class="wSidebar-button" title="Search this wiki" type="button" onclick="searchWiki()"></input>`;output+=`<input style="background:url(https://upload.wikimedia.org/wikipedia/commons/0/02/OOjs_UI_icon_link-rtl.svg); background-size: 100% 100%" class="wSidebar-button" title="What links here" type="button" onclick="whatLinksHere()"></input>`;output+=`<input style="background:url(https://upload.wikimedia.org/wikipedia/commons/a/a3/OOjs_UI_icon_articles-ltr.svg); background-size: 100% 100%" class="wSidebar-button" title="View subpages" type="button" onclick="subpages()"></input>`;if(wTools.viewingUserName)output+=`<input style="background:url(https://upload.wikimedia.org/wikipedia/commons/8/89/OOjs_UI_icon_web.svg); background-size: 100% 100%" class="wSidebar-button" title="View user contributions" type="button" onclick="userContribs()"></input>`;if(isAdmin){if(wTools.pageExists)output+=`<input style="background:url(https://upload.wikimedia.org/wikipedia/commons/3/3f/OOjs_UI_icon_trash.svg); background-size: 100% 100%" class="wSidebar-button" title="Delete page" type="button" onclick="deletePage()"></input>`;if(wTools.viewingUserName)output+=`<input style="background:url(https://upload.wikimedia.org/wikipedia/commons/a/a1/OOjs_UI_icon_block.svg); background-size: 100% 100%" class="wSidebar-button" title="Block user" type="button" onclick="blockUser()"></input>`}else{if(wTools.pageExists)output+=`<input style="background:url(https://upload.wikimedia.org/wikipedia/commons/3/3f/OOjs_UI_icon_trash.svg); background-size: 100% 100%" class="wSidebar-button" title="Send speedy delete request" type="button" onclick="speedyDeletePage()"></input>`}return`<div style="margin-top:8px">${output}</div>`}function getSimpleButtons(){var output="";if(wTools.viewingUserName)output+=`<input style="background:url(https://upload.wikimedia.org/wikipedia/commons/2/29/OOjs_UI_icon_speechBubbleAdd-ltr.svg); background-size: 100% 100%" class="wSidebar-button" title="Template this user" type="button" onclick="templateUser()"></input>`;return`<div style="margin-top:8px">${output}</div>`}function getwToolButtons(){var output="";output+=`<input style="background:url(https://upload.wikimedia.org/wikipedia/commons/5/55/OOjs_UI_icon_newspaper-ltr.svg); background-size: 100% 100%" class="wSidebar-button" title="wToolCore changelog" type="button" onclick="changeLog()"></input>`;return`<div style="position:absolute; bottom:8px">${output}</div>`}function history(){___location.href=wTools.scriptPath+`?title=${wTools.pathSafeFilename}&action=history`}function editPage(){___location.href=wTools.scriptPath+`?title=${wTools.pathSafeFilename}&action=edit`}function viewPage(){___location.href=wTools.getArticlePath(wTools.pageName)}function protectPage(){___location.href=wTools.getArticlePath("Special:Protect/"+wTools.pageName)}function deletePage(){___location.href=wTools.getArticlePath("Special:Delete/"+wTools.pageName)}function subpages(){___location.href=wTools.getArticlePath("Special:PrefixIndex/"+wTools.pageName+"/")}function whatLinksHere(){___location.href=wTools.getArticlePath("Special:WhatLinksHere/"+wTools.pageName)}function movePage(){___location.href=wTools.getArticlePath("Special:MovePage/"+wTools.pageName)}function userContribs(){___location.href=wTools.getArticlePath("Special:Contribs/"+wTools.viewingUserName)}function purgePage(){mwAPI.edit(wTools.pageName,(r)=>{return{text:r.content,summary:"NULL EDIT",minor:true,watchlist:"nochange"}}).then(()=>{___location.reload()},()=>{mwAPI.post({action:"purge",titles:wTools.pageName}).then(()=>{___location.reload()},()=>{mw.notify('Purge failed',{type:'error'})})})}function userPage(){___location.href=wTools.getArticlePath("User:"+wTools.userName)}function userTalkPage(){___location.href=wTools.getArticlePath("User_talk:"+wTools.userName)}function blockUser(){___location.href=wTools.getArticlePath("Special:Block/"+wTools.viewingUserName)}function pageInfo(){___location.href=wTools.scriptPath+`?title=${wTools.pathSafeFilename}&action=info`}function recentChangesPage(){___location.href=wTools.getArticlePath("Special:RecentChanges")}function watchlistPage(){___location.href=wTools.getArticlePath("Special:Watchlist")}function uploadFile(){___location.href=wTools.getArticlePath("Special:Upload")}function searchWiki(){___location.href=wTools.getArticlePath("Special:Search")}function returnFromTalkPage(){___location.href=wTools.getArticlePath(wTools.namespacesIdToString[wTools.namespace-1]+":"+wTools.pageTitle)}function goToTalkPage(){___location.href=wTools.getArticlePath(wTools.namespacesIdToString[wTools.namespace+1]+":"+wTools.pageTitle)}function watch(){mwAPI.watch(wTools.pageName);wTools.isPageWatched=true;document.getElementById("wSidebar-watch").style.display="inline";document.getElementById("wSidebar-unwatch").style.display="none"}function unwatch(){mwAPI.unwatch(wTools.pageName);wTools.isPageWatched=false;document.getElementById("wSidebar-unwatch").style.display="inline";document.getElementById("wSidebar-watch").style.display="none"}function changeLog(){createForm("Changelog for wToolCore",CHANGELOG)}function speedyDeletePage(){let configData={};let redirectData=[];let hasMadeRequest=false;function makeRequest(){if(hasMadeRequest)return;hasMadeRequest=true;let reportReason=document.getElementById("wsidebar-textbox-reason").children[2].value.trim();let pageName=mw.config.get('wgPageName');let redirectsDeleting=0;let additionalRedirectText="";let redirectCheckbox=document.getElementById("wsidebar-checkbox-deleteredirects");if(redirectCheckbox!==null&&redirectCheckbox.children[0].checked)for(let redirect of redirectData){if(document.getElementById("wsidebar-checkbox-redirect-"+redirect.title).children[0].checked)redirectsDeleting++;additionalRedirectText+=configData.redirect_append.replace("{{{PAGE}}}",redirect.title).replace("{{{REASON}}}",reportReason)}let editSummary=`[Requesting Deletion of [[${pageName}]]${redirectsDeleting>0 ?` (And [[Special:WhatLinksHere/${pageName}|${redirectsDeleting} Redirect${redirectsDeleting!==1 ?"s":""}]])`:""}] ${reportReason} ${wTools_config.editAd}`;let shortEditSummary=`[Requesting Deletion of [[${pageName}]]] ${reportReason} ${wTools_config.editAd}`;let message;if("message_redirect"in configData&&mw.config.get("wgIsRedirect"))message=configData.message_redirect.replace("{{{PAGE}}}",pageName).replace("{{{REASON}}}",reportReason).replace("{{{REDIRECTS}}}",additionalRedirectText);else if("message"in configData)message=configData.message.replace("{{{PAGE}}}",pageName).replace("{{{REASON}}}",reportReason).replace("{{{REDIRECTS}}}",additionalRedirectText);if(!configData.message&&redirectsDeleting>0)for(let redirect of redirectData){if(document.getElementById("wsidebar-checkbox-redirect-"+redirect.title).children[0].checked){mwAPI.edit(redirect.title,(revision)=>{return{text:configData.send_page_notice.replace("{{{PAGE}}}",pageName).replace("{{{REASON}}}",reportReason).replace("{{{CONTENT}}}",revision.content),summary:editSummary,tags:wTools_config.editTags}})}}if(configData.target_page)mwAPI.get({action:"parse",prop:"wikitext",page:configData.target_page}).then((ret)=>{let hasSentReport=false;configData.append_message_rules.forEach((appendRule)=>{if(hasSentReport)return;let text=ret.parse.wikitext["*"];let canEdit=true;if(appendRule.type==="below_text_anchor"){if(!text.includes(appendRule.anchor))canEdit=false;else text=text.replace(appendRule.anchor,appendRule.anchor+message)}else if(appendRule.type==="above_text_anchor"){if(!text.includes(appendRule.anchor))canEdit=false;else text=text.replace(appendRule.anchor,message+appendRule.anchor)}else if(appendRule.type==="bottom")text+=message;else if(appendRule.type==="top")text=message+text;if(canEdit){mwAPI.postWithToken('csrf',{title:configData.target_page,action:"edit",format:"json",summary:editSummary,text:text,tags:wTools_config.editTags}).then(()=>{mw.notify("Successfuly sent request!",{type:'success'});if(configData.send_page_notice&&(!configData.target_page||document.getElementById("wsidebar-checkbox-sendtemplate").children[0].checked)){mwAPI.edit(pageName,(revision)=>{return{text:configData.send_page_notice.replace("{{{PAGE}}}",pageName).replace("{{{REASON}}}",reportReason).replace("{{{CONTENT}}}",revision.content),summary:shortEditSummary,tags:wTools_config.editTags}}).then(()=>{___location.reload()})}else if(wTools_config.speedyDeleteShouldRedirect){___location.href=wTools.getArticlePath(configData.target_page)}else ___location.reload()},()=>{hasMadeRequest=false;mw.notify("Unable to send request.",{type:'error'})});hasSentReport=true}},()=>{hasMadeRequest=false;mw.notify("Cannot get page data for "+configData.target_page,{type:'error'})})});else{mwAPI.edit(pageName,(revision)=>{return{text:configData.send_page_notice.replace("{{{PAGE}}}",pageName).replace("{{{REASON}}}",reportReason).replace("{{{CONTENT}}}",revision.content),summary:shortEditSummary,tags:wTools_config.editTags}}).then(()=>{___location.reload()})}}mw.loader.getScript(`https://${wTools.serverName}/w/index.php?title=User:L10nM4st3r/wikimenu/quick_qvfd/config.json&action=raw&ctype=text/json`).then((file)=>{configData=JSON.parse(file);if(configData===null){mw.notify(`Speedy delete not configured on this wiki!`,{type:"error",tag:"err-sp-delete"});return}mwAPI.get({"action":"query","prop":"redirects","titles":wTools.pageName,"formatversion":2}).then((data)=>{hasLoadedPageData=true;if("redirects"in data.query.pages[0])redirectData=data.query.pages[0].redirects;let content=[{"type":"label","text":"Request the speedy deletion of this page."},{"type":"textbox","id":"wsidebar-textbox-reason","text":"Reason:","placeholder":"Reason","onenter":makeRequest}];if(configData.send_page_notice&&configData.target_page){content.push({"type":"checkbox","id":"wsidebar-checkbox-sendtemplate","value":true,"text":`Post deletion template on page.`})}if(redirectData.length>0){content.push({"type":"checkbox","id":"wsidebar-checkbox-deleteredirects","onclick":()=>{var checked=document.getElementById("wsidebar-checkbox-deleteredirects").children[0].checked;for(let checkbox of document.getElementsByName("wsidebar-checkbox-redirectoption")){checkbox.style.display=checked ?"block":"none"}},"text":`Also request deletion of redirects`})}for(let redirect of redirectData){content.push({"type":"checkbox","value":true,"style":"display:none","name":"wsidebar-checkbox-redirectoption","id":"wsidebar-checkbox-redirect-"+redirect.title,"text":`Delete redirect <a href="${wTools.scriptPath}?title=${makeStringPathSafe(redirect.title)}&redirect=no">${redirect.title}</a>`})}content.push({"type":"button","tooltip":`Make deletion request.`,"text":`Make Request`,"onclick":makeRequest,"style":"padding:8px; width: 35%"});createForm(`Request speedy deletion for ${wTools.pageName}`,content)})},(e)=>{mw.notify(JSON.stringify(e),{type:"error",tag:"err-sp-delete"})})}function templateUser(){let configData={};mw.loader.getScript(`https://${wTools.serverName}/w/index.php?title=User:L10nM4st3r/wikimenu/user_templating/config.json&action=raw&ctype=text/json`).then((file)=>{configData=JSON.parse(file);if(configData===null){mw.notify(`User templating not configured on this wiki!`,{type:"error",tag:"err-user-temp"});return}var formOutput=[];for(let category of configData){formOutput.push({type:"raw",element:"h2",text:category.category_name},{type:"label",text:category.tooltip+"."});for(let template of category.templates){let templateDescription=template.description;let templateHeader=template.wToolCore_header;let templateSummary=template.editSummary;let templateMessage=template.message;let templateArguments=template.arguments;formOutput.push({type:"link",text:template.template_name,tooltip:template.tooltip,onclick:()=>{let output=[{type:"label",text:templateDescription}];if(templateArguments)for(let arg of templateArguments){if(arg.with==="text_input"||arg.with==="text_input_notrim")output.push({type:"textbox",placeholder:arg.placeholder,name:"wToolCore-arg-"+arg.name});else if(arg.with==="multiline_text_input"||arg.with==="multiline_text_input_notrim")output.push({type:"textarea",placeholder:arg.placeholder,name:"wToolCore-arg-"+arg.name})}output.push({type:"button",text:"Send",onclick:()=>{let pageTitle="User_talk:"+mw.config.get("wgRelevantUserName");let message=templateMessage;let editSummary=templateSummary+wTools_config.editAd;if(templateArguments){templateArguments.forEach((arg)=>{if(arg.with==="text_input"){message=message.replace("{{{"+arg.name+"}}}",document.getElementsByName("wToolCore-arg-"+arg.name+"-input")[0].value.trim());editSummary=editSummary.replace("{{{"+arg.name+"}}}",document.getElementsByName("wToolCore-arg-"+arg.name+"-input")[0].value.trim())}else if(arg.with==="text_input_notrim"){message=message.replace("{{{"+arg.name+"}}}",document.getElementsByName("wToolCore-arg-"+arg.name+"-input")[0].value);editSummary=editSummary.replace("{{{"+arg.name+"}}}",document.getElementsByName("wToolCore-arg-"+arg.name+"-input")[0].value.trim())}else if(arg.with==="multiline_text_input"){message=message.replace("{{{"+arg.name+"}}}",document.getElementsByName("wToolCore-arg-"+arg.name+"-input")[0].value.trim());editSummary=editSummary.replace("{{{"+arg.name+"}}}",document.getElementsByName("wToolCore-arg-"+arg.name+"-input")[0].value.trim())}else if(arg.with==="multiline_text_input_notrim"){message=message.replace("{{{"+arg.name+"}}}",document.getElementsByName("wToolCore-arg-"+arg.name+"-input")[0].value);editSummary=editSummary.replace("{{{"+arg.name+"}}}",document.getElementsByName("wToolCore-arg-"+arg.name+"-input")[0].value)}else if(arg.with==="mw_config"){message=message.replace("{{{"+arg.name+"}}}",mw.config.get(arg.config));editSummary=editSummary.replace("{{{"+arg.name+"}}}",mw.config.get(arg.config))}})}mwAPI.get({action:"query",prop:"info",titles:pageTitle}).then((ret)=>{if(!Object.keys(ret.query.pages).includes("-1")){mwAPI.edit(pageTitle,(revision)=>{return{text:revision.content+"\n\n"+message,summary:editSummary,tags:wTools_config.editTags}}).then(()=>{mw.notify("Successfuly sent message!",{type:'success'});___location.href=wTools.getArticlePath(pageTitle)+"#bottom";___location.reload()},(e)=>{mw.notify("Unable to send message: "+JSON.stringify(e),{type:'error'})})}else{mwAPI.create(pageTitle,{summary:editSummary,tags:wTools_config.editTags},message).then(()=>{mw.notify("Successfuly sent message!",{type:'success'});___location.href=wTools.getArticlePath(pageTitle)+"#bottom";___location.reload()},(e)=>{mw.notify("Unable to create page: "+JSON.stringify(e),{type:'error'})})}},()=>{mw.notify("Unable to get page data.",{type:'error'})})}});createForm(templateHeader.replace("{user}",wTools.viewingUserName),output)}})}}createForm(`Template user ${wTools.viewingUserName}`,formOutput)},(e)=>{mw.notify(JSON.stringify(e),{type:"error",tag:"err-user-temp"})})}$(()=>{var crossWiki=mw.user.options.get('echo-cross-wiki-notifications'),shownTime=Date.now();function updateIcon(id,data){$('#'+id+' a').toggleClass('mw-echo-unseen-notifications',data.latest>data.seen).toggleClass('mw-echo-notifications-badge-all-read',!data.count).attr('data-counter-num',data.count).attr('data-counter-text',data.count)}function updateCount(status){if(status.alert.latest>shownTime||status.message.latest>shownTime){shownTime=Date.now();mw.notify('New notification received!')}updateIcon('pt-notifications-alert',status.alert);updateIcon('pt-notifications-notice',status.message)}function getData(){mwAPI.get({action:'query',format:'json',meta:'notifications',notprop:'list|count|seenTime',notlimit:1,notgroupbysection:true,notalertunreadfirst:true,notmessageunreadfirst:true,notcrosswikisummary:crossWiki}).then((res)=>{var info=res.query.notifications,status={alert:{seen:Date.parse(info.alert.seenTime),latest:info.alert.list[0].timestamp.utcunix,count:info.alert.rawcount},message:{seen:Date.parse(info.message.seenTime),latest:info.message.list[0].timestamp.utcunix,count:info.message.rawcount}};localStorage.setItem('update-notifications-status',JSON.stringify(status));updateCount(status)})}setInterval(()=>{getData()},10000)});if(wTools_config.editorEnabled&&(wTools.action==="edit"||wTools.action==="submit")){var wEditData={is_new_page:false,is_viewing_source:false,old_text:"",edit_section:"-1",currentRevId:mw.config.get("wgCurRevisionId"),editConflictText:"",thisText:"",codeMirror:null,codeMirrorExtensions:{extensions:[{key:"Tab",run:onTabPressed}],autocomplete:(context)=>{let word=context.matchBefore(/\w*/)if(word.from==word.to&&!context.explicit)return null return{from:word.from,options:[{label:"TEST",type:"keyword"}]}}}};function textareaCursorPos(value){if(value===true||value===false||value==null)return wEditData.codeMirror.$textarea.textSelection('getCaretPosition',{startAndEnd:value});if(value!=null){if(typeof value==="number")wEditData.codeMirror.$textarea.textSelection("setSelection",{start:value,end:value[0]});else wEditData.codeMirror.$textarea.textSelection("setSelection",{start:value[0],end:value[1]})}}function textareaFocus(){wEditData.codeMirror.$textarea[0].focus()}function textContent(value){if(value!=undefined){wEditData.codeMirror.$textarea.textSelection('setContents',value);return value}return wEditData.codeMirror.$textarea.textSelection('getContents')}function textareaProp(prop,value){return wEditData.codeMirror.$textarea.prop(prop,value)}const TEXT_VALUES={previewText:"Show Preview",previewTooltip:"Preview your changes",changesText:"Show Changes",changesTooltip:"Show which changes you made to the text",saveEditText:"Save Changes",saveEditTooltip:"Save your changes",savePageText:"Save",savePageTooltip:"Save this page",editSummaryPlaceholder:"Edit Summary",editSummaryCreatePlaceholder:"Summary",editSummaryTooltip:"Enter a short summary",subjectPlaceholder:"Subject",subjectTooltip:"What is the subject you are talking about?",minorEditLabel:"Minor Edit",watchPageLabel:"Watch This Page",editSummaryClearTooltip:"Clear summary",insertWikilinkTooltip:"Insert Wiki-link Brackets",insertTemplateTooltip:"Insert Template Brackets",ec_replaceWithNewVer:"Replace Content With New Version",ec_replaceWithMyVer:"Replace Content With My Version",ec_replaceWithNewVerTooltip:"Replaces the edit box content with the new version",ec_replaceWithMyVerTooltip:"Replaces the edit box content with your version"};mw.loader.load("https://en.wikipedia.org/w/index.php?title=User:Cacycle/diff.js&action=raw&ctype=text/javascript");function onTabPressed(){let selection=textareaCursorPos(true);if(e.shiftKey&&selection[0]!==selection[1]){let selectedText=textContent().slice(selection[0],selection[1]);var decreaseSelectionBy=selectedText.split("\n\t").length-1;textContent(textContent().slice(0,selection[0])+selectedText.replace(/\n\t/g,"\n")+textContent().slice(selection[1]));let didAtSelectionStart=false;if(selectedText.charAt(0)!=="\n"){let lastNewlinePos=textContent().lastIndexOf("\n",selection[0])+1;if(textContent().charAt(lastNewlinePos)==="\t"){textContent(textContent().slice(0,lastNewlinePos)+textContent().slice(lastNewlinePos+1));decreaseSelectionBy++;didAtSelectionStart=true}}textareaCursorPos([selection[0]-(didAtSelectionStart ? 1:0),selection[1]-decreaseSelectionBy])}else if(selection[0]!==selection[1]){let selectedText=textContent().slice(selection[0],selection[1]);textContent(textContent().slice(0,selection[0])+selectedText.replace(/\n/g,"\n\t")+textContent().slice(selection[1]));var increaseSelectionBy=selectedText.split("\n").length-1;if(selectedText.charAt(0)!=="\n"){var lastNewlinePos=textContent().lastIndexOf("\n",selection[0])+1;textContent(textContent().slice(0,lastNewlinePos)+"\t"+textContent().slice(lastNewlinePos));increaseSelectionBy++}textareaCursorPos([selection[0]+1,selection[1]+increaseSelectionBy])}else wEditor_insertText("\t")}function contentOnKeyPress(e){if(e.key==='Tab'){let selection=textareaCursorPos(true);if(e.shiftKey&&selection[0]!==selection[1]){let selectedText=textContent().slice(selection[0],selection[1]);var decreaseSelectionBy=selectedText.split("\n\t").length-1;textContent(textContent().slice(0,selection[0])+selectedText.replace(/\n\t/g,"\n")+textContent().slice(selection[1]));let didAtSelectionStart=false;if(selectedText.charAt(0)!=="\n"){let lastNewlinePos=textContent().lastIndexOf("\n",selection[0])+1;if(textContent().charAt(lastNewlinePos)==="\t"){textContent(textContent().slice(0,lastNewlinePos)+textContent().slice(lastNewlinePos+1));decreaseSelectionBy++;didAtSelectionStart=true}}textareaCursorPos([selection[0]-(didAtSelectionStart ? 1:0),selection[1]-decreaseSelectionBy])}else if(selection[0]!==selection[1]){let selectedText=textContent().slice(selection[0],selection[1]);textContent(textContent().slice(0,selection[0])+selectedText.replace(/\n/g,"\n\t")+textContent().slice(selection[1]));var increaseSelectionBy=selectedText.split("\n").length-1;if(selectedText.charAt(0)!=="\n"){var lastNewlinePos=textContent().lastIndexOf("\n",selection[0])+1;textContent(textContent().slice(0,lastNewlinePos)+"\t"+textContent().slice(lastNewlinePos));increaseSelectionBy++}textareaCursorPos([selection[0]+1,selection[1]+increaseSelectionBy])}else{wEditor_insertText("\t")}e.preventDefault()}if((thisUndoType==="key"||thisUndoType==="backspace"||thisUndoType==="space"||["/",":"].includes(e.key))&&!isNullInput)setTimeout(()=>{let lastLinkPos=textContent().lastIndexOf('[[',textareaCursorPos())+2;let text=textContent().slice(lastLinkPos,textareaCursorPos());let linkText=text[0]===":"? text.slice(1):text;if(lastLinkPos>=2&&!text.includes("\n")&&!text.includes("|")&&!text.includes("]]")&&!text.includes("{")&&text.length>0){let searchNamespace=getNamespaceFromText(linkText.slice(0,linkText.indexOf(":")));let searchText=linkText.slice(linkText.indexOf(":")+1);if(searchNamespace==="-1"){searchNamespace="0";searchText=linkText}if(searchText)mwAPI.get({"action":"query","format":"json","list":"allpages","apprefix":linkText.slice(linkText.indexOf(":")+1),"apnamespace":searchNamespace}).then((ret)=>{if(ret.query.allpages.length>0){let caret=getCaretCoordinates(textareaCursorPos(),textareaCursorPos());wEditor_populateAutocompleteMenu(caret.top+65,caret.left+90,ret.query.allpages,lastLinkPos,text[0]===":")}else wEditor_hideAutocompleteMenu()},wEditor_hideAutocompleteMenu);else wEditor_hideAutocompleteMenu()}else{lastLinkPos=textContent().lastIndexOf('{{',textareaCursorPos())+2;text=textContent().slice(lastLinkPos,textareaCursorPos());linkText=text[0]===":"? text.slice(1):text;if(lastLinkPos>1&&!text.includes("\n")&&!text.includes("|")&&!text.includes("}}")&&text.length>0&&textContent().charAt(lastLinkPos-3)!=="{"){let searchNamespace=getNamespaceFromText(linkText.slice(0,linkText.indexOf(":")));let searchText=linkText.slice(linkText.indexOf(":")+1);if(searchNamespace==="-1"){searchNamespace="10";searchText=linkText}if(searchText)mwAPI.get({"action":"query","format":"json","list":"allpages","apprefix":searchText,"apnamespace":searchNamespace}).then((ret)=>{if(ret.query.allpages.length>0){let selection=textareaCursorPos(true);let caret=getCaretCoordinates(selection[0],selection[1]);wEditor_populateAutocompleteMenu(caret.top+65,caret.left+90,ret.query.allpages,lastLinkPos,false,true,text.toLowerCase().startsWith("template:"))}else wEditor_hideAutocompleteMenu()},wEditor_hideAutocompleteMenu);else wEditor_hideAutocompleteMenu()}else wEditor_hideAutocompleteMenu()}},1);else if(!isNullInput)wEditor_hideAutocompleteMenu()}function wEditor_populateAutocompleteMenu(top,left,pages,lastLinkPos,useColon,isTemplate=false,templateIncludePrefix=false){var autocomplete=document.getElementById("wedit-autocomplete");autocomplete.style.top=(textareaProp("offsetTop")-textareaProp("scrollTop")+top).toString()+"px";autocomplete.style.left=(textareaProp("offsetLeft")-textareaProp("scrolLeft")+left).toString()+"px";autocomplete.style.display="block";var innerText="";for(let page of pages){if(isTemplate&&page.title.startsWith("Template:")&&!templateIncludePrefix)page.title=page.title.replace("Template:","");innerText+=`<input type="button" style="width:100%;display:block" value="${page.title.replace(/"/g,'\\"')}" onclick="${isTemplate ?"wEditor_InsertTemplate":"wEditor_InsertLink"}('${useColon ?":":""}${page.title.replace(/'/g,"\\'").replace(/"/g,'\\"')}')"></input>`}autocomplete.innerHTML=innerText}function wEditor_hideAutocompleteMenu(){document.getElementById("wedit-autocomplete").style.display="none"}function getNamespaceFromText(text){const DATA=mw.config.get("wgNamespaceIds");if(text.toLowerCase()in DATA)return DATA[text.toLowerCase().replace(/ /g,"_")].toString();return"-1"}var pageName=mw.config.get("wgPageName").toLowerCase().replace(/ /g,"_");var pageTitle=document.getElementsByClassName("mw-first-heading")[0].innerText;if(pageTitle.toLowerCase().startsWith("view source for "+pageName))wEditData.is_viewing_source=true;if(pageTitle.toLowerCase().replace(/ /g,"_")==="creating_"+pageName)wEditData.is_new_page=true;if(___location.href.includes("&section=")){var href=___location.href;href=href.slice(href.indexOf("&section=")+9,href.length);if(href.includes("&"))href=href.slice(0,href.indexOf("&"));wEditData.edit_section=href}if(!wEditData.is_viewing_source){var editTextBoxValue=document.getElementById("wpTextbox1").value;var editSummaryValue=document.getElementsByName('wpSummary')[0].value;wEditData.old_text=editTextBoxValue;var editform=document.getElementById("editform");editform.style.display="none";var container=document.createElement("div");container.innerHTML=wEditor_generateEditor();editform.parentNode.insertBefore(container,editform.nextNode);var textarea=document.getElementById("wedit-content");textarea.style.display="none";mw.loader.using(['ext.CodeMirror.v6','ext.CodeMirror.v6.mode.mediawiki','ext.CodeMirror.v6.view']).then((require)=>{const CodeMirror=require('ext.CodeMirror.v6');const mediawikiLang=require('ext.CodeMirror.v6.mode.mediawiki');const view=require('ext.CodeMirror.v6.view');wEditData.codeMirror=new CodeMirror(textarea);wEditData.codeMirror.initialize([wEditData.codeMirror.defaultExtensions,mediawikiLang(),wEditData.codeMirrorExtensions]);autocomplete.});textarea.value=editTextBoxValue;textarea.addEventListener("keydown",contentOnKeyPress);document.getElementById("wedit-summary").value=editSummaryValue;document.getElementById("wedit-summary").addEventListener("keydown",wEditor_summaryOnKeyPress);document.getElementById("wedit-templatesUsed").appendChild(document.getElementsByClassName("templatesUsed")[0])}document.body.addEventListener('click',wEditor_hideAutocompleteMenu,true);function wEditor_generateEditor(){var header="<style>.unselectable {-webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none} .checkbox {margin-left: 10px; margin-right: 7px} </style>";var textbox='<div style="background: white"><textarea id="wedit-content" style="line-height:16px; tab-size: 4; width:100%; max-height:250em; min-height:10em; height: 25em; resize:vertical; overflow:auto"></textarea></div>';var output="";if(wEditData.edit_section==="new")output=header+'<div style="background-color:#cbdaf2">'+wEditor_generateToolBar()+wEditor_generateSubjectBar()+textbox+wEditor_generateSubmitBar()+'</div><div id="wedit-editConflictContent"></div><div style="min-height:160px" id="wedit-previewContent"></div>';else output=header+'<div style="background-color:#cbdaf2">'+wEditor_generateToolBar()+textbox+wEditor_generateSubmitBar()+'</div><div id="wedit-editConflictContent"></div><div style="min-height:160px" id="wedit-previewContent"></div><div id="wedit-templatesUsed"></div>';var autocomplete=document.createElement("div");autocomplete.id="wedit-autocomplete";autocomplete.style="background: #e6ecf5; width:auto; height:auto; max-width: 40em; max-height:30em; display:none; position:absolute; float:left";document.body.appendChild(autocomplete);return output}function wEditor_generateToolBar(){var category1=``;var category1Box='<div style="padding: 5px 5px 5px 5px; margin: 7px 7px 7px 7px; border: 1px black solid; flex:1">'+category1+'</div>';var category2=`<input style="background: url(https://upload.wikimedia.org/wikipedia/commons/d/d6/WikiText.svg); background-size: 100% 100%; cursor:pointer; display:inline; width:32px; height:32px" title="${TEXT_VALUES.insertWikilinkTooltip}" type="button" onclick="wEditor_insertWikiLink()"></input><input style="background: url(https://upload.wikimedia.org/wikipedia/commons/a/ab/CurlyBracketsBlue.svg); background-size: 100% 100%; cursor:pointer; display:inline; width:32px; height:32px" title="${TEXT_VALUES.insertTemplateTooltip}" type="button" onclick="wEditor_insertTemplateBrackets()"></input>`;var category2Box='<div style="padding: 5px 5px 5px 5px; margin: 7px 7px 7px 7px; border: 1px black solid; flex:1">'+category2+'</div>';var category3=`<div style="display:flex"><input id="wEditor_searchText" style="flex:1; display:inline" placeholder="Search..." type="text"></input><input style="cursor:pointer; display:inline" title="Search for text" type="button" value="Search" onclick="wEditor_searchForText()"></input></div><div style="display:flex"><input id="wEditor_replaceText" style="width:calc(100% - 10px)" placeholder="Replace..." type="text"></input><input style="cursor:pointer; display:inline" title="Replace next" type="button" value="Replace" onclick="wEditor_replaceNextText()"></input><input style="cursor:pointer; display:inline" title="Replace all" type="button" value="All" onclick="wEditor_replaceAllText()"></input></div><span id="wEditor_searchText_matchCount">--</span><br/><input id="wEditor_searchText_UseRegex" type="checkbox" title="Search for a regular expression. Use regex101.com to test RegExes."></input><label for="wEditor_searchText_UseRegex"> Use RegEx</label><input id="wEditor_searchText_caseSensitive" type="checkbox" title="Is the search case-sensitive? Case-sensitive means that the capitalisation must match."></input><label for="wEditor_searchText_caseSensitive"> Case-Sensitive</label>`;var category3Box='<div style="padding: 5px 5px 5px 5px; margin: 7px 7px 7px 7px; border: 1px black solid; flex:1">'+category3+'</div>';var output='<div style="background-color:#cbdaf2; display:flex">'+category1Box+category3Box+category2Box+'</div>';return output}function wEditor_generateSubmitBar(){if(wEditData.is_viewing_source)return"";var editSummaryInput='<input style="flex:1" id="wedit-summary" title="'+TEXT_VALUES.editSummaryTooltip+'" placeholder="'+(wEditData.is_new_page ? TEXT_VALUES.editSummaryCreatePlaceholder:TEXT_VALUES.editSummaryPlaceholder)+'" type="text" maxlength="400"></input>';var editSummaryClear='<input style="cursor:pointer; display:inline; width:2em" id="wedit-summary-clear" title="'+TEXT_VALUES.editSummaryClearTooltip+'" type="button" value="X" onclick="document.getElementById(\'wedit-summary\').value=\'\'; document.getElementById(\'wedit-summary\').focus();"></input>';var minorEdit=document.getElementById("wpMinoredit")==undefined ?"":'<label class="unselectable" for="wedit-minor"><input id="wedit-minor" name="wedit-minor"'+(document.getElementById("wpMinoredit").checked ?" checked=true":"")+' class="checkbox" type="checkbox"></input>'+TEXT_VALUES.minorEditLabel+'</label>';var watchPageToggle='<label class="unselectable" for="wedit-watch"><input id="wedit-watch" name="wedit-watch"'+(document.getElementById("wpWatchthis").checked ?" checked=true":"")+' class="checkbox" type="checkbox"></input>'+TEXT_VALUES.watchPageLabel+'</label>';var saveEdit='<input style="cursor:pointer; background: linear-gradient(0.99turn, #6daafc, #ebeef2); display:inline; flex:1; height: 2em" id="wedit-save-edit" title="'+(wEditData.is_new_page ? TEXT_VALUES.savePageTooltip:TEXT_VALUES.saveEditTooltip)+'" type="button" value="'+(wEditData.is_new_page ? TEXT_VALUES.savePageText:TEXT_VALUES.saveEditText)+'" onclick="wEditor_saveEdit();"></input>';var previewPage='<input style="cursor:pointer; display:inline; flex:1; height: 2em" id="wedit-show-preview" title="'+TEXT_VALUES.previewTooltip+'" type="button" value="'+TEXT_VALUES.previewText+'" onclick="wEditor_showPreview();"></input>';var viewChanges=wEditData.is_new_page ?"":'<input style="cursor:pointer; display:inline; flex:1; height: 2em" id="wedit-show-showChanges" title="'+TEXT_VALUES.changesTooltip+'" type="button" value="'+TEXT_VALUES.changesText+'" onclick="wEditor_showChanges();"></input>';var editSummaryBar='<div style="display:flex; margin: 6px 3px 6px 3px;">'+editSummaryClear+editSummaryInput+'</div>';var saveButtonsBar='<div style="display:flex; margin: 6px 3px 6px 3px;">'+saveEdit+previewPage+viewChanges+'</div>';if(wEditData.edit_section==="new")return minorEdit+watchPageToggle+saveButtonsBar;return editSummaryBar+minorEdit+watchPageToggle+saveButtonsBar}function wEditor_generateSubjectBar(){var editSummaryInput='<input style="flex:1" id="wedit-summary" title="'+TEXT_VALUES.subjectTooltip+'" placeholder="'+TEXT_VALUES.subjectPlaceholder+'" type="text" maxlength="400"></input>';var editSummaryClear='<input style="cursor:pointer; display:inline; width:2em" id="wedit-summary-clear" title="'+TEXT_VALUES.editSummaryClearTooltip+'" type="button" value="X" onclick="document.getElementById(\'wedit-summary\').value=\'\'; document.getElementById(\'wedit-summary\').focus();"></input>';return'<div style="display:flex; margin: 6px 3px 6px 3px;">'+editSummaryClear+editSummaryInput+'</div>'}(()=>{var properties=['direction','boxSizing','width','height','overflowX','overflowY','borderTopWidth','borderRightWidth','borderBottomWidth','borderLeftWidth','borderStyle','paddingTop','paddingRight','paddingBottom','paddingLeft','fontStyle','fontVariant','fontWeight','fontStretch','fontSize','fontSizeAdjust','lineHeight','fontFamily','textAlign','textTransform','textIndent','textDecoration','letterSpacing','wordSpacing','tabSize','MozTabSize'];var isFirefox=(window.mozInnerScreenX!=null);function getCaretCoordinates(element,position){var div=document.createElement('div');div.id='input-textarea-caret-position-mirror-div';document.body.appendChild(div);var style=div.style;var computed=window.getComputedStyle ? window.getComputedStyle(element):element.currentStyle;var isInput=element.nodeName==='INPUT';style.whiteSpace='pre-wrap';if(!isInput)style.wordWrap='break-word';style.position='absolute';style.visibility='hidden';properties.forEach((prop)=>{if(isInput&&prop==='lineHeight'){if(computed.boxSizing==="border-box"){var height=parseInt(computed.height);var outerHeight=parseInt(computed.paddingTop)+parseInt(computed.paddingBottom)+parseInt(computed.borderTopWidth)+parseInt(computed.borderBottomWidth);var targetHeight=outerHeight+parseInt(computed.lineHeight);if(height>targetHeight)style.lineHeight=height-outerHeight+"px";else if(height===targetHeight)style.lineHeight=computed.lineHeight;else style.lineHeight=0}else style.lineHeight=computed.height}else style[prop]=computed[prop]});if(isFirefox){if(element.scrollHeight>parseInt(computed.height))style.overflowY='scroll'}else style.overflow='hidden';div.textContent=element.value.substring(0,position);if(isInput)div.textContent=div.textContent.replace(/\s/g,'\u00a0');var span=document.createElement('span');span.textContent=element.value.substring(position)||'.';div.appendChild(span);var coordinates={top:span.offsetTop+parseInt(computed.borderTopWidth),left:span.offsetLeft+parseInt(computed.borderLeftWidth),height:parseInt(computed.lineHeight)};div.remove();return coordinates}if(typeof module!='undefined'&&typeof module.exports!='undefined')module.exports=getCaretCoordinates;else window.getCaretCoordinates=getCaretCoordinates})()}function wEditor_showChanges(){var wikEdDiff=new WikEdDiff();document.getElementById('wedit-previewContent').innerHTML=wikEdDiff.diff(wEditData.old_text,textContent())}function wEditor_showPreview(){document.getElementById("wedit-show-preview").disabled=true;var bodyData=textContent();AjaxPreview(bodyData,LocalPreviewAjaxHandler,()=>{document.getElementById("wedit-show-preview").disabled=false})}function wEditor_searchForText(){let searchFor=document.getElementById("wEditor_searchText").value;if(!document.getElementById("wEditor_searchText_UseRegex").checked)searchFor=escapeRegex(searchFor);let regex=new RegExp(searchFor,document.getElementById("wEditor_searchText_caseSensitive").checked ?'g':'ig');let textareaContent=textContent();textareaFocus();if(!textareaContent.match(regex)){document.getElementById("wEditor_searchText_matchCount").innerHTML="Found <strong>0</strong> occurrences.";return}document.getElementById("wEditor_searchText_matchCount").innerHTML="Found <strong>"+textareaContent.match(regex).length.toString()+"</strong> occurrences.";if(textareaContent.match(regex).length>0){regex.lastIndex=textareaProp("selectionEnd");var matchIndex=regex.exec(textareaContent);if(matchIndex===null){regex.lastIndex=0;matchIndex=regex.exec(textareaContent)}wEditor_scrollToChar(matchIndex.index);textareaCursorPos([matchIndex.index,matchIndex.index+matchIndex[0].length])}}function wEditor_replaceNextText(){let searchFor=document.getElementById("wEditor_searchText").value;if(!document.getElementById("wEditor_searchText_UseRegex").checked)searchFor=escapeRegex(searchFor);let regex=new RegExp(searchFor,document.getElementById("wEditor_searchText_caseSensitive").checked ?'':'i');textareaFocus();regex.lastIndex=textareaCursorPos();var matchIndex=regex.exec(textContent());if(matchIndex===null){regex.lastIndex=0;matchIndex=regex.exec(textContent())}var replaceWith=document.getElementById("wEditor_replaceText").value.replace(/([^\\]|^)\\n/g,"$1\n").replace(/\\\\n/g,"\\n").replace(/([^\\]|^)\\t/g,"$1\t").replace(/\\\\t/g,"\\t");var oldTextLength=textContent().length;textContent(textContent().slice(0,matchIndex.index)+textContent().slice(matchIndex.index).replace(regex,replaceWith));wEditor_scrollToChar(matchIndex.index);textareaCursorPos([matchIndex.index,matchIndex.index+(matchIndex[0].length)+(textContent().length-oldTextLength)]);regex=new RegExp(searchFor,document.getElementById("wEditor_searchText_caseSensitive").checked ?'g':'ig');if(!textContent().match(regex))document.getElementById("wEditor_searchText_matchCount").innerHTML="Found <strong>0</strong> occurrences.";else document.getElementById("wEditor_searchText_matchCount").innerHTML="Found <strong>"+textContent().match(regex).length.toString()+"</strong> occurrences."}function wEditor_replaceAllText(){let searchFor=document.getElementById("wEditor_searchText").value;if(!document.getElementById("wEditor_searchText_UseRegex").checked)searchFor=escapeRegex(searchFor);let regex=new RegExp(searchFor,document.getElementById("wEditor_searchText_caseSensitive").checked ?'g':'ig');textareaFocus();textContent(textContent().replace(regex,document.getElementById("wEditor_replaceText").value.replace(/([^\\]|^)\\n/g,"$1\n").replace(/\\\\n/g,"\\n").replace(/([^\\]|^)\\t/g,"$1\t").replace(/\\\\t/g,"\\t")));textareaCursorPos([0,0]);document.getElementById("wEditor_searchText_matchCount").innerHTML="Found <strong>0</strong> occurrences."}function wEditor_scrollToChar(char){textareaProp("scrolTop",0);let textareaContent=textContent();let newContent=textareaContent;newContent=textareaContent.slice(0,char);textareaProp("scrollTop",textareaProp("scrollHeight"));textContent(newContent+textareaContent.slice(char))}function wEditor_insertText(text,selectionOffset=0){let selection=textareaCursorPos(true);let content=textContent();var newCursorPosition=selection[0]+text.length+selectionOffset;textareaFocus();textContent(content.substring(0,selection[0])+text+content.substring(selection[1],content.length));textareaCursorPos([newCursorPosition,newCursorPosition])}function wEditor_summaryOnKeyPress(event){if(event.key==="Enter")wEditor_saveEdit()}function wEditor_saveEdit(){document.getElementById("wedit-save-edit").disabled=true;if(wEditData.is_new_page){mwAPI.create(mw.config.get("wgPageName"),{summary:document.getElementById('wedit-summary').value,watchlist:document.getElementById("wedit-watch").checked ?"watch":"unwatch"},textContent()).then(()=>{___location.href="https://"+mw.config.get("wgServerName")+"/wiki/"+mw.config.get("wgPageName")},(e)=>{mw.notify("Cannot save page. Error: "+e)})}else{if(wEditData.edit_section==="new"){wEditor_doSaveEdit();return}if(wEditData.edit_section==="-1")mwAPI.get({"action":"parse","format":"json","page":mw.config.get("wgPageName"),"prop":"revid|wikitext","formatversion":"2"}).then((ret)=>{if(ret.parse.revid!==wEditData.currentRevId&&ret.parse.wikitext.trim()!==wEditData.old_text.trim()){wEditData.currentRevId=ret.parse.revid;var wikEdDiff=new WikEdDiff();var wikEdDiff2=new WikEdDiff();wEditData.editConflictText=ret.parse.wikitext;wEditData.thisText=textContent();document.getElementById('wedit-editConflictContent').innerHTML=`<h2>Edit conflict!</h2><div style="display:flex"><input type="button" style="flex:1" title="${TEXT_VALUES.ec_replaceWithMyVerTooltip}" value="${TEXT_VALUES.ec_replaceWithMyVer}" onclick="textContent(wEditData.thisText)"></input><input type="button" style="flex:1" title="${TEXT_VALUES.ec_replaceWithNewVerTooltip}" value="${TEXT_VALUES.ec_replaceWithNewVer}" onclick="textContent(wEditData.editConflictText)"></input></div><p>Difference between your version and new version:</p>${wikEdDiff.diff(wEditData.thisText,wEditData.editConflictText)}<p>Difference between old version and new version:</p>${wikEdDiff2.diff(wEditData.old_text,wEditData.editConflictText)}`;document.getElementById("wedit-save-edit").disabled=false}else wEditor_doSaveEdit()},(e)=>{document.getElementById("wedit-save-edit").disabled=false;mw.notify(e)});else if(wEditData.edit_section!=="-1")mwAPI.get({"action":"parse","format":"json","page":mw.config.get("wgPageName"),"prop":"revid|wikitext","formatversion":"2","section":wEditData.edit_section}).then((ret)=>{if(ret.parse.revid!==wEditData.currentRevId&&ret.parse.wikitext.trim()!==wEditData.old_text.trim()){wEditData.currentRevId=ret.parse.revid;var wikEdDiff=new WikEdDiff();var wikEdDiff2=new WikEdDiff();wEditData.editConflictText=ret.parse.wikitext;wEditData.thisText=textContent();document.getElementById('wedit-editConflictContent').innerHTML=`<h2>Edit conflict!</h2><div style="display:flex"><input type="button" style="flex:1" title="${TEXT_VALUES.ec_replaceWithMyVerTooltip}" value="${TEXT_VALUES.ec_replaceWithMyVer}" onclick="textContent(wEditData.thisText)"></input><input type="button" style="flex:1" title="${TEXT_VALUES.ec_replaceWithNewVerTooltip}" value="${TEXT_VALUES.ec_replaceWithNewVer}" onclick="textContent(wEditData.editConflictText)"></input></div><p>Difference between your version and new version:</p>${wikEdDiff.diff(wEditData.thisText,wEditData.editConflictText)}<p>Difference between old version and new version:</p>${wikEdDiff2.diff(wEditData.old_text,wEditData.editConflictText)}`;document.getElementById("wedit-save-edit").disabled=false}else wEditor_doSaveEdit()},(e)=>{document.getElementById("wedit-save-edit").disabled=false;mw.notify(e)})}}function wEditor_doSaveEdit(){var isMinorEdit=document.getElementById("wedit-minor")==undefined ? false:document.getElementById("wedit-minor").checked;if(wEditData.edit_section==="-1"){mwAPI.edit(mw.config.get("wgPageName"),(revision)=>{return{text:textContent(),summary:document.getElementById('wedit-summary').value,minor:isMinorEdit,watchlist:document.getElementById("wedit-watch").checked ?"watch":"unwatch"}}).then(()=>{___location.href="https://"+mw.config.get("wgServerName")+"/wiki/"+mw.config.get("wgPageName")},(e)=>{mw.notify("Cannot save page. Error: "+e);document.getElementById("wedit-save-edit").disabled=false})}else{mwAPI.edit(mw.config.get("wgPageName"),(revision)=>{var output={text:textContent(),section:wEditData.edit_section,summary:document.getElementById('wedit-summary').value,minor:isMinorEdit,watchlist:document.getElementById("wedit-watch").checked ?"watch":"unwatch"};if(wEditData.edit_section==="new"){output.sectiontitle=document.getElementById('wedit-summary').value;output.summary="/*"+document.getElementById('wedit-summary').value+"*/ New section"}return output}).then(()=>{___location.href="https://"+mw.config.get("wgServerName")+"/wiki/"+mw.config.get("wgPageName")},(e)=>{mw.notify("Cannot save page. Error: "+e)})}}function wEditor_InsertTemplate(link){let pos=textareaCursorPos();var lastLinkPos=textContent().lastIndexOf('{{',pos)+2;var text=textContent().slice(lastLinkPos,pos);if(text[0]===":")text=text.slice(1);var insertBrackets=!(textContent().slice(pos,pos+2)==="}}"||textContent().charAt(pos)==="|");wEditor_insertText(link.slice(text.length,link.length)+(insertBrackets ?"}}":""));document.getElementById("wedit-autocomplete").style.display="none"}function wEditor_InsertLink(link){let pos=textareaCursorPos();var lastLinkPos=textContent().lastIndexOf('[[',pos)+2;var text=textContent().slice(lastLinkPos,pos);var insertBrackets=!(textContent().slice(pos,pos+2)==="]]"||textContent().charAt(pos)==="|");wEditor_insertText(link.slice(text.length,link.length)+(insertBrackets ?"]]":""));document.getElementById("wedit-autocomplete").style.display="none"}function wEditor_insertTemplateBrackets(){wEditor_insertText("{{}}",-2)}function wEditor_insertWikiLink(){wEditor_insertText("[[]]",-2)}function CreateRandomString(strLength,charSet){if(charSet===undefined)charSet='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789';let str='';for(let i=0;i<strLength;i++)str+=charSet.charAt(Math.floor(Math.random()*charSet.length));return str}function AjaxPreview(textValue,ResponseHandler,FailHandler){var pageName=mw.config.get("wgPageName");var editform=document.getElementById('editform');var requestUrl;if(editform!=null){requestUrl=editform.action.replace(/\?.*()/,'');if(/:\/\/()/.test(requestUrl)===false)requestUrl=window.___location.protocol+'//'+window.___location.host+requestUrl}else if(mw.config.get("wgScriptPath")!==undefined)requestUrl=mw.config.get("wgScriptPath")+'/index.php';else{requestUrl=window.___location.href;requestUrl=requestUrl.replace(/\?.*()/,'');requestUrl=requestUrl.replace(/\/[\w\.]*$/,'/index.php')}var postFields={};if(pageName!==null&&mw.config.get("wgNamespaceNumber")!=-1)postFields.title=pageName;else postFields.title='wEditor_Preview';postFields.action='submit';postFields.wpTextbox1=textValue;var starttime=document.getElementsByName('wpStarttime')[0];var edittime=document.getElementsByName('wpEdittime')[0];var edittoken=document.getElementsByName('wpEditToken')[0];var autosummary=document.getElementsByName('wpAutoSummary')[0];if(starttime!=null)postFields.wpStarttime=starttime.value;if(edittime!=null)postFields.wpEdittime=edittime.value;if(edittoken!=null)postFields.wpEditToken=edittoken.value;if(autosummary!=null)postFields.wpAutoSummary=autosummary.value;postFields.wpPreview='true';simpleAjaxRequest('POST',requestUrl,postFields,'text/plain',ResponseHandler,FailHandler)}function LocalPreviewAjaxHandler(ajax){var html=ajax.responseText;if(html.indexOf('<api>')!=-1){html=StringGetInnerHTML(html,'text','').replace(/&lt;/g,'<').replace(/&gt;/g,'>').replace(/&quot;/g,'"').replace(/&amp;/g,'&')}else{html=StringGetInnerHTML(html,'div','id','wikiPreview',true);html=StringGetInnerHTML(html,'div','class','previewnote',true,false,true);html=html.replace(/<!--(.|\n)*?-->/g,'');html=html.replace(/\s+$/g,'')}html=html.replace(/<\/?form\b[^>]*>/gi,'');html=html.replace(/<input\b[^>]*?\btype\s*=\s*["']?hidden["']?[^>]*>/gi,'');html=html.replace(/<input\b([^>]*)>/gi,(p,p1)=>{p1=p1.replace(/\bname\s*=\s*([^"'`=]+|\'[^'=]*\'|\"[^"=]*\")/gi,'');return p1});html=html.replace(/(<div\b[^>]*?\bclass="wikEdPreviewRefs"[^>]*>(.|\n)*$)/gi,(p,p1,p2)=>{p1=p1.replace(/<strong\b[^>]*?\bclass="error"[^>]*>(.|\n)*?<\/strong>/g,'');return p1});document.getElementById('wedit-previewContent').innerHTML=html;document.getElementById("wedit-show-preview").disabled=false;if(typeof window.sortables_init=='function'){window.sortables_init()}if(typeof window.createCollapseButtons=='function'){window.createCollapseButtons()}if(window.mw!==undefined&&window.mw.hook!==undefined&&window.mw.hook('wikipage.content').fire!==undefined){window.mw.hook('wikipage.content').fire($('#wikEdPreviewArticle'))}}function StringGetInnerHTML(html,tag,attrib,value,defaultToWholeHTML,getBeforeHTML,getAfterHTML){var startPos;var startLength;var endPos;var endLength;var level=0;var string;var attribValue='';if(attrib!=='')attribValue='[^>]*?'+attrib+'\\s*=\\s*("|\\\')?'+value+'\\1';var regExpStart=new RegExp('<'+tag+'\\b'+attribValue+'[^>]*>','gi');var regExpMatch;if((regExpMatch=regExpStart.exec(html))!==null){startPos=regExpMatch.index;startLength=regExpMatch[0].length;var regExpParse=new RegExp('<(\\/?)'+tag+'\\b[^>]*>','g');regExpParse.lastIndex=startPos;while((regExpMatch=regExpParse.exec(html))!==null){var p1=regExpMatch[1]||'';if(p1==='')level++;else{level--;if(level===0){endPos=regExpMatch.index;endLength=regExpMatch[0].length;break}}}}if(endPos===undefined&&defaultToWholeHTML)string=html;else if(getBeforeHTML===true)string=html.substr(0,startPos);else if(getAfterHTML===true)string=html.substr(endPos+endLength);else string=html.substring(startPos+startLength,endPos);return string}var mwAPI=new mw.Api();$(function(){var loopSkip=false;var loopItems=[];var loopIndex=0;var loopProcess=()=>{};var loopComplete=()=>{};var logMessage=()=>{};var pagesMoved=[];var userIsBot=wTools.userGroups.includes("bot")||wTools.userGroups.includes("psudo-bot");function getEntireApiRequest(request,then,getArrayProcessor){var allPages=[];function getNextPageBatch(){mwAPI.get(request).then((ret)=>{var arr=getArrayProcessor(ret.query);if(arr==null){logMessage("No pages link here.");then(allPages);return}allPages=allPages.concat(arr);if("continue"in ret){Object.keys(ret.continue).forEach((k)=>{request[k]=ret.continue[k]});getNextPageBatch()}else{then(allPages)}},(e)=>{logMessage(`Error: ${JSON.stringify(e)}`);getNextPageBatch()})}getNextPageBatch()}function loopDoNext(){loopIndex+=1;if(loopIndex>=loopItems.length){loopSkip=false;loopComplete()}else if(loopSkip){loopSkip=false;loopComplete()}else loopDoThis()}function loopDoPage(page,then){loopProcess(page.title,(success,changesWereMade,ratelimit)=>{if(success&&!ratelimit){if(changesWereMade)logMessage(`Fixed ${page.title}`);else logMessage(`No changes made to ${page.title}.`)}then(ratelimit,changesWereMade)},false)}function loopDoThis(){var page=loopItems[loopIndex];loopDoPage(page,(ratelimit,changesWereMade)=>{if(ratelimit){clearTimeout();setTimeout(loopDoThis,1500)}else{clearTimeout();if(userIsBot)setTimeout(loopDoNext,250);else setTimeout(loopDoNext,400)}})}function movePage(oldTitle,newTitle,reason,movetalk,watch,supressRedirect,then){new mw.Api().post({action:"move",from:oldTitle,to:newTitle,reason:reason,movetalk:movetalk,watchlist:watch,noredirect:supressRedirect ?"1":false,token:mw.user.tokens.get('csrfToken'),format:"json",tags:wTools_config ? wTools_config.editTags:""}).then((r)=>{if(r.move)pagesMoved.push({from:r.move.from,to:r.move.to,ns:mw.config.get("wgNamespaceIds")[r.move.to.slice(0,r.move.to.indexOf(":")).toLowerCase()]});then(r)},(e)=>{then()})}function doPostMoveStuff(fromTitle,toTitle){getFixPagecache();var index=0;function fixPageLinks(pageName,onCompleted,isCategory,fixLinks,fixTransclusions){var request={action:"query",format:"json",prop:`${fixLinks ?"linkshere":""}|${fixTransclusions ?"transcludedin":""}`,titles:pageName,formatversion:"2"};if(isCategory)request={action:"query",format:"json",list:"categorymembers",cmtitle:pageName,cmlimit:"250"};getEntireApiRequest(request,(ret)=>{loopItems=ret;loopIndex=0;if(ret.length===0){index+=1;if(index<pagesMoved.length)fixPageLinks(pagesMoved[index].from,onCompleted,isCategory,fixLinks,fixTransclusions);else onCompleted();return}$('#renameCategories-log').remove();$('#progressWarning-log').remove();var inProgressWarning=$('<span>').appendTo($('#movepage')).text('Moving links. If you see this, do not close the tab.').css('color','red').attr('id','progressWarning-log');var log=$('<span>').appendTo($('#movepage')).append('<br/><hr/>').attr('id','renameCategories-log');loopComplete=()=>{index+=1;if(index<pagesMoved.length)fixPageLinks(pagesMoved[index].from,onCompleted,isCategory,fixLinks,fixTransclusions);else{onCompleted();inProgressWarning.remove()}};loopProcess=(pageTitle,then)=>{var changesWereMade=false;mwAPI.edit(pageTitle,(revision)=>{var output={text:revision.content,summary:`Moving page [[${fromTitle}]] to [[${toTitle}]] - updating links${window.wTools_config ? window.wTools_config.editAd:''}`,minor:true,bot:true,watchlist:"nochange",tags:wTools_config ? wTools_config.editTags:""};for(let i of pagesMoved){if(i.ns!=null){var colonIndex=i.from.indexOf(":");output.text=fixPage(output.text,i.from.slice(0,colonIndex+1)+i.from.charAt(colonIndex+1).toUpperCase()+i.from.slice(colonIndex+2),i.to);output.text=fixPage(output.text,i.from.slice(0,colonIndex+1)+i.from.charAt(colonIndex+1).toLowerCase()+i.from.slice(colonIndex+2),i.to)}else{output.text=fixPage(output.text,i.from.charAt(0).toUpperCase()+i.from.slice(1),i.to);output.text=fixPage(output.text,i.from.charAt(0).toLowerCase()+i.from.slice(1),i.to)}}changesWereMade=output.text!==revision.content;return output}).then(()=>{then(true,changesWereMade,false)},(e)=>{then(false,false,e==="ratelimited")})};logMessage=(message)=>{log.append($('<p>').text(message).css('color','green'))};loopDoThis()},(query)=>{var output=[];if("categorymembers"in query)output=query.categorymembers;if("pages"in query&&query.pages.length>0){if("linkshere"in query.pages[0])output=output.concat(query.pages[0].linkshere);if("transcludedin"in query.pages[0])output=output.concat(query.pages[0].transcludedin)}return output})}if(wTools.relevantNamespace===14){var changeCategoryLinks=$('input[name=changeCategoryLinks]').prop('checked');if(changeCategoryLinks){index=0;fixPageLinks(pagesMoved[index].from,()=>{___location.href=wTools.getArticlePath(toTitle)},true)}else ___location.href=wTools.getArticlePath(toTitle)}else{var changeTransclusions=$('input[name=changeTransclusions]').prop('checked');var changeLinks=$('input[name=changeLinks]').prop('checked');if(changeLinks||changeTransclusions){index=0;fixPageLinks(pagesMoved[index].from,()=>{___location.href=wTools.getArticlePath(toTitle)},false,changeLinks,changeTransclusions)}else ___location.href=wTools.getArticlePath(toTitle)}}function movePagePressed(){var oldTitle=wTools.pageName,to_ns=wTools.namespacesIdToString[$('select[name=wpNewTitleNs]').val()].replace(' ','_'),to_page=$('input[name=wpNewTitleMain]').val(),newTitle=(to_ns===''? to_page:to_ns+':'+to_page),reason=$('input[name=wpReason]').val(),talk=$('input[name=wpMovetalk]').prop('checked')?'yes':void 0,watch=$('input[name=wpWatch]').prop('checked')?'watch':void 0,supressRedirect=$('input[name=wpLeaveRedirect]').prop('checked')? false:true;document.getElementById("new-movePage").style.display="none";if(document.getElementById("new-moveSubPages"))document.getElementById("new-moveSubPages").style.display="none";movePage(oldTitle,newTitle,reason,talk,watch,supressRedirect,(response)=>{if(response.move){doPostMoveStuff(response.move.from,response.move.to)}else{document.getElementById("new-movePage").style.display="inline";if(document.getElementById("new-moveSubPages"))document.getElementById("new-moveSubPages").style.display="inline";mw.notify("Cannot move page: "+response.error.info,{type:"error"})}})}function moveSubpagesPressed(){document.getElementById("new-movePage").style.display="none";if(document.getElementById("new-moveSubPages"))document.getElementById("new-moveSubPages").style.display="none";var oldTitle=wTools.pageName,to_ns=wTools.namespacesIdToString[$('select[name=wpNewTitleNs]').val()].replace(' ','_'),to_page=$('input[name=wpNewTitleMain]').val(),newTitle=(to_ns===''? to_page:to_ns+':'+to_page),reason=$('input[name=wpReason]').val(),talk=$('input[name=wpMovetalk]').prop('checked')?'yes':void 0,watch=$('input[name=wpWatch]').prop('checked')?'watch':void 0,supressRedirect=$('input[name=wpLeaveRedirect]').prop('checked')? false:true;getEntireApiRequest({action:'query',list:'prefixsearch',pssearch:oldTitle+'/',pslimit:'max',format:'json'},(subpageList)=>{$('#moveSubpages-log').remove();var log=$('<span>').appendTo($('#movepage')).append('<br/><hr/>').attr('id','moveSubpages-log');function doMovePage(oldTitle,newTitle,noerror,reason="",onerror=null){movePage(oldTitle,newTitle,reason,talk,watch,supressRedirect,(response)=>{if(response.move){if(response.move['talkmove-errors']){var talkpage=oldTitle.match(':')? oldTitle.replace(':',' talk:'):'Talk:'+oldTitle;log.append($('<p>').text(talkpage+' could not be moved.').css('color','red'))}else if(response.move.talkfrom){log.append('<p>Successfully moved '+response.move.talkfrom+' to '+response.move.talkto+'.</p>').css('color','green')}}if(response.error){log.append($('<p>').text(oldTitle+' could not be moved.').css('color','red'));log.append($('<p>').append('&bull; Reason: '+response.error.info+'</li>').css('color','red'));if(onerror)onerror()}else{log.append('<p>Successfully moved '+response.move.from+' to '+response.move.to+'.</p>').css('color','green');noerror()}})}let subpageIndex=0;function doMoveNextPage(){while(subpageIndex<subpageList.length){doMovePage(subpageList[subpageIndex].title,subpageList[subpageIndex].title.replace(oldTitle,newTitle),doMoveNextPage,"[Moving Subpages] "+reason+(window.wTools_config ? window.wTools_config.editAd:''));subpageIndex+=1;return}doPostMoveStuff(oldTitle,newTitle)}doMovePage(oldTitle,newTitle,()=>{doMoveNextPage()},reason,()=>{document.getElementById("new-movePage").style.display="inline";if(document.getElementById("new-moveSubPages"))document.getElementById("new-moveSubPages").style.display="inline"})},(query)=>{return query.prefixsearch})}new OO.ui.ButtonWidget({label:'Move page',id:'new-movePage',flags:['primary','progressive']}).$element.on('click',movePagePressed).appendTo($('button[name=wpMove]').parent().parent());if(!$('p:contains(\'This page has no subpages.\')')[0]){var canUseSubpageMover=containsAny(wTools.userGroups,["extendedconfirmed","extendedconfirmeduser","rollbacker","admin","interface-admin","reviewer","suppressredirect","suppress-redirect","bureaucrat","steward","sysop"]);if(canUseSubpageMover){new OO.ui.ButtonWidget({label:'Move page and subpages',id:'new-moveSubPages',flags:['primary','progressive']}).$element.on('click',moveSubpagesPressed).appendTo($('button[name=wpMove]').parent().parent())}}if(wTools.relevantNamespace===14){var changeCategoryLinks=new OO.ui.CheckboxInputWidget({name:'changeCategoryLinks',selected:false});new OO.ui.FieldLayout(changeCategoryLinks,{label:'Change category links for pages which use this category',align:'inline'}).$element.appendTo($('input[name=wpWatch]').parent().parent().parent().parent())}else{var changeLinks=new OO.ui.CheckboxInputWidget({name:'changeLinks',selected:false});new OO.ui.FieldLayout(changeLinks,{label:'Change links to the new page.',align:'inline'}).$element.appendTo($('input[name=wpWatch]').parent().parent().parent().parent());var changeTransclusions=new OO.ui.CheckboxInputWidget({name:'changeTransclusions',selected:true});new OO.ui.FieldLayout(changeTransclusions,{label:'Change transclusions to the new page.',align:'inline'}).$element.appendTo($('input[name=wpWatch]').parent().parent().parent().parent())}$('button[name=wpMove]').parent().remove();var fixPage_fixCategories=false;var fixPage_fixLinks=false;var fixPage_fixTransclusions=true;function getFixPagecache(){if(wTools.relevantNamespace===14){fixPage_fixCategories=$('input[name=changeCategoryLinks]').prop('checked')}else{fixPage_fixCategories=false;fixPage_fixLinks=$('input[name=changeLinks]').prop('checked');fixPage_fixTransclusions=$('input[name=changeTransclusions]').prop('checked')}}function fixPage(content,fromTitle,toTitle){var safeFromTitle=escapeRegex(fromTitle);var safeToTitle=escapeRegex(toTitle);if(fixPage_fixCategories)content=content.replace(new RegExp(`\\[\\[ *(${safeFromTitle}) *\\]\\]`,'g'),`[[${toTitle}]]`).replace(new RegExp(`\\[\\[ *\\:(${safeFromTitle}) *\\]\\]`,'g'),`[[:${toTitle}|$1]]`).replace(new RegExp(`\\[\\[ *${safeFromTitle} *\\|(.+?)\\]\\]`,'g'),`[[${toTitle}]]`).replace(new RegExp(`\\[\\[ *:${safeFromTitle} *\\|(.+?)\\]\\]`,'g'),`[[$1${toTitle}|$2]]`).replace(new RegExp(`(?:^|[^{])\\{\\{ *(:?)${safeFromTitle} *\\}\\}`,'g'),`{{$1${toTitle}}}`).replace(new RegExp(`(?:^|[^{])\\{\\{ *(:?)${safeFromTitle} *\\|(.+?) *\\}\\}`,'g'),`{{$1${toTitle}|$2}}`);else{if(fixPage_fixLinks)content=content.replace(new RegExp(`\\[\\[ *(:?)(${safeFromTitle}) *\\]\\]`,'g'),`[[$1${toTitle}|$2]]`).replace(new RegExp(`\\[\\[ *(:?)${safeFromTitle} *\\|(.+?)\\]\\]`,'g'),`[[$1${toTitle}|$2]]`).replace(new RegExp(`\\[\\[ *(:?)${safeToTitle} *\\|${safeToTitle}\\]\\]`,'g'),`[[$1${toTitle}]]`);if(fixPage_fixTransclusions){if(wTools.relevantNamespace===10){toTitle=toTitle.slice(toTitle.indexOf(":")+1);let shortFromTitle=escapeRegex(fromTitle.slice(fromTitle.indexOf(":")+1));content=content.replace(new RegExp(`(?:^|[^{])\\{\\{ *(:?)${shortFromTitle} *\\}\\}`,'g'),`{{$1${toTitle}}}`).replace(new RegExp(`(?:^|[^{])\\{\\{ *(:?)${shortFromTitle} *\\|(.+?) *\\}\\}`,'g'),`{{$1${toTitle}|$2}}`)}content=content.replace(new RegExp(`(?:^|[^{])\\{\\{ *(:?)${safeFromTitle} *\\}\\}`,'g'),`{{$1${toTitle}}}`).replace(new RegExp(`(?:^|[^{])\\{\\{ *(:?)${safeFromTitle} *\\|(.+?) *\\}\\}`,'g'),`{{$1${toTitle}|$2}}`)}}return content}});if((___location.href.includes("&diff=")||___location.href.includes("?diff="))||mw.config.get('wgAction')==='history')$(()=>{function thank(revid,thankButton){thankButton.addClass('restorer-loading');mwAPI.postWithToken("csrf",{action:"thank","format":"json","rev":revid}).then((e)=>{thankButton.removeClass('restorer-loading').parent().html(" | <strong>thanked</strong>")},(e)=>{thankButton.removeClass('restorer-loading')})}function addLink(item,revid,isDiffPage=false,isThanked=false,showThankLink=false,showRollback=false){if(mw.config.get('wgAction')!=='history'&&showRollback){$('<span>').text(" | ").append($('<a>').click((e)=>{var button=$(e.target);button.addClass('restorer-loading');rollbackRevid(revid).then(()=>{mw.notify('Rolled-back revision successfully.');___location.reload()},(_,data)=>{mw.notify(mpAPI.getErrorMessage(data),{type:'error'});button.removeClass('restorer-loading')})}).text('rollback').attr('title','Rollback this edit')).appendTo(item)}if(revid!=mw.config.get('wgCurRevisionId')){$('<span>').text(" | ").append($('<a>').click((e)=>{var button=$(e.target);button.addClass('restorer-loading');restoreRevid(revid).always(()=>{button.removeClass('restorer-loading')})}).text('restore').attr('title',`Restore revision ${revid}`)).appendTo(item)}if(isDiffPage){if(showThankLink){$('<span>').text(" | ").append($(isThanked ?"<strong>":'<a>').click((e)=>{thank(revid,$(e.target))}).text(isThanked ?'thanked':'thank').attr('title',isThanked ?"User already thanked.":"Thank user for this edit.")).appendTo(item)}}}var serverName=mw.config.get("wgServerName");var script=mw.config.get("wgScript");var pageName=mw.config.get("wgPageName");var pathSafePageName=makeStringPathSafe(pageName);element=document.getElementById("mw-diff-ntitle1");if(element){var elementChild=element.children[0];if(elementChild.nodeName==="STRONG")elementChild=elementChild.children[0];var viewRevisionLink=elementChild.href;var viewRevisionText=elementChild.textContent;var diffId=viewRevisionLink;if(diffId.includes("&oldid=")){diffId=diffId.slice(diffId.indexOf("&oldid=")+7);var isThanked=document.getElementsByClassName("mw-thanks-thank-confirmation").length>0;var hadThankButton=document.getElementsByClassName("mw-thanks-thank-link").length>0;var rollbackLink=document.getElementsByClassName("mw-rollback-link")[0];if(rollbackLink){rollbackLink.remove();rollbackLink=true}element.innerHTML=`<strong><a href="${viewRevisionLink}" title="${pageName}">${viewRevisionText}</a> (<a href="https://${serverName}${script}?title=${pathSafePageName}&action=edit&oldid=${diffId}${diffId!=mw.config.get('wgCurRevisionId')?`&summary=Editing old version [[Special:diff/${diffId}|${diffId}]]`:''}" title="Edit revision ${diffId} of ${pageName}">edit</a><span id="rev-1"></span> )</strong>`;addLink(document.getElementById("rev-1"),diffId,true,isThanked,isThanked||hadThankButton,rollbackLink)}}element=document.getElementById("mw-diff-otitle1");if(element){let elementChild=element.children[0];if(elementChild.nodeName==="STRONG")elementChild=elementChild.children[0];let viewRevisionLink=elementChild.href;let viewRevisionText=elementChild.textContent;let diffId=viewRevisionLink;if(diffId.includes("&oldid=")){diffId=diffId.slice(diffId.indexOf("&oldid=")+7);element.innerHTML=`<strong><a href="${viewRevisionLink}" title="${pageName}">${viewRevisionText}</a> (<a href="https://${serverName}${script}?title=${pathSafePageName}&action=edit&oldid=${diffId}&summary=Editing old version [[Special:diff/${diffId}|${diffId}]]" title="Edit revision ${diffId} of ${pageName}">edit</a><span id="rev-2"></span> )</strong>`;addLink(document.getElementById("rev-2"),diffId,true,false,false)}}for(let element of document.getElementsByClassName("mw-history-undo")){let link=element.children[0].href;if(!link.includes("&undo="))continue;link=link.slice(link.indexOf("&undo=")+6);addLink(element,link)}mw.loader.addStyleTag('@keyframes restorer-loading {'+'0%, 100% {content: " ⡁"} 16% {content: " ⡈"} 33% {content: " ⠔"} 50% {content: " ⠒"} 66% {content: " ⠢"} 83% {content: " ⢁"}}'+'.restorer-loading::after {white-space: pre; content: ""; animation: restorer-loading 0.5s infinite}')});if(mw.config.get('wgCanonicalSpecialPageName')==="Contributions"){var createRollbackForm=(rollbackAction)=>{createForm("",[{name:"rollbkEdits-RollbackReason",type:"textbox",value:wTools_config.rollbackAllDefaultReason,text:"Rollback reason",onenter:rollbackAction},{type:"button",onclick:rollbackAction,text:"Rollback Everything"}],false)};var rollbackEverything=(editSummary)=>{if(editSummary===null)return false;$("a[href*='action=rollback']").each((ind,el)=>{rollbackOneThing(el,editSummary)});return false};var rollbackSelected=(editSummary)=>{if(editSummary===null)return false;var rollbackList=$("input.revdelIds:checked").parents("li.mw-contributions-current").find("a[href*='action=rollback']");if(rollbackList.length<=0)return mw.notify("You didn't select any edits that could be rolled back!");$("input.revdelIds:checked").parents("li.mw-contributions-current").find("a[href*='action=rollback']").each(function(ind,el){rollbackOneThing(el,editSummary)})};var rollbackOneThing=(edit,editSummary='')=>{var userName;if(wTools.viewingUserName===null)userName=$(edit).parents("li:first").children("a.mw-anonuserlink").not(".mw-contributions-title").text();else userName=wTools.viewingUserName;rollbackEdit(/title=([^&]+)/.exec(edit.href)[1],userName,editSummary)};if($("span.mw-rollback-link").length>0){if($("ul.mw-contributions-list .mw-revdelundel-link").length>0)$("ul.mw-contributions-list .mw-revdelundel-link").each(function(ind,el){if($(this).children("a").length>0){var revId=/ids=(\d+)/.exec($(this).children("a").attr("href"))[1];var pageTitle=/target=([^&]+)/.exec($(this).children("a").attr("href"))[1];$(el).prepend("<input type='checkbox' name='"+decodeURIComponent(pageTitle)+"' class='revdelIds' value='"+revId+"'>&nbsp;");$(el).children(".revdelIds").data("index",ind)}});else $("ul.mw-contributions-list a.mw-changeslist-date").each(function(ind,el){$(el).before("<input type='checkbox' class='revdelIds'>&nbsp;")});var rollbackAll=addToolbarButton("rollback all","rollback all edits displayed here");rollbackAll.click((event)=>{rollbackAll.hide();rollbackSome.hide();event.preventDefault();createRollbackForm(()=>{var reason=document.getElementsByName("rollbkEdits-RollbackReason-input")[0].value;rollbackEverything(wTools_config.rollbackAllEditSummary.replace("{reason}",reason ?" - "+reason:"")+wTools_config.editAd)})});$("a[href*='action=rollback']").each((ind,el)=>{el.addEventListener("click",(event)=>{event.preventDefault();rollbackOneThing(el)})});var rollbackSome=addToolbarButton("rollback selected","rollback selected edits");rollbackSome.click((event)=>{rollbackAll.hide();rollbackSome.hide();event.preventDefault();createRollbackForm(()=>{var reason=document.getElementsByName("rollbkEdits-RollbackReason-input")[0].value;rollbackSelected(wTools_config.rollbackAllEditSummary.replace("{reason}",reason ?" - "+reason:"")+wTools_config.editAd)})})}$("li[class*='mw-contributions-current']").each((ind,el)=>{let diff=el.getAttribute("data-mw-revid");if(el.className.includes("mw-tag"))$(el).find("span[class*='mw-tag-markers']").before(`<span>[<a id="undoEditAll-${diff}">undo</a>]</span> `);else $(el).append(`<span>[<a id="undoEditAll-${diff}">undo</a>]</span>`);let undoButton=document.getElementById(`undoEditAll-${diff}`);undoButton.addEventListener("click",(event)=>{event.preventDefault();undoRevid(diff).done(()=>{undoButton.parentElement.innerHTML="[<strong>reverted</strong>]"})})})}