diff --git a/static/voyage.css b/static/voyage.css index 20efeb1..467e907 100644 --- a/static/voyage.css +++ b/static/voyage.css @@ -14,6 +14,10 @@ body { opacity: 0.33; } +.hidden { + display: none; +} + .tag { font-size: 0.8em; } @@ -65,3 +69,13 @@ body { .deadlink { text-decoration: line-through; } + +#visibility_menu_toggle { + cursor: pointer +} + +#visibility_menu { + border: 1px solid darkgray; + position: absolute; + background-color: #FAFAFA; +} diff --git a/static/voyage.js b/static/voyage.js index 845a98f..95289fe 100644 --- a/static/voyage.js +++ b/static/voyage.js @@ -46,3 +46,35 @@ function remove_tag(event) { tag.remove(); }); } + +function toggle_visibility_menu(event) { + let menu = document.querySelector('#visibility_menu'); + if (menu.style.display == 'block') { + menu.style.display = 'none'; + } else if (menu.style.display == 'none') { + menu.style.display = 'block'; + } +} + +function toggle_visibility(event) { + console.log(event); + let tag = event.target.parentElement.parentElement.cells[0].innerText; + let vis_class = ['faded', 'hidden']; + if (tag == 'non-qm posts') { + for (let post of document.querySelectorAll('.post_container:not(.qm_post)')) { + if (event.target.checked) { + post.classList.add(vis_class[event.target.parentElement.cellIndex - 1]); + } else { + post.classList.remove(vis_class[event.target.parentElement.cellIndex - 1]); + } + } + } else { + for (let post of document.querySelectorAll('.' + tag)) { + if (event.target.checked) { + post.classList.add(vis_class[event.target.parentElement.cellIndex - 1]); + } else { + post.classList.remove(vis_class[event.target.parentElement.cellIndex - 1]); + } + } + } +} diff --git a/templates/thread.html b/templates/thread.html index 8b506f7..528c0a8 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -11,6 +11,28 @@