Discuss Scratch

__init__
Scratcher
1000+ posts

I made a userscript that removes every nav link and adds "Discuss"


// ==UserScript==
// @name        Scratch Discuss Link Adder
// @namespace   __init__.scratchdiscuss
// @description The only link you need
// @include     https://scratch.mit.edu/*
// @version     1
// @grant       none
// ==/UserScript==
window.addEventListener('load', function() {
    if (document.getElementsByClassName("site-nav")[0]) {
        // Old site
        nav = document.getElementsByClassName("site-nav")[0];
        nav.innerHTML = "<li><a href=\"/discuss/\">Discuss</a></li>";
    } else {
        // New site
        for (i of [
            document.getElementsByClassName("create")[0],
            document.getElementsByClassName("explore")[0],
            document.getElementsByClassName("about")[0]
          ]) {
          i.remove();
        }
        
        tips = document.getElementsByClassName("tips")[0];
        tips.innerHTML = "<a href=\"/discuss/\"><span>Discuss</span></a>";
    }
}, false);
install

Last edited by __init__ (July 7, 2017 22:19:01)

SimpleScratch
Scratcher
100+ posts

I made a userscript that removes every nav link and adds "Discuss"

Doesn't work for me in Chrome/Win10
MegaApuTurkUltra
Scratcher
1000+ posts

I made a userscript that removes every nav link and adds "Discuss"

+1

sadly, my signature was eaten by some ST
__init__
Scratcher
1000+ posts

I made a userscript that removes every nav link and adds "Discuss"

SimpleScratch wrote:

Doesn't work for me in Chrome/Win10
Are you getting any error messages in the console? (Press F12 and click on Console)
Blaze349
Scratcher
1000+ posts

I made a userscript that removes every nav link and adds "Discuss"

Precisely what I needed.
Jonathan50
Scratcher
1000+ posts

I made a userscript that removes every nav link and adds "Discuss"

You should at least spare Create.
__init__
Scratcher
1000+ posts

I made a userscript that removes every nav link and adds "Discuss"

Jonathan50 wrote:

You should at least spare Create.
Just go to My Stuff and click New Project. It's not that hard
SimpleScratch
Scratcher
100+ posts

I made a userscript that removes every nav link and adds "Discuss"

Are you getting any error messages in the console? (Press F12 and click on Console)
I don't get that far
Chrome won't let me install it - it says
Apps, extensions and user scripts cannot be added from this website
Calculator54
New to Scratch
8 posts

I made a userscript that removes every nav link and adds "Discuss"

It looks cool! But I use Midori web browser and it does not support user scripts.
herohamp
Scratcher
1000+ posts

I made a userscript that removes every nav link and adds "Discuss"

MegaApuTurkUltra
Scratcher
1000+ posts

I made a userscript that removes every nav link and adds "Discuss"

SimpleScratch wrote:

Are you getting any error messages in the console? (Press F12 and click on Console)
I don't get that far
Chrome won't let me install it - it says
Apps, extensions and user scripts cannot be added from this website
Install tampermonkey first

sadly, my signature was eaten by some ST
SimpleScratch
Scratcher
100+ posts

I made a userscript that removes every nav link and adds "Discuss"

Install tampermonkey first

Is that safe for an old codger like me to use?
MegaApuTurkUltra
Scratcher
1000+ posts

I made a userscript that removes every nav link and adds "Discuss"

SimpleScratch wrote:

Install tampermonkey first

Is that safe for an old codger like me to use?
Just don't go around installing random userscripts without reading the source first. Otherwise yes

Last edited by MegaApuTurkUltra (July 7, 2017 21:11:07)


sadly, my signature was eaten by some ST
__init__
Scratcher
1000+ posts

I made a userscript that removes every nav link and adds "Discuss"

For some reason, with the userscript enabled, the post editor buttons and the message count disappears. This doesn't happen when I run the code from the JavaScript console. Any idea why?

Do I need to somehow load the userscript at a different time?
SimpleScratch
Scratcher
100+ posts

I made a userscript that removes every nav link and adds "Discuss"

Just don't go around installing random userscripts without reading the source first. Otherwise yes

Thanks
SimpleScratch
Scratcher
100+ posts

I made a userscript that removes every nav link and adds "Discuss"

Ok - all working

… but bit of an overkill I see

How do I remove it when I want to see the original site?
__init__
Scratcher
1000+ posts

I made a userscript that removes every nav link and adds "Discuss"

SimpleScratch wrote:

Ok - all working

… but bit of an overkill I see

How do I remove it when I want to see the original site?
There should be a menu in the top right hand corner where you can disable userscripts?

I'm not entirely sure how it works on Chrome, as I use Firefox personally
__init__
Scratcher
1000+ posts

I made a userscript that removes every nav link and adds "Discuss"

__init__ wrote:

For some reason, with the userscript enabled, the post editor buttons and the message count disappears. This doesn't happen when I run the code from the JavaScript console. Any idea why?

Do I need to somehow load the userscript at a different time?
Making the script run after page load fixed it. It works now
SimpleScratch
Scratcher
100+ posts

I made a userscript that removes every nav link and adds "Discuss"

There should be a menu in the top right hand corner where you can disable userscripts?
Yep - got it
Imagine if these forums die - information like this would not get shared out amongst us!
DatOneLefty
Scratcher
1000+ posts

I made a userscript that removes every nav link and adds "Discuss"

change it so it replaces everything with discuss instead of removing everything and only having discuss

Hey! Check out one of my websites!

Make a fun countdown
Play my game!

Check out my GitHub

Posts: bf97b44a7fbd33db070f6ade2b7dc549
Donate BTC: 1B1QuYiDHSkrw4KJjRvDbuLeeHU8pQ9b3s

Powered by DjangoBB

Standard | Mobile