User:Mignof/common.js
Appearance
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. |
The accompanying .css page for this skin is at User:Mignof/common.css. |
/*
https://meta.wikimedia.org/wiki/User:Mignof/global.js
https://pt.wikipedia.org/wiki/Usuário(a):Mignof/common.js
*/
importScript('c:User:Jon_Harald_Søby/warnOnLargeFile.js'); // Backlink: [[c:User:Jon_Harald_Søby/warnOnLargeFile.js]]
importScript('User:Nardog/TemplatePreviewGuard.js'); // Backlink: [[User:Nardog/TemplatePreviewGuard.js]]
importScript('User:Chlod/Scripts/GoToTitle.js'); // Backlink: [[User:Chlod/Scripts/GoToTitle.js]]
importScript('User:Awesome_Aasim/noeditredlinks.js'); // Backlink: [[User:Awesome_Aasim/noeditredlinks.js]]
importScript('User:Nardog/PlayAudioNow.js'); // Backlink: [[User:Nardog/PlayAudioNow.js]]
importScript('User:Evad37/Thanky.js'); // Backlink: [[User:Evad37/Thanky.js]]
importScript('User:SD0001/hide-reverted-edits.js'); // Backlink: [[User:SD0001/hide-reverted-edits.js]]
if (mw.config.get('wgCanonicalSpecialPageName') == 'Whatlinkshere')
importScript('User:V111P/js/whatLinksHereLinkFilter.js'); // [[User:V111P/js/whatLinksHereLinkFilter.js]]
importScript('User:Chlod/Scripts/UserHighlighter.js'); // Backlink: [[User:Chlod/Scripts/UserHighlighter.js]]
importScript('User:Lourdes/Backlinks.js'); // Backlink: [[User:Lourdes/Backlinks.js]]
importScript('User:Awesome_Aasim/savedraft.js'); // Backlink: [[User:Awesome_Aasim/savedraft.js]]
importScript('User:DannyS712/Readonly.js'); // Backlink: [[User:DannyS712/Readonly.js]]
importScript('User:Writ_Keeper/Scripts/previewAndDiff.js'); // Backlink: [[User:Writ_Keeper/Scripts/previewAndDiff.js]]
importScript('User:Headbomb/unreliable.js'); // Backlink: [[User:Headbomb/unreliable.js]]
importScript('User:IagoQnsi/ipareader.js'); // Backlink: [[User:IagoQnsi/ipareader.js]]
importScript('User:PrimeHunter/Source_links.js'); // Backlink: [[User:PrimeHunter/Source_links.js]]
importScript('User:Guarapiranga/accessKeysCheatSheet.js'); // Backlink: [[User:Guarapiranga/accessKeysCheatSheet.js]]
importScript('User:Majavah/Unslashifier.js'); // Backlink: [[User:Majavah/Unslashifier.js]]
importScript('User:BrandonXLF/CollapseSections.js'); // Backlink: [[User:BrandonXLF/CollapseSections.js]]
importScript('User:Phlsph7/ClassicalTOC(Vector2022).js'); // Backlink: [[User:Phlsph7/ClassicalTOC(Vector2022).js]]
importScript('User:Nardog/VitalTopicon.js'); // Backlink: [[User:Nardog/VitalTopicon.js]]
// Enable caching for resource loads, see [[User:SD0001/Making_user_scripts_load_faster]], @revision 6
if(!/\bnocache=\b/.test(location.href)){let e=(e,t,n)=>(e=e.replace(/special:mypage/i,"User:"+mw.config.get("wgUserName")),$.get("https://"+t+"/w/api.php?titles="+e+"&origin=*&format=json&formatversion=2&uselang=content&maxage=86400&smaxage=86400&action=query&prop=revisions|info&rvprop=content&rvlimit=1").then((r=>{let o=r.query.pages[0];if(o.missing)return;let a=o.revisions[0].content;if(n&&"text/javascript"!==n||"javascript"!==o.contentmodel){if("text/css"!==n||"css"!==o.contentmodel)return $.Deferred().reject('Refused to load "'+e+'"@'+t+": content type mismatch");mw.loader.addStyleTag(a)}else{let e=document.createElement("script");e.innerHTML=a,document.head.appendChild(e)}}))),t=e=>{let t=/^(?:(?:https:)?\/\/(.*))?\/w\/index.php/.exec(e),n=/\btitle=([^=?&]*)/.exec(e);return t&&n&&/\baction=raw\b/.test(e)&&/\bctype=/.test(e)?[n[1],t[1]||mw.config.get("wgServerName")]:null};window.importScript=t=>{e(encodeURIComponent(t),mw.config.get("wgServerName"),"text/javascript")},window.importStyleSheet=t=>{e(encodeURIComponent(t),mw.config.get("wgServerName"),"text/css")};let n=mw.loader.load;mw.loader.load=function(r,o){let a=t(r);a?e(a[0],a[1],o):n.apply(mw.loader,[...arguments])};let r=mw.loader.getScript;mw.loader.getScript=function(n){let o=t(n);return o?e(o[0],o[1],"text/javascript"):r.apply(mw.loader,[...arguments])}}
/*
//*** add floating table of contents ***
//add sticky toc, if has toc
var stoc, ele = window.toc;
if (ele && (ele.childElementCount > 1)) {
sty.textContent += `
#toc.sticky {position:fixed; z-index:10; left:0; top: 0; padding:0 .5ex; background:#f9f9f9; white-space:nowrap; font-family:sans-serif; font-size:10pt}
#toc.sticky #toctitle {margin:.3ex 0 .2ex 0}
#toc.sticky #toctitle h2 {font-family:sans-serif}
#toc.sticky > ul {display:none; margin-bottom:0; max-height:${innerHeight - eContent.offsetTop - 30}px; padding-right:3ex}
#toc.sticky:hover #toctitle {width:auto}
#toc.sticky:hover > ul {display:block; overflow-y:auto}`;
(stoc = ele.cloneNode(true)).classList.add("sticky");
(ele = stoc.querySelector(".toctogglespan")) && ele.remove();
document.body.appendChild(stoc);
}
//*** end: add floating table of contents ***
(() => {
//add section toggle on section headlines. and add permalink if possible
var sty = document.head.appendChild(document.createElement("STYLE")), eContent = document.querySelector("#content"), mwp = window["mw-panel"];
var ele = window.toc;
var a, b, c;
function toggleSection() {
var ele = this.parentNode, htyp = ele.tagName, exp;
if (this.classList.contains("expanded")) {
this.classList.remove("expanded");
this.classList.add("collapsed");
exp = false;
} else {
this.classList.remove("collapsed");
this.classList.add("expanded");
exp = true;
}
ele = ele.nextElementSibling;
if (ele) {
while (ele) {
if (((ele.tagName[0] === "H") && (ele.tagName[1] <= htyp[1])) || ((ele.tagName === "DIV") && (ele.className === "navbox"))) break;
if (exp) {
ele.style.display = ele.getAttribute("od_");
ele.removeAttribute("od_");
} else {
ele.setAttribute("od_", ele.style.display);
ele.style.display = "none";
}
ele = ele.nextElementSibling;
}
}
updateTableHeadersPos();
dispatchEvent(new Event("resize"));
}
sty.textContent += `.mw-headline.expanded:after{content:" \\23f6"}
.mw-headline.collapsed:after{content:" \\23f7"}
.mw-headline:hover {background:#ddf; cursor:pointer}`;
document.querySelectorAll(".mw-headline").forEach(a => {
a.classList.add("expanded");
a.onclick = toggleSection;
if (c = a.id ? a.id : (a.name ? a.name : "")) {
(b = document.createElement("SPAN")).className = "mw-editsection";
b.innerHTML = `<span class="mw-editsection-bracket">[</span><a href="${location.href.split("#")[0] + "#" + c}" title="Link to this section">link</a><span class="mw-editsection-bracket">]</span>`;
a.parentNode.appendChild(b);
}
});
//*** end: add collapsible sections and section links ***
})();
*/