MediaWiki:Common.js
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
mw.loader.using("mediawiki.util").then(function(){var a="https://final-fight.com/",i=document.querySelector(".vector-header-end");if(i&&!document.querySelector(".ffw-play")){var e=document.createElement("a");e.className="ffw-play",e.href=a,e.title="Go to the Final Fight website",e.innerHTML='<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M7 4.5v15l12-7.5z"/></svg>Play now',i.insertBefore(e,i.firstChild)}var t=document.getElementById("footer");if(t&&!document.querySelector(".ffw-footer")){var r=[["Play now",a],["Discord","https://discord.gg/YZ7f5tJ"],["YouTube","https://www.youtube.com/@finalfight4099"],["Twitch","https://www.twitch.tv/final_fight_streamer"]],n=document.createElement("div");n.className="ffw-footer",n.innerHTML='<a class="ffw-footer-brand" href="'+a+'">Final Fight</a><nav>'+r.map(function(c){return'<a href="'+c[1]+'">'+c[0]+"</a>"}).join("")+"</nav>",t.appendChild(n)}}),mw.config.get("wgCanonicalSpecialPageName")==="Search"&&document.querySelectorAll(".searchresult").forEach(function(a){var i="";a.childNodes.forEach(function(t){i+=t.nodeType===1?"\uE000"+t.textContent+"\uE001":t.nodeValue}),i=i.replace(/\n\.\.\.\s*$/," \u2026").replace(/\{\{[^}]*(\}\}|$)|\}\}|<\/?[a-z][^>]*>|\[\[(?:[^|\]]*\|)?|\]\]|'{2,}|={2,}|__[A-Z]+__/gi," ").replace(/\|\s*[\w \uE000\uE001]+?\s*=\s*/g,`
`).replace(/(^|\n)\s*[*#:]+\s*/g,"$1").replace(/\s*\n[\s\n]*/g," \xB7 ").replace(/ {2,}/g," ").replace(/^[\s\u00b7]+|[\s\u00b7]+$/g,""),a.textContent="";var e=null;i.split(/([\uE000\uE001])/).forEach(function(t){t==="\uE000"?e||(e=a.appendChild(Object.assign(document.createElement("span"),{className:"searchmatch"}))):t==="\uE001"?e=null:t&&(e||a).appendChild(document.createTextNode(t))})}),mw.config.get("wgCanonicalSpecialPageName")==="Upload"&&mw.loader.load(mw.config.get("wgScript")+"?title=MediaWiki:MultiUpload.js&action=raw&ctype=text/javascript"),mw.config.get("wgCanonicalSpecialPageName")==="Search"&&mw.loader.using("mediawiki.api").then(function(){var a={};document.querySelectorAll(".mw-search-result").forEach(function(e){var t=e.querySelector(".mw-search-result-heading a");if(!(!t||e.querySelector(".ffw-sr-icon"))){var r=document.createElement("div");for(r.className="ffw-sr-body";e.firstChild;)r.appendChild(e.firstChild);var n=document.createElement("span");n.className="ffw-sr-icon",e.appendChild(n),e.appendChild(r),(a[t.title]=a[t.title]||[]).push(n)}});var i=Object.keys(a);i.length&&new mw.Api().get({action:"query",prop:"pageimages",piprop:"thumbnail",pithumbsize:96,pilimit:50,titles:i.join("|"),formatversion:2}).then(function(e){(e.query.pages||[]).forEach(function(t){t.thumbnail&&(a[t.title]||[]).forEach(function(r){var n=document.createElement("img");n.src=t.thumbnail.source,n.alt="",r.appendChild(n),r.classList.add("ffw-sr-has-icon")})})})});