MediaWiki:Common.js

From MassiveCraft Wiki
Revision as of 21:01, 3 September 2017 by Suzzie (talk | contribs)
Jump to navigation Jump to search

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
/*
* TRIVIA AT BOTTOM OF ACCREDITATION.
* ----------------------------------
*/
var a = [
	
	["The Regalian Empire is rivalled only by the Songaskian Masaya in terms of power and authority.", "Regalia"],
	["Ailor are the most populous race in all of Aloria, and are also the most affluent.", "Ailor"],
	["Orcs are often considered the strongest, yet dumbest, race in Aloria. ", "Orc"],
	["TheAirships were designed to look like a mythical animal from Ellador, the Aetherwhale.", "Aetherwhale"],
	["Orcs created the world’s biggest firework, and the show was so awe-inspiring that it destroyed the Elven Empire.", "Elven Empire"],
	["Despite their bear-like appearance, the Ur of Jorrhildr are active pacifists and dislike fighting.", "Ur"],
	["Although the Nelfin are to thank for the advancements in Metallurgy, Dwarves will often feign that they were the true inventors of now mythical forges.", "Metallurgy"],
	["Magic is a very uncommon sight in Regalia, and most shun its existence and usage.", "Magic"],
	["The Regalian Empire is home to a number of Knightly Orders, including the Viridian Order, the Turall Bladesmen, and the Helerian Guards.", "Military Schools"],
	["There are two main Orc clans in Daendroc: The aggressive Blood Clans, and the friendlier Dark Iron Clans.", "Orcs"],
	["There was once a race of sentient trees known as the Nenya, though they are rare sights after the Night of the Fallen Star.", "Nenya"],
	["Slizzar, despite being alien in appearance, will often use their beauty (and a little bit of magic) to win over powerful allies.", "Slizzar"],
	["Alchemists say that Dwarvish blood has accelerated healing properties that can be applied in medicine.", "Alchemy"],
	["The Saivalthar of Saivalé spend their days partying and their nights testing magical experiments.", "Saivalthar"],
	["Antelabbits, despite initially looking soft and fuzzy, are carnivorous killers that pose a large threat to explorers.", "Antelabbit"],
	["Contrary to popular belief, the Basilisk does not actually petrify those who look into its eyes, although it does tend to kill them.", "Basilisk"],
	["Al-Allar and Mu-Allar are the only form of bipedal being capable of regrowing their fingers if they’ve been lost in the past.", "Allar"],
	["Altalar that do not learn magic often become Rangers.", "School of Rangers"],
	["The School of Turall is ideal for agile Ailor dual-wielders.", "School of Turall"],
	["Tresmisae Vampires do not necessarily become stupid upon infection, but they do have a heightened difficulty in mental processing.", "Tresmisae"],
	["The Viridian Knights of Regalia attend the School of Viridian, where they receive top-of-the-line military education, at a cost.", "School of Viridian"],
	["The current ruler of Regalia is Emperor Cedromar I Kade, a ruler who has established himself as a military-oriented leader.", "Cedromar Kade"],
	["Unionism is the dominant religion of the Regalian Empire, based on the Ten Creeds written by the First Emperor, Theomar the Holy.", "Unionism"],
	["Vilitatei usually tend to hide in the darkest depths of the sewers, although few have been seen wandering the surface.", "Vilitatei"],
	["Nightshade is a frequently-used poison among assassins.", "Nightshade"],
	["Tarchlann have a lot of trouble often speaking about nobility and wealth in other languages since such terms don’t exist in their own.", "Tarchlann"],
	["Orcs claim to have invented the game of Chess, and that the Ailor of Daendroc stole the game Cheukek and made it simpler so the Ailor could understand.", "Orcish Chess"],
	["The Haurmann is an eggshaped nuisance that despite their lack of any sign of intelligence and several self harming practices, have managed to stay alive.", "Haurmann"],
	["Followers of Shambala believe that the Sun is the source of all good in the world, and that covering the head prohibits the wearer from receiving the Sun’s blessings.", "Shambala"],
	["Slizzar culture has all but vanished following their destruction in and after the Chrysant War as they move to adopt the cultures of others to fit in.", "Chrysant War"],
	["Ombratore vampires can drink Goleanon’s Elixir to raise their physical capabilities, though they lose their coercive powers by consuming it.", "Ombratore"],
	["Fearsome Northerne berserkers are commonly known as Skaggers.", "School of Skagger"],
	["The exclusive Tyrian Order trains Human men into Imperial Guards of unparalleled strength and obedience to be used at the Imperial Family’s disposal.", "Tyrian Order"],
	["The Lampar cannot learn Void and Exist magic due to their terrible attention span.", "Lampar"],
	["Candle Mice make excellent pets, and even better fire starters.", "Candle Mouse"],
	["During the bone-horror crisis, the Ailor of Etosil teamed up with the Undead that live beneath the island to defend their home.", "Undead"],
	["Wolathar, otherwise known as Wild Elves, are primitive and stoic Nelfin that hold close connections to nature and their Wódbehaeri beasts.", "Wolathar"],
	["Most, with the exception of the Drowdar, do not exist long on the Drowda due to the dangerous flora and fauna.", "Drowda"],
	["Despite the many uses of Light Magic, the Discipline of Medicine actively shuns the use of the arcane arts in favor of using alchemy and surgery to treat the wounded.", "Light Magic"],
	["The School of Tenpenny is the only military school accessible to all, but is simultaneously the weakest in comparison to the others.", "School of Tenpenny"],
	["The Pilgrim’s Flock is a unit of the Regalian Army comprised of solely Dogartan monks armed with maces and wearing nothing but woolen robes.", "Dogartan Unionism"],
	["Many theorize that the Temple Orphans of Solangeria are unkillable; all attempts to prove this theory wrong have failed.", "Temple Orphans"],
	["One of the few animals that manage to survive in the frozen wasteland of Jorrhildr is the Northern Moose.", "Northern Moose"],
	["Vile Rats have been found to share a hivemind akin to that of the bumblebee.", "Vile Rats"],
	["The Avanthar are a race of brutally territorial horse-lords with the ability to imitate the traits of other races through an ability called “Imprinting.”", "Avanthar"],
	["Despite popular culture, Vampires don't have stronger immune systems than those uninfected with the dark disease.", "Vampires"],
	["It's believed the Elasmo horn is a valuable ingredient in an ‘immortality potion.’", "Elasmo"],
	["It is said that there is a shadowy organization that watches all in every corner of the city. It doesn’t exist.", "Black Order"],
	["Many Regalian scholars claim that Primal Magic is actually just an exorcism of the spirits.", "Primal Magic"],
	["Those who’ve trained in the School of Blackmark are often seen as lowlifes and scum to those in special combat schools.", "School of Blackmark"],
	["Before the spread of Ch'ien-ji knowledge on astronomy it was heavily implicated that the known world of Aloria was flat and infinite.", "Astronomy"],

	];
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 ); 

*/