Järjestelmäviesti:Common.js
RuneWikistä, vapaasta RuneScape-aiheisesta tietosanakirjasta. Tänään on 5. toukokuuta 2024.
Siirry valikkoon
Siirry hakuun
Huomautus: Selaimen välimuisti pitää tyhjentää asetusten tallentamisen jälkeen, jotta muutokset tulisivat voimaan.
- Firefox ja Safari: Napsauta Shift-näppäin pohjassa Päivitä, tai paina Ctrl-F5 tai Ctrl-R (⌘-R Macilla)
- Google Chrome: Paina Ctrl-Shift-R (⌘-Shift-R Macilla)
- Internet Explorer: Napsauta Ctrl-näppäin pohjassa Päivitä tai paina Ctrl-F5
- Opera: Valikko → Asetukset (Opera → Asetukset Macilla) ja sitten Tietosuoja ja turvallisuus → Tyhjennä selaustiedot → Välimuistissa olevat kuvat ja tiedostot.
/* Any JavaScript here will be loaded for all users on every page load. */
/* <pre> */
if ( mw.config.get( 'wgAction' ) == 'edit' || mw.config.get( 'wgAction' ) == 'submit' ) {
mw.loader.using( 'mediawiki.action.edit', function() {
var buttons, i, len;
buttons = [
{
'id': 'button-redirect',
'imageFile': 'http://images.wikia.com/central/images/c/c8/Button_redirect.png',
'speedTip': 'Siirto',
'tagOpen': '#OHJAUS [[',
'tagClose': ']]',
'sampleText': 'Tähän teksti'
},
{
'id': 'button-table',
'imageFile': 'http://images3.wikia.nocookie.net/central/images/4/4a/Button_table.png',
'speedTip': 'Lisää wikitaulukko',
'tagOpen': '{| class="wikitable"\n|-\n',
'tagClose': '\n|}',
'sampleText': '! header 1\n! header 2\n! header 3\n|-\n| row 1, cell 1\n| row 1, cell 2\n| row 1, cell 3\n|-\n| row 2, cell 1\n| row 2, cell 2\n| row 2, cell 3'
},
{
'id': 'button-enter',
'imageFile': 'http://images2.wikia.nocookie.net/central/images/1/13/Button_enter.png',
'speedTip': 'Rivin vahto',
'tagOpen': '<br />',
'tagClose': '',
'sampleText': ''
},
{
'id': 'button-gallery',
'imageFile': 'http://images2.wikia.nocookie.net/central/images/1/12/Button_gallery.png',
'speedTip': 'Lisää kuvagalleria',
'tagOpen': '\n<div align="center"><gallery>\n',
'tagClose': '\n</gallery></div>',
'sampleText': 'Tiedosto:Esimerkki.jpg|Kuvateksti1\nTiedosto:Esimerkki.jpg|Kuvateksti2'
},
{
'id': 'button-small',
'imageFile': 'http://images2.wikia.nocookie.net/central/images/5/58/Button_small.png',
'speedTip': 'Pienennä',
'tagOpen': '<small>',
'tagClose': '</small>',
'sampleText': 'Pienennä'
},
{
'id': 'button-strike',
'imageFile': 'http://images2.wikia.nocookie.net/central/images/c/c9/Button_strike.png',
'speedTip': 'Yliviivaa',
'tagOpen': '<s>',
'tagClose': '</s>',
'sampleText': 'Yliviivaa'
},
{
'id': 'button-comment',
'imageFile': 'http://images2.wikia.nocookie.net/central/images/3/34/Button_hide_comment.png',
'speedTip': 'Kommentti',
'tagOpen': '<!--',
'tagClose': '-->',
'sampleText': 'Kommentti'
},
{
'id': 'button-wikipedia-link',
'imageFile': 'http://images2.wikia.nocookie.net/central/images/c/cb/Button_wikipedia.png',
'speedTip': 'Wikipedia-linkki',
'tagOpen': '[[Wikipedia:',
'tagClose': ']]',
'sampleText': 'Tähän teksti'
},
{
'id': 'button-align-left',
'imageFile': 'http://images2.wikia.nocookie.net/central/images/e/ea/Button_align_left.png',
'speedTip': 'Teksti vasemmalle',
'tagOpen': '<p style="text-align:left;">',
'tagClose': '</p>',
'sampleText': 'Tähän teksti'
},
{
'id': 'button-align-center',
'imageFile': 'http://images2.wikia.nocookie.net/central/images/5/5f/Button_center.png',
'speedTip': 'Teksti keskelle',
'tagOpen': '<p style="text-align:center;">',
'tagClose': '</p>',
'sampleText': 'Tähän teksti'
},
{
'id': 'button-align-right',
'imageFile': 'http://images2.wikia.nocookie.net/central/images/a/a5/Button_align_right.png',
'speedTip': 'Teksti oikealle',
'tagOpen': '<p style="text-align:right;">',
'tagClose': '</p>',
'sampleText': 'Tähän teksti'
}
];
for ( i = 0, len = buttons.length; i < len; i++ ) {
mw.toolbar.addButton(
buttons[i].imageFile,
buttons[i].speedTip,
buttons[i].tagOpen,
buttons[i].tagClose,
buttons[i].sampleText,
buttons[i].id,
buttons[i].id
);
}
});
}
/* IRC */
importScript( 'MediaWiki:Common.js/embedirc.js' );
/* Foorumit */
importScript( 'MediaWiki:Common.js/embedforum.js' );
/* RuneScape-client */
importScript( 'MediaWiki:Common.js/runescape.js' );
/* GEMW-päivitys (manuaalinen) */
importScript( 'MediaWiki:Common.js/gemwupdate.js' );
// ==================================================================
// Dynamic Templates
// Suomeksi siis laskin joillakin tietyillä sivuilla
// ==================================================================
addOnloadHook( function() {
if ( $( '.jcConfig' ).length > 0 ) {
importScript( 'MediaWiki:Common.js/calc.js' );
importStylesheet( 'MediaWiki:Common.css/calc.css' );
}
});
// ============================================================
// EDIT-INTRO FIX for Exchange articles
//
// This script is modified from English Wikipedia
// Source: http://en.wikipedia.org/wiki/User:RockMFR/disambigeditintro.js
// Function: Adds EditIntro to all Exchange pages
// when "edit this page" link is clicked
// ============================================================
function fixEditIntro() {
if ( wgCanonicalNamespace == 'Exchange' && document.getElementById( 'ca-edit' ) ) {
var editLinks = document.getElementById( 'ca-edit' ).getElementsByTagName( 'a' );
if ( editLinks.length > 0 ) {
editLinks[0].href += '&editintro=Template:ExchangeItemHelp';
}
}
}
addOnloadHook( fixEditIntro );
// ============================================================
// End of EDIT-INTRO FIX
// ============================================================
// ============================================================
// a test script to try to copy the [show] | [hide] feature currently in toc panels
// ============================================================
var expandoShowText = 'show';
var expandoHideText = 'hide';
// the initAllToggles function has to be called *after* the page has finished loading otherwise the DOM nodes
// won't actually exist when we try to get references to them. the hookEvent function is defined in wikibits.js
// and provides a mechanism for adding functions to the list of callbacks to run when a particular event
// occurs. we'll use this to register a callback for the page load event, which happens after everything has
// been loaded from the server. at that point the DOM nodes will exist so we can safely try to get references
// to them.
hookEvent( 'load', initAllExpandos );
// initialise all known expando panels on the page.
function initAllExpandos() {
// check the 'initExpando' function is defined and set the 'show' and 'hide' text if it is
if ( window.initExpando ) {
// add a line here to initialise each known expando panel. keep the name short to
// avoid storing more data than necessary in the cookie. this will keep bandwidth
// usage to a minimum since the cookie is sent to the server at every page request.
initExpando( 'userbox' ); // user box panel
};
};
// initialise the specified expando panel. we'll add a new <span> node that contains the
// [ show | hide ] text and then automatically make sure the panel is in the correct state
// by reading the cookie and checking what the last saved value was.
function initExpando( name ) {
if ( document.createTextNode ) {
// Uses DOM calls to avoid document.write + XHTML issues
var expandoTitle = document.getElementById( name + '-title' );
if ( !expandoTitle ) {
return;
}
// this section of code manipulates the dom tree and inserts a new toggle link span that contains the 'show' and 'hide' links.
// dom tree before:
// <div id='%name%-title'>title</div>
// <div id='%name%-body'>
// ...
// </div>
// dom tree after
// <div id='%name%-title'>title <span class='togglespan'>[<a id='togglelink' classname='internal' href='javascript:flipExpando(%name%)'>%expandoHideText%</a>]</span></div>
// <div id='%name%-body'>
// ...
// </div>
var outerSpan = document.createElement( 'span' );
outerSpan.className = 'togglespan';
var toggleLink = document.createElement( 'a' );
toggleLink.id = name + '-link';
toggleLink.className = 'internal';
toggleLink.href = 'javascript:flipExpando("' + name + '")';
toggleLink.appendChild( document.createTextNode( expandoHideText ) );
outerSpan.appendChild( document.createTextNode( '[' ) );
outerSpan.appendChild( toggleLink);
outerSpan.appendChild( document.createTextNode( ']' ) );
expandoTitle.appendChild( document.createTextNode( ' ' ) );
expandoTitle.appendChild( outerSpan );
// now we need to check whether the panel should be in 'show' mode or 'hide' mode when the page initialises
var cookiePos = document.cookie.indexOf( 'hide' + name + '=' );
if ( cookiePos > -1 && document.cookie.charAt( cookiePos + ( 'hide' + name + '=' ).length ) == 1 ) {
flipExpando( name );
}
}
}
// flips the current state of the specified expando panel. it if's currently expanded it will be collapsed
// and vice versa. also updates the local cookie so that we can remember the state when we come back to
// the current page. note that the changeText function is defined in wikibits.js.
function flipExpando( name ) {
// get references to the body content and toggle link for this named panel
var expandoBody = document.getElementById( name + '-body' );
var expandoLink = document.getElementById( name + '-link' );
// check if the panel is in expanded or collapsed mode, then switch the mode and update the cookie
if ( expandoBody && expandoLink && expandoBody.style.display == 'none' ) {
changeText( expandoLink, expandoHideText );
expandoBody.style.display = 'block';
document.cookie = 'hide' + name + '=0';
} else {
changeText( expandoLink, expandoShowText );
expandoBody.style.display = 'none';
document.cookie = 'hide' + name + '=1';
}
}
// ============================================================
// BEGIN Dynamic Navigation Bars (experimantal)
// This script is from Wikipedia. For author attribution, please see http://en.wikipedia.org/w/index.php?title=MediaWiki:Common.js&action=history
// ============================================================
/* 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.
// Reference: [[Wikipedia:Wikipedia:NavFrame]]
// [[Wikipedia:Help:Collapsing]]
// Maintainers: [[Wikipedia:User:R. Koot]]
//
// =====================================================================
var autoCollapse = 2;
var collapseCaption = 'pienennä';
var expandCaption = 'suurenna';
function collapseTable( tableIndex ) {
var Button = document.getElementById( 'collapseButton' + tableIndex );
var Table = document.getElementById( 'collapsibleTable' + tableIndex );
if ( !Table || !Button ) {
return false;
}
var Rows = Table.getElementsByTagName( 'tr' );
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 );
} else if ( hasClass( NavigationBoxes[i], 'innercollapse' ) ) {
var element = NavigationBoxes[i];
while ( element = element.parentNode ) {
if ( hasClass( element, 'outercollapse' ) ) {
collapseTable ( i );
break;
}
}
}
}
}
addOnloadHook( createCollapseButtons );
// =====================================================================
// End of Collapsible Tables
// =====================================================================
/** Dynamic Navigation Bars (experimental) *************************************
*
* Description: See [[Wikipedia:NavFrame]].
* Maintainers: UNMAINTAINED
*/
// set up the words in your language
var NavigationBarHide = '[' + collapseCaption + ']';
var NavigationBarShow = '[' + expandCaption + ']';
// set up max count of Navigation Bars on page,
// if there are more, all will be hidden
// NavigationBarShowDefault = 0; // all bars will be hidden
// NavigationBarShowDefault = 1; // on pages with more than 1 bar all bars will be hidden
var NavigationBarShowDefault = autoCollapse;
// shows and hides content and picture (if available) of navigation bars
// Parameters:
// indexNavigationBar: the index of navigation bar to be toggled
function toggleNavigationBar( indexNavigationBar ) {
var NavToggle = document.getElementById( 'NavToggle' + indexNavigationBar );
var NavFrame = document.getElementById( 'NavFrame' + indexNavigationBar );
if ( !NavFrame || !NavToggle ) {
return false;
}
// if shown now
if ( NavToggle.firstChild.data == NavigationBarHide ) {
for ( var NavChild = NavFrame.firstChild; NavChild != null;
NavChild = NavChild.nextSibling
)
{
if ( hasClass( NavChild, 'NavPic' ) ) {
NavChild.style.display = 'none';
}
if ( hasClass( NavChild, 'NavContent' ) ) {
NavChild.style.display = 'none';
}
}
NavToggle.firstChild.data = NavigationBarShow;
// if hidden now
} else if ( NavToggle.firstChild.data == NavigationBarShow ) {
for ( var NavChild = NavFrame.firstChild; NavChild != null;
NavChild = NavChild.nextSibling
)
{
if ( hasClass( NavChild, 'NavPic' ) ) {
NavChild.style.display = 'block';
}
if ( hasClass( NavChild, 'NavContent' ) ) {
NavChild.style.display = 'block';
}
}
NavToggle.firstChild.data = NavigationBarHide;
}
}
// adds show/hide-button to navigation bars
function createNavigationBarToggleButton() {
var indexNavigationBar = 0;
// iterate over all < div >-elements
var divs = document.getElementsByTagName( 'div' );
for( var i = 0; NavFrame = divs[i]; i++ ) {
// if found a navigation bar
if ( hasClass( NavFrame, 'NavFrame' ) ) {
indexNavigationBar++;
var NavToggle = document.createElement( 'a' );
NavToggle.className = 'NavToggle';
NavToggle.setAttribute( 'id', 'NavToggle' + indexNavigationBar );
NavToggle.setAttribute( 'href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');' );
var NavToggleText = document.createTextNode( NavigationBarHide );
NavToggle.appendChild( NavToggleText );
// Find the NavHead and attach the toggle link
// (Must be this complicated because Moz's firstChild handling is borked)
for( var j = 0; j < NavFrame.childNodes.length; j++ ) {
if ( hasClass( NavFrame.childNodes[j], 'NavHead' ) ) {
NavFrame.childNodes[j].appendChild( NavToggle );
}
}
NavFrame.setAttribute( 'id', 'NavFrame' + indexNavigationBar );
}
}
// if more Navigation Bars found than Default: hide all
if ( NavigationBarShowDefault < indexNavigationBar ) {
for( var i = 1; i <= indexNavigationBar; i++ ) {
toggleNavigationBar( i );
}
}
}
addOnloadHook( createNavigationBarToggleButton );
function getElementsByClassName( oElm, strTagName, oClassNames ) {
var arrElements = ( strTagName == '*' && oElm.all ) ? oElm.all : oElm.getElementsByTagName( strTagName );
var arrReturnElements = new Array();
var arrRegExpClassNames = new Array();
if( typeof oClassNames == 'object' ) {
for( var i = 0; i < oClassNames.length; i++ ) {
arrRegExpClassNames[arrRegExpClassNames.length] =
new RegExp( "(^|\\s)" + oClassNames[i].replace( /\-/g, "\\-" ) + "(\\s|$)" );
}
} else {
arrRegExpClassNames[arrRegExpClassNames.length] =
new RegExp( "(^|\\s)" + oClassNames.replace( /\-/g, "\\-" ) + "(\\s|$)" );
}
var oElement;
var bMatchesAll;
for( var j = 0; j < arrElements.length; j++ ) {
oElement = arrElements[j];
bMatchesAll = true;
for( var k = 0; k < arrRegExpClassNames.length; k++ ) {
if( !arrRegExpClassNames[k].test( oElement.className ) ) {
bMatchesAll = false;
break;
}
}
if( bMatchesAll ) {
arrReturnElements[arrReturnElements.length] = oElement;
}
}
return ( arrReturnElements );
}
// ============================================================
function createCheckboxes() {
var items = getElementsByClassName( document, 'span', 'checklistitem' );
for ( var ti = 0; ti < items.length; ti++ ) {
items[ti].innerHTML = '<input type="checkbox">' + items[ti].innerHTML;
}
}
addOnloadHook( createCheckboxes );
// ============================================================
// Overrides the function with the same name in http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/skins/common/wikibits.js
// Fixes a bug: for the sorting order, takes the whole number, not the number before the second comma.
// Also, removes spaces. See [[Help:Sorting]].
function ts_parseFloat( num ) {
if ( !num ) {
return 0;
}
num = removeSpaces( num );
num = parseFloat( num.replace( /,/g, '' ) );
return ( isNaN( num ) ? 0 : num );
}
// Keep spaces in "currency" mode, to sort a range "70 to 80" at 70, not 7080
function ts_parseFloat_ks( num ) {
if ( !num ) {
return 0;
}
num = parseFloat( num.replace( /,/g, '' ) );
return ( isNaN( num ) ? 0 : num );
}
// Auxiliary function for function ts_resortTable(lnk)
function removeSpaces( string ) {
var tstring = '';
string = '' + string;
splitstring = string.split( ' ' );
for( i = 0; i < splitstring.length; i++ ) {
tstring += splitstring[i];
}
return tstring;
}
/** Title rewrite ********************************************************
* Rewrites the page's title, used by Template:Title
* By Sikon
*/
function rewriteTitle() {
if( typeof( SKIP_TITLE_REWRITE ) != 'undefined' && SKIP_TITLE_REWRITE ) {
return;
}
var titleDiv = document.getElementById( 'title-meta' );
if( titleDiv == null || titleDiv == undefined ) {
return;
}
var cloneNode = titleDiv.cloneNode( true );
var firstHeading = getElementsByClass( 'firstHeading', document.getElementById( 'content' ), 'h1' )[0];
var node = firstHeading.childNodes[0];
// new, then old!
firstHeading.replaceChild( cloneNode, node );
cloneNode.style.display = 'inline';
var titleAlign = document.getElementById( 'title-align' );
firstHeading.style.textAlign = titleAlign.childNodes[0].nodeValue;
}
addOnloadHook( rewriteTitle, false );
/* This global variable specifies if client-side persistent storage is available. */
window.storagePresent = ( typeof( globalStorage ) != 'undefined' );
/* Stores the (unmodified) page title. */
function storePageName() {
if ( skin == 'monobook' || skin == 'vector' ) {
window.pageName = jQuery( 'h1#firstHeading span' ).text();
} else if ( skin == 'bluecloud' || skin == 'eminence' || skin == 'monaco' ) {
window.pageName = jQuery( 'h1.firstHeading' ).text();
} else if ( skin == 'games' || skin == 'nimbus' || skin == 'sports' ) {
window.pageName = jQuery( 'h1.pagetitle' ).text();
} else if ( skin == 'hope' ) {
window.pageName = jQuery( 'h2#one' ).text();
} else if ( skin == 'modern' ) {
window.pageName = jQuery( 'h1#firstHeading span' ).text();
} else if ( skin == 'truglass' ) {
window.pageName = jQuery( 'h1#title' ).text();
}
}
/* Adds a trim method to string variables. */
String.prototype.trim = function() {
return this.replace( /^\s+|\s+$/g, '' );
};
/* Searches an array for an element and returns its index, or -1 if it's not in the array. */
function arrayFind( array, value ) {
for( var i = 0; i < array.length; i++ ) {
if( array[i] == value ) {
return i;
}
}
return -1;
}
/* Removes the first occurrence of an element in an array, if it is there. */
function arrayRemove( array, value ) {
var i = arrayFind( array, value );
if( i != -1 ) {
array.splice( i, 1 );
}
}
/*
the ContentLoader class to encapsulate "creative differences" with XHR
Usage:
- construct a ContentLoader object: var loader = new ContentLoader();
- set necessary state parameters (via fields); e.g. loader.myvar = 'mytext';
- set the callback: loader.callback = myfunc;
- send the request:
loader.send(url, postdata = null, contentType = 'application/x-www-form-urlencoded');
(if postdata isn't null or omitted, POST is used, otherwise GET)
- the callback function is called when the content is loaded
- the ContentLoader object is this
- the raw response data is this.text
- the XML DOM object, if any, is this.document
*/
function ContentLoader() {
this.cache = true;
}
ContentLoader.prototype.enableCache = function( caching ) {
this.cache = ( caching == null ) ? true : this.cache;
}
ContentLoader.prototype.createRequest = function() {
if( typeof( XMLHttpRequest ) != 'undefined' ) {
return new XMLHttpRequest();
} else if( typeof( ActiveXObject ) != 'undefined' ) {
return new ActiveXObject( 'Msxml2.XMLHTTP' );
}
return null;
}
ContentLoader.prototype.send = function( url, postdata, contentType ) {
var method = ( postdata == null ) ? 'GET' : 'POST';
this.request = this.createRequest();
this.request.open( method, url );
if( !this.cache ) {
this.request.setRequestHeader( 'If-Modified-Since', 'Sat, 1 Jan 2000 00:00:00 GMT' );
}
var request = this.request;
var loader = this;
if( postdata == null ) {
if( contentType == null ) {
contentType = 'application/x-www-form-urlencoded';
}
request.setRequestHeader( 'Content-type', contentType );
}
var f = function() {
if( request.readyState == 4 ) {
loader.text = request.responseText;
loader.document = request.responseXML;
request = null;
loader.request = null;
loader.callback();
}
};
this.request.onreadystatechange = f;
this.request.send( postdata );
}
/* end ContentLoader */
/*
Source: http://www.dustindiaz.com/getelementsbyclass/
getElementsByClass, which complements getElementById and getElementsByTagName, returns an array of all subelements of ''node'' that are tagged with a specific CSS class (''searchClass'') and are of the tag name ''tag''. If tag is null, it searches for any suitable elements regardless of the tag name.
Example: getElementsByClass( 'infobox', document.getElementById( 'content' ), 'div' ) selects the same elements as the CSS declaration #content div.infobox
*/
function getElementsByClass( searchClass, node, tag ) {
var classElements = new Array();
if( node == null ) {
node = document;
}
if( tag == null ) {
tag = '*';
}
var els = node.getElementsByTagName( tag );
var elsLen = els.length;
var tester = new ClassTester( searchClass );
for( i = 0, j = 0; i < elsLen; i++ ) {
if( tester.isMatch( els[i] ) ) {
classElements[j] = els[i];
j++;
}
}
return classElements;
}
function ClassTester( className ) {
this.regex = new RegExp( "(^|\\s)" + className + "(\\s|$)" );
}
ClassTester.prototype.isMatch = function( element ) {
return this.regex.test( element.className );
}
/* end getElementsByClass */
/* Returns the parameter as it appears in the query string. Equivalent to $_GET['p'] in PHP. */
function queryString( p ) {
var re = RegExp( '[&?]' + p + '=([^&]*)' );
var matches;
matches = re.exec( document.location );
if( matches ) {
try {
return decodeURI( matches[1] );
} catch( e ) { }
}
return null;
}
/* Dynamically load a combobox's content by pagename (e. g. Template:Stdsummaries). The page should be of the same format as http://starwars.wikia.com/wiki/Template:Stdsummaries */
function requestComboFill( id, page ) {
var loader = new ContentLoader();
loader.comboID = id;
loader.callback = onComboDataArrival;
loader.send( wgScriptPath + '/index.php?title=' + page + '&action=raw&ctype=text/plain' );
}
function onComboDataArrival() {
fillCombo( this.text, this.comboID );
}
function fillCombo( text, comboid ) {
var combo = document.getElementById( comboid );
var lines = text.split( "\n" );
for( var i = 0; i < lines.length; i++ ) {
var value = lines[i].indexOf( '-- ' ) == 0 ? lines[i].substring( 3 ) : '';
var option = document.createElement( 'option' );
option.setAttribute( 'value', value );
option.appendChild( document.createTextNode( lines[i] ) );
combo.appendChild( option );
}
}
/* end combo fill code */
/* Loads the current source of the page "pagename" (as stored in the database) and inserts it at the cursor position */
function doPreload( pagename ) {
var loader = new ContentLoader();
loader.callback = onPreloadArrival;
loader.send( wgScriptPath + '/index.php?title=' + pagename + '&action=raw&ctype=text/plain' );
}
function insertAtCursor( myField, myValue ) {
// IE support
if( document.selection ) {
myField.focus();
sel = document.selection.createRange();
sel.text = myValue;
} else if( myField.selectionStart || myField.selectionStart == '0' ) { // MOZILLA/NETSCAPE support
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
myField.value = myField.value.substring( 0, startPos ) + myValue +
myField.value.substring( endPos, myField.value.length );
} else {
myField.value += myValue;
}
}
function onPreloadArrival() {
insertAtCursor( document.getElementById( 'wpTextbox1' ), this.text );
}
/* end preload code */
/* Returns h1.firstHeading (the page title element). */
function getFirstHeading() {
var elements = getElementsByClass( 'firstHeading', document.getElementById( 'content' ), 'h1' );
return ( elements != null && elements.length > 0 ) ? elements[0] : null;
}
/* Returns the element's nearest parent that has the specified CSS class. */
function getParentByClass( className, element ) {
var tester = new ClassTester( className );
var node = element.parentNode;
while( node != null && node != document ) {
if( tester.isMatch( node ) ) {
return node;
}
node = node.parentNode;
}
return null;
}
/* Makes the image on the search form, if one is present, point to the search page. */
function rewriteSearchFormLink() {
var links = document.getElementById( 'searchform' ).getElementsByTagName( 'a' );
if( links.length > 0 ) {
links[0].href = wgScriptPath + '/index.php?title=Special:Search&adv=1';
}
}
/* Replaces {{USERNAME}} with the name of the user browsing the page. Requires copying Template:USERNAME. */
function substUsername() {
var spans = getElementsByClass( 'insertusername', null, 'span' );
for( var i = 0; i < spans.length; i++ ) {
spans[i].innerHTML = wgUserName;
}
}
/* Performs dynamic hover class rewriting to work around the IE6 :hover bug (needs CSS changes as well) */
function rewriteHover() {
var gbl = document.getElementById( 'hover-global' );
if( gbl == null ) {
return;
}
var nodes = getElementsByClass( 'hoverable', gbl );
for( var i = 0; i < nodes.length; i++ ) {
nodes[i].onmouseover = function() {
this.className += ' over';
}
nodes[i].onmouseout = function() {
this.className = this.className.replace( new RegExp( " over\\b" ), '' );
}
}
}
// onload stuff
var firstRun = true;
function loadFunc() {
if( firstRun ) {
firstRun = false;
} else {
return;
}
storePageName();
// DEPRECATED
if( document.getElementById( 'infoboxinternal' ) != null && document.getElementById( 'infoboxend' ) != null ) {
document.getElementById( 'infoboxend' ).innerHTML = '<a id="infoboxtoggle" href="javascript:infoboxToggle()">[Hide]</a>';
}
addHideButtons();
if( document.getElementById( 'mp3-navlink' ) != null ) {
document.getElementById( 'mp3-navlink' ).onclick = onArticleNavClick;
document.getElementById( 'mp3-navlink' ).getElementsByTagName( 'a' )[0].href = 'javascript:void(0)';
}
if( window.storagePresent ) {
initVisibility();
}
rewriteSearchFormLink();
fillEditSummaries();
fillPreloads();
if( typeof( onPageLoad ) != 'undefined' ) {
onPageLoad();
}
}
function fillEditSummaries() {
var label = document.getElementById( 'wpSummaryLabel' );
if( label == null ) {
return;
}
var comboString = 'Yleiset yhteenvedot: <select id="stdSummaries" onchange="onStdSummaryChange()">';
comboString += '</select><br />';
label.innerHTML = comboString + label.innerHTML;
requestComboFill( 'stdSummaries', 'Template:Stdsummaries' );
}
function onStdSummaryChange() {
var combo = document.getElementById( 'stdSummaries' );
var value = combo.options[combo.selectedIndex].value;
if( value != '' ) {
document.getElementById( 'wpSummary' ).value = value;
}
}
function onStdReasonChange() {
var combo = document.getElementById( 'stdReasons' );
var value = combo.options[combo.selectedIndex].value;
if( value != '' ) {
document.getElementById( 'wpReason' ).value = value;
}
}
function fillPreloads() {
var div = document.getElementById( 'lf-preload' );
if( div == null ) {
return;
}
div.style.display = 'block';
var span = document.getElementById( 'lf-preload-cbox' );
var comboString = '<select id="stdPreloads" onchange="onPreloadChange()">';
comboString += '</select>';
span.innerHTML = comboString;
span = document.getElementById( 'lf-preload-pagename' );
span.innerHTML = '<input type="text" class="textbox" />';
span = document.getElementById( 'lf-preload-button' );
span.innerHTML = '<input type="button" class="button" value="Lisää" onclick="doCustomPreload()" />';
requestComboFill( 'stdPreloads', 'Template:Stdpreloads' );
}
function doCustomPreload() {
var page = document.getElementById( 'lf-preload-pagename' ).getElementsByTagName( 'input' )[0].value;
if ( page != '' ) {
doPreload( page );
} else {
alert(
'Sivun nimi tulee määritellä. ' +
'Artikkelilla, jolla on ohjauksia, itse artikkelin nimi (ohjauksien kohdesivu) pitää antaa.'
);
}
}
function onPreloadChange() {
var combo = document.getElementById( 'stdPreloads' );
var value = combo.options[combo.selectedIndex].value;
if( value == '' ) {
return;
}
value = 'Template:' + value + '/preload';
value = value.replace( ' ', '_' );
doPreload( value );
}
function initVisibility() {
var storage = globalStorage[window.location.hostname];
var page = window.pageName.replace( /\W/g, '_' );
var show = storage.getItem( 'infoboxshow-' + page );
if( show == 'false' ) {
infoboxToggle();
}
var hidables = getElementsByClass( 'hidable' );
for( var i = 0; i < hidables.length; i++ ) {
show = storage.getItem( 'hidableshow-' + i + '_' + page );
if( show == 'false' ) {
var content = getElementsByClass( 'hidable-content', hidables[i] );
var button = getElementsByClass( 'hidable-button', hidables[i] );
if(
content != null && content.length > 0 &&
button != null && button.length > 0 &&
content[0].style.display != 'none'
)
{
button[0].onclick( 'bypass' );
}
} else if( show == 'true' ) {
var content = getElementsByClass( 'hidable-content', hidables[i] );
var button = getElementsByClass( 'hidable-button', hidables[i] );
if(
content != null && content.length > 0 &&
button != null && button.length > 0 &&
content[0].style.display == 'none'
)
{
button[0].onclick( 'bypass' );
}
}
}
}
function addHideButtons() {
var hidables = getElementsByClass( 'hidable' );
for( var i = 0; i < hidables.length; i++ ) {
var box = hidables[i];
var button = getElementsByClass( 'hidable-button', box, 'span' );
if( button != null && button.length > 0 ) {
button = button[0];
button.onclick = toggleHidable;
button.appendChild( document.createTextNode( '[Piilota]' ) );
if( new ClassTester( 'start-hidden' ).isMatch( box ) ) {
button.onclick( 'bypass' );
}
}
}
}
function toggleHidable( bypassStorage ) {
var parent = getParentByClass( 'hidable', this );
var content = getElementsByClass( 'hidable-content', parent );
var nowShown;
if( content != null && content.length > 0 ) {
content = content[0];
if( content.style.display == 'none' ) {
content.style.display = content.oldDisplayStyle;
this.firstChild.nodeValue = '[Piilota]';
nowShown = true;
} else {
content.oldDisplayStyle = content.style.display;
content.style.display = 'none';
this.firstChild.nodeValue = '[Näytä]';
nowShown = false;
}
if(
window.storagePresent &&
( typeof( bypassStorage ) == 'undefined' || bypassStorage != 'bypass' )
)
{
var page = window.pageName.replace( /\W/g, '_' );
var items = getElementsByClass( 'hidable' );
var item = -1;
for( var i = 0; i < items.length; i++ ) {
if( items[i] == parent ) {
item = i;
break;
}
}
if( item == -1 ) {
return;
}
var storage = globalStorage[window.location.hostname];
storage.setItem( 'hidableshow-' + item + '_' + page, nowShown );
}
}
}
addOnloadHook( loadFunc );
// addOnloadHook( fillPreloads );
// ============================================================
// Collapsible sidebar portlets
// Author: wikipedia:User:Splarka
// ============================================================
function foldingPortlets() {
var portlets = getElementsByClassName( document.getElementById( 'column-one' ), 'div', 'portlet' );
var portskip = ['p-personal', 'p-cactions', 'p-logo', 'p-search', 'p-tb', 'p-lang'];
var num = 0;
for ( var i = 0; i < portlets.length; i++ ) {
if ( portskip.join( ' ' ).indexOf( portlets[i].id ) == -1 ) {
var pd = portlets[i].getElementsByTagName( 'div' )[0];
var ph = portlets[i].getElementsByTagName( 'h5' )[0];
ph.className = 'portletCollapsible';
pd.setAttribute( 'id', 'pbody-' + i );
pd.style.display = 'none';
var link = document.createElement( 'a' );
var head = getAllText( ph );
while ( ph.firstChild ) {
ph.removeChild( ph.firstChild );
}
link.appendChild( document.createTextNode( head ) );
link.setAttribute( 'href', 'javascript:showPortlet("' + i + '");' );
link.setAttribute( 'id', 'plink-' + i );
link.className = 'portletClosed';
ph.appendChild( link );
if ( num++ < 3 ) {
showPortlet( i );
}
}
}
}
if ( skin == 'monobook' && !window.portletsNormal ) {
addOnloadHook( foldingPortlets );
}
function getAllText( thing ) {
if ( thing.nodeType == 3 ) {
return thing.nodeValue;
}
var text = new Array();
var i = 0;
while ( thing.childNodes[i] ) {
text[text.length] = getAllText( thing.childNodes[i] );
i++;
}
return text.join( '' );
}
function showPortlet( id ) {
var pd = document.getElementById( 'pbody-' + id );
var pl = document.getElementById( 'plink-' + id );
if ( pd.style.display == 'none' ) {
pd.style.display = 'block';
pl.className = 'portletOpened';
} else {
pd.style.display = 'none';
pl.className = 'portletClosed';
}
}
// ============================================================
// End of Collapsible sidebar portlets
// ============================================================
///////////////////////////////////////////////////////////////////////////////////////////////////////////
// ADVANCED AJAX AUTO-REFRESHING ARTICLES
// Code courtesy of "pcj" of WoWWiki.
// Coding style fixes & code comments by Jack Phoenix <jack@countervandalism.net>
// Date: 7 October 2010
///////////////////////////////////////////////////////////////////////////////////////////////////////////
// Array of special pages where AJAX RC is active.
// Use *canonical* names (see page source, the value of wgCanonicalSpecialPageName if you don't know it)
ajaxPages = [ 'Recentchanges', 'Watchlist', 'Log' ];
// Internationalizable texts, courtesy of wikia:User:Grunny
var refreshText = 'Automatically refresh:';
if( typeof AjaxRCRefreshText == 'string' ) {
refreshText = AjaxRCRefreshText;
}
var refreshHover = 'Enable auto-refreshing page loads';
if( typeof AjaxRCRefreshHoverText == 'string' ) {
refreshHover = AjaxRCRefreshHoverText;
}
/**
* Sets a cookie with the given options
* @param c_name String: name of the cookie to set
* @param value String: 'on' or 'off'
* @param expiredays Integer: The cookie expires after this many days
*/
function setCookie( c_name, value, expiredays ) {
var exdate = new Date();
exdate.setDate( exdate.getDate() + expiredays );
document.cookie = c_name + '=' + escape( value ) + ( ( expiredays === null ) ? '' : ';expires=' + exdate.toGMTString() );
}
/**
* Gets a cookie with the specified name
* @param c_name String: cookie name
* @return Cookie name or nothing
*/
function getCookie( c_name ) {
if( document.cookie.length > 0 ) {
c_start = document.cookie.indexOf( c_name + '=' );
if( c_start != -1 ) {
c_start = c_start + c_name.length + 1;
c_end = document.cookie.indexOf( ';', c_start );
if( c_end == -1 ) {
c_end = document.cookie.length;
}
return unescape( document.cookie.substring( c_start, c_end ) );
}
}
return '';
}
// @todo FIXME: use MediaWiki's AJAX framework?
function getXmlHttpRequestObject() {
if( window.XMLHttpRequest ) {
return new XMLHttpRequest(); // Not Internet Explorer
} else if( window.ActiveXObject ) {
return new ActiveXObject( "Microsoft.XMLHTTP" ); // Internet Explorer
} else {
// fail silently
}
}
getRCDataRO = getXmlHttpRequestObject();
var cr = new RegExp( "\r", 'gm' );
var lf = new RegExp( "\n", 'gm' );
var endText = new RegExp( '</div>[\t\s]*?<!-- end content -->[\t\s]*?<div class="visualClear">', 'mi' );
var rcTimer;
var rcRefresh = 60000;
function preloadAJAXRC() {
if( skin == 'monaco' ) {
s = 1;
} else {
s = 0;
}
ajaxRCCookie = ( getCookie( 'ajaxload-' + wgPageName ) == 'on' ) ? true : false;
document.getElementsByTagName( 'h1' )[0].innerHTML += ' <span style="font-size: xx-small; border-bottom: 1px dotted; cursor:help;" title="' + refreshHover + '">' + refreshText + '</span><input type="checkbox" id="ajaxRCtoggle" onClick="toggleRC();">';
document.getElementById( 'ajaxRCtoggle' ).checked = ajaxRCCookie;
if( getCookie( 'ajaxload-' + wgPageName ) == 'on' ) {
loadRCData();
}
}
function toggleRC() {
if( document.getElementById( 'ajaxRCtoggle' ).checked === true ) {
setCookie( 'ajaxload-' + wgPageName, 'on', 30 );
loadRCData();
} else {
setCookie( 'ajaxload-' + wgPageName, 'off', 30 );
clearTimeout( rcTimer );
}
}
function loadRCData() {
if( getRCDataRO.readyState == 4 || getRCDataRO.readyState === 0 ) {
if( location.href.indexOf( '/wiki/' ) ) {
rcURL = 'http://' + location.hostname + '/wiki/' + wgPageName + location.search;
} else {
rcURL = 'http://' + location.hostname + '/' + wgPageName + location.search;
}
getRCDataRO.open( 'GET', rcURL, true );
getRCDataRO.onreadystatechange = parseRCdata;
getRCDataRO.send( null );
}
}
function parseRCdata() {
if( getRCDataRO.readyState == 4 ) {
textFilter = new RegExp( '<div id="bodyContent">.*?</div>[\t\s]*?<!-- end content -->[\t\s]*?<div class="visualClear">', 'i' );
rawRCdata = getRCDataRO.responseText.replace( cr, '' ).replace( lf, '' );
filteredRCdata = textFilter.exec( rawRCdata );
updatedText = filteredRCdata[0].replace( '<div id="bodyContent">', '' ).replace( endText, '' );
document.getElementById( 'bodyContent' ).innerHTML = updatedText;
rcTimer = setTimeout( 'loadRCData();', rcRefresh );
}
}
// Only load this JS for certain, pre-defined special pages
for( x in ajaxPages ) {
if( wgCanonicalSpecialPageName == ajaxPages[x] ) {
addOnloadHook( preloadAJAXRC );
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////
// END OF AJAX AUTO-REFRESH
///////////////////////////////////////////////////////////////////////////////////////////////////////////
// Suomenkieliset tekstit AJAX RC -vekottimelle (katso ylemmäs)
refreshText = 'Päivitä automaattisesti:';
refreshHover = 'Ota käyttöön automaattisesti päivittyvät sivulataukset';
// **************************************************
// Experimental JavaScript countdown timer (Splarka)
// Version 0.0.3
// **************************************************
//
// Usage example:
// <span class="countdown" style="display:none;">
// Only <span class="countdowndate">January 01 2007 00:00:00 PST</span> until New years.
// </span>
// <span class="nocountdown">JavaScript disabled.</span>
function updatetimer( i ) {
var now = new Date();
var then = timers[i].eventdate;
var diff = count = Math.floor( ( then.getTime() - now.getTime() ) / 1000 );
// catch bad date strings
if( isNaN( diff ) ) {
timers[i].firstChild.nodeValue = '** ' + timers[i].eventdate + ' **';
return;
}
// determine plus/minus
if( diff < 0 ) {
diff = -diff;
var tpm = 'T plus ';
} else {
var tpm = 'T minus ';
}
// calculate the diff
var left = ( diff % 60 ) + ' sekuntia';
diff = Math.floor( diff / 60 );
if( diff > 0 ) {
left = ( diff % 60 ) + ' minuuttia ' + left;
}
diff = Math.floor( diff / 60 );
if( diff > 0 ) {
left = ( diff % 24 ) + ' tuntia ' + left;
}
diff = Math.floor( diff / 24 );
if( diff > 0 ) {
left = diff + ' päivää ' + left;
}
timers[i].firstChild.nodeValue = tpm + left;
// a setInterval() is more efficient, but calling setTimeout()
// makes errors break the script rather than infinitely recurse
timeouts[i] = setTimeout( 'updatetimer(' + i + ')', 1000 );
}
function checktimers() {
// hide 'nocountdown' and show 'countdown'
var nocountdowns = getElementsByClassName( document, 'span', 'nocountdown' );
for( var i in nocountdowns ) {
nocountdowns[i].style.display = 'none';
}
var countdowns = getElementsByClassName( document, 'span', 'countdown' );
for( var i in countdowns ) {
countdowns[i].style.display = 'inline';
}
// set up global objects timers and timeouts.
timers = getElementsByClassName( document, 'span', 'countdowndate' ); // global
timeouts = new Array(); // generic holder for the timeouts, global
if( timers.length == 0 ) {
return;
}
for( var i in timers ) {
timers[i].eventdate = new Date( timers[i].firstChild.nodeValue );
updatetimer( i ); // start it up
}
}
addOnloadHook( checktimers );
// **************************************************
// - end - Experimental JavaScript countdown timer
// **************************************************
// ============================================================
// Experimental EMBEDDING hack for multimedia files
//
// Used in: [[Template:Listen]]
// Function: Embeds a file based if the DIV class is "embedMe"
// The "src" is located in the DIV id.
// ============================================================
function embedMe() {
var allDivs = document.getElementsByTagName( 'div' );
for ( var i = 0; i < allDivs.length; i++ ) {
var divClass = allDivs[i].getAttribute( 'class' );
if ( divClass == null ) { // For IE
var divClass = allDivs[i].getAttribute( 'className' );
}
if ( divClass == 'embedMe' ) {
var filename = allDivs[i].id
if( filename == null || filename == undefined ) {
return;
}
filename = filename.replace( /\.2F/gi, '/' );
var embedString = '<embed src="http://' + filename + '" height="60" width="150" volume="100" autostart="false">';
allDivs[i].innerHTML = embedString;
}
}
}
addOnloadHook( embedMe );
// ============================================================
// End of Experimental EMBEDDING hack
// ============================================================
// ============================================================
// wikiSiteMeter
//
// Function: Adds a counter from http://www.sitemeter.com/
// ============================================================
function wikiSiteMeter() {
if( skin == 'monobook' ) {
var sidebar = document.getElementById( 'p-tb' );
if( sidebar == null ) {
return;
}
var comboString = '<br /><h5>wiki site meter</h5>';
comboString += '<div class="pBody"><div style="margin-top:2px; margin-bottom:5px;"><table><tr><td><a href="http://sm6.sitemeter.com/stats.asp?site=sm6runescapewiki" target="_top"><img src="http://sm6.sitemeter.com/meter.asp?site=sm6runescapewiki" alt="Site Meter" border="0" /></a></td></tr></table></div></div>';
sidebar.innerHTML += comboString;
}
}
addOnloadHook( wikiSiteMeter );
// ============================================================
// End of wikiSiteMeter
// ============================================================
// ==================================================================
// Added SiteNotice Functionality
//
// Functions:
// * Moves the dismiss link into the SiteNotice table.
// * Saves the show/hide status of the SiteNotice in a cookie.
// * Automatically expands the SiteNotice when the ID is updated.
// ==================================================================
var dCookieName = 'dismissSiteNotice=';
var msgClose = 'älä näytä';
var msgDismiss = 'Piilota tämä viesti.';
var hCookieName = 'hideSiteNotice=';
var hCookiePos = document.cookie.indexOf( hCookieName );
var hCookieValue = '';
function editSiteNotice() {
var snbox = document.getElementById( 'mw-dismissable-notice' );
if ( snbox != null ) {
if ( hCookiePos > -1 ) {
hCookiePos = hCookiePos + hCookieName.length;
var hideEndPos = document.cookie.indexOf( ';', hCookiePos );
if ( hideEndPos > -1 ) {
hCookieValue = document.cookie.substring( hCookiePos, hideEndPos );
} else {
hCookieValue = document.cookie.substring( hCookiePos );
}
}
var newLink = document.createElement( 'a' );
newLink.setAttribute( 'href', 'javascript:dismissNotice();' );
newLink.setAttribute( 'title', msgDismiss );
newLink.innerHTML = msgClose;
var newSpan = document.createElement( 'span' );
newSpan.id = 'siteNoticeDismiss';
newSpan.appendChild( document.createTextNode( ' [' ) );
newSpan.appendChild( newLink );
newSpan.appendChild( document.createTextNode( ']' ) );
var hideLink = document.getElementById( 'collapseButton' + '0' );
if ( hideLink !== null ) {
hideLink.href = 'javascript:hideSiteNotice();';
hideLink.parentNode.style.width = '12em';
hideLink.parentNode.appendChild( newSpan );
if ( hCookieValue != siteNoticeID && hideLink.innerHTML == 'suurenna' ) {
collapseTable( 0 );
}
if ( hCookieValue == siteNoticeID && hideLink.innerHTML == 'pienennä' ) {
collapseTable( 0 );
}
}
}
}
function hideSiteNotice() {
var hideLink = document.getElementById( 'collapseButton' + '0' );
var date = new Date();
if ( hideLink.innerHTML == 'hide' ) {
date.setTime( date.getTime() + 30 * 86400 * 1000 );
} else {
date.setTime( date.getTime() - 30 * 86400 * 1000 );
}
document.cookie = hCookieName + siteNoticeID + '; expires=' +
date.toGMTString() + '; path=/';
collapseTable( 0 );
}
addOnloadHook( editSiteNotice );
// ==================================================================
// End of Added SiteNotice Functionality
// ==================================================================
function createCheckboxes() {
var items = getElementsByClassName( document, 'span', 'checklistitem' );
for ( var ti = 0; ti < items.length; ti++ ) {
items[ti].innerHTML = '<input type="checkbox">' + items[ti].innerHTML;
}
}
addOnloadHook( createCheckboxes );
// Google
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-23629662-1']);
_gaq.push(['_trackPageview']);
( function() {
var ga = document.createElement( 'script' );
ga.type = 'text/javascript';
ga.async = true;
ga.src = ( 'https:' == document.location.protocol ? 'https://ssl' : 'http://www' ) + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName( 'script' )[0];
s.parentNode.insertBefore( ga, s );
} )();
/* </pre> */