-
Notifications
You must be signed in to change notification settings - Fork 0
/
booru-always-show-child-posts.user.js
60 lines (56 loc) · 2.09 KB
/
booru-always-show-child-posts.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// ==UserScript==
// @name Booru Always Show Child Posts
// @namespace dragontamer8740.e621ShowChildren
// @description Always show child posts on boorus that collapse them by default
// @version 1
// @include http://e621.net/posts/*
// @include https://e621.net/posts/*
// @grant none
// ==/UserScript==
if(window.location.origin.endsWith("e621.net"))
{
// old site script was:
// // toggleChildPosts();
// var spacerDisplay=document.getElementById("child-posts-spacer").style.display;
// if(spacerDisplay == "none" || spacerDisplay == "")
// {
// window.toggleChildPosts();
// }
/*
* The new site layout uses JQuery (ugh), which I have no patience for.
* So I reimplemented the functions to show parent elements/child elements
* using pure JS instead.
*/
// same fn called for children and parents.
function showTheThing(postLink,thingToShow)
{
if(postLink)
{
var previewparents=document.getElementById('has-parent-relationship-preview');
if(thingToShow && thingToShow.style.display == 'none' || thingToShow.style.display == '')
{
thingToShow.style.display='block';
postLink.innerHTML='« hide';
}
}
}
showTheThing(document.getElementById('has-parent-relationship-preview-link'),document.getElementById('has-parent-relationship-preview'));
showTheThing(document.getElementById('has-children-relationship-preview-link'),document.getElementById('has-children-relationship-preview'));
/* Next, move all notices above the image (instead of below) */
var notices=document.querySelectorAll('.bottom-notices')
if(notices.length > 0)
{
var x=0;
while(x < notices.length)
{
var noticeDiv=notices[x].cloneNode(true);
var imgCont=document.getElementById('image-container')
imgCont.parentElement.insertBefore(noticeDiv,imgCont);
// remove original
notices[x].remove();
// could just the one below hide instead, if we so chose.
// notices[x].setAttribute( 'style', 'display: none !important' );
x++;
} // end while loop
} // (if notices.length > 0)
} // (if e621)