1
$(document).ready(function() {
3
// Smooth scrolling, taken from:
4
// http://stackoverflow.com/a/18795112
5
$("a[href*='#']").click(function(event){
6
$('html, body').animate({
7
scrollTop: $( $.attr(this, 'href') ).offset().top
9
event.preventDefault();
12
// Toggle display of scripting values
13
// Usage of sessionStore makes it possible to keep the status
14
// when switching to different pages. When switching the page the
15
// state of checkbox and the visibility of items has to be set.
16
if ( $("input#toggle_scripting").length > 0 &&
17
sessionStorage.getItem('scripting_status') === "true"){
18
$("input#toggle_scripting")[0].checked = true;
19
$(".scripting").show();
21
$("input#toggle_scripting").click(function(){
22
$(".scripting").toggle();
23
sessionStorage.setItem('scripting_status', this.checked);
26
// Toggle the display of whole tables
27
$("input#small").click(function(){
28
$(".size-S").toggle();
31
$("input#medium").click(function(){
32
$(".size-M").toggle();
35
$("input#big").click(function(){
36
$(".size-B").toggle();
39
$("input#mines").click(function(){
40
$(".size-I").toggle();
43
// Toggle rows of tables
44
$("input#warehouse").click(function(){
45
$(".type-W").toggle( function(){
50
$("input#production").click(function(){
51
$(".type-P").toggle( function(){
56
$("input#military").click(function(){
57
$(".type-M").toggle( function(){
62
$("input#training").click(function(){
63
$(".type-T").toggle( function(){
70
function hide_empty_tables(){
71
// Hide a whole table if no row is displayed in it
72
var tables = $("table");
73
for (var i=0; i<tables.length; i++){
74
var table = tables[i];
76
for (var x=0, row; row = table.rows[x]; x++){
77
if (row.style.display == 'none'){
81
// +1 here because we need to count also <th>
82
if (table.rows.length == hidden_rows+1){
83
table.style.display = 'none';
85
table.style.display = '';
b'\\ No newline at end of file'