User:Duskey/monaco.js

// NOTE: enhanced recent changes not supported function fixBlogLinks { if (wgPageName == "Special:RecentChanges") $("#bodyContent ul.special li:contains('Blog comments')").each(function (i) { oldHTML = $(this).html; lnk = $(this).find("a:contains('hist')").attr("href"); if (typeof(lnk) != "undefined") { rawID = lnk.replace(/.*curid=(.*?)&.*/,"$1"); bLink = "/wiki/User_blog:" + lnk.replace(/.*User_blog_comment:(.*?\/.*?)\/.*/,"$1") + "?showall=1#comm-" + rawID; newHTML = oldHTML.replace(/Blog comments \((.*?)\)/,"Blog comments ($1)"); $(this).html(newHTML); } }); } function fbl { fixBlogLinks; $("#bodyContent").bind("ajaxPageLoad",fixBlogLinks); } addOnloadHook(fbl);

/* Prepending special pages thanks to Zombiedan & pcj */ $(function { if ( wgNamespaceNumber === -1 && wgCanonicalSpecialPageName === "Specialpages" ) $("#contentSub").after(""); if ( wgNamespaceNumber === -1 && wgCanonicalSpecialPageName === "UnusedFiles" ) $("#contentSub").after("Hello world"); }); /* Prepend end */

/** * purge.js * * Add a purge link to the Monaco toolbox. Adding the link directly to * a toolbox customization page doesn't work too well because of the server cache. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ if ((wgAction == 'view' || wgAction == 'purge') && wgCanonicalNamespace != 'Special') { $(document).ready(function {		var list = null;		if (skin == 'monobook') {			list = document.getElementById('p-tb').getElementsByTagName('ul')[0];		} else {			var lists = document.getElementById('link_box').getElementsByTagName('ul');			if (lists[0].getElementsByTagName('li').length <= lists[1].getElementsByTagName('li').length) {				list = lists[0];			} else {				list = lists[1];			}		}		var li = document.createElement('li');		var a = document.createElement('a');		a.href = wgScript + '?action=purge&title=' + encodeURIComponent(wgPageName);		a.appendChild(document.createTextNode('Purge this page'));		a.title = 'Clear the server cache of this page.';		li.appendChild(a);		list.insertBefore(li, list.firstChild);	}); }

/* PCJ's dup finder start */ dil = new Array; function findDupImages(gf) { output = ""; url = "/api.php?action=query&generator=allimages&prop=duplicatefiles&gailimit=500&format=json"; if (gf) url += "&gaifrom=" + gf; $.getJSON(url,function (data) { if (data.query) { pages = data.query.pages; for (pageID in pages) { dils = ","+dil.join; if (dils.indexOf(","+pages[pageID].title) == -1 && pages[pageID].title.indexOf("File::") == -1 && pages[pageID].duplicatefiles) { output += " "+pages[pageID].title+" \n\n"; for (x=0;xFile:"+pages[pageID].duplicatefiles[x].name+"\n"; dil.push("File:"+pages[pageID].duplicatefiles[x].name.replace(/_/g," ")); } output += "\n\n" } } $("#mw-dupimages").append(output); if (data["query-continue"]) setTimeout("findDupImages('"+data["query-continue"].allimages.gaifrom+"');",5000); } }); } $(function { if ($("#mw-dupimages").length) findDupImages; }); /* PCJ's dup finder end */