diff options
author | emkael <emkael@tlen.pl> | 2020-05-26 22:09:28 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2020-05-26 22:09:55 +0200 |
commit | 155246e089131143b53306615c52c3f9e7b5082d (patch) | |
tree | 5d3c08eac1d79602cbe22828b1511b39d5569f34 /index.php | |
parent | fcabba1789d3274a9f78fb091957b84583733032 (diff) |
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -79,6 +79,8 @@ <script src="bootstrap/js/html5shiv.js"></script> <![endif]--> + <script src="bootstrap/js/jquery.js"></script> + <!-- Fav and touch icons <link rel="apple-touch-icon-precomposed" sizes="144x144" href="bootstrap/ico/apple-touch-icon-144-precomposed.png"> <link rel="apple-touch-icon-precomposed" sizes="114x114" href="bootstrap/ico/apple-touch-icon-114-precomposed.png"> @@ -156,7 +158,7 @@ <script type="text/javascript"> var hashTrigger = true; - var formHash = document.getElementById('formHash'); + var formHash = $('#formHash'); var onHash = function(e) { if (hashTrigger) { var hash = location.hash.replace(/^#/, ''); @@ -164,9 +166,9 @@ var hashParts = hash.split('|'); var boards = parseInt(hashParts[0]); var discrete = (['dyskretna', 'calkowita'].indexOf(hashParts[1]) > -1); - document.forms['boardNumForm'].n.value = boards; - document.forms['boardNumForm'].discrete.value = (discrete ? 1 : 0); - if (e.type != 'load' || !formHash) { + $('input[name="n"]').val(boards); + $('input[name="discrete"][value="' + (discrete ? 1 : 0) + '"]').prop('checked', true); + if (e.type != 'load' || !formHash.length) { document.forms['boardNumForm'].submit(); } } @@ -176,14 +178,13 @@ } } } - window.onload = onHash; - window.onhashchange = onHash; + $(window).on('hashchange', onHash).on('load', onHash); if (formHash) { - var fromForm = formHash.value; + var fromForm = formHash.val(); if (fromForm) { hashTrigger = false; location.hash = fromForm; - formHash.value = ''; + formHash.val(''); } } </script> |