Last active
July 20, 2017 16:18
-
-
Save GarethPW/6ed59113b09bb9af9308ab5bccf8f4d0 to your computer and use it in GitHub Desktop.
Brings the discuss button back to the Scratch Website.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Scratch 2.0 Discuss Button Fix | |
// @namespace http://garethpw.net | |
// @version 1.1 | |
// @description Brings back the discuss button on the site header because removing it was illogical. | |
// @author Gareth Welch | |
// @include /^https?:\/\/scratch\.mit\.edu | |
// ==/UserScript== | |
(function() { | |
var nav = document.querySelector("#topnav ul.site-nav, #navigation .inner>ul"); | |
var discuss = document.createElement("li"); | |
var discuss_a = discuss.appendChild( document.createElement('a') ); | |
discuss_a.setAttribute("href", "/discuss/"); | |
discuss_a.innerText = "Discuss"; | |
if (nav.className === "site-nav") { | |
nav.insertBefore(discuss, nav.children[2]); | |
} else { | |
discuss.className = "link discuss"; | |
nav.insertBefore(discuss, nav.querySelector("li.tips")); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment