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">
contentsToggle = function() {
var b = document.getElementById("toggle-button")
var b = document.getElementById("toggle-button");
var i = document.getElementById("index-order");
var t = document.getElementById("turn-order");
if (t.style.display == "none") {
i.style.display = "none"
t.style.display = "block"
b.innerText = "Switch to index order"
i.style.display = "none";
t.style.display = "block";
b.innerText = "Switch to index order";
} else {
i.style.display = "block"
t.style.display = "none"
b.innerText = "Switch to turn order"
i.style.display = "block";
t.style.display = "none";
b.innerText = "Switch to turn order";
}
}
window.onload = function(){
if (location.search.search("byturn") > 0)
{
document.getElementById("turn-order").style.display = "block";
b.innerText = "Switch to index order";
}
if (location.search.search("byindex") > 0)
{
document.getElementById("index-order").style.display = "block";
b.innerText = "Switch to turn order";
}
}
</script>
<button id="toggle-button" onClick="javascript:contentsToggle()">Switch to turn order</button>