Jump to content

User:Will Pittenger/monobook.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/* By manually purging this page, you will be able to see the divisions I have set up for easy navigation.  Please purge manually as using the [[Wikipedia:WikiProject User scripts/Scripts/Add purge to tabs|purge tab]] will have no effect.

== Tools by [[User:Lupin]] ==
== [[Wikipedia:User:Lupin/popups.js]] ==
<pre><nowiki>*/
mw.loader.load(
             'https://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'
             + '&action=raw&ctype=text/javascript&dontcountme=s'); // </nowiki></pre> End of popup code
// </nowiki></pre>  end of popup code

/*
==== Options for Popups ====
<pre><nowiki>*/
//popupFixDabs=true;
//popupRevertSummaryPrompt=true;// </nowiki></pre>

/*

=== [[User:Lupin/Anti-vandal tool|Filter Recent Changes]] ===
<pre><nowiki>*/
// Script from [[User:Lupin/recent2.js]]
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/recent2.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></s'+'cript>');
// </nowiki></pre>

/*

== [[User:Kbh3rd/whackamole.js]] ==
<pre style="overflow:auto"><nowiki> */
//
// Edit tools for the vandal whack-a-mole game
// [[User:Kbh3rd/whackamole.js]] - please include this line
//

document.write('<script type="text/javascript" src="'
  + 'http://en.wikipedia.org/w/index.php?title=User:Kbh3rd/whackamole.js'
  + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');// </nowiki></pre>  end of whack vandal code

/*
== [[User:Cacycle/wikEd|wikEd]] by [[User:Cacycle]] ==
=== wikEd helpers ===
==== [[User:Cacycle/diff]] text diff code ====
<pre style="overflow:auto"><nowiki>*/
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/diff.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
// </nowiki></pre>  end of text diff code

/*
==== [[User:Mboverload/RegExTypoFix|RegExTypoFix]] common typo fixer ====
<pre><nowiki>*/
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/RegExTypoFix.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></'+'script>');// </nowiki></pre>

/*
=== Options ===
<pre style="overflow:auto"><nowiki>*/
wikEdLoadRegExTypoFix = true;
wikEdFollowHighlightedLinks = true;//</nowiki></pre>

/*
=== Custom Buttons ===
See the instructions and sample at [[User:Cacycle/wikEd#Custom buttons]]
<pre style="overflow:auto"><nowiki>*/
//define  custom buttons (id, class, popup title, image src, width, height, alt text, onClick and parameters)
var wikEdButton = [];// </nowiki></pre>

/*
==== Declare the buttons ====
===== &lt;div> tags =====
<pre style="overflow:auto"><nowiki>*/
wikEdButton[100] = ['wikEdDiv', 'wikEdButton', 'Make the selection a html DIV element', 'http://upload.wikimedia.org/wikipedia/commons/e/eb/WikEd_button_DivTag.PNG', '16', '16', 'DIV', 'javascript:WikEdEditButton(this, this.id, null, CreateDivBtnHandler);' ];

// define the function which is called upon clicking the custom button
function CreateDivBtnHandler(obj) {

// select the appropriate text change target (whole, selection, cursor, focusWord, focusLine, selectionWord, or selectionLine)
  WikEdGetText(obj, 'selection, cursor');
  if (obj.selection.plain != '') {
    obj.changed = obj.selection;
  }
  else {
    obj.changed = obj.cursor;
  }

// make the changes to the plain target text
  if ( /&lt;div&gt;(.*?)&lt;\/div&gt;/i.test(obj.changed.plain) ) {
    obj.changed.plain = obj.changed.plain.replace(/&lt;div&gt;(.*?)&lt;\/div&gt;/gi, '$1');
  }
  else {
    obj.changed.plain = '&lt;div&gt;' + obj.changed.plain + '&lt;/div&gt;';
    obj.changed.plain = obj.changed.plain.replace(/(&lt;div&gt;)( *)(.*?)( *)(&lt;\/div&gt;)/, '$2$1$3$5$4');
  }

  // keep the changed text selected, needed to remove the formatting with a second click
  obj.changed.keepSel = true;

  return;
}// </nowiki></pre>

/*
===== [[User:Will Pittenger/SumCO]] insertion =====
<pre style="overflow:auto"><nowiki>*/
wikEdButton[101] = ['wikEdSumCoInsertion', 'wikEdButton', 'Inserts SumCO', 'http://upload.wikimedia.org/wikipedia/commons/a/a3/WikEd_button_WLP_SumCO.PNG', '16', '16', 'SumCO', 'javascript:WikEdEditButton(this, this.id, null, InsertSumCoBtnHandler);' ];

// define the function which is called upon clicking the custom button
function InsertSumCoBtnHandler(obj) {

// select the appropriate text change target (whole, selection, cursor, focusWord, focusLine, selectionWord, or selectionLine)
  WikEdGetText(obj, 'selection, cursor');
  if (obj.selection.plain != '') {
    return;
  }

// make the changes to the plain target text
   obj.changed.plain = '{{subst:User:Will Pittenger/SumCO}}';

  // keep the changed text selected, needed to remove the formatting with a second click
  obj.changed.keepSel = true;

  return;
}// </nowiki></pre>

/*
===== &lt;code> tags =====
<pre style="overflow:auto"><nowiki>*/
wikEdButton[102] = ['wikEdCode', 'wikEdButton', 'Make the selection a html CODE element', 'http://upload.wikimedia.org/wikipedia/commons/b/be/Wiked_button_CodeTag.PNG', '16', '16', 'CODE', 'javascript:WikEdEditButton(this, this.id, null, CreateCodeTagBtnHandler);' ];

// define the function which is called upon clicking the custom button
function CreateCodeTagBtnHandler(obj) {

// select the appropriate text change target (whole, selection, cursor, focusWord, focusLine, selectionWord, or selectionLine)
  WikEdGetText(obj, 'selection, cursor');
  if (obj.selection.plain != '') {
    obj.changed = obj.selection;
  }
  else {
    obj.changed = obj.cursor;
  }

// make the changes to the plain target text
  if ( /&lt;code&gt;(.*?)&lt;\/code&gt;/i.test(obj.changed.plain) ) {
    obj.changed.plain = obj.changed.plain.replace(/&lt;code&gt;(.*?)&lt;\/code&gt;/gi, '$1');
  }
  else {
    obj.changed.plain = '&lt;code&gt;' + obj.changed.plain + '&lt;/code&gt;';
    obj.changed.plain = obj.changed.plain.replace(/(&lt;code&gt;)( *)(.*?)( *)(&lt;\/code&gt;)/, '$2$1$3$5$4');
  }

  // keep the changed text selected, needed to remove the formatting with a second click
  obj.changed.keepSel = true;

return;
}// </nowiki></pre>

/*
===== [[User:Will Pittenger/PlusTab]] insertion =====
<pre style="overflow:auto"><nowiki>*/
wikEdButton[103] = ['wikEdPlusTabInsertion', 'wikEdButton', 'Inserts PlusTab', 'http://upload.wikimedia.org/wikipedia/commons/3/30/WikEd_button_WLP_PlusTab.PNG', '16', '16', 'PlusTab', 'javascript:WikEdEditButton(this, this.id, null, InsertPlusTabBtnHandler);' ];

// define the function which is called upon clicking the custom button
function InsertPlusTabBtnHandler(obj) {

// select the appropriate text change target (whole, selection, cursor, focusWord, focusLine, selectionWord, or selectionLine)
  WikEdGetText(obj, 'selection, cursor');
  if (obj.selection.plain != '') {
    return;
  }

// make the changes to the plain target text
   obj.changed.plain = '{{subst:User:Will Pittenger/PlusTab}}';


// keep the changed text selected, needed to remove the formatting with a second click
obj.changed.keepSel = true;

  return;
}// </nowiki></pre>

/*
===== [[User:Will Pittenger/FairUse]] insertion =====
<pre style="overflow:auto"><nowiki>*/
wikEdButton[104] = ['wikEdSumCoInsertion', 'wikEdButton', 'Inserts FairUse', 'http://upload.wikimedia.org/wikipedia/commons/7/7d/WikEd_Button_FairUse.PNG', '16', '16', 'FairUse', 'javascript:WikEdEditButton(this, this.id, null, InsertFairUseBtnHandler);' ];

// define the function which is called upon clicking the custom button
function InsertFairUseBtnHandler(obj) {

// select the appropriate text change target (whole, selection, cursor, focusWord, focusLine, selectionWord, or selectionLine)
  WikEdGetText(obj, 'selection, cursor');
  if (obj.selection.plain != '') {
    return;
  }

// make the changes to the plain target text
   obj.changed.plain = '{{subst:User:Will Pittenger/FairUse|Put the list here}}';

  // keep the changed text selected, needed to remove the formatting with a second click
  obj.changed.keepSel = true;

  return;
}// </nowiki></pre>

/*

===== &lt;pre> tags =====
<pre style="overflow:auto"><nowiki>*/
wikEdButton[105] = ['wikEdCode', 'wikEdButton', 'Make the selection a html PRE element', 'http://upload.wikimedia.org/wikipedia/commons/f/ff/WikEd_Button_PreTag.PNG', '16', '16', 'PRE', 'javascript:WikEdEditButton(this, this.id, null, CreatePreTagBtnHandler);' ];

// define the function which is called upon clicking the custom button
function CreatePreTagBtnHandler(obj) {

// select the appropriate text change target (whole, selection, cursor, focusWord, focusLine, selectionWord, or selectionLine)
  WikEdGetText(obj, 'selection, cursor');
  if (obj.selection.plain != '') {
    obj.changed = obj.selection;
  }
  else {
    obj.changed = obj.cursor;
  }

// make the changes to the plain target text
  if ( /&lt;pre&gt;(.*?)&lt;\/pre&gt;/i.test(obj.changed.plain) ) {
    obj.changed.plain = obj.changed.plain.replace(/&lt;pre&gt;(.*?)&lt;\/pre&gt;/gi, '$1');
  }
  else {
    obj.changed.plain = '&lt;pre&gt;' + obj.changed.plain + '&lt;/pre&gt;';
    obj.changed.plain = obj.changed.plain.replace(/(&lt;pre&gt;)( *)(.*?)( *)(&lt;\/pre&gt;)/, '$2$1$3$5$4');
  }

  // keep the changed text selected, needed to remove the formatting with a second click
  obj.changed.keepSel = true;

return;
}// </nowiki></pre>

/*

===== [[User:Will Pittenger/WhereIHaveBeen]] insertion =====
<pre style="overflow:auto"><nowiki>*/
wikEdButton[106] = ['wikEdPlusTabInsertion', 'wikEdButton', 'Inserts WhereIHaveBeenTools', 'http://upload.wikimedia.org/wikipedia/commons/2/29/WikEd_Button_WhereIHaveBeenTools.PNG', '16', '16', 'WhereIHaveBeenTools', 'javascript:WikEdEditButton(this, this.id, null, InsertWhereIHaveBeenToolsBtnHandler);' ];

// define the function which is called upon clicking the custom button
function InsertWhereIHaveBeenToolsBtnHandler(obj) {

// select the appropriate text change target (whole, selection, cursor, focusWord, focusLine, selectionWord, or selectionLine)
  WikEdGetText(obj, 'selection, cursor');
  if (obj.selection.plain != '') {
    return;
  }

// make the changes to the plain target text
   obj.changed.plain = '{{subst:User:Will Pittenger/WhereIHaveBeen}}';


// keep the changed text selected, needed to remove the formatting with a second click
obj.changed.keepSel = true;

  return;
}// </nowiki></pre>

/*

==== Actually display the custom buttons ====
<pre><nowiki>*/
// define custom button bars (id, class, button numbers)
var wikEdButtonBar = [];
wikEdButtonBar['custom1'] = ['wikEdButtonBarCustom1',  'wikEdButtonBarCustom1', 'wikEdButtonsCustom1', 'wikEdButtonsCustom1', 44, 'My custom buttons', [100, 102, 104, 106, 'br', 101, 103, 105] ];// </nowiki></pre>

/*

=== wikEd core ===
[[User:Cacycle/wikEd]]
<pre style="overflow:auto"><nowiki>*/
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');//</nowiki></pre>

/*

== Takes the wikipage "page" and includes its raw text as javascript. ==
<pre style="overflow:auto"><nowiki>*/
function import_module(page)
{
  if(document.createElement && document.childNodes)
  {
    var url = 'http://en.wikipedia.org/w/index.php?title=' + page.replace(/ /g, "_") +
      '&action=raw&ctype=text/javascript&dontcountme=s';

    var scriptElem = document.createElement('script');

    scriptElem.setAttribute('src',url);
    scriptElem.setAttribute('type','text/javascript');
    document.getElementsByTagName('head')[0].appendChild(scriptElem);
  }
}
// </nowiki></pre>  end of Import Module code

/*
== [[Wikipedia:WikiProject User scripts/Scripts/Add purge to tabs]] ==
<pre style="overflow:auto"><nowiki>*/
import_module("Wikipedia:WikiProject User scripts/Scripts/addLink");
import_module("Wikipedia:WikiProject User scripts/Scripts/Add purge to tabs");
// </nowiki></pre>

/*
== [[Wikipedia:WikiProject User scripts/Scripts/Watchlist since]] ==
<pre style="overflow:auto"><nowiki>*/
import_module('Wikipedia:WikiProject User scripts/Scripts/Watchlist since');
// </nowiki></pre>

/*
== add user tabs [[Wikipedia:WikiProject User scripts/Scripts/User tabs]] ==
<pre style="overflow:auto"><nowiki>*/
import_module('Wikipedia:WikiProject User scripts/Scripts/Add LI link');
import_module('Wikipedia:WikiProject User scripts/Scripts/Add tab');

/*
== [[Wikipedia:WikiProject User scripts/Scripts/Quick wikify]] ==
<pre style="overflow:auto"><nowiki>*/
import_module('Wikipedia:WikiProject User scripts/Scripts/Quick wikify');
// </nowiki></pre>

/*
===[[user:Where/usertabs]] Actual code ===
<pre><nowiki>*/
 addOnloadHook(function() {
   if (document.title.search("/") != -1 || document.title.search("- History -") != -1) { //no subpages or history
      return;
   }
   if (document.title.indexOf("User:") == 0 || document.title.indexOf("User talk:") == 0) {
      username_a = document.URL.match(/:.*:(.*)/);
      username=username_a[1];
      addTab("http://en.wikipedia.org/wiki/Special:Contributions/" + username, "contrib", "ca-contrib", "contribs", "");
      addTab("http://en.wikipedia.org/w/index.php?title=Special%3ALog&type=move&user=" + username, "page moves", "ca-pagemoves", "page moves", "");
      addTab("http://en.wikipedia.org/w/index.php?title=Special%3ALog&type=block&user=" + username, "block log", "ca-blog", "blog", "");
      addTab("http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?dbname=enwiki_p&user=" + username, "edit count", "ca-kate", "kate", "");
   }
 }); // </nowiki></pre>

/*
==[[Wikipedia:WikiProject User scripts/Scripts/test-enhanced]] ==
<pre style="overflow:auto"><nowiki>*/
import_module("Wikipedia:WikiProject User scripts/Scripts/test-enhanced");// </nowiki></pre>

/*
==[[Wikipedia:WikiProject User scripts/Scripts/Talk page section tabs]]==
<pre style="overflow:auto"><nowiki>*/
//import_module("Wikipedia:WikiProject User scripts/Scripts/Talk page section tabs");// </nowiki></pre>

/*

==[[Wikipedia:WikiProject User scripts/Scripts/CleanupTab.js]] ==
<pre style="overflow:auto"><nowiki>*/
import_module("Wikipedia:WikiProject User scripts/Scripts/CleanupTab.js");// </nowiki></pre>

/*
== [[Wikipedia:WikiProject User scripts/Scripts/Unwatch]]==
<pre style="overflow:auto"><nowiki>*/
addOnloadHook(function () {
    //var query_prefix = "title=Special:Watchlist&action=submit&remove=1&id[]=";
    var query_prefix = "action=unwatch&title=";

    if (window.location.href.indexOf("Special:Watchlist") < 0) return;
    if (window.location.href.indexOf("Special:Watchlist/edit") >= 0) return;

    var links = document.getElementById('content').getElementsByTagName('a');
    for (var i = 0; i < links.length; i++) {
        if (links[i].href.substring(links[i].href.length-15) != '&action=history')
            continue;
        var unwatch = document.createElement('a');
        unwatch.href = "/w/index.php?" + query_prefix + encodeURIComponent(links[i].title);
        unwatch.title = "Unwatch "+links[i].title;
        unwatch.appendChild(document.createTextNode("unwatch"));
        links[i].parentNode.insertBefore(unwatch, links[i].nextSibling);
        // kluge to handle case where "diff" is unlinked:
        var delim = links[i].previousSibling;
        delim = (delim.nodeType == 3 ? delim.nodeValue : "");
        links[i].parentNode.insertBefore(document.createTextNode(delim.replace(/^.*diff/, "")), unwatch);
    }
});// </nowiki></pre> end of [[Wikipedia:WikiProject User scripts/Scripts/Unwatch]]

/*
==sigContract code from [[User:Where/sigcontract.js]]==
<pre style="overflow:auto"><nowiki>*/
////Conflicts with force edit summary script!

//var scIndex = 0;
//var scKeys = new Array();
//var scValues = new Array();

//function scFormSubmit() {
//   var i=0
//   var textArea = document.getElementById("wpTextbox1");
//   var text = textArea.value;
//   while (i<scIndex) {
//      text = text.replace(scKeys[i], scValues[i]);
//      ++i;
//   }
//   textArea.value = text;
//}

//addOnloadHook(function() {
//   if (document.title.indexOf("Editing ") != 0) {return;}
//   document.getElementById("wpSave").onclick = scFormSubmit;
//   document.getElementById("wpPreview").onclick = scFormSubmit;
//   document.getElementById("wpDiff").onclick = scFormSubmit;
//   //TODO: make it work with previews too!
//});

//addOnloadHook(function() {
//   if (document.title.indexOf("Editing ") != 0) {return;}
//   var textArea = document.getElementById("wpTextbox1");
//   var text = textArea.value;
//   var re = /<!--\[\[User:Where\/sigContract\]\];(.*)-->.*<!--ESC:(.*)-->/g;
//   var lastIndex = 0;
///*   while (1) {
//      var textSubstr = text.substr(lastIndex);
//      alert(lastIndex);
//      alert(textSubstr); //TODO: remove
//      var newIndex = textSubstr.search(re);
//      alert("newindex:" + newIndex);
//      if (newIndex == -1) {
//     break;
//      }
//      lastIndex += newIndex+1;*/
//      text = text.replace(re,
//     function(str, p1, p2, offset, s) {
////        alert("In replacement function");
//        if (p1 == p2) {
//           var newString = "-[[User:" + p1 + "|" + p1 + "]]";
//           scKeys[scIndex] = newString;
//           scValues[scIndex] = str;
//           ++scIndex;
//           return newString;
//        }
//        else {
//           return str;
//        }
//     });
//   //}
//   textArea.value = text;
//});// </nowiki></pre> End of sigContract code

/*

==Localized time/date script by [[User:Where/commentLocalize]] ==
<pre style="overflow:auto"><nowiki>*/
function numToMonth(num) {
   if (num==0) {return "Janurary";}
   else if (num==1) {return "February";}
   else if (num==2) {return "March";}
   else if (num==3) {return "April";}
   else if (num==4) {return "May";}
   else if (num==5) {return "June";}
   else if (num==6) {return "July";}
   else if (num==7) {return "August";}
   else if (num==8) {return "September";}
   else if (num==9) {return "October";}
   else if (num==10) {return "November";}
   else if (num==11) {return "December";}
}

function monthToNum(month) {
   var tmp = new Date(month + " 1, 2006");
   return tmp.getMonth();
}

function adjustTime(str, hour, minute, day, month, year,  offset, s) {
   var time = new Date();
   time.setUTCHours(hour);
   time.setUTCMinutes(minute);
   time.setUTCDate(day);
   time.setUTCMonth(monthToNum(month));
   time.setUTCFullYear(year);

   var timeStr = "";
   if (time.getHours()<10) {timeStr += "0";}
   timeStr += parseInt(time.getHours()) + ":";
   if (time.getMinutes()<10) {timeStr += "0";}
   timeStr += parseInt(time.getMinutes());
   timeStr += ", ";
   timeStr += time.getDate();
   timeStr += " ";
   timeStr += numToMonth(time.getMonth());
   timeStr += " ";
   timeStr += time.getFullYear();
   timeStr += " (UTC";
   var offset = -1*time.getTimezoneOffset()/60;
   if (offset >= 0) {timeStr += "+";}
   timeStr += offset + ")";
   return timeStr;
}

function adjustTime2(str, hour, minute, month, day, year,  offset, s) {
   return adjustTime(str, hour, minute, day, month, year, offset, s);
}

addOnloadHook(function() {
      if (document.title.indexOf("Editing ") == 0) {
       return;
      }
      if (document.location.href.indexOf("action=history") != -1) {
       return;
      }
   if (document.title.indexOf("Talk:") == 0 || document.title.indexOf("talk:") != -1 || document.title.indexOf("Wikipedia:") == 0) {
      var newDoc = document.getElementById("column-content").innerHTML.replace(/(\d\d):(\d\d), (\d{1,2}) ([A-Z][a-z]+) (\d{4}) \(UTC\)/g, adjustTime);
      document.getElementById("column-content").innerHTML = newDoc;
   }
/*   if (document.location.href.indexOf("&action=history") != -1) {
      var newDoc = document.getElementById("bodyContent").innerHTML.replace(/(\d\d):(\d\d), ([A-Z][a-z]+) (\d{1,2}), (\d{4})/g, adjustTime2);
      document.getElementById("bodyContent").innerHTML = newDoc;
   }*/
}); // </nowiki></pre> End of commentLocalize code

/*
== [[User:GeorgeMoney|George Money's]] [[User:GeorgeMoney/UserScripts|scripts]] ==
/*
===Helpers===
*/
//////
// [[User:GeorgeMoney/UserScripts/helpers/all|Helpers]] for George Money's scripts
//*****************

/*
==== [[User:GeorgeMoney/UserScripts/helpers/all#Vars|Var]] ====
<pre style="overflow:auto"><nowiki>*/
var myname=mw.config.get('wgUserName').replace(' ', '_'); //use underscores instead of spaces
var mypage="User:"+myname;
var mytalk="User_talk:"+myname;
var mycontribs="Special:Contributions/"+myname;
var serverurl="http://en.wikipedia.org";
var wikiurl=serverurl+"/wiki/";
var pathurl=serverurl+"/w/";
var phpurl=pathurl+"index.php?title=";
var editcounturl="http://tools.wikimedia.de/~essjay/edit_count/Count.php";
var editcount=editcounturl+"?username="; // </nowiki></pre> end of vars code

/*
==== [[User:GeorgeMoney/UserScripts/helpers/all#Cookies|Cookies]] ====
<pre style="overflow:auto"><nowiki>*/
//COOKIE FUNCTIONS
function readCookie(name)
{
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');

  for(var i=0; i < ca.length; i++)
  {
    var c = ca[i];

    while(c.charAt(0) == ' ')
      c = c.substring(1, c.length);

    if(c.indexOf(nameEQ) == 0)
      return c.substring(nameEQ.length, c.length);
  }
  return null;
}

function createCookie(name, value, days)
{
  if(days)
  {
    var date = new Date();
    date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);

    var expires = "; expires=" + date.toGMTString();
  }
  else
    var expires = "";

  document.cookie = name+"="+value+expires+"; path=/";
}

