User:CyRoXX/standard.js

// ============================================================ // BEGIN Configuration for "star" logo in front of interwiki links to Featured Articles for "standard" skin

/** set to false in Special:Mypage/standard.js to switch off this "feature" */ var enable_linkFA = true;

/** * star logo for featured articles in other languages, * see Template:Link_FA and MediaWiki:Common.css */ function linkFA { // early exit when disabled if (!enable_linkFA) return;

// define an array of IDs to show where the interwiki links can only be found var InterwikiLocations = new Array("topbar", "footer"); // iterate through this array to mark the FA interwiki links in the given regions for (var locCount = 0; locCount < InterwikiLocations.length; locCount++) { var iwLocationId = InterwikiLocations[locCount]; var iwLocation = document.getElementById(iwLocationId); // if the current ID can't be found, try the next one if (!iwLocation) continue; var tblinks = iwLocation.getElementsByTagName("a");      // find all iwLocation links for (var i = 0; i < tblinks.length; i++) { var link = tblinks[i]; var parts = link.title.split(":"); // possible problem owing the standard skin: "Link FA" template is transcluded with a non-interwikim parameter, for example "Special" // result: links to special pages in the topbar and/or footer might also be marked as a Featured Article if (document.getElementById("interwiki-" + parts[0] + "-fa")) { var lang = parts[0] document.write(lang); // build an image-node with all necessary attributes var FAimg = document.createElement("img"); var imgsrc = document.createAttribute("src"); imgsrc.nodeValue = "http://upload.wikimedia.org/wikipedia/commons/d/d4/Monobook-bullet-star.png"; // add alternative text (though not visible because of the "title" attribute of the link) var alttext = document.createAttribute("alt"); alttext.nodeValue = "Dieser Artikel wurde als exzellent bewertet."; // add some beauty: margin-left to have some space to the name of the language var styattr = document.createAttribute("style"); styattr.nodeValue = "margin-right: 0.2em;"; FAimg.setAttributeNode(imgsrc); FAimg.setAttributeNode(alttext); FAimg.setAttributeNode(styattr);

// remove the clickable text of the link to replace it with both star logo and the text then var NodeCopy = link.firstChild.cloneNode(true); link.removeChild(link.firstChild); link.appendChild(FAimg); link.appendChild(NodeCopy); link.setAttribute("title", "Dieser Artikel wurde als exzellent bewertet: " + link.getAttribute("title")); }      }    } } // aOnloadFunctions[aOnloadFunctions.length] = linkFA; addOnloadHook(linkallFA);

// END Configuration for "star" logo in front of interwiki links to Featured Articles for "standard" skin // ============================================================