MediaWiki:Common.js

From MassiveCraft Wiki
Revision as of 12:28, 6 September 2019 by HydraLana (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 = [
	
	["Ailor are the most populous Race in all of Aloria, and as a result, are often the most affluent as well.", "Ailor"],
	["The Sihai are the most distant Race, living beyond Aloria on the continent of Dexai in the Far East.", "Sihai"],
	["The Qadir are a Race with a past lost, destroyed by the Great Storm brought by the ancestors of the Songaskians. Now, all they have left is their clockwork, which many devote their lives to.", "Qadir"],
	["The Songaskia are the children of the Black Desert Dragon, and since they have emerged, they have dominated Farah’deen for over a century and a half.", "Songaskia"],
	["The Dwarves are a Race marred by tragedy, losing much of their population after they dug too deep under the earth, unleashing the relentless Dakkar that eventually destroyed all but two of their great Holds.", "Dwarf"],
	["Orcs are often considered the strongest, yet dumbest, Race in Aloria. ", "Orc"],
	["Orcs are often stereotyped to all be green. In fact, there are several colorations to their skin tone that is based on what Tribe they come from.", "Orcs"],
	["The Url are perhaps the most unique Race in Aloria, being a mutually-beneficial union between an exotic and alien Oorl Worm and a host body.", "Url"],
	["Varran are one of the most diverse Races in Aloria, divided into countless subraces of mammalian life and live scattered across the whole of Daen.", "Varran"],
	["Slizzar, despite being alien in their natural appearance, have the ability to transform into two different, Shifted, forms in order to appeal better to others.", "Slizzar"],
	["Allar possess a remarkably firm caste system that has ruled their society for generations.", "Allar"],
	["The Maraya are perhaps the oldest Race in Aloria, having survived the Void Cycle asleep within the earth only to awaken in the wake of the Cataclysm 300 years ago.", "Maraya"],
	["Yanar are beings of living plant matter created by the goddess Estel in the final years before the Cataclysm in an attempt to warn the Altalar of their folly. They failed in this task, and are now spread about the world, each Yanar seeking their own path.", "Yanar"],
	["All Altalar have the ability to acquire a Ring of Power, so long as they are pious and devoted enough to the Altalar Pantheon.", "Altalar"],
	["The Avanthar are a Race of territorial horse-lords with the ability to imitate the traits of other Races through an ability called “Casting.”", "Avanthar"],
	["Kathar were once just Void Worshipping Altalar, but they gave up their appearance and powers to fully gain access to the power of the Void for their own uses.", "Kathar"],
	["The Isldar protected the last Violet Night Dragon on Ellador and when it was finally killed by Dwarves, the spell they enacted changed the world.", "Isldar"],
	["The Cielothar are pacifistic animal-tenders, but have suffered much in recent years as the Regalian Empire has expanded into their territory.", "Cielothar"],
	["Sihndar have many strange abilities and even stranger beliefs, likely due to their extreme isolation in the distant north of Aloria and because of their creation as a result of warping, corrupting Essences.", "Sihndar"],
	["Half Races can be rather exotic beings, and even Races some think would be totally incompatible with each other actually are.", "Half Races"],
	["Despite popular culture, Vampires don't have stronger immune systems than those uninfected with the dark disease.", "Vampires"],
	["The Allorn Empire dominated Aloria for millennia with Magic and remarkable innovations. Unfortunately, much of this was lost to both the Wildering and the Cataclysm.", "Allorn Empire"],
	["The Regalian Empire is rivalled only by the Songaskian Masaya in terms of power and authority.", "Songaskian Masaya"],
	["The Kingdom of Nordskag is a wild place, with open expansions of wilderness and varied Velheim people living in it.", "Kingdom of Nordskag"],
	["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 Combat Schools that help to train all sorts of combatants, from knights to foot soldiers to special guardsmen.", "Schools"],
	["There are many Schools within Aloria today, of science, culture and combat, all helping to teach those willing a diverse set of skills.", "Schools"],
	["The School of Turall is ideal for agile Ailor dual-wielders.", "School of Turall"],
	["The Viridian Knights of Regalia attend the School of Viridian, where they receive top-of-the-line combat education, at a cost.", "School of Viridian"],
	["Those who’ve trained in the School of Blackmark are often seen as lowlifes and scum to those in more prestigious Combat Schools.", "School of Blackmark"],
	["The Highland Ceardians birthed the School of Lecgaen and it remains a strong expression of their Culture.", "School of Lecgaen"],
	["Anglian society had to rely on defending themselves in the waning years of the Kingdom of Regalia. From this, the Wapnboggers formed.", "School of Wapnbog"],
	["Fearsome Velheim warriors, the students of the School of Skaggers take their name from the now vanished Skagger Horde that once raided and terrified much of the Regalian Archipelago.", "School of Skagger"],
	["The exclusive School of Tyrian trains men into Imperial Guards of unparalleled strength and obedience to be used at the Imperial Family’s disposal.", "School of Tyrian"],
	["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 former ruler of Regalia was Emperor Cedromar I Kade, a ruler who established himself as a military-oriented leader but who is today best known as the Imperial Dragon.", "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"],
	["Followers of Shambala believe that the Sun is the source of all good in the world, and that she blessed the world with Dragons.", "Shambala"],
	["The true Faith of Estel died millenia ago, and has now diversified into almost half a dozen varieties between the different Nelfin Races.", "Faith of Estel"],
	["Many coastal regions of Hadaria are still recovering from the devastation they suffered during the savage coastal bombardments of the Chrysant War.", "Chrysant War"],
	["Most, with the exception of the Sihndar, cannot survive long on Drowda due to the dangerous flora and fauna.", "Drowda"],
	["The windy deserts of Farah’deen are dominated by the Songaskian Masaya, but also other nations who once jostled for status and power either against or with the powerful empire.", "Farah’deen"],
	["Ithania is a picturesque land of open fields, cossy forests, and is populated by several Races, the Ithanian Ailor the most notable given their odd customs.", "Ithania"],
	["Jorrhildr is a land of ice and snow, as well as many savage creatures, but also great and unsolved mysteries.", "Jorrhildr"],
	["Nightshade is a frequently-used poison among assassins.", "Nightshade"],
	["Ruby Flowers have many uses in the field of healing.", "Ruby Flower"],
	["Drachenwald Nuttree are almost extinct, which is a shame for the culinary world.", "Drachenwald Nuttree"],
	["Garuda Stalk has a unique dual function, one culinary and another more dastardly. Both have been used by the Sihai at different times in their history.", "Garuda Stalk"],
	["Many theorize that the Temple Orphans of Solangeria are unkillable; all attempts to prove this theory wrong have failed.", "Temple Orphan"],
	["One of the few animals that manage to survive in the frozen wasteland of Jorrhildr is the Northern Moose.", "Northern Moose"],
	["Ogres are unique beasts in Aloria, humanoid in appearance, large in size, and capable of low intellect.", "Ogres"],
	["Myths of the Longtail Gryphon often exaggerate their appearance, leading to disappointment or confusion in the ill-informed should they ever run into a real one.", "Longtail Gryphon"],
	["The Slizzar worship the Deep Sea Serpent, though the savage and carnivorous beasts lack many of the traits the serpentine Race assigns them.", "Deep Sea Serpent"],
	["The meat of the Nordskag Kreb is delicious, and the creature is commonly served abroad in non-Velheim regions.", "Nordskag Kreb"],
	["Grand Papillons are brilliantly colored creatures, possessing vivid shades of red, green and yellow depending on their gender.", "Grand Papillon"],
	["The Haurmann is an egg shaped nuisance that despite their lack of any sign of intelligence and several self harming practices, have managed to stay alive.", "Haurmann"],
	["There was once a Race of sentient trees known as the Nenya, though they are rare sights after the Night of the Fallen Star that took place in the twilight of the Allorn Empire.", "Nenya"],

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

*/