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.
/***********************************************
/* Hearthstone Wiki Card Table Collapse Script *
/***********************************************/
// Author: Shawn Bruckner
// Date: 2014-Feb-04
// License: CC-BY 3.0
// Version: beta
var cardtable = cardtable || {
oldWidth : 0,
wideWidth : 1052,
initialize : function() {
var index = 0;
var tables = $( "table.cardtable-collapsible" );
if ( tables.length > 0 ) {
cardtable.oldWidth = $( window ).width();
$( window ).resize( cardtable.performLayout );
}
$( "table.cardtable-collapsible" ).each( function() {
var firstRow = $( this ).find( "tr" ).first();
if ( firstRow.length > 0 ) {
++index;
$( this ).attr( "id", ( $( this ).attr( "id" ) ? $( this ).attr( "id" ) + " " : "" ) + "cardtable-collapsible-" + index );
var linkHtml = "<div style=\"float: left; font-weight: normal; font-size: 95%;\">" +
"[<a href=\"javascript:cardtable.toggleTable( " +
index + " );\" class=\"cardtable-collapse-link-" + index + "\">hide</a>]</div>";
var firstNarrowCell = firstRow.find( "th.narrowonly" ).first();
var firstWideCell = firstRow.find( "th.wideonly" ).first();
if ( firstNarrowCell.length > 0 && firstWideCell.length > 0 ) {
firstNarrowCell.html( firstNarrowCell.html() + linkHtml );
firstWideCell.html( firstWideCell.html() + linkHtml );
} else {
var firstCell = firstRow.find( "th" ).first();
if ( firstCell.length > 0 ) {
firstCell.html( firstCell.html() + linkHtml );
}
}
if ( $( this ).hasClass( "cardtable-collapsed" ) ) {
$( this ).removeClass( "cardtable-collapsed" );
cardtable.toggleTable( index );
}
}
} );
},
toggleTable : function( index ) {
var links = $( "a.cardtable-collapse-link-" + index );
if ( links.length > 0 ) {
var table = $( "table#cardtable-collapsible-" + index );
if ( table.hasClass( "cardtable-collapsed" ) ) {
if ( $( window ).width() >= cardtable.wideWidth ) {
table.find( "tr" ).each( function() {
if ( !$( this ).hasClass( "narrowonly" ) ) {
$( this ).show();
}
} );
} else {
table.find( "tr" ).show();
}
links.html( "hide" );
table.removeClass( "cardtable-collapsed" );
} else {
table.find( "tr" ).hide();
table.find( "tr" ).first().show();
links.html( "show" );
table.addClass( "cardtable-collapsed" );
}
}
},
performLayout : function() {
var newWidth = $( window ).width();
if ( cardtable.oldWidth < cardtable.wideWidth && newWidth >= cardtable.wideWidth ) {
$( "table.cardtable-collapsible" ).each( function() {
cardtable.performLayoutOnTable( $( this ), "wideonly", "narrowonly" );
} );
} else if ( cardtable.oldWidth >= cardtable.wideWidth && newWidth < cardtable.wideWidth ) {
$( "table.cardtable-collapsible" ).each( function() {
cardtable.performLayoutOnTable( $( this ), "narrowonly", "wideonly" );
} );
}
cardtable.oldWidth = newWidth;
},
performLayoutOnTable : function( table, showClass, hideClass ) {
var elements;
if ( table.hasClass( "cardtable-collapsed" ) ) {
elements = table.find( "tr" ).first();
} else {
elements = table;
}
elements.find( "." + hideClass ).hide();
elements.find( "." + showClass ).show();
}
}
$( document ).ready( cardtable.initialize );
/***************************************************
/* End Hearthstone Wiki Card Table Collapse Script *
/***************************************************/
/*******************
/* Countdown Timer *
/*******************/
/**
* To create a timer add the class countdown-timer to the element that will container the countdown as well
* as the attribute countdown-timer, which should container the target date-time for the countdown.
* The target element can contain default output for if javascript is disabled by the user, such as the target date-time.
*
* Relies on [[MediaWiki:Gadget-Countdown]].
*/
if (typeof countdown !== 'undefined') { // Check that the countdown library is present
$('.countdown-timer[data-countdown-timer]').each(function () {
var el = this;
var targetDate = new Date($(el).attr('data-countdown-timer'));
countdown.setLabels('||m|h|d|','||m|h|d|',' ',' ');
$(el).html(countdown(null, targetDate, countdown.DAYS | countdown.HOURS | countdown.MINUTES).toString());
countdown.resetLabels();
setInterval(function() {
countdown.setLabels('||m|h|d|','||m|h|d|',' ',' ');
$(el).html(countdown(null, targetDate, countdown.DAYS | countdown.HOURS | countdown.MINUTES).toString());
countdown.resetLabels();
}, 1000);
});
} else {
console.error('Warning: The Countdown javascript library is not present on the wiki or its gadget is disable in your user preferences. Countdowns will not function.');
}
/***********************
/* End Countdown Timer *
/***********************/
//CrazyEgg
setTimeout(function(){var a=document.createElement("script");
var b=document.getElementsByTagName("script")[0];
a.src=document.location.protocol+"//script.crazyegg.com/pages/scripts/0011/8371.js?"+Math.floor(new Date().getTime()/3600000);
a.async=true;a.type="text/javascript";b.parentNode.insertBefore(a,b)}, 1);