Topher Grace

/** Main Page layout fixes ********************************************************* * *  Description:        Various layout fixes for the main page, including an  *                      additional link to the complete list of languages available *                     and the renaming of the 'Article' to to 'Main Page'. * Maintainers:        en:User:AzaToth, User:R. Koot */ function mainPageRenameNamespaceTab { try { var Node = document.getElementById( 'ca-nstab-main' ).firstChild; if ( Node.textContent ) {     // Per DOM Level 3 Node.textContent = 'Faqja Kryesore'; } else if ( Node.innerText ) { // IE doesn't handle .textContent Node.innerText = 'Faqja Kryesore'; } else {                      // Fallback Node.replaceChild( Node.firstChild, document.createTextNode( 'Faqja Kryesore' ) ); }    } catch(e) { // bailing out! } } function mainPageAppendCompleteListLink { try { var node = document.getElementById( "p-lang" ) .getElementsByTagName('div')[0] .getElementsByTagName('ul')[0]; var aNode = document.createElement( 'a' ); var liNode = document.createElement( 'li' ); aNode.appendChild( document.createTextNode( 'Complete list' ) ); aNode.setAttribute( 'href', 'http://meta.wikimedia.org/wiki/List_of_Wikipedias' ); liNode.appendChild( aNode ); liNode.className = 'interwiki-completelist'; node.appendChild( liNode ); } catch(e) { // lets just ignore what's happened return; } } if ( wgTitle == 'Faqja Kryesore' && ( wgNamespaceNumber == 0 || wgNamespaceNumber == 1 ) ) { addOnloadHook( mainPageRenameNamespaceTab ); } if ( wgTitle == 'Faqja Kryesore' && wgNamespaceNumber == 0 ) { addOnloadHook( mainPageAppendCompleteListLink ); }

/** "Technical restrictions" title fix ***************************************** * * Description: * Maintainers: User:Interiot, User:Mets501, User:Freakofnurture */ // // For pages that have something like Template:Lowercase, replace the title, but only if it is cut-and-pasteable as a valid wikilink. // (for instance iPod's title is updated. But C is not an equivalent // wikilink, so C Sharp doesn't have its main title changed) // Likewise for users who have selected the U.K. date format ("1 March") the // titles of day-of-the-year articles will appear in that style. Users with any // other date setting are not affected. // // The function looks for a banner like this: // &lt;div id="RealTitleBanner"&gt; ... &lt;span id="RealTitle"&gt;title&lt;/span&gt; ... &lt;/div&gt; // An element with id=DisableRealTitle disables the function. // var disableRealTitle = 0; // users can set disableRealTitle = 1 locally to disable. if (wgIsArticle) { // don't display the RealTitle when editing, since it is apparently inconsistent (doesn't show when editing sections, doesn't show when not previewing) addOnloadHook(function {   try {        var realTitleBanner = document.getElementById("RealTitleBanner");        if (realTitleBanner && !document.getElementById("DisableRealTitle") && !disableRealTitle ) {            var realTitle = document.getElementById("RealTitle");            if (realTitle) {                var realTitleHTML = realTitle.innerHTML;                realTitleText = pickUpText(realTitle);                var isPasteable = 0;                //var containsHTML = //gi, "") ); // contains HTML that will be ignored when cut-n-pasted as a wikilink                // calculate whether the title is pasteable                var verifyTitle = realTitleText.replace(/^ +/, "");       // trim left spaces                verifyTitle = verifyTitle.charAt(0).toUpperCase + verifyTitle.substring(1, verifyTitle.length);    // uppercase first character // if the namespace prefix is there, remove it on our verification copy. If it isn't there, add it to the original realValue copy. if (wgNamespaceNumber != 0) { if (wgCanonicalNamespace == verifyTitle.substr(0, wgCanonicalNamespace.length).replace(/ /g, "_") && verifyTitle.charAt(wgCanonicalNamespace.length) == ":") { verifyTitle = verifyTitle.substr(wgCanonicalNamespace.length + 1); } else { realTitleText = wgCanonicalNamespace.replace(/_/g, " ") + ":" + realTitleText; realTitleHTML = wgCanonicalNamespace.replace(/_/g, " ") + ":" + realTitleHTML; }               }                // verify whether wgTitle matches verifyTitle = verifyTitle.replace(/[\s_]+/g, " ");     // underscores and multiple spaces to single spaces verifyTitle = verifyTitle.replace(/^\s+/, "").replace(/\s+$/, "");       // trim left and right spaces verifyTitle = verifyTitle.charAt(0).toUpperCase + verifyTitle.substring(1, verifyTitle.length);   // uppercase first character if ( (verifyTitle == wgTitle) || (verifyTitle == wgTitle.replace(/^(.+)?(Janar|Shkurt|Mars|Prill|Maj|Qershor|Korrik|Gusht|Shtator|Tetor|Nëntor|Dhjetor)\s+([12]?[0-9]|3[0123])([^\d].*)?$/g, "$1$3 $2$4") )) isPasteable = 1; var h1 = document.getElementsByTagName("h1")[0]; if (h1 && isPasteable) { h1.innerHTML = containsTooMuchHTML ? realTitleText : realTitleHTML; if (!containsTooMuchHTML) realTitleBanner.style.display = "none"; }               document.title = realTitleText + " - Wikipedia"; }       }    } catch (e) { /* Something went wrong. */   }  }); } // similar to innerHTML, but only returns the text portions of the insides, excludes HTML function pickUpText(aParentElement) { var str = ""; function pickUpTextInternal(aElement) {  var child = aElement.firstChild;  while (child) {   if (child.nodeType == 1)     // ELEMENT_NODE     pickUpTextInternal(child);   else if (child.nodeType == 3)   // TEXT_NODE    str += child.nodeValue;   child = child.nextSibling;  } }  pickUpTextInternal(aParentElement);  return str; }

/* Test if an element has a certain class ************************************** * * Description: Uses regular expressions and caching for better performance. * Maintainers: User:Mike Dillon, User:R. Koot, User:SG */ var hasClass = (function {     var reCache = {};     return function (element, className) {         return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);    }; }); /** Collapsible tables ********************************************************* * *  Description: Allows tables to be collapsed, showing only the header. See *              NavFrame. * Maintainers: User:R. Koot */ var autoCollapse = 2; var collapseCaption = "hide"; var expandCaption = "show"; function collapseTable( tableIndex ) {    var Button = document.getElementById( "collapseButton" + tableIndex ); var Table = document.getElementById( "collapsibleTable" + tableIndex ); if ( !Table || !Button ) { return false; }    var Rows = Table.rows; if ( Button.firstChild.data == collapseCaption ) { for ( var i = 1; i < Rows.length; i++ ) { Rows[i].style.display = "none"; }        Button.firstChild.data = expandCaption; } else { for ( var i = 1; i < Rows.length; i++ ) { Rows[i].style.display = Rows[0].style.display; }        Button.firstChild.data = collapseCaption; } } function createCollapseButtons {    var tableIndex = 0; var NavigationBoxes = new Object; var Tables = document.getElementsByTagName( "table" ); for ( var i = 0; i < Tables.length; i++ ) { if ( hasClass( Tables[i], "collapsible" ) ) { /* only add button and increment count if there is a header row to work with */ var HeaderRow = Tables[i].getElementsByTagName( "tr" )[0]; if (!HeaderRow) continue; var Header = HeaderRow.getElementsByTagName( "th" )[0]; if (!Header) continue; NavigationBoxes[ tableIndex ] = Tables[i]; Tables[i].setAttribute( "id", "collapsibleTable" + tableIndex ); var Button    = document.createElement( "span" ); var ButtonLink = document.createElement( "a" ); var ButtonText = document.createTextNode( collapseCaption ); Button.style.styleFloat = "right"; Button.style.cssFloat = "right"; Button.style.fontWeight = "normal"; Button.style.textAlign = "right"; Button.style.width = "6em"; ButtonLink.style.color = Header.style.color; ButtonLink.setAttribute( "id", "collapseButton" + tableIndex ); ButtonLink.setAttribute( "href", "javascript:collapseTable(" + tableIndex + ");" ); ButtonLink.appendChild( ButtonText ); Button.appendChild( document.createTextNode( "[" ) ); Button.appendChild( ButtonLink ); Button.appendChild( document.createTextNode( "]" ) ); Header.insertBefore( Button, Header.childNodes[0] ); tableIndex++; }    }     for ( var i = 0;  i < tableIndex; i++ ) { if ( hasClass( NavigationBoxes[i], "collapsed" ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], "autocollapse" ) ) ) { collapseTable( i ); }    } } addOnloadHook( createCollapseButtons );

