Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
function AddPurgeTab()
{
   if (mw.config.wgCanonicalNamespace != "Special")
   {
      mw.util.addPortletLink("p-cactions", "/w/index.php?title=" + mw.config.wgPageName + "&action=purge", "Purge", '', "purge the cache");
   }
}

function ResetCatALotPosition()
{
   if (mw.config.values.wgCanonicalNamespace == "Category")
   {
      mw.util.addPortletLink("p-cactions", "#", "Reset Cat-a-Lot", "p-resetCatALot", "Reset the position of Cat-a-Lot");
      $("#p-resetCatALot").on("click", function() { $("#cat_a_lot").css({top: 200, left: 200, position:'absolute'}); });
      console.log("ResetCatALotPosition detects we're in a category, so setting the link");
   }
   else { console.log("ResetCatALotPosition detects we're not in a category"); }
}

function FixBadSearches()
{
   var elems = document.getElementsByClassName("noarticletext");
   var url = String(document.location) + '';
 
   if (
      elems != null && elems.length > 0
      && (url.indexOf('+') > 0 || url.indexOf('%2B') > 0)
      && url.indexOf("autoredirect=true") < 0
      && url.indexOf("monobook.js") < 0
   )
   {
      document.location.replace(url.replace(/\+|(%2B)/gi, '_') + "?autoredirect=true");
   }
}

function AddEnTab()
{
   if (mw.config.wgCanonicalNamespace != "Special")
   {
      mw.util.addPortletLink("p-cactions", "http://en.wikipedia.org/wiki/" + mw.config.wgPageName, "en.wiki", '', "This image on the English wikipedia");
   }
}

function AddLanguageTooltips()
{
   /* $('span[lang]').tipsy({title: function() { return "Language: " + jsL10N.iso639(this.getAttribute('lang'), 'en'); } }); */
   /* $('span[lang]').each( function() { $(this).tooltip( { content: "Language: " + $(this).attr('lang') } ) } ); */
   /* $('span[lang]').setAttr('title', "Language: " + $(this).attr('lang')); */

   $('span[lang]').each( function(index, element) {
      var span = $(this);
      span.attr('title', "Language: " + span.attr('lang') );
      console.log("Added a language tooltip " + index + " for [" + span.text() + "] in language " + span.attr("lang"));
   });
   console.log("AddLanguageTooltips loaded.");
}

function RemoveTitleTagFromEditSummary()
{
   $("#wpSummary").removeAttr("title");
   console.log("RemoveTitleTagFromEditSummary loaded.");
}

$(AddPurgeTab);
$(FixBadSearches);
$(AddEnTab);
$(RemoveTitleTagFromEditSummary);
$(AddLanguageTooltips);
$(ResetCatALotPosition);
importScript('User:Rd232/myuploads.js');
//syntax highlighter
mw.loader.load('//www.mediawiki.org/w/index.php?title=MediaWiki:Gadget-DotsSyntaxHighlighter.js&action=raw&ctype=text/javascript');