User:Hotbot/monobook.js

From Homestar Runner Wiki

(Difference between revisions)
Jump to: navigation, search
m (gfhgfghfgh)
Line 11: Line 11:
var isIE=((self.navigator.appName).indexOf("Microsoft")!=-1);
var isIE=((self.navigator.appName).indexOf("Microsoft")!=-1);
-
loadJS('[en.wikipedia.org/wiki/User:Dantheox/watchlistdiff.js]');
+
loadJS('[[User:Dantheox/watchlistdiff.js]]');
-
loadJS('[en.wikipedia.org/wiki/User:Lupin/wpus.js]');
+
loadJS('[[User:Lupin/wpus.js]]');
-
loadJS('[en.wikipedia.org/wiki/User:Lupin/redlinks.js]');
+
loadJS('[[User:Lupin/redlinks.js]]');
-
loadJS('[en.wikipedia.org/wiki/en.wikipedia.org/wiki/User:Lupin/watchlistfilter.js]');
+
loadJS('[[User:Lupin/watchlistfilter.js]]');
-
loadJS('[en.wikipedia.org/wiki/User:Lupin/listsince.js]');
+
loadJS('[[User:Lupin/listsince.js]]');
-
//tmpJS('[en.wikipedia.org/wiki/User:Lupin/recent2.js]');
+
//tmpJS('[[User:Lupin/recent2.js]]');
-
loadJS('[en.wikipedia.org/wiki/User:Lupin/recent2.js]]');
+
loadJS('[[User:Lupin/recent2.js]]');
-
//loadJS('[en.wikipedia.org/wiki/User:Lupin/sectionkeys.js]');
+
//loadJS('[[User:Lupin/sectionkeys.js]]');
-
loadJS('[en.wikipedia.org/wiki/User:Lupin/evaluator.js]');
+
loadJS('[[User:Lupin/evaluator.js]]');
-
loadJS('[en.wikipedia.org/wiki/en.wikipedia.org/wiki/User:Lupin/nichalp_links.js]');
+
loadJS('[[User:Lupin/nichalp_links.js]]');
-
loadJS('[User:Zocky/SearchBox.js]]');
+
loadJS('[[User:Zocky/SearchBox.js]]');
-
//loadJS('[en.wikipedia.org/wiki/User:Zocky/jsSandBox.js]'); // prototype messes stuff up
+
//loadJS('[[User:Zocky/jsSandBox.js]]'); // prototype messes stuff up
//loadJS('[[de:Benutzer:ASM/quickedit.js]]');
//loadJS('[[de:Benutzer:ASM/quickedit.js]]');
tmpJS('quickedit.js');
tmpJS('quickedit.js');
-
//loadJS('[User:Lupin/editcount.js]]');
+
//loadJS('[[User:Lupin/editcount.js]]');
tmpJS('ec.js');
tmpJS('ec.js');
if (!isIE) {
if (!isIE) {
-
loadJS('[[en.wikipedia.org/wiki/User:Lupin/summarynag.js]');
+
loadJS('[[User:Lupin/summarynag.js]]');
-
loadJS('[[en.wikipedia.org/wiki/User:Zocky/PicturePopups.js]');
+
loadJS('[[User:Zocky/PicturePopups.js]]');
}
}
Line 39: Line 39:
//window.localCSS=true;
//window.localCSS=true;
-
//loadJS('[[en.wikipedia.org/wiki/User:Lupin/popupsdev.js]]');
+
//loadJS('[[User:Lupin/popupsdev.js]]');
tmpJS('popupsdev.js');
tmpJS('popupsdev.js');
popupAdminLinks=true; popupShortcutKeys=true; popupFixDabs=true;
popupAdminLinks=true; popupShortcutKeys=true; popupFixDabs=true;
Line 84: Line 84:
  */
  */
