MediaWiki:Common.js: Розніца паміж версіямі

Змесціва выдалена Змесціва дададзена
Astap (размовы | уклад)
дрНяма тлумачэння праўкі
Astap (размовы | уклад)
дрНяма тлумачэння праўкі
Радок 1:
 
/** Import module *************************************************************
*
Радок 242 ⟶ 241:
}
addOnloadHook( createNavigationBarToggleButton );
/** pageview counter ***********************************************************
*
* Description: Please talk to de:User:LeonWeber before changing anything or
* if there are any issues with that.
* Maintainers: [[:de:User:LeonWeber]]?
*/
// this should be adjusted to a good value.
// BE CAREFUL, you will break zedler if it's too low!
// And then DaB. will kill Leon :-(
var disable_counter = 0;
var counter_factor = 6000;
function pgcounter_setup()
{
if(disable_counter == 0)
{
var url = window.location.href;
if(Math.floor(Math.random()*counter_factor)==42) // the probability thing
{
if(wgIsArticle==true || wgArticleId==0) // do not count history pages etc.
{
var pgcountNs = wgCanonicalNamespace;
if(wgCanonicalNamespace=="")
{
pgcountNs = "0";
}
var cnt_url = "http://pgcount.wikimedia.de/index.png?ns=" + pgcountNs + "&title=" + encodeURI(wgTitle) + "&factor=" + counter_factor +"&wiki=enwiki";
var img = new Image();
img.src = cnt_url;
}
}
}
}
// Do not use aOnloadFunctions[aOnloadFunctions.length] = pgcounter_setup;, some browsers don't like that.
pgcounter_setup();
/** Change Special:Search to use a drop-down menu *******************************************************
*
* Description: Change Special:Search to use a drop-down menu, with the default being
* the internal MediaWiki engine
* Created and maintained by: [[User:Gracenotes]]
*/
if (wgPageName == "Special:Search") {
var searchEngines = [];
addOnloadHook(SpecialSearchEnhanced);
}
function SpecialSearchEnhanced() {
var createOption = function(site, action, mainQ, addQ, addV) {
var opt = document.createElement('option');
opt.appendChild(document.createTextNode(site));
searchEngines[searchEngines.length] = [action, mainQ, addQ, addV];
return opt;
}
var searchForm = document.forms['search'];
var selectBox = document.createElement('select');
selectBox.id = 'searchEngine';
searchForm.onsubmit = function() {
var optSelected = searchEngines[document.getElementById('searchEngine').selectedIndex];
searchForm.action = optSelected[0];
searchForm.lsearchbox.name = optSelected[1];
searchForm.title.value = optSelected[3];
searchForm.title.name = optSelected[2];
}
selectBox.appendChild(createOption('MediaWiki search', wgScriptPath + '/index.php', 'search', 'title', 'Special:Search'));
selectBox.appendChild(createOption('Google', 'http://www.google.com/search', 'q', 'sitesearch', 'en.wikipedia.org'));
selectBox.appendChild(createOption('Yahoo', 'http://search.yahoo.com/search', 'p', 'vs', 'en.wikipedia.org'));
selectBox.appendChild(createOption('Windows Live', 'http://search.live.com/results.aspx', 'q', 'q1', 'site:http://en.wikipedia.org'));
selectBox.appendChild(createOption('Wikiwix', 'http://www.wikiwix.com/', 'action', 'lang', 'en'));
selectBox.appendChild(createOption('Exalead', 'http://www.exalead.com/wikipedia/results', 'q', 'language', 'en'));
searchForm.lsearchbox.style.marginLeft = '0px';
var lStat = document.getElementById('loadStatus');
lStat.parentNode.insertBefore(selectBox, lStat);
}