Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

MediaWiki:Common.js: Difference between revisions

MediaWiki interface page
No edit summary
Shayin (talk | contribs)
No edit summary
Line 5: Line 5:
var a = [
var a = [
["If your character has been bitten by a vampire, you can determine if they're infected by rolling 1-100. If the number is 15 or lower, they're infected.", "Vampire"],
["The Regalian Empire is rivalled only by the Songaskian Masaya in terms of power and authority.", "Regalia"],
["Ailor as a name comes from the name of the world, Aloria.", "Ailor"],
 
["The term ‘Vampirate’ has been fondly coined by one Dra’lonais crew as a means of referring to themselves and their gifted bretheren.", "Dralonais"],
["Justinian II had a massive beard towards the end of his life, it almost reached down to his waist.", "Justinian_II"],
["Mekett feel certain that even if all else fails, they will be able to go to ground once more and ride out the next Void Invasion", "Mekett_History"],
["Cannibalism is actually not uncommon in Drowdar culture.", "Drowdar"],
["Mages in particular are typically keen to avoid Mind Rot.", "Mind_Rot"],
["Maiar can actually lose their intelligence after long exposure to solitude.", "Maiar"],
["Healing Light magic doesn’t work on Drowdar because of their natural resilience to magics.", "Light_Magic"],
["Middencroft’s Decoction is a dangerous poison that causes the rapid circulation of blood.", "Middencroft's_Decoction"],
["Q’urebo are considered adults around the age of 20, but can live up to 140.", "Q'urebo"],
["Although they do not do so intentionally, the Wushou almost always construct a musangwu, or ‘mourning cave.’", "Wushou_Bloodline"],
["The Dozorcovka's primary charge has been the prevention of Ur immigration.", "Dozorcovka"],
["The Sirens of Mohren have predicted that a conflict with soon uplift the very foundation of Muird.", "Muird"],
["Even while the Archdemon is trapped in Aloria, shadow mages still claim to hear the same voice tugging at them to stay when they pass through the Void. ", "Beheasal"],
["The Isldar’s central belief is that of Dragons, the belief that Dragons gave life to the world.", "Isldar"],
["In Mooriyye, both sexes will actively shave their heads to keep minimal heat.", "Mooriyye"],
["Every spirit has a certain charm associated with it, and primal mages instantly have access to that spirit’s charm.", "Primal_Magic"],
["Nobles outside of the guard may never order the execution or removal of a limb of a commoner or other noble.", "Guard_Etiquette"],
["Ailor from Jorrsundr are similar to most Northerne men, but are praised for their bulky frames, muscular bodies and height. ", "Jorrsundr"],
["Some of the oldest Dwarven families tell of a hidden burial chamber deep beneath Grebor that is theorized to hold the armor and artifacts of their king turned deity, Duindin.", "Grebor"],
];
];
var pre = "<b>Did You Know?</b> "
var pre = "<b>Did You Know?</b> "

Revision as of 18:20, 29 April 2017

/*
* TRIVIA AT BOTTOM OF ACCREDITATION.
* ----------------------------------
*/
var a = [
	
	["The Regalian Empire is rivalled only by the Songaskian Masaya in terms of power and authority.", "Regalia"],

	];
var pre = "<b>Did You Know?</b> "
var randomValue = a[Math.floor(a.length * Math.random())];

var url = "<a href='http://wiki.massivecraft.com/" + randomValue[1] + "'>here</a>."

document.getElementById("trivia").innerHTML = pre +  randomValue[0];
document.getElementById("read").innerHTML = url;


/**
 * Collapsible tables
 *
 * Allows tables to be collapsed, showing only the header. See [[Wikipedia:NavFrame]].
 *
 * @version 2.0.3 (2014-03-14)
 * @source https://www.mediawiki.org/wiki/MediaWiki:Gadget-collapsibleTables.js
 * @author [[User:R. Koot]]
 * @author [[User:Krinkle]]
 * @deprecated Since MediaWiki 1.20: Use class="mw-collapsible" instead which
 * is supported in MediaWiki core.


var autoCollapse = 2;
var collapseCaption = 'hide';
var expandCaption = 'show';
var tableIndex = 0;

function collapseTable( tableIndex ) {
    var Button = document.getElementById( 'collapseButton' + tableIndex );
    var Table = document.getElementById( 'collapsibleTable' + tableIndex );

    if ( !Table || !Button ) {
        return false;
    }

    var Rows = Table.rows;
    var i;

    if ( Button.firstChild.data === collapseCaption ) {
        for ( i = 1; i < Rows.length; i++ ) {
            Rows[i].style.display = 'none';
        }
        Button.firstChild.data = expandCaption;
    } else {
        for ( i = 1; i < Rows.length; i++ ) {
            Rows[i].style.display = Rows[0].style.display;
        }
        Button.firstChild.data = collapseCaption;
    }
}

function createClickHandler( tableIndex ) {
    return function ( e ) {
        e.preventDefault();
        collapseTable( tableIndex );
    };
}

function createCollapseButtons( $content ) {
    var NavigationBoxes = {};
    var $Tables = $content.find( 'table' );
    var i;

    $Tables.each( function( i, table ) {
        if ( $(table).hasClass( 'collapsible' ) ) {

            /* only add button and increment count if there is a header row to work with EDIT HERE WITH COMMENTS
            var HeaderRow = table.getElementsByTagName( 'tr' )[0];
            if ( !HeaderRow ) {
                return;
            }
            var Header = table.getElementsByTagName( 'th' )[0];
            if ( !Header ) {
                return;
            }

            NavigationBoxes[ tableIndex ] = table;
            table.setAttribute( 'id', 'collapsibleTable' + tableIndex );

            var Button     = document.createElement( 'span' );
            var ButtonLink = document.createElement( 'a' );
            var ButtonText = document.createTextNode( collapseCaption );
            // Styles are declared in [[MediaWiki:Common.css]]
            Button.className = 'collapseButton';

            ButtonLink.style.color = Header.style.color;
            ButtonLink.setAttribute( 'id', 'collapseButton' + tableIndex );
            ButtonLink.setAttribute( 'href', '#' );
            $( ButtonLink ).on( 'click', createClickHandler( tableIndex ) );
            ButtonLink.appendChild( ButtonText );

            Button.appendChild( document.createTextNode( '[' ) );
            Button.appendChild( ButtonLink );
            Button.appendChild( document.createTextNode( ']' ) );

            Header.insertBefore( Button, Header.firstChild );
            tableIndex++;
        }
    } );

    for ( i = 0;  i < tableIndex; i++ ) {
        if ( $( NavigationBoxes[i] ).hasClass( 'collapsed' ) ||
            ( tableIndex >= autoCollapse && $( NavigationBoxes[i] ).hasClass( 'autocollapse' ) )
        ) {
            collapseTable( i );
        }
        else if ( $( NavigationBoxes[i] ).hasClass ( 'innercollapse' ) ) {
            var element = NavigationBoxes[i];
            while ((element = element.parentNode)) {
                if ( $( element ).hasClass( 'outercollapse' ) ) {
                    collapseTable ( i );
                    break;
                }
            }
        }
    }
}

mw.hook( 'wikipage.content' ).add( createCollapseButtons ); 

*/