-
//loadJS('[[en.wikipedia.org/wiki/User:Zocky/CategoryBrowser.js]]');
+
//loadJS('[[User:Zocky/CategoryBrowser.js]]');
-
//loadJS('[[en.wikipedia.org/wiki/User:Lupin/annoy.js]]');
+
//loadJS('[[User:Lupin/annoy.js]]');
//window.annoy={ freq: 1000*60*15, duration: 1000*60,
//window.annoy={ freq: 1000*60*15, duration: 1000*60,
//  target: 'http://en.wikipedia.org/wiki/Wikipedia:Recovering_from_Wikipediholism' };
//  target: 'http://en.wikipedia.org/wiki/Wikipedia:Recovering_from_Wikipediholism' };
// Show diffs on recent changes, history pages and so on
// Show diffs on recent changes, history pages and so on
-
// loadJS('[en.wikipedia.org/wiki/User:Lupin/recentdiffs.js]');
+
// loadJS('[[User:Lupin/recentdiffs.js]]');
-
// loadJS('[en.wikipedia.org/wiki/User:Lupin/editblind.js]');
+
// loadJS('[[User:Lupin/editblind.js]]');
// addOnloadHook(function(){window.popupShortcutKeys=true;}); // for testing
// addOnloadHook(function(){window.popupShortcutKeys=true;}); // for testing
-
// if (location.href == "http://en.wikipedia.org/wiki/User:Jitse_Niesen/Client-side_preferences") loadJS('[en.wikipedia.org/wiki/User:Jitse_Niesen/Client-side_preferences/Main.js]');
+
// if (location.href == "http://en.wikipedia.org/wiki/User:Jitse_Niesen/Client-side_preferences") loadJS('[[User:Jitse_Niesen/Client-side_preferences/Main.js]]');
/**
/**
Line 122: Line 122:
//</nowiki></pre>
//</nowiki></pre>
-
 
-
 
-
 
-
 
-
function getParamValue(paramName) {
 
-
  var cmdRe=RegExp('[&?]'+paramName+'=([^&]*)');
 
-
  var h=document.location;
 
-
  var m;
 
-
  if (m=cmdRe.exec(h)) {
 
-
    try {
 
-
      return decodeURI(m[1]);
 
-
    } catch (someError) {}
 
-
  }
 
-
  return null;
 
-
};
 
-
 
-
function substitute(data,cmdBody) {
 
-
  // alert('sub\nfrom: '+cmdBody.from+'\nto: '+cmdBody.to+'\nflags: '+cmdBody.flags);
 
-
  var fromRe=RegExp(cmdBody.from, cmdBody.flags);
 
-
  return data.replace(fromRe, cmdBody.to);
 
-
};
 
-
 
-
function execCmds(data, cmdList) {
 
-
  for (var i=0; i<cmdList.length; ++i) {
 
-
    data=cmdList[i].action(data, cmdList[i]);
 
-
  }
 
-
  return data;
 
-
}
 
-
 
-
function parseCmd(str) {
 
-
  // returns a list of commands
 
-
  if (!str.length) return [];
 
-
  var p=false;
 
-
  switch (str.charAt(0)) {
 
-
  case 's':
 
-
    p=parseSubstitute(str);
 
-
    break;
 
-
  case 'j':
 
-
    p=parseJavascript(str);
 
-
    break;
 
-
  default:
 
-
    return false;
 
-
  }
 
-
  if (p) return [p].concat(parseCmd(p.remainder));
 
-
  return false;
 
-
};
 
-
 
-
function unEscape(str, sep) {
 
-
  return str.split('\\\\').join('\\')
 
-
        .split('\\'+sep).join(sep)
 
-
        .split('\\n').join('\n');
 
-
};
 
-
 
-
 
-
function runJavascript(data, argWrapper) {
 
-
  // flags aren't used (yet)
 
-
 
-
  // from the user's viewpoint,
 
-
  // data is a special variable may appear inside code
 
-
  // and gets assigned the text in the edit box
 
-
 
-
  // alert('eval-ing '+argWrapper.code);
 
-
 
-
  return eval(argWrapper.code);
 
-
};
 
-
 
-
function parseJavascript(str) {
 
-
  // takes a string like j/code/;othercmds and parses it
 
-
 
-
  var tmp,code,flags;
 
-
 
-
  if (str.length<3) return false;
 
-
  var sep=str.charAt(1);
 
-
  str=str.substring(2);
 
-
 
 
-
  tmp=skipOver(str,sep);
 
-
  if (tmp) { code=tmp.segment.split('\n').join('\\n'); str=tmp.remainder; }
 
-
  else return false;
 
-
 
-
  flags='';
 
-
  if (str.length) {
 
-
    tmp=skipOver(str,';') || skipToEnd(str, ';');
 
-
    if (tmp) {flags=tmp.segment; str=tmp.remainder; }
 
-
  }
 
-
 
-
  return { action: runJavascript, code: code, flags: flags, remainder: str };
 
-
};
 
-
 
-
function parseSubstitute(str) {
 
-
  // takes a string like s/a/b/flags;othercmds and parses it
 
-
 
-
  var from,to,flags,tmp;
 
-
 
-
  if (str.length<4) return false;
 
-
  var sep=str.charAt(1);
 
-
  str=str.substring(2);
 
-
 
-
  tmp=skipOver(str,sep);
 
-
  if (tmp) { from=tmp.segment; str=tmp.remainder; }
 
-
  else return false;
 
-
 
-
  tmp=skipOver(str,sep);
 
-
  if (tmp) { to=tmp.segment; str=tmp.remainder; }
 
-
  else return false;
 
-
 
-
  flags='';
 
-
  if (str.length) {
 
-
    tmp=skipOver(str,';') || skipToEnd(str, ';');
 
-
    if (tmp) {flags=tmp.segment; str=tmp.remainder; }
 
-
  }
 
-
 
 
-
  return {action: substitute, from: from, to: to, flags: flags, remainder: str};
 
-
 
-
};
 
-
 
-
function skipOver(str,sep) {
 
-
  var endSegment=findNext(str,sep);
 
-
  if (endSegment<0) return false;
 
-
  var segment=unEscape(str.substring(0,endSegment), sep);
 
-
  return {segment: segment, remainder: str.substring(endSegment+1)};
 
-
}
 
-
 
-
function skipToEnd(str,sep) {
 
-
  return {segment: str, remainder: ''};
 
-
}
 
-
 
-
function findNext(str, ch) {
 
-
  for (var i=0; i<str.length; ++i) {
 
-
    if (str.charAt(i)=='\\') i+=2;
 
-
    if (str.charAt(i)==ch) return i;
 
-
  }
 
-
  return -1;
 
-
};
 
-
 
-
function runOnLoad(f) {
 
-
  if (window.addEventListener) {
 
-
    window.addEventListener("load",f,false);
 
-
  }
 
-
  else if (window.attachEvent) {
 
-
    window.attachEvent("onload",f);
 
-
  }
 
-
  else {
 
-
    window._old_popup_autoedit_onload = window.onload;
 
-
    window.onload = function() {
 
-
      window._old_popup_autoedit_onload();
 
-
      f();
 
-
    }
 
-
  }
 
-
};
 
-
 
-
window.autoEdit=function() {
 
-
  if (window.autoEdit.alreadyRan) return false;
 
-
  window.autoEdit.alreadyRan=true;
 
-
  var cmdString=getParamValue('autoedit');
 
-
  if (cmdString) {
 
-
    try {
 
-
      var editbox=document.editform.wpTextbox1;
 
-
    } catch (dang) { return; }
 
-
    var cmdList=parseCmd(cmdString);
 
-
    var input=editbox.value;
 
-
    var output=execCmds(input, cmdList);
 
-
    editbox.value=output;
 
-
  }
 
-
 
-
  var summary=getParamValue('autosummary');
 
-
  if (summary) document.editform.wpSummary.value=summary;
 
-
 
-
  var minor=getParamValue('autominor');
 
-
  if (minor) {
 
-
    switch (minor) {
 
-
    case '1':
 
-
    case 'yes':
 
-
    case 'true':
 
-
      document.editform.wpMinoredit.checked=true;
 
-
      break;
 
-
    case '0':
 
-
    case 'no':
 
-
    case 'false':
 
-
      document.editform.wpMinoredit.checked=false;
 
-
    }
 
-
  }
 
-
 
-
  var btn=getParamValue('autoclick');
 
-
  if (btn) {
 
-
    if (document.editform && document.editform[btn]) {
 
-
      var headings=document.getElementsByTagName('h1');
 
-
      if (headings) {
 
-
        var div=document.createElement('div');
 
-
        var button=document.editform[btn];
 
-
        div.innerHTML='<font size=+1><b>The "' + button.value +
 
-
          '" button has been automatically clicked.' +
 
-
          ' Please wait for the next page to load.</b></font>';
 
-
        document.title='('+document.title+')';
 
-
        headings[0].parentNode.insertBefore(div, headings[0]);
 
-
        button.click();
 
-
      }
 
-
    } else {
 
-
      alert('autoedit.js\n\nautoclick: could not find button "'+ btn +'".');
 
-
    } 
 
-
  }
 
-
};
 
-
 
-
runOnLoad(autoEdit);
 

Revision as of 05:47, 7 July 2007

// jncsp-start The section below (up to jncsp-end) is maintained by [[Wikipedia:WikiProject_User_scripts/User-script_manager]]
// jncsp-config

if (location.href == "http://en.wikipedia.org/wiki/Wikipedia:WikiProject_User_scripts/User-script_manager") 
   document.write('<script type="text/javascript" src="http://en.wikipedia.org/w' + 
                  '/index.php?title=User:Jitse_Niesen/Client-side_preferences/Main.js&action=raw&ctype=text/javascript"></script>'); 

// jncsp-end

//<pre>
var isIE=((self.navigator.appName).indexOf("Microsoft")!=-1);

loadJS('[[User:Dantheox/watchlistdiff.js]]');
loadJS('[[User:Lupin/wpus.js]]');
loadJS('[[User:Lupin/redlinks.js]]');
loadJS('[[User:Lupin/watchlistfilter.js]]');
loadJS('[[User:Lupin/listsince.js]]');
//tmpJS('[[User:Lupin/recent2.js]]');
loadJS('[[User:Lupin/recent2.js]]');
//loadJS('[[User:Lupin/sectionkeys.js]]');
loadJS('[[User:Lupin/evaluator.js]]');
loadJS('[[User:Lupin/nichalp_links.js]]');
loadJS('[[User:Zocky/SearchBox.js]]');
//loadJS('[[User:Zocky/jsSandBox.js]]'); // prototype messes stuff up
//loadJS('[[de:Benutzer:ASM/quickedit.js]]');
tmpJS('quickedit.js');
//loadJS('[[User:Lupin/editcount.js]]');
tmpJS('ec.js');
if (!isIE) {
	loadJS('[[User:Lupin/summarynag.js]]');
	loadJS('[[User:Zocky/PicturePopups.js]]');
}

//<nowiki>

/**
 * Popups stuff
 */

