Add lobste.rs tweaks for preview mode

Thu, 18 Aug 2016 14:41:19 -0400

author
Meredith Howard <mhoward@roomag.org>
date
Thu, 18 Aug 2016 14:41:19 -0400
changeset 375
195bf106146f
parent 374
366c04327ad7
child 376
45be44be97c5

Add lobste.rs tweaks for preview mode

.js/lobste.rs.js file | annotate | diff | comparison | revisions
new file mode 100644
--- /dev/null
+++ b/.js/lobste.rs.js
@@ -0,0 +1,16 @@
+// If story previews are enabled, set regular spacing and place byline below
+// title.
+if (document.querySelector('div.story_content')) {
+  var sheet = document.createElement('style')
+  sheet.innerHTML = "\
+    li.story { height: 7.5em; } \
+    li.story div.byline { color: #777; } \
+    li.story div.byline a { color: #777; } \
+    li.story div.story_content { color: #999; font-size: 95%; }"
+  document.body.appendChild(sheet)
+
+  var bylines = document.querySelectorAll('div.story_content + div.byline')
+  for (var e of bylines) {
+    e.parentNode.insertBefore(e, e.previousElementSibling)
+  }
+}

mercurial