From 5c22f33711ff2784927b8e2a9933d467b1a6edf7 Mon Sep 17 00:00:00 2001 From: Cody Swartz Date: Thu, 3 Oct 2019 14:22:37 -0700 Subject: [PATCH] Initialize v1 - Collapse by default - Add borders + indents - Hide empty right side bar --- canvas discussion enhancer.js | 45 +++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 canvas discussion enhancer.js diff --git a/canvas discussion enhancer.js b/canvas discussion enhancer.js new file mode 100644 index 0000000..79e2928 --- /dev/null +++ b/canvas discussion enhancer.js @@ -0,0 +1,45 @@ +// IIFE +(document => { + function execute() { + injectStyling(); + collapseAllEntries(); + } + + function injectStyling() { + const css = ` + #discussion_subentries > .discussion-entries { + margin-left: 0; + border-left: 0; + } + + .discussion-entries { + margin-left: 20px; + border-left: solid 2px grey; + } + + .entry-content { + padding-left: 0 !important; + } + + /* make threads full width; hide right column that is empty */ + .with-right-side #right-side-wrapper { + display: none; + } + `; + + const style = document.createElement('style'); + style.type = 'text/css'; + style.appendChild(document.createTextNode(css)); + document.head.appendChild(style); + } + + function collapseAllEntries() { + const collapseButton = document.getElementById('collapseAll'); + collapseButton.click(); + } + + // exposed members + return { + execute + }; +})(document).execute(); \ No newline at end of file