User:Mavoc/global.js

/* Import Personal Javascript Extensions */ importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:MercuryPreview/code.js',    ] });

/* Edit Modules in Wide Mode */ $("#EditPage").removeClass("editpage-sourcewidemode-off").addClass("editpage-sourcewidemode-on"); $("#EditPageToolbar").addClass("ace-editor-wide");

/* Add Page Load Statistics to the bottom of the page. */ var STATS = $(' ', { style:"padding-left:12px" }); STATS.insertAfter('.license-description'); STATS.text("Page Load Statistics"); var NEWPP = $(' ', { style:"padding-left:12px; padding-bottom:12px" }); NEWPP.insertAfter(STATS); $('#mw-content-text').contents.filter(function {    if (this.nodeType == 8 && /^\s*(NewPP) /.test(this.data)) {        var text = $.trim(this.data);        /*text = text.replace(/(\d+\/\d+)/g, "$1 "+(eval("$1")*100).toFixed(2)+"%");*/        text = text.replace(/^.+$/gm, function(line) { var x = line.match(/\d+\/\d+/g); if (x !== null) { x = eval(x[0]); x = x*100; x = x.toFixed(1)+"%"; line = line.replace(/\B(?=(\d{3})+(?!\d))/g, ","); var s = " "; return line+s.repeat(85-line.length-x.length)+x; } else { return line; }       });        NEWPP.text(text);    } });

/* Add Useful Links after Page Load Statistics */ var LINKS = $(' ', { style:"padding-left:12px" }); LINKS.insertAfter(NEWPP); LINKS.text("Useful Links"); var LINKSHERE = $(' ', { style:"font-size:14px; padding-left:12px; padding-bottom:12px" }); LINKSHERE.insertAfter(LINKS); var url = $(location).attr('href'); var regex = /(^.*?fandom.com\/wiki\/)([^\?]*)\??(.*?$)/; var domain = url.replace(regex, "$1"); var page = url.replace(regex, "$2"); var params = url.replace(regex, "$3"); LINKSHERE.append("What Links Here "); LINKSHERE.append("Watchlist ("); LINKSHERE.append("Add - "); LINKSHERE.append("Remove) ");