function eraseCookie(name)
{
  createCookie(name, "", -1);
} // </nowiki></pre> end of Cookies code

/*
==== [[User:GeorgeMoney/UserScripts/helpers/all#Links|Links]] ====
<pre style="overflow:auto"><nowiki>*/
//    --- ADD VARIOUS LINKS ----
function addToolboxLink(url, name, id)
{
  var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
  addlilink(tb, url, name, id);
}

function addTopLink(url, name, id)
{
  var personal = document.getElementById('p-personal').getElementsByTagName('ul')[0];
  addlilink(personal, url, name, id);
}

function addNavLink(url, name, id)
{
  var navigation = document.getElementById('p-navigation').getElementsByTagName('ul')[0];
  addlilink(navigation, url, name, id);
}

function addTab(url, name, id, title, key)
{
  var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
  return addlilink(tabs, url, name, id, title, key);
}

//      ------ MORE MAJOR LINKAGE -----
function addLink(where, url, name, id, title, key, after)
{
  //* where is the id of the toolbar where the button should be added;
  //   i.e. one of "p-cactions", "p-personal", "p-navigation", or "p-tb".
  //
  //* url is the URL which will be called when the button is clicked.
  //   javascript: urls can be used to do more complex things.
  //
  //* name is what will appear as the name of the button.
  //
  //* id is the id of the button; it's best to define one.
  //   Use a prefix to make sure its unique. Optional.
  //
  //* title is the tooltip title that gives a longer description
  //   of the button; if you define a accesskey, mention it here. Optional.
  //
  //* key is the char you want for the accesskey. Optional.
  //
  //* after is the id of the button you want to follow this one. Optional.
  //

  var na = document.createElement('a');
  na.href = url;
  na.appendChild(document.createTextNode(name));

  var li = document.createElement('li');
  if(id)
    li.id = id;

  li.appendChild(na);

  var tabs = document.getElementById(where).getElementsByTagName('ul')[0];
  if(after)
  {
    tabs.insertBefore(li,document.getElementById(after));
  }
  else
  {
    tabs.appendChild(li);
  }

  if(id)
  {
    if(key && title)
    {
      ta[id] = [key, title];
    }
    else if(key)
    {
      ta[id] = [key, ''];
    }
    else if(title)
    {
      ta[id] = ['', title];
    }
  }

  // re-render the title and accesskeys from existing code in wikibits.js
  akeytt();
  return li;
}

