Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// <nowiki>$(()=>{varlogout=$("#pt-logout a")[0];if(!logout)return;// Create new logout link.varnew_logout=document.createElement("a");new_logout.innerText=logout.innerText;// Insert new logout link and remove old.logout.insertAdjacentElement("afterend",new_logout);logout.remove();// Get user-defined styling.varfw=window.us_conlog_font_weight?window.us_conlog_font_weight:"bold";varfs=window.us_conlog_font_size?window.us_conlog_font_size:"86%";varbg=window.us_conlog_background?window.us_conlog_background:"#EEE";varfg=window.us_conlog_color?window.us_conlog_color:"#000";varbd=window.us_conlog_border?window.us_conlog_border:"2px solid #00F";// Add styling to the page.document.getElementsByTagName("body")[0].insertAdjacentHTML("afterbegin","<style>#use-conlog button { margin: 0 0.2em; border-radius: 9em; padding: 0 0.7em; box-sizing: border-box;"+`font-weight: ${fw}; font-size: ${fs}; background: ${bg}; color: ${fg}; border: ${bd}}`+"#use-conlog button:active { background:rgba(255,255,255,0.6)}</style>");// Main grouping div for conlog elements.document.getElementsByTagName("body")[0].insertAdjacentHTML("afterbegin","<div id='use-conlog'></div>");new_logout.addEventListener("click",event=>{// Create the logout confirmation prompt.varconlog=document.getElementById("use-conlog");conlog.insertAdjacentHTML("beforeend","<div onclick='this.style.transform = \"translateY(-130%)\";setTimeout(function(){this.remove()}.bind(this), 500);' style='"+"position:fixed; top:0; left:0; right:0; margin: 0 0 auto 0; height: auto; line-height: 1.4em; "+"padding: 0.6em 2em; opacity: 1; text-align: center; z-index: 9999; box-shadow: 0 2px 5px rgba(0,0,0,0.2); "+"transform: translateY(-130%); transition: all 0.2s;"+`font-weight: ${fw}; font-size: ${fs}; background: ${bg}; color: ${fg}; border: ${bd}'>`+"<div style='margin-bottom: 0.5em;'>You clicked on a log-out link. Do you want to continue?</div>"+"<div><button>No</button><button id='conlog-logout'>Log out</button></div></div>");// Logout handler.document.getElementById("conlog-logout").addEventListener("click",event=>{newmw.Api().post({"action":"logout","token":mw.user.tokens.get("csrfToken")}).fail(result=>{mw.notify("Failed to log out: "+result);}).done(()=>{window.location.href=mw.util.getUrl(mw.config.get("wgPageName"));});});// The logout confirmation prompt pops down from the top.setTimeout(()=>{conlog.lastChild.style.transform="translateY(0%)";},10);event.preventDefault();event.stopPropagation();});});// </nowiki>