//window.localCSS=true;
//loadJS('[[User:Lupin/popupsdev.js]]');
tmpJS('popupsdev.js');
popupAdminLinks=true; popupShortcutKeys=true; popupFixDabs=true;
popupPreviewKillTemplates=false; popupPreviewFirstParOnly=false;
popupOnlyArticleLinks=false;
popupEditCounterTool='interiot';
popupExtraUserMenu='<menurow><<monobook|shortcut=M>>|<<editMonobook|edit>></menurow>';
popupFixRedirs=true;
popupRedlinkRemoval=true;
extraPopupFilters=[
 function(data) { if (/[{]{2}[Ff]eatured article[}]{2}/.test(data) )
   return '<img src="http://upload.wikimedia.org/wikipedia/en/thumb/c/cf/Cscr-featured.png/7px-Cscr-featured.png">';
   else return ''; }
];
if (!isIE) { popupStructure='menus'; }
popupDragHandle='popupTopLinks';
popupEditCounterTool='custom';
popupEditCounterUrl='http://en.wikipedia.org/wiki/User:$1?ectarget=$1';
//popupModifier='shift';
/**
 * IE nonsense
 */

if (isIE) {
	document.write('<link rel="stylesheet" type="text/css" href="http://localhost:8080/js/ie.css">');
}

