1 function storageAvailable(type) {
3 var storage = window[type],
4 x = '__storage_test__';
10 return e instanceof DOMException && (
11 // everything except Firefox
15 // test name field too, because code might not be present
16 // everything except Firefox
17 e.name === 'QuotaExceededError' ||
19 e.name === 'NS_ERROR_DOM_QUOTA_REACHED') &&
20 // acknowledge QuotaExceededError only if there's something already stored
25 function select_table(table_id)
27 if (table_id === null) {
28 if (storageAvailable('sessionStorage')) {
29 table_id = sessionStorage.getItem('selected_table');
31 table_id = table_id ? table_id : "race_id";
34 $("table.statistics_table").hide();
35 $("div#" + table_id + " table.statistics_table").show();
37 $("a.table_select").css('font-weight', 'normal').css('font-size', 'small');
38 $("a.table_select#" + table_id).css('font-weight', 'bold').css('font-size', 'large');
40 if (storageAvailable('sessionStorage')) {
41 sessionStorage.setItem('selected_table', table_id);
46 $(".tablesorter").tablesorter({
52 $(".table_select").on('click', function() {
53 select_table($(this).attr("id"));