-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbringItBack.user.js
More file actions
28 lines (27 loc) · 1.25 KB
/
bringItBack.user.js
File metadata and controls
28 lines (27 loc) · 1.25 KB
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
// ==UserScript==
// @name Bring it Back
// @namespace github.com/mxmou
// @version 1.1
// @description Bring back the Discuss button in the header!
// @author MaxiMouse
// @homepageURL https://github.com/mxmou/customize-scratch
// @supportURL https://github.com/mxmou/customize-scratch/issues
// @updateURL https://mxmou.github.io/customize-scratch/bringItBack.user.js
// @match https://scratch.mit.edu/*
// @run-at document-body
// ==/UserScript==
var interval = setInterval(function() {
if (document.querySelector('div#navigation div.inner ul') || document.querySelector('div#topnav ul.site-nav')) {
clearInterval(interval);
var link = document.createElement('li');
link.innerHTML = '<a href="/discuss">Discuss</a>';
link.className = 'link discuss';
try {
document.querySelector('div#navigation div.inner ul')
.insertBefore(link, document.querySelector('div#navigation div.inner ul').getElementsByTagName('li')[3]);
} catch(err) {
document.querySelector('div#topnav ul.site-nav')
.insertBefore(link, document.querySelector('div#topnav ul.site-nav').getElementsByTagName('li')[2]);
}
}
}, 50);