//
// ------------- LINKAGE ----------------

function addlilink(tabs, url, name, id, title, key)
{
  var na = document.createElement('a');

  na.href = url;
  na.appendChild(document.createTextNode(name));

  var li = document.createElement('li');
  if(id)
    li.id = id;

  li.appendChild(na);
  tabs.appendChild(li);
  if(id)
  {
    if(key && title)
    {
      ta[id] = [key, title];
    }
    else if(key)
    {
      ta[id] = [key, ''];
    }
    else if(title)
    {
      ta[id] = ['', title];
    }
  }

  // re-render the title and accesskeys from existing code in wikibits.js
  akeytt();
  return li;
} // </nowiki></pre> End of links

/*
==== [[User:GeorgeMoney/UserScripts/helpers/all#Include|Include]] ====
<pre style="overflow:auto"><nowiki>*/
function loadJS(s)
{
  s = s.replace(/^\[\[/, '').replace(/\]\]$/, '').replace(" ", "_");
  document.write('<script type="text/javascript" src="'
    + 'http://en.wikipedia.org/w/index.php?title=' + s
    + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
}

function loadJSext(s)
{
  document.write('<script type="text/javascript" src="'+ s + '"></script>');
}

function loadCSS(page)
{
  page=page.replace(" ", "_");
  document.write('<style type="text/css">@import "'+phpurl+page+'&action=raw&ctype=text/css";</style>');
}

function loadCSSext(page)
{
  document.write('<style type="text/css">@import "'+page+'";</style>');
}  // </nowiki></pre> End of Include
//******************
// End of Helpers for George Money's scripts
//////

/*
=== [[User:GeorgeMoney/UserScripts/newmessages]] ===
<pre style="overflow:auto"><nowiki>*/
loadJS("User:GeorgeMoney/UserScripts/newmessages"); // </nowiki></pre>

/*
=== [[User:GeorgeMoney/UserScripts/archive|George Money's Archive Manager]] ===
<pre><nowiki>*/
/AUTO ARCHIVE
//Written by GeorgeMoney

//The header to put on top of all archives (if the archive is in 'w' mode (modes explained below))
var archiveheader = '';

//Your talk page header for to use when archiving. Remember to keep the <noinclude> tags or else your archive will have your talk page header along with it.
var talkheader = '<noinclude>{{User:Will Pittenger/Archive Indexer}}</noinclude>';

//Your talk page archive page. Insert "NUMBER" where the number of archive you are on goes. (Dont put a real number!! just put the text "NUMBER")
var archiveurl = "User_talk:Will Pittenger/Archive NUMBER";

//The mode to archive your talk page. Making this value 'a' will make the script add your archive to the bottom of the current archive. 

//Making it 'w' will totally erase the contents of the current archive (usually you should set the current archive value to a new archive to avoid erasing old archives, 
//where as in append mode (a), you should set it to your current archive to append the contents)
var archivemode = 'w';

//do not edit below this line
var mtyalk = ("User talk:"+mw.config.get('wgUserName')).replace(/ /g, '_');
var wikiurl = mw.config.get('wgServer')+mw.config.get('wgArticlePath').replace('$1', '');
if(readCookie('archive1') == 'yes' && window.location.href.indexOf('archivestep') == -1) { (window.location.href) = document.getElementById('ca-edit').firstChild.href+'&archivestep=2'; }
function changearccontents() {
document.title = "Archival Script Manager";
document.getElementById('bodyContent').innerHTML = 
'<div class="dontshow" style="display: none !important;"></div>\n' +
'<h1 class="firstHeading" style="display:block;">Archive Script Manager</h1>\n' +
'Current archive number (the one that you haven\'t done yet (like if I want to archive to archive 2 then that is the next one not done)): <br> <input type="text" id="archnuminput" value="' + readCookie('archivenum') + '"  size="1" maxlength="4" /> <input type="button" value="save number" onclick="createCookie(\'archivenum\', document.getElementById(\'archnuminput\').value); document.getElementById(\'arclink\').href = wikiurl+archiveurl.replace(\'NUMBER\',readCookie(\'archivenum\'))+\'?action=edit&archivestep=1\';" /><br><br>\n'+
'<a href="'+wikiurl+archiveurl.replace('NUMBER',readCookie('archivenum'))+'?action=edit&archivestep=1" id="arclink" style="font-size: 2em; font-weight: bold;">Click here to begin the archive</a><br>\n' +
'';
document.write('<style type="text/css">.firstHeading, .editsection {display:none;} .dontshow { display: none !important; } #content {background: honeydew !important; border: 3px solid green;} #p-cactions {display: none;}</style>');
}

if(window.location.href.indexOf('archivemanage') != -1||window.location.href.indexOf('Archivemanage') != -1) {
addOnloadHook(function(){ changearccontents(); });
}
if (window.location.href.indexOf('archivestep=1') != -1 && window.location.href.indexOf('action=edit') != -1) {
addOnloadHook(function (){
  if(!readCookie('archivenum') != 'yes') { (window.location.href) = wikiurl+'User:GeorgeMoney/archivemanage' }
  if(archivemode == 'a') {
  document.getElementById('wpTextbox1').value += "\n{{sub"+"st:"+mytalk+"}}";
  } else {
  document.getElementById('wpTextbox1').value = archiveheader+"\n{{sub"+"st:"+mytalk+"}}";
  }
  document.getElementById('wpSummary').value = "JS: Copying talkpage to archive";
  createCookie('archive1', 'yes');
  document.getElementById('editform').submit();
});
}
if (window.location.href.indexOf('archivestep=2') != -1 && window.location.href.indexOf('action=edit') != -1) {
addOnloadHook(function (){
  if(readCookie('archive1') != 'yes') { alert("You shouldn't be at \"&archivestep=2\" because you haven't completed &archivestep=1. Please read the instructions on this archiving script. Redirecting to archive manager. "); (window.location.href) = wikiurl+'User:GeorgeMoney/archivemanage'; return; }
  createCookie('archive1', 'no');
  document.getElementById('wpTextbox1').value = talkheader;
  document.getElementById('wpSummary').value = "JS: Archiving talk page";
  document.getElementById('editform').submit();
});
}
//-------
//
// </nowiki></pre> end of archive code by [[User:GeorgeMoney/UserScripts/archive]]

/*
==== Code to add Archive to the sidebar toolbox ====
<pre><nowiki>*/
if(mw.config.get('wgPageName') == 'User_talk:Will_Pittenger')
{
  addOnloadHook(
    function()
    {
      var nav = document.getElementById('p-navigation').getElementsByTagName('ul')[0];
      addlilink(nav, "http://en.wikipedia.org/wiki/Archivemanage", "archive", 'p-archive');
    });
}
//</nowiki></pre>

/*

=== [[User:GeorgeMoney/UserScripts/autowelcome]] ===
==== Options ====
<pre><nowiki>*/
if(welcome == undefined)
{
  var welcome={};
  welcome.edit={};
  welcome.link={};
  welcome.link.tab={};
  welcome.link.newUserLog={};
  welcome.link.redLinkTalk={};
  welcome.options={};

  //config
  welcome.edit.summary = "Welcome to Wikipedia!";
  welcome.edit.text = "{{sub" + "st:User:Will Pittenger/templates/Welcome}}";
  welcome.edit.textAnon = "{{sub" + "st:User:Will Pittenger/templates/Welcome IP}}";
  welcome.edit.button = 'wpSave';

  welcome.link.newUserLog.defaultColor = "blue";
  welcome.link.newUserLog.clickedColor = "green";
  welcome.link.newUserLog.text = "[welcome]";

  welcome.link.redLinkTalk.defaultColor = "blue";
  welcome.link.redLinkTalk.clickedColor = "green";
  welcome.link.redLinkTalk.text = "[welcome]";
  welcome.link.redLinkTalk.blink = false;

  welcome.link.tab.text = "Welcome!";
  welcome.link.tab.accessKey = '';

  welcome.options.newUserLogaddReloadButton = true;
  welcome.options.newUserLogEnabled = true;
  welcome.options.redLinkTalkEnabled = true;
  welcome.options.addTab = true;
  welcome.options.askIfPageIsNotBlank = true;
  welcome.options.maxLinks = 6000;
  welcome.options.warnIfOverMaxLinks = true;

  //end config
}//</nowiki></pre>

/*

==== Actual Import of AutoWelcome code ====
<pre><nowiki>*/
import_module("User:GeorgeMoney/UserScripts/autowelcome"); //</nowiki></pre>

/*

==[[user:Where/easy db]] ==
<pre><nowiki>*/
addOnloadHook(function()
{
//check if called from deletion request
if (document.title.indexOf("Editing ") != -1)
{
if (document.URL.lastIndexOf("&fakeaction=huff") == -1)
return;
if (document.URL.lastIndexOf("&reason=off") != -1)
{
var type = prompt("Enter criteria for speedy deletion, e.g. A1, G3");
var f = document.editform, t = f.wpTextbox1;
t.value = "{{db-" + type.toLowerCase() + "}}\n" + t.value;
f.wpSummary.value = "JS: Requesting speedy deletion ([[WP:CSD#" + type + "|CSD " + type + "]])";
f.wpSave.click();
return;
}
else if (document.URL.lastIndexOf("&reason=on") != -1)
{
var type = prompt("Enter reason for speedy deletion");
var f = document.editform, t = f.wpTextbox1;
t.value = "{{db|" + type + "}}\n" + t.value;
f.wpSummary.value = "JS: Requesting speedy deletion";
f.wpSave.click();
return;
}
}
if (window.location.href.indexOf("Special:") != -1)
return;

addTab("javascript:easyDb(0)", "db (csd)", "ca-db0", "Request speedy deletion according to WP:CSD", "");
addTab("javascript:easyDb(1)", "db (reason)", "ca-db0", "Request speedy deletion with reason", "");
});

function easyDb(n)
{
if (n == 0)
{
//edit page
var title = document.title.substr(0, document.title.lastIndexOf(' - Wikipedia, the free'));
location.assign("/w/index.php?title=" + title + "&action=edit&fakeaction=huff&reason=off");
}  

if (n == 1)
{
//edit page
var title = document.title.substr(0, document.title.lastIndexOf(' - Wikipedia, the free'));
location.assign("/w/index.php?title=" + title + "&action=edit&fakeaction=huff&reason=on");
}
}
//</nowiki></pre>

///////////////////////////////
// Must be after all other tabs
/*
== [[Wikipedia:WikiProject User scripts/Scripts/Duplicate tabs at bottom]] ==
<pre style="overflow:auto"><nowiki>*/
addOnloadHook(function () {
    var tabs = document.getElementById('p-cactions').cloneNode(true);
    tabs.id = 'mytabs';
    var listitems = tabs.getElementsByTagName('LI');
    for (i=0;i<listitems.length;i++) {
        if(listitems[i].id) listitems[i].id = 'mytabs-' + listitems[i].id;
    }

    content = document.getElementById("content");    // Find the content div
    content.parentNode.insertBefore(tabs, content.nextSibling);    // Place tab list right after content div
});// </nowiki></pre> end of [[Wikipedia:WikiProject User scripts/Scripts/Duplicate tabs at bottom]] code

/*
== See also ==
*[[User:Will Pittenger/monobook.css]]
*[[Wikipedia:WikiProject User scripts/Scripts]] -- List of available scripts*/