Fix button text not changing with sort order preset

This commit is contained in:
Tim Van Baak 2018-08-09 09:10:47 -07:00
parent c8cfbc6da8
commit 985f5be19f
1 changed files with 13 additions and 7 deletions

View File

@ -1,23 +1,29 @@
<script type="text/javascript"> <script type="text/javascript">
contentsToggle = function() { contentsToggle = function() {
var b = document.getElementById("toggle-button") var b = document.getElementById("toggle-button");
var i = document.getElementById("index-order"); var i = document.getElementById("index-order");
var t = document.getElementById("turn-order"); var t = document.getElementById("turn-order");
if (t.style.display == "none") { if (t.style.display == "none") {
i.style.display = "none" i.style.display = "none";
t.style.display = "block" t.style.display = "block";
b.innerText = "Switch to index order" b.innerText = "Switch to index order";
} else { } else {
i.style.display = "block" i.style.display = "block";
t.style.display = "none" t.style.display = "none";
b.innerText = "Switch to turn order" b.innerText = "Switch to turn order";
} }
} }
window.onload = function(){ window.onload = function(){
if (location.search.search("byturn") > 0) if (location.search.search("byturn") > 0)
{
document.getElementById("turn-order").style.display = "block"; document.getElementById("turn-order").style.display = "block";
b.innerText = "Switch to index order";
}
if (location.search.search("byindex") > 0) if (location.search.search("byindex") > 0)
{
document.getElementById("index-order").style.display = "block"; document.getElementById("index-order").style.display = "block";
b.innerText = "Switch to turn order";
}
} }
</script> </script>
<button id="toggle-button" onClick="javascript:contentsToggle()">Switch to turn order</button> <button id="toggle-button" onClick="javascript:contentsToggle()">Switch to turn order</button>