User:Msh210/format.js

Definition from Wiktionary, the free dictionary
< User:Msh210
Archived revision by Msh210 (Talk | contribs) as of 15:37, 22 May 2012.

Jump to: navigation, 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 user page lacks a documentation page. Please create it.
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 */