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
  • Select an option

  • Save as-com/bd5ab8869cfa9c1a163cd41ff831d32b to your computer and use it in GitHub Desktop.

Select an option

Save as-com/bd5ab8869cfa9c1a163cd41ff831d32b to your computer and use it in GitHub Desktop.

Revisions

  1. as-com renamed this gist Jul 20, 2017. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. @GarethPW GarethPW revised this gist Jul 18, 2017. 1 changed file with 8 additions and 3 deletions.
    11 changes: 8 additions & 3 deletions discuss.js
    Original file line number Diff line number Diff line change
    @@ -1,19 +1,24 @@
    // ==UserScript==
    // @name Scratch 2.0 Discuss Button Fix
    // @namespace http://garethpw.net
    // @version 1.0
    // @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");
    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";

    nav.insertBefore(discuss, nav.children[2]);
    if (nav.className === "site-nav") {
    nav.insertBefore(discuss, nav.children[2]);
    } else {
    discuss.className = "link discuss";
    nav.insertBefore(discuss, nav.querySelector("li.tips"));
    }
    })();
  3. @GarethPW GarethPW created this gist Jul 18, 2017.
    19 changes: 19 additions & 0 deletions discuss.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    // ==UserScript==
    // @name Scratch 2.0 Discuss Button Fix
    // @namespace http://garethpw.net
    // @version 1.0
    // @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");

    var discuss = document.createElement("li");
    var discuss_a = discuss.appendChild( document.createElement('a') );
    discuss_a.setAttribute("href", "/discuss/");
    discuss_a.innerText = "Discuss";

    nav.insertBefore(discuss, nav.children[2]);
    })();