/* generated javascript */
var skin = 'monobook';
var stylepath = '/skins-1.5';
/* MediaWiki:Common.js */
// Common javascript code which effects everyone
// hasClass()
// 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);
};
})();
// for backwards compatibility
var addLoadEvent = addOnloadHook;
// book name
var wgBookName = wgPageName.split("/", 1)[0] || wgPageName;
wgBookName = wgBookName.split(':', 2).join(":");
// Provides an easy way to disable load dependent features
function delLoadEvent(func) {
for (var i = 0; i < onloadFuncts.length; i++) {
if (onloadFuncts[i] == func)
onloadFuncts.splice(i, 1);
}
}
function get_query_value(query, name)
{
if (typeof query != "string" || typeof name != "string")
return "";
var value = query.match('[&?]' + name + '=([^&]*)');
if (value)
return decodeURIComponent(value[1]);
else
return "";
}
// include a raw wiki page as javascript or css stylesheet
//test this because it might already be declared.
if(typeof import_ss_list == "undefined") import_ss_list = {};
function import_script(name)
{
name = encodeURIComponent(name.replace(/ /g, '_' ));
if (import_ss_list[name]) return; else import_ss_list[name] = true;
var scriptElem = document.createElement('script');
scriptElem.setAttribute('type', 'text/javascript');
scriptElem.setAttribute('src', '/w/index.php?title=' + name + '&action=raw&ctype=text/javascript');
document.getElementsByTagName('head')[0].appendChild(scriptElem);
}
function import_style(name)
{
name = encodeURIComponent(name.replace(/ /g, '_' ));
if (import_ss_list[name]) return; else import_ss_list[name] = true;
if(document.createStyleSheet) {
document.createStyleSheet("/w/index.php?title=" + name + "&action=raw&ctype=text/css");
} else {
var styleElem = document.createElement('style');
styleElem.setAttribute('type', 'text/css');
styleElem.appendChild(document.createTextNode('@import "/w/index.php?title=' + name + '&action=raw&ctype=text/css";'));
document.getElementsByTagName('head')[0].appendChild(styleElem);
}
}
import_script("MediaWiki:ExtraTools.js");
import_script("MediaWiki:Navigation.js");
import_script("MediaWiki:NavigationTabs.js");
import_script("MediaWiki:Displaytitle.js");
// adds buttons to the edit toolbar
if (mwCustomEditButtons) {
import_script("MediaWiki:EditToolbar.js");
}
/** Add dismiss button to watchlist-message *************************************
*
* Description: Hide the watchlist message for one week.
* Maintainers: [[w:User:Ruud Koot|Ruud Koot]]
*/
function addDismissButton() {
var watchlistMessage = document.getElementById("watchlist-message");
if ( watchlistMessage == null ) return;
if ( document.cookie.indexOf( "hidewatchlistmessage=yes" ) != -1 ) {
watchlistMessage.style.display = "none";
}
var Button = document.createElement( "span" );
var ButtonLink = document.createElement( "a" );
var ButtonText = document.createTextNode( "dismiss" );
ButtonLink.setAttribute( "id", "dismissButton" );
ButtonLink.setAttribute( "href", "javascript:dismissWatchlistMessage();" );
ButtonLink.setAttribute( "title", "Hide this message for one week" );
ButtonLink.appendChild( ButtonText );
Button.appendChild( document.createTextNode( "[" ) );
Button.appendChild( ButtonLink );
Button.appendChild( document.createTextNode( "]" ) );
watchlistMessage.appendChild( Button );
}
function dismissWatchlistMessage() {
var e = new Date();
e.setTime( e.getTime() + (7*24*60*60*1000) );
document.cookie = "hidewatchlistmessage=yes; expires=" + e.toGMTString() + "; path=/";
var watchlistMessage = document.getElementById("watchlist-message");
watchlistMessage.style.display = "none";
}
addOnloadHook( addDismissButton );
//////////////////////////////////////////////////////////////////
// BEGIN RANDOM BOOK
//////////////////////////////////////////////////////////////////
// Gets a page from the wiki and runs function action on it
function GetPage(page, action)
{
var doc = false;
if (window.XMLHttpRequest)
doc = new XMLHttpRequest();
else if (window.ActiveXObject) {
try {
doc = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
doc = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
}
}
}
if (doc) {
var url = wgArticlePath.replace(/\$1$/, page);
doc.onreadystatechange = function() { action(doc); };
doc.open('GET', url+'?printable=true', true);
doc.overrideMimeType('text/xml');
doc.send(null);
}
}
// Get a random page from Wikibooks:Alphabetical_classification
function RandomBook()
{
function random_book(doc) {
try {
if (doc.readyState == 4 && doc.status == 200)
{
var wiki = doc.responseXML;
if (wiki)
{
var books = wiki.getElementById('books').getElementsByTagName('li');
if (books && books.length > 0) {
var page = books.item(Math.floor(Math.random() * books.length + 1)).firstChild;
while (hasClass(page, "new") || hasClass(page, "external")) {
page = books.item(Math.floor(Math.random() * books.length + 1)).firstChild;
}
window.location = page.href;
}
}
}
} catch (e) { }
}
GetPage("Wikibooks:Alphabetical_classification", random_book);
}
// Adds a random book link to the navigation toolbar and calls RandomBook when clicked
function RandomBookLink() {
var tb = document.getElementById('p-Navigation');
var link = document.createElement('a');
var li = document.createElement('li');
if (tb) {
tb = tb.getElementsByTagName('ul')[0];
link.href = "javascript:RandomBook();";
link.title = "Random Book";
link.onmouseover = function() { window.status = "Random Book"; return true; }
link.onmouseout = function() { window.status = ""; return true; }
link.appendChild(document.createTextNode("Random book"));
li.id = "n-random-book";
li.appendChild(link);
tb.appendChild(li);
}
}
addOnloadHook( RandomBookLink );
//Removes the default no-license option for image uploads.
//All new image uploads must be tagged with a license or nld
function remove_no_license() {
if (wgPageName != "Special:Upload")
return;
var license = document.getElementById("wpLicense");
if (!license)
return;
var options = license.getElementsByTagName("option");
if (!options)
return;
license.removeChild(options[0]);
}
addOnloadHook(remove_no_license);
// ============================================================
// BEGIN pageview counter
// Please talk to [[de:User:LeonWeber]] before changing anything or
// if there are any issues with that.
//
// this should be adjusted to a good value.
// BE CAREFULL, you will break zedler if it's too low!
// And then DaB. will kill Leon :-(
var disable_counter = 0;
var counter_factor = 100;
function pgcounter_setup()
{
// do not count if disabled or if its a history page, etc.
if (disable_counter != 0 || wgIsArticle == false)
return;
if (wgNamespaceNumber != 0 && wgNamespaceNumber != 102 && wgNamespaceNumber != 110)
return; // ignore unless main namespace, cookbook namespace or wikijunior namespace
if (Math.floor(Math.random()*counter_factor)!=42)
return; // the probability thing
var url = window.location.href;
var pgcountNs = wgCanonicalNamespace;
if (wgCanonicalNamespace=="") pgcountNs = "0";
var cnt_url = "http://pgcount.wikimedia.de/index.png?ns=" + pgcountNs + "&title=" +
encodeURI(wgTitle).replace(/\+/g, "%2B") + "&factor=" + counter_factor + "&wiki=enwikibooks";
var img = new Image();
img.src = cnt_url;
}
// Do not use aOnloadFunctions[aOnloadFunctions.length] = pgcounter_setup;, some browsers don't like that.
pgcounter_setup();
// End of Common.js
/* MediaWiki:Monobook.js (deprecated; migrate to Common.js!) */
/*
See also: [[MediaWiki:Common.js]]
*/
/* Functions for adding links to the personal links section and the toolbox*/
function AddPersonalLink(link, text, tag, ibefore)
{
var li = document.createElement( 'li' );
li.id = tag;
var a = document.createElement( 'a' );
a.appendChild( document.createTextNode( text ) );
a.href = link;
li.appendChild( a );
if ( ! ibefore ) // append to end (right) of list
{
document.getElementById( 'pt-logout' ).parentNode.appendChild( li );
}
else
{
var before = document.getElementById( ibefore );
before.appendChild( li, before );
}
}
function AddToolboxLink(text, href, onclick, linkid) {
var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
var link = document.createElement('a');
link.onclick = onclick;
link.href = href;
link.appendChild(document.createTextNode(text));
var li = document.createElement('li');
li.id = linkid;
li.appendChild(link);
tb.insertBefore(li, tb.firstChild);
return;
}
/*
*/