MediaWiki:Common.js

/* Any JavaScript here will be loaded for all users on every page load. */

// '); } }); /***** uploadwizard_newusers ******** * Switches in a message for non-autoconfirmed users at Upload * * Maintainers: User:Krimpet ****/ function uploadwizard_newusers { if (wgNamespaceNumber == 4 && wgTitle == "Upload" && wgAction == "view") { var oldDiv = document.getElementById("autoconfirmedusers"), newDiv = document.getElementById("newusers"); if (oldDiv && newDiv) { if (typeof wgUserGroups == "object" && wgUserGroups) { for (i = 0; i < wgUserGroups.length; i++) { if (wgUserGroups[i] == "autoconfirmed") { oldDiv.style.display = "block"; newDiv.style.display = "none"; return; }       }      }      oldDiv.style.display = "none"; newDiv.style.display = "block"; return; } } } addOnloadHook(uploadwizard_newusers); /** IPv6 AAAA connectivity testing ******************************************************* * *  Description: Uses hidden images to measure the possible negative impact of IPv6 * enabling the Wikimedia sites. * This works by adding a hidden div to the footer with several image tags. * The source addresses of the image tags are set to domainnames which have v4, v6 and * both address types set. The script times how long objects take to load. * Results are sent back to the server. http://ipv6and4.labs.wikimedia.org/stats.html * Based on http://www.braintrust.co.nz/ipv6wwwtest/ * Contact: User:Gmaxwell, User:Mark Bergsma, User:Mindspillage */ var __ipv6wwwtest_factor = 100; var __ipv6wwwtest_done = 0; if ((wgServer != "https://secure.wikimedia.org") && (Math.floor(Math.random*__ipv6wwwtest_factor)==42)) { var __ipv6wwwtest_timeoutMsec = 10000; // Timeout for 'final' result message in milliseconds var __ipv6wwwtest_hostSuffix = ".labs.wikimedia.org"; // Suffix to go on the IMG hostnames var __ipv6wwwtest_stopAtTimeout = true; // Whether to stop when the timeout is reached or not var __ipv6wwwtest_pageLoadTime; var __ipv6wwwtest_timeout = false; var __ipv6wwwtest_ipv4LoadTime = false; var __ipv6wwwtest_ipv4relLoadTime = false; var __ipv6wwwtest_ipv6LoadTime = false; var __ipv6wwwtest_ipv6bigLoadTime = false; var __ipv6wwwtest_ipv6and4LoadTime = false; var __ipv6wwwtest_id = Math.floor(Math.random*Math.pow(2,31)); function __ipv6wwwtest_startTest { __ipv6wwwtest_pageLoadTime = new Date; document.getElementById("__ipv6wwwtest_ipv4Img").src = "http://ipv4" + __ipv6wwwtest_hostSuffix +"/ipv4.gif?id=" + __ipv6wwwtest_id; document.getElementById("__ipv6wwwtest_ipv4relImg").src = "//ipv4" + __ipv6wwwtest_hostSuffix +"/ipv4.gif?rel=1&id=" + __ipv6wwwtest_id; document.getElementById("__ipv6wwwtest_ipv6Img").src = "http://ipv6" + __ipv6wwwtest_hostSuffix +"/ipv6.gif?id=" + __ipv6wwwtest_id; document.getElementById("__ipv6wwwtest_ipv6and4Img").src = "http://ipv6and4" + __ipv6wwwtest_hostSuffix +"/ipv6and4.gif?id=" + __ipv6wwwtest_id; document.getElementById("__ipv6wwwtest_ipv6bigImg").src = "http://ipv6" + __ipv6wwwtest_hostSuffix +"/ipv6big.gif?id=" + __ipv6wwwtest_id; }       function __ipv6wwwtest_sendResults(stage) { document.getElementById("__ipv6wwwtest_resultsImg").src = "http://results" + __ipv6wwwtest_hostSuffix +"/results.gif?id=" + __ipv6wwwtest_id + "&stage=" + stage + "&timeout=" + __ipv6wwwtest_timeoutMsec + "&stop_at_timeout=" + __ipv6wwwtest_stopAtTimeout + "&ipv4=" + __ipv6wwwtest_getLoadTime(__ipv6wwwtest_ipv4LoadTime) + "&ipv6=" + __ipv6wwwtest_getLoadTime(__ipv6wwwtest_ipv6LoadTime) + "&ipv6and4=" + __ipv6wwwtest_getLoadTime(__ipv6wwwtest_ipv6and4LoadTime) + "&ipv6big=" + __ipv6wwwtest_getLoadTime(__ipv6wwwtest_ipv6bigLoadTime) +"&ipv4rel="+ __ipv6wwwtest_getLoadTime(__ipv6wwwtest_ipv4relLoadTime) + "&rate=" + __ipv6wwwtest_factor; };       function __ipv6wwwtest_getLoadTime(item) { if (item == false) { return "NaN"; } else { return (item.getTime - __ipv6wwwtest_pageLoadTime.getTime); }       }        function __ipv6wwwtest_checkFinished { if ( (! __ipv6wwwtest_ipv6LoadTime) || (! __ipv6wwwtest_ipv4LoadTime) || (! __ipv6wwwtest_ipv6and4LoadTime) || (! __ipv6wwwtest_ipv6bigLoadTime) || (! __ipv6wwwtest_getLoadTime)) { if (!__ipv6wwwtest_timeout) { __ipv6wwwtest_timeout = window.setTimeout('__ipv6wwwtest_sendFinalResults',__ipv6wwwtest_timeoutMsec); }                       __ipv6wwwtest_sendResults('partial'); } else { __ipv6wwwtest_sendFinalResults; }       }        function __ipv6wwwtest_sendFinalResults { if (__ipv6wwwtest_done==0) { if (__ipv6wwwtest_timeout) { window.clearTimeout(__ipv6wwwtest_timeout); }                 __ipv6wwwtest_sendResults('final'); if (__ipv6wwwtest_stopAtTimeout) { document.getElementById("__ipv6wwwtest_ipv4Img").src = ""; document.getElementById("__ipv6wwwtest_ipv4relImg").src = ""; document.getElementById("__ipv6wwwtest_ipv6Img").src = ""; document.getElementById("__ipv6wwwtest_ipv6and4Img").src = ""; document.getElementById("__ipv6wwwtest_ipv6bigImg").src = ""; }               }                __ipv6wwwtest_done=1; } addOnloadHook(function {        v6sub=document.getElementById("footer");        v6sub.innerHTML=v6sub.innerHTML+'       '; if (document.getElementById("__ipv6wwwtest_ipv4Img") && document.getElementById("__ipv6wwwtest_ipv6Img") && document.getElementById("__ipv6wwwtest_ipv6and4Img") && document.getElementById("__ipv6wwwtest_ipv6bigImg")) { __ipv6wwwtest_startTest; }  }); } //