Skip to content

Instantly share code, notes, and snippets.

@as-com
Forked from GarethPW/discuss.js
Created July 20, 2017 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save as-com/bd5ab8869cfa9c1a163cd41ff831d32b to your computer and use it in GitHub Desktop.
Save as-com/bd5ab8869cfa9c1a163cd41ff831d32b to your computer and use it in GitHub Desktop.
Brings the discuss button back to the Scratch Website.
// ==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