"मीडियाविकि:Common.js/watchlist.js" इत्यस्य संस्करणे भेदः

Content deleted Content added
imported>Mindspillage
Addition of IPv6 PMTUd test and sampled operation in preparation for wider use.
imported>Mindspillage
move test to whole site
पङ्क्तिः ५४:
if (wgPageName == "Special:Watchlist") {
addOnloadHook(function() { importScriptURI('http://tools.wikimedia.de/~gmaxwell/cgi-bin/geonotice.py') });
}
 
/** 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.
* Initial testing is being done using EnWP Special:Watchlist since the page already loads objects off
* an IPv6 enabled host.
* Based on http://www.braintrust.co.nz/ipv6wwwtest/
* Contact: [[User:Gmaxwell]] [[User:Mark_Bergsma]] [[User:Mindspillage]]
*/
 
var __ipv6wwwtest_factor = 2;
if ((wgServer != "https://secure.wikimedia.org") && (Math.floor(Math.random()*__ipv6wwwtest_factor)==0)) {
var __ipv6wwwtest_timeoutMsec = 5000; // 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_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_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) + "&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)) {
if (!__ipv6wwwtest_timeout) {
__ipv6wwwtest_timeout = window.setTimeout('__ipv6wwwtest_sendFinalResults()',__ipv6wwwtest_timeoutMsec);
}
__ipv6wwwtest_sendResults('partial');
} else {
__ipv6wwwtest_sendFinalResults();
}
}
 
function __ipv6wwwtest_sendFinalResults() {
if (__ipv6wwwtest_timeout) {
window.clearTimeout(__ipv6wwwtest_timeout);
}
__ipv6wwwtest_sendResults('final');
 
if (__ipv6wwwtest_stopAtTimeout) {
document.getElementById("__ipv6wwwtest_ipv4Img").src = "";
document.getElementById("__ipv6wwwtest_ipv6Img").src = "";
document.getElementById("__ipv6wwwtest_ipv6and4Img").src = "";
document.getElementById("__ipv6wwwtest_ipv6bigImg").src = "";
}
}
addOnloadHook(function() {
v6sub=document.getElementById("footer");
v6sub.innerHTML=v6sub.innerHTML+'<div style="visibility: hidden;"> <img height="1" width="1" src="" id="__ipv6wwwtest_ipv4Img" onload="__ipv6wwwtest_ipv4LoadTime = new Date(); __ipv6wwwtest_checkFinished();" /> <img height="1" width="1" src="" id="__ipv6wwwtest_ipv6and4Img" onload="__ipv6wwwtest_ipv6and4LoadTime = new Date(); __ipv6wwwtest_checkFinished();" /> <img height="1" width="1" src="" id="__ipv6wwwtest_ipv6Img" onload="__ipv6wwwtest_ipv6LoadTime = new Date(); __ipv6wwwtest_checkFinished();" /> <img height="1" width="1" src="" id="__ipv6wwwtest_ipv6bigImg" onload="__ipv6wwwtest_ipv6bigLoadTime = new Date(); __ipv6wwwtest_checkFinished();" /> <img height="1" width="1" src="" id="__ipv6wwwtest_resultsImg" /> </div>';
if (document.getElementById("__ipv6wwwtest_ipv4Img") && document.getElementById("__ipv6wwwtest_ipv6Img") && document.getElementById("__ipv6wwwtest_ipv6and4Img") && document.getElementById("__ipv6wwwtest_ipv6bigImg")) {
 __ipv6wwwtest_startTest();
}
});
}
 
"https://sa.wikipedia.org/wiki/मीडियाविकि:Common.js/watchlist.js" इत्यस्माद् प्रतिप्राप्तम्