//EXPERIMENTAL //============================================================= /** WikiMiniAtlas ******************************************************* *  *  Description: WikiMiniAtlas is a popup click and drag world map. *              This script causes all of our coordinate links to display the WikiMiniAtlas popup button. *              The script itself is located on meta because it is used by many projects. *              See WikiMiniAtlas for more information. * Created by: User:Dschwen */ document.write(' '); /** IE 6 Z-index bug workaround for anonnotice ************************** *  *  Description: This implements a work around for the Z-index bug found in Internet Explorer. *              It correctly places the anon notice on the page, even under IE6. *              See this Google search for more information about the bug: *              http://www.google.com/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&hs=q74&q=z-index+ie6+bug&btnG=Search * Created by: User:Gmaxwell */ addOnloadHook((function { if (wgUserName == null) { var message=new Array; message[0]='Your continued donations keep Wikipedia running!'; message[1]='Make a donation to Wikipedia and give the gift of knowledge!'; message[2]='Wikipedia is sustained by people like you. Please donate today.'; message[3]='Help us improve Wikipedia by supporting it financially.'; message[4]='You can support Wikipedia by making a tax-deductible donation.' message[5]='Help us provide free content to the world by donating today!'; var whichMessage = Math.floor(Math.random*(message.length)); document.writeln('  + message[whichMessage] +   '); var messageEdu=new Array; messageEdu[0]='Learn more about using Wikipedia for research</a>'; messageEdu[1]='Ten things you didn\'t know about Wikipedia</a>'; messageEdu[2]='Ten things you didn\'t know about images on Wikipedia</a>'; messageEdu[3]='Learn more about citing Wikipedia</a>'; messageEdu[4]='Have questions? Find out how to ask questions and get answers.</a>'; messageEdu[5]='Find out more about navigating Wikipedia and finding information</a>'; messageEdu[6]='Interested in contributing to Wikipedia?</a>'; var whichMessageEdu = Math.floor(Math.random*(messageEdu.length)); document.getElementById("contentSub").innerHTML +=' •  + messageEdu[whichMessageEdu] +  •  '; } })); /* Correctly handle PNG transparency in Win IE 5.5 & 6. http://homepage.ntlworld.com/bobosola. Updated 18-Jan-2006. Adapted for Wikipedia by Remember_the_dot http://homepage.ntlworld.com/bobosola/pnginfo.htm states "This page contains more information for the curious or those who wish to amend the script for special needs", which I take as permission to modify or adapt this script freely. I release my changes into the public domain. function PngFix {  if (document.body.filters) {      var documentImages = document.images for (var i = 0; i < documentImages.length;) {         var img = documentImages[i] var imgSrc = img.src if (imgSrc.substr(imgSrc.length - 3).toLowerCase == "png" && !img.useMap && !img.onclick) {            var imgID = (img.id) ? "id=\"" + img.id + "\" " : "" var imgClass = (img.className) ? "class=\"" + img.className + "\" " : "" var imgTitle = (img.title) ? "title=\"" + img.title + "\" " : "" var imgStyle = "display:inline-block; font-size:0; vertical-align:middle;" + img.style.cssText if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle img.outerHTML = "<span " + imgID + imgClass + imgTitle + " style=\"" + imgStyle + "\"><span style=\"width:" + img.width + "px; height:" + img.height + "px; display:inline-block; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + encodeURI(imgSrc) + "');\"> " }         else {            i++ }      }   } } if (navigator.appName == "Microsoft Internet Explorer") {   var version = navigator.appVersion.substr(22, 3) if (version == "6.0" || version == "5.5") {       window.attachEvent("onload", PngFix) } }

/** Interwiki links to featured articles *************************************** * *  Description: Highlights interwiki links to featured articles (or  *               equivalents) by changing the bullet before the interwiki link *              into a star. * Maintainers: User:R. Koot */ function LinkFA {    if ( document.getElementById( "p-lang" ) ) { var InterwikiLinks = document.getElementById( "p-lang" ).getElementsByTagName( "li" ); for ( var i = 0; i < InterwikiLinks.length; i++ ) { if ( document.getElementById( InterwikiLinks[i].className + "-fa" ) ) { InterwikiLinks[i].className += " FA" InterwikiLinks[i].title = "Ky artikull ka arritur një kualitet të lartë në këtë gjuhë."; }        }     } } addOnloadHook( LinkFA );