summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/index.php b/index.php
index 98d5b23..b47a9ef 100644
--- a/index.php
+++ b/index.php
@@ -141,6 +141,7 @@
if(!$discrete) {
echo '<br /><a class="btn" href="teamy.php?n='.$n.'">Pobierz tabelÄ™ dla programu JFR Teamy</a>';
}
+ echo '<input type="hidden" id="formHash" value="' . $n . ($discrete ? '|dyskretna' : '') . '" />';
}
?>
@@ -153,5 +154,37 @@
</div> <!-- /container -->
+ <script type="text/javascript">
+ var hashTrigger = true;
+ var formHash = document.getElementById('formHash');
+ var onHash = function(e) {
+ if (hashTrigger) {
+ var hash = location.hash.replace(/^#/, '');
+ if (hash) {
+ 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) {
+ document.forms['boardNumForm'].submit();
+ }
+ }
+ } else {
+ hashTrigger = true;
+ }
+ }
+ window.onload = onHash;
+ window.onhashchange = onHash;
+ if (formHash) {
+ var fromForm = formHash.value;
+ if (fromForm) {
+ hashTrigger = false;
+ location.hash = fromForm;
+ formHash.value = '';
+ }
+ }
+ </script>
+
</body>
</html>