Difference between revisions of "User:Shine/valve.js"
m |
m |
||
(One intermediate revision by the same user not shown) | |||
Line 31: | Line 31: | ||
// | // | ||
− | + | function gid(i) { | |
− | + | return document.getElementById(i); | |
− | + | } | |
− | + | function replaceRecentChangesLink(){ | |
− | + | if(gid('n-recentchanges')) { | |
− | + | var a = gid('n-recentchanges').getElementsByTagName('a'); | |
− | + | for(i in a) { | |
− | + | a[i].href = '/w/index.php?title=Special:RecentChanges&hidebots=0'; | |
− | + | } | |
− | + | } | |
− | { | + | } |
− | + | addOnloadHook(replaceRecentChangesLink); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
// | // |
Latest revision as of 07:21, 26 August 2010
// addPurge addOnloadHook(function () { var hist; var url; if (!(hist = document.getElementById('ca-history') )) return; if (!(url = hist.getElementsByTagName('a')[0] )) return; if (!(url = url.href )) return; addPortletLink('p-cactions', url.replace(/([?&]action=)history([&#]|$)/, '$1purge$2'), 'Purge', 'ca-purge', 'Purge server cache for this page', '0'); }); // // Adds a "Replace" tab which pops up two prompt boxes; one for a regexp and one for a replacement function wpTextboxReplace() { var s = prompt("Search regexp:"); if(s){ var r = prompt("Replace /"+s+"/ with:"); if(!r && r != '') return; var txt = document.editform.wpTextbox1; txt.value = txt.value.replace(new RegExp(s, "mg"), r); } } addOnloadHook(function () { if (document.forms.editform) { addPortletLink('p-cactions', 'javascript:wpTextboxReplace()', 'Replace', 'ca-replace', 'Regexp replace for the edit window', 'R', document.getElementById('ca-history')); } }); // function gid(i) { return document.getElementById(i); } function replaceRecentChangesLink(){ if(gid('n-recentchanges')) { var a = gid('n-recentchanges').getElementsByTagName('a'); for(i in a) { a[i].href = '/w/index.php?title=Special:RecentChanges&hidebots=0'; } } } addOnloadHook(replaceRecentChangesLink); //