Last active
March 28, 2022 22:10
-
-
Save jethroo/f6af838f0b00d755642d2ff875deb092 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// hide all | |
datasheets = $('.datasheet.pagebreak') | |
for (let i = 0; i < datasheets.length; i++) { | |
datasheets[i].style.setProperty('display', 'none'); | |
datasheets[i].style.setProperty('margin-bottom', '6px'); | |
} | |
// make content overview noprint | |
$('.contents_header')[0].parentNode.parentNode.classList.add("noprint"); | |
// remove br and h2 | |
$('br').remove(); | |
$('h2').remove(); | |
// allow to print background gradients | |
$('body')[0].style.setProperty('color-adjust', 'exact') | |
navlinks = $('.NavColumns3 .mw2.i30 a') | |
for (let i = 0; i < navlinks.length; i++) { | |
var button = document.createElement("BUTTON"); | |
function hideFunction(event) { | |
//console.log($("[name='"+navlinks[i].parentNode.dataset.name+"']")); | |
datasheet = $("[name='"+navlinks[i].parentNode.dataset.name+"']").nextAll('.datasheet')[0]; | |
console.log(event.target); | |
if (datasheet.style.getPropertyValue('display')){ | |
event.target.innerHTML = "🙈"; | |
datasheet.style.removeProperty('display') | |
} else { | |
event.target.innerHTML = "👁️"; | |
datasheet.style.setProperty('display', 'none'); | |
} | |
} | |
button.innerHTML = "👁️"; | |
button.addEventListener("click", hideFunction); | |
navlinks[i].parentNode.dataset.name = navlinks[i].href.split('#').pop(); | |
navlinks[i].parentNode.appendChild(button); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment