User:Msh210/format.js
Jump to navigation
Jump to search
Note – after saving, you may have to bypass your browser’s cache to see the changes.
- Mozilla / Firefox / Safari: hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (Command-R on a Macintosh);
- Konqueror and Chrome: click Reload or press F5;
- Opera: clear the cache in Tools → Preferences;
- Internet Explorer: hold Ctrl while clicking Refresh, or press Ctrl-F5.
- This script lacks a documentation subpage. Please create it.
- Useful links: root page • root page’s subpages • links • redirects • your own
document.getElementById('firstHeading').setAttribute('style','color:#3cc');
/* begin stuff copied from [[User:Connel MacKenzie/reformat.js]] and amended */
rfd='{'+'{rfd|fragment=nineteen sixty-eight}}';
function minorFormat() {
txt=txt.replace(/English==\n/g, "English==\n"+rfd);
}
function superAutoFormat() {
switch(wgAction){case 'submit': case 'edit': break; default: return};
// is this in the main namespace? If not, stop.
if (wgNamespaceNumber) return;
txt = " " + document.editform.wpTextbox1.value;
txt = txt.substr (1, txt.length-1);
oldtxt = txt;
if (txt.length < 2) txt = " " + txt;
//safety valves
if (txt.search(/^#redirect/i) != -1) return;
minorFormat();
if (txt == " ") txt = "";
document.editform.wpTextbox1.value = txt;
document.editform.wpSummary.value=rfd;
if (txt != oldtxt) {
setTimeout( "document.editform.wpSave.click();", 2000 );
}
}
addOnloadHook( superAutoFormat );
/* end stuff copied from User:Connel MacKenzie/reformat.js */