Toscead betweox fadungum "Brūcend:OwenBlacker/common.js"

Content deleted Content added
Copied from en.wp
(Nænig toscead)

Edniwung fram 10:45, 14 Winterfylleð 2013

function AddCommonsTab()
{
   if (document.getElementsByClassName("sharedUploadNotice") != null)
   {
      addPortletLink("p-cactions", "//commons.wikimedia.org/wiki/" + wgPageName, "Commons", '', "this image on the Commons");
   }
}
function externISBN() {
   for (var i = 0; i < document.links.length; i++)
   {
      if (wgPageName != "Special:BookSources"
         && !(wgTitle == "Book sources" && 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");
}
 
addOnloadHook(externISBN);
addOnloadHook(fixBadSearches);
addOnloadHook(AddCommonsTab);
addOnloadHook(AddLanguageTooltips);
addOnloadHook(AddCustomScriptAndStyleLinks);
addOnloadHook(RemoveTitleTagFromEditSummary);