MediaWiki:Common.js

/* Any JavaScript here will be loaded for all users on every page load. */

/** * Official Google Translate Script * Google's Official 'Plugin' that translates pages from default wiki language to user's default language */

$('head').append(' ');

function googleTranslateElementInit { new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE, multilanguagePage: true}, 'google_translate_element'); }

$('.WikiHeader').append(' '); $('.WikiHeader').append(' ');

/** * Switch Infobox -- Allows multiple infoboxes to be seamlessly switched. * Required template: http://runescape.wikia.com/wiki/Template:Switch_infobox * Required stylesheet: http://runescape.wikia.com/wiki/User:Matthew2602/SwitchInfobox.css */ // Fixes a weird bug with the MW parser that adds lots of empty paragraphs $( '.switch-infobox > p, .switch-infobox-triggers > p' ).each( function {   if ( $( this ).children( 'br' ).length ) {        $( this ).remove;    } else {        $( this ).replaceWith( this.innerHTML );    } } ); // Appends the switch triggers to every item $( '.switch-infobox' ).each( function {       // The switch triggers        var triggers = $( this ).children( '.switch-infobox-triggers' );        $( this ).children( '.item' ).find( 'caption' ).append( triggers ); } ); // Does the actual switching $( '.switch-infobox' ).find( '.switch-infobox-triggers' ).children( '.trigger' ).click( function {   // The parent .switch-infobox of the clicked trigger    var parentSwitchInfobox = $( this ).parents( '.switch-infobox' );    // Hides items showing    parentSwitchInfobox.children( '.item.showing' ).removeClass( 'showing' );    // Show the relevant item    parentSwitchInfobox.children( '.item[data-id="' + this.getAttribute( 'data-id' ) + '"]' ).addClass( 'showing' ); } ); // Finishes loading and makes switch infoboxes functional $( '.switch-infobox.loading' ).removeClass( 'loading' );

//Debug console.log('Initialised switch infoboxes', $( '.switch-infobox' ).length);

/** * Character Template Stat Switching * By Starport592 * * Meant to enable the Character template to switch between Glass, Drizzle, and Normal modes. */

var Drizzle = 0, Artifact = 0;

$(document).ready(function{ $(".DrizzleOff").click(function {   Drizzle = 1; $(".DrizzleOff").css("display","none"); $(".DrizzleOn").css("display","inline-block"); $(".DrizzleRegen").css("display","inline-block"); $(".HealthRegen").css("display","none"); if (Drizzle == Artifact) {       $(".DrizzleHPBar").css("display","none"); $(".RainstormMonsoonHPBar").css("display","none"); $(".GlassDrizzleHPBar").css("display","inline-block"); $(".GlassRainstormMonsoonHPBar").css("display","none"); }   else {       $(".DrizzleHPBar").css("display","inline-block"); $(".RainstormMonsoonHPBar").css("display","none"); $(".GlassDrizzleHPBar").css("display","none"); $(".GlassRainstormMonsoonHPBar").css("display","none"); } });  $(".DrizzleOn").click(function {   Drizzle = 0; $(".DrizzleOff").css("display","inline-block"); $(".DrizzleOn").css("display","none"); $(".DrizzleRegen").css("display","none"); $(".HealthRegen").css("display","inline-block"); if (Artifact == 1) {       $(".DrizzleHPBar").css("display","none"); $(".RainstormMonsoonHPBar").css("display","none"); $(".GlassDrizzleHPBar").css("display","none"); $(".GlassRainstormMonsoonHPBar").css("display","inline-block"); }   else {       $(".DrizzleHPBar").css("display","none"); $(".RainstormMonsoonHPBar").css("display","inline-block"); $(".GlassDrizzleHPBar").css("display","none"); $(".GlassRainstormMonsoonHPBar").css("display","none"); } });  $(".ArtifactOff").click(function{ Artifact = 1; $(".ArtifactOff").css("display","none"); $(".ArtifactOn").css("display","inline-block"); $(".GlassDamage").css("display","inline-block"); $(".BaseDamage").css("display","none"); if (Artifact == Drizzle) {       $(".DrizzleHPBar").css("display","none"); $(".RainstormMonsoonHPBar").css("display","none"); $(".GlassDrizzleHPBar").css("display","inline-block"); $(".GlassRainstormMonsoonHPBar").css("display","none"); }   else {       $(".DrizzleHPBar").css("display","none"); $(".RainstormMonsoonHPBar").css("display","none"); $(".GlassDrizzleHPBar").css("display","none"); $(".GlassRainstormMonsoonHPBar").css("display","inline-block"); } });  $(".ArtifactOn").click(function{ Artifact = 0; $(".ArtifactOff").css("display","inline-block"); $(".ArtifactOn").css("display","none"); $(".GlassDamage").css("display","none"); $(".BaseDamage").css("display","inline-block"); if (Drizzle == 1) {       $(".DrizzleHPBar").css("display","inline-block"); $(".RainstormMonsoonHPBar").css("display","none"); $(".GlassDrizzleHPBar").css("display","none"); $(".GlassRainstormMonsoonHPBar").css("display","none"); }   else {       $(".DrizzleHPBar").css("display","none"); $(".RainstormMonsoonHPBar").css("display","inline-block"); $(".GlassDrizzleHPBar").css("display","none"); $(".GlassRainstormMonsoonHPBar").css("display","none"); } }); });