Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
function AddCommonsTab()
{
   if (document.getElementsByClassName("sharedUploadNotice") != null)
   {
      mw.util.addPortletLink("p-cactions", "//commons.wikimedia.org/wiki/" + mw.config.get('wgPageName'), "Commons", '', "this image on the Commons");
   }
}
function externISBN() {
   for (var i = 0; i < document.links.length; i++)
   {
      if (mw.config.get('wgPageName') != "Special:BookSources"
         && !(mw.config.get('wgTitle') == "Book sources" && mw.config.get( 'wgCanonicalNamespace')  == "Project"))
      {
         if (document.links[i].href.match(/Special:BookSources\/(.{10,13})$/i))
         {
           document.links[i].href = "http://www.amazon.co.uk/o/ASIN/" + RegExp.$1 + "/bookaid";
         }
      }
   }
}
 
function fixBadSearches()
{
   if (navigator.userAgent.indexOf("MSIE") > 0) return;
 
   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("common.js") < 0
   )
   {
      document.location.replace(url.replace(/\+|(%2B)/gi, '_') + "?autoredirect=true");
   }
 
   if (
      elems != null && elems.length > 0
      && url.indexOf('Tempalte') >= 0
      && url.indexOf("autoredirect=true") < 0
   )
   {
      document.location.replace(url.replace(/Tempalte/g, 'Template') + "?autoredirect=true");
   }
}
 
function AddLanguageTooltips()
{
   /* $('span[lang]').tipsy({title: function() { return "Language: " + jsL10N.iso639(this.getAttribute('lang'), 'en'); } }); */
   $('span[lang]').tipsy({title: function() { return "Language: " + this.getAttribute('lang'); } });
   $('span[lang] a').removeAttr('title');
}
 
function AddCustomScriptAndStyleLinks()
{
   var jsLi = document.createElement("li");
   jsLi.setAttribute("id", "pt-userscripts");
   var jsLink = document.createElement("a");
   jsLink.setAttribute("href", "/wiki/User:OwenBlacker/common.js");
   jsLink.appendChild(document.createTextNode("js"));
   jsLi.appendChild(jsLink);
   //console.log(jsLi.outerHTML);
 
   var cssLi = document.createElement("li");
   cssLi.setAttribute("id", "pt-userstyles");
   var cssLink = document.createElement("a");
   cssLink.setAttribute("href", "/wiki/User:OwenBlacker/common.css");
   cssLink.appendChild(document.createTextNode("css"));
   cssLi.appendChild(cssLink);
   //console.log(cssLi.outerHTML);
 
   $("#pt-userpage").after(cssLi);
   $("#pt-userpage").after(jsLi);
}
 
function RemoveTitleTagFromEditSummary()
{
  $("#wpSummary").removeAttr("title");
}
 
$(externISBN);
$(fixBadSearches);
$(AddCommonsTab);
$(AddLanguageTooltips);
$(AddCustomScriptAndStyleLinks);
$(RemoveTitleTagFromEditSummary);