From fb82ad546764956730d0a8ef0055880a67521425 Mon Sep 17 00:00:00 2001 From: Lars Tveito Date: Tue, 19 Nov 2019 19:46:07 +0100 Subject: [PATCH] Blur code blocks --- committees.org | 1 + js/script.js | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 js/script.js diff --git a/committees.org b/committees.org index be7e69a..121aa52 100644 --- a/committees.org +++ b/committees.org @@ -1,5 +1,6 @@ #+TITLE: SMT for IN3070 #+AUTHOR: Lars Tveito +#+HTML_HEAD: #+HTML_HEAD: #+OPTIONS: toc:nil num:nil html-style:nil diff --git a/js/script.js b/js/script.js new file mode 100644 index 0000000..ffddae4 --- /dev/null +++ b/js/script.js @@ -0,0 +1,16 @@ +function blurPython() { + blocksToBlur = document.getElementsByClassName('src-python'); + // Note: Skipping the two first code blocks + for (var i = 1; i < blocksToBlur.length; i++) { + const block = blocksToBlur[i] + block.setAttribute("style", "cursor: pointer;"); + block.classList.toggle("blur"); + block.addEventListener("click", function () { + block.classList.toggle("blur"); + }); + } +} + +document.addEventListener('DOMContentLoaded', function(){ + blurPython(); +}, false);