-
Notifications
You must be signed in to change notification settings - Fork 0
/
home-nuker.user.js
53 lines (49 loc) · 1.45 KB
/
home-nuker.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
// ==UserScript==
// @name home tab nuker
// @namespace Kyll
// @description Removes home tab, shows first other tab by default
// @include *://stackoverflow.com/
// @include *://stackoverflow.com/questions/*
// @version 3
// @grant GM_addStyle
// @run-at document-start
// @eat Waffles
// ==/UserScript==
// Hide "home" tab forever
GM_addStyle(`
span.intellitab:nth-child(1) {
display : none!important;
}
`)
// Only do something if we're on the home tab
if(!(document.URL.indexOf('questions') > -1)) {
// To avoid having the "home" tab question list blinking we'll first hide it,
// then once it's changed we'll show it again
GM_addStyle(`
#qlist-wrapper, .pager.fl, .page-sizer {
display: none;
}
`)
window.addEventListener('load', () => {
// Click on first next tab
document.querySelector('span.intellitab:nth-child(2)').click()
const
questionList = document.getElementById('qlist-wrapper')
// We're going to wait for the question list to change,
// indicating that we switched tab
, observer = new MutationObserver(
() => {
GM_addStyle(`
#qlist-wrapper, .pager.fl, .page-sizer {
display: inline;
}
`)
observer.disconnect()
}
)
, observerConfig = {
childList: true,
}
observer.observe(questionList, observerConfig)
})
}