Tue, 22 Aug 2017 23:31:04 -0400
add and configure mucomplete
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 = "\ |
533 | 6 | ol.list li.story { height: 9em; } \ |
375
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; } \ |
533 | 9 | li.story div.story_content { color: #999; font-size: 95%; max-height: 3em !important; }" |
375
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 | } |
510 | 17 | |
18 | // only safe when you've guaranteed a parent matches | |
19 | function parentSelector (el, selector) { | |
20 | while ((el = el.parentElement) && !el.matches(selector)); | |
21 | return el; | |
22 | } | |
23 | ||
24 | ['angersock'].forEach(function (u) { | |
25 | var collapse = document.querySelectorAll('div.comment > div.details > div.byline > a[href="/u/' + u + '"]') | |
26 | for (var el of collapse) { | |
27 | parentSelector(el, 'div.comment').previousElementSibling.click() | |
28 | } | |
29 | }) |