User:Holly Cheng/common.js
Jump to navigation
Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
The accompanying .css page for this skin is at User:Holly Cheng/common.css. |
window.HotCatAutoRemoveCheckCat = true;
function addTab(url, name, id, title, key){
return mw.util.addPortletLink('p-cactions', url, name, id, title, key);
}
// edit section 0
$(function () {
var x;
if (!(x = document.getElementById('ca-edit') )) return;
var url;
if (!(url = x.getElementsByTagName('a')[0] )) return;
if (!(url = url.href )) return;
var y = mw.util.addPortletLink('p-cactions', url+"§ion=0", '0', 'ca-edit-0',
'Edit the lead section of this page', '0', x.nextSibling);
y.className = x.className; // steal classes from the the edit tab...
x.className = 'istalk'; // ...and make the edit tab have no right margin
// exception: don't steal the "selected" class unless actually editing section 0:
if (/(^| )selected( |$)/.test(y.className)) {
if (!document.editform || !document.editform.wpSection
|| document.editform.wpSection.value != "0") {
y.className = y.className.replace(/(^| )selected( |$)/g, "$1");
x.className += ' selected';
}
}
});
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Ais523/topcontrib.js&action=raw&ctype=text/javascript');
mw.hook( 'wikipage.content' ).add(function() {
z=document.getElementById("content").childNodes;
var pname;
for (var n=0;n<z.length;n++) {
if (z[n].className=="firstHeading") {
pname=z[n].textContent;
}
}
var l=addTab("http://" + location.hostname + "/w/index.php?title=" + pname + "&diff=cur&oldid=prev", 'last', '');
l.lastChild.title="Show most recent diff";
});
importScript('MediaWiki:Category from gallery.js');
importScript('User:Majora/LicenseReview.js');
function replace() {
var s = prompt("Search regexp?");
if(s) {
var r = prompt("Replace regexp?");
if(!r && r !== '') return;
var txt = document.editform.wpTextbox1;
txt.value = txt.value.replace(new RegExp(s, "g"), r);
}
}
$(function () {
if(document.forms.editform) {
addTab('javascript:replace()', 'replace', 'ca-replace', 'Regexp replace for the edit window', '');
}
});
//<nowiki>
//catALot///////////////////////////////////////
////////// Cat-A-Lot user preferences //////////
window.catALotPrefs = {"watchlist":"preferences","minor":false,"editpages":false,"docleanup":true,"subcatcount":50};
////////////////////////////////////catALotEnd//
//</nowiki>