diff options
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> |