1,956
edits
No edit summary |
(refactoring expandables (templates & javascript) (better fallback and nestability)) |
||
Line 40: | Line 40: | ||
} | } | ||
} | } | ||
function | |||
function showOnlyNext(ev) { // for expandable text: | |||
ev.target.style.display = "none"; | |||
ev.target.nextElementSibling.style.display = "initial"; | |||
ev.stopPropagation(); | |||
} | |||
function showOnlyPrev(ev) { | |||
ev.target.style.display = "none"; | |||
ev.target.previousElementSibling.style.display = "initial"; | |||
ev.stopPropagation(); | |||
} | } | ||
function dpInfo(o) { // for calculator: display a datapoint's info | function dpInfo(o) { // for calculator: display a datapoint's info | ||
var id = o.innerHTML; | var id = o.innerHTML; | ||
Line 168: | Line 176: | ||
function parseFeatures() { | function parseFeatures() { | ||
var e; | var e; | ||
// Expandable text | // Expandable text and popups | ||
e = document.getElementsByClassName(' | e = document.getElementsByClassName('forMore'); | ||
for (var i=0; i<e.length; i++) { | for (var i=0; i<e.length; i++) { | ||
var | var next = e[i].nextElementSibling; | ||
if (next.className=="xpContent" || next.classList.contains("xpContent")) { | |||
e[i].onclick = showOnlyNext; | |||
next.onclick = showOnlyPrev; | |||
} else | |||
if (next.className=="ppContent" || next.classList.contains("ppContent")) { | |||
e[i].onclick = next.onclick = function(e){togglePopup(next);}; | |||
} | |||
} | } | ||
// Local datapoints and calculations | // Local datapoints and calculations |