1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Links to full pages are now adjusted by choices in onpage selector

This commit is contained in:
Krateng
2019-06-17 13:02:06 +02:00
parent e6aa0a25c8
commit f484c768ab
7 changed files with 67 additions and 58 deletions

View File

@@ -1,29 +1,37 @@
function showRange(identifier,unit) {
// Make all modules disappear
modules = document.getElementsByClassName("stat_module_" + identifier)
modules = document.getElementsByClassName("stat_module_" + identifier);
for (var i=0;i<modules.length;i++) {
//modules[i].setAttribute("style","width:0px;overflow:hidden;")
// cheesy trick to make the allocated space always whatever the biggest module needs
// somehow that messes up pulse on the start page tho
modules[i].setAttribute("style","display:none;")
modules[i].setAttribute("style","display:none;");
}
// Make requested module appear
reactivate = document.getElementsByClassName(identifier + "_" + unit)
reactivate = document.getElementsByClassName(identifier + "_" + unit);
for (var i=0;i<reactivate.length;i++) {
reactivate[i].setAttribute("style","")
reactivate[i].setAttribute("style","");
}
// Set all selectors to unselected
selectors = document.getElementsByClassName("stat_selector_" + identifier)
selectors = document.getElementsByClassName("stat_selector_" + identifier);
for (var i=0;i<selectors.length;i++) {
selectors[i].setAttribute("style","")
selectors[i].setAttribute("style","");
}
// Set the active selector to selected
reactivate = document.getElementsByClassName("selector_" + identifier + "_" + unit)
reactivate = document.getElementsByClassName("selector_" + identifier + "_" + unit);
for (var i=0;i<reactivate.length;i++) {
reactivate[i].setAttribute("style","opacity:0.5;")
reactivate[i].setAttribute("style","opacity:0.5;");
}
links = document.getElementsByClassName("stat_link_" + identifier);
for (let l of links) {
var a = l.href.split("=");
a.splice(-1);
a.push(unit);
l.href = a.join("=");
}
}