/**
 * messy stuff
 */

function fixWatchlistLink () {
	for (var i=0; i<document.links.length; ++i) {
		if (document.links[i].href.indexOf('Special:Watchlist')>0) {
			document.links[i].href+='?hideOwn=1';
			break;
		}
	}
};
if (!isIE) { addOnloadHook(fixWatchlistLink); }

/**
 * Inactive stuff
 */

//loadJS('[[User:Zocky/CategoryBrowser.js]]');

//loadJS('[[User:Lupin/annoy.js]]');
//window.annoy={ freq: 1000*60*15, duration: 1000*60,
//  target: 'http://en.wikipedia.org/wiki/Wikipedia:Recovering_from_Wikipediholism' };

// Show diffs on recent changes, history pages and so on
// loadJS('[[User:Lupin/recentdiffs.js]]');

// loadJS('[[User:Lupin/editblind.js]]');

// addOnloadHook(function(){window.popupShortcutKeys=true;}); // for testing

// if (location.href == "http://en.wikipedia.org/wiki/User:Jitse_Niesen/Client-side_preferences") loadJS('[[User:Jitse_Niesen/Client-side_preferences/Main.js]]');

/**
 * page loading functions
 */

function tmpJS(name) {
        if (window.isIE) { return; }
        name=name.replace(/^(\[\[)?(User:Lupin\/)?(.*?)(\]\])?$/, '$3');
	document.write('<script type="text/javascript" src="' +
		       'http://localhost:8080/js/' + name + '"></script>');
}

function loadJS(page){
  page=page.replace(/^\[\[(.*)\]\]$/, '$1');
  var lang='en';
  if (page.match(/^(.*?):(.*:.*)/)) {
    lang=RegExp.$1; page=RegExp.$2;
  }
  document.write('<script type="text/javascript" src="' +
		 'http://' + lang + '.wikipedia.org/w/index.php?title=' + page +
		 '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
}

//</nowiki></pre>
Personal tools