.js/lobste.rs.js

Wed, 31 Aug 2016 16:35:04 -0400

author
Meredith Howard <mhoward@roomag.org>
date
Wed, 31 Aug 2016 16:35:04 -0400
changeset 382
09a6309e4856
parent 375
195bf106146f
child 397
466b95c31b1e
permissions
-rw-r--r--

fixes

375
195bf106146f Add lobste.rs tweaks for preview mode
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
1 // If story previews are enabled, set regular spacing and place byline below
195bf106146f Add lobste.rs tweaks for preview mode
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
2 // title.
195bf106146f Add lobste.rs tweaks for preview mode
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
3 if (document.querySelector('div.story_content')) {
195bf106146f Add lobste.rs tweaks for preview mode
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
4 var sheet = document.createElement('style')
195bf106146f Add lobste.rs tweaks for preview mode
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
5 sheet.innerHTML = "\
195bf106146f Add lobste.rs tweaks for preview mode
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
6 li.story { height: 7.5em; } \
195bf106146f Add lobste.rs tweaks for preview mode
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
7 li.story div.byline { color: #777; } \
195bf106146f Add lobste.rs tweaks for preview mode
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
8 li.story div.byline a { color: #777; } \
195bf106146f Add lobste.rs tweaks for preview mode
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
9 li.story div.story_content { color: #999; font-size: 95%; }"
195bf106146f Add lobste.rs tweaks for preview mode
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
10 document.body.appendChild(sheet)
195bf106146f Add lobste.rs tweaks for preview mode
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
11
195bf106146f Add lobste.rs tweaks for preview mode
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
12 var bylines = document.querySelectorAll('div.story_content + div.byline')
195bf106146f Add lobste.rs tweaks for preview mode
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
13 for (var e of bylines) {
195bf106146f Add lobste.rs tweaks for preview mode
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
14 e.parentNode.insertBefore(e, e.previousElementSibling)
195bf106146f Add lobste.rs tweaks for preview mode
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
15 }
195bf106146f Add lobste.rs tweaks for preview mode
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
16 }

mercurial