Skip to content

Instantly share code, notes, and snippets.

@apple502j
Last active June 2, 2018 23:14
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 apple502j/763dd45811b3641648e5f1d507615100 to your computer and use it in GitHub Desktop.
Save apple502j/763dd45811b3641648e5f1d507615100 to your computer and use it in GitHub Desktop.
See at Scratch 3: Add a button to 3.0 on project pages
// ==UserScript==
// @name See at Scratch 3
// @version 1.0
// @description Open Scratch 3 as fast as possible
// @author apple502j
// @match https://scratch.mit.edu/projects/*
// ==/UserScript==
function seeAtScratch3(e){
if (document.URL.indexOf("#editor") > -1) return;
if (document.URL.indexOf("#fullscreen") > -1) return;
var btn = "<a href='https://llk.github.io/scratch-gui/develop/#{PID}'><div style='font-weight:bold;font-size:20px;background-color:#4baa29;color:white;display:inline-block;padding:8px;text-align:center;width:150px;height:20px;'>Open at 3.0</div></a>";
var pid = document.URL.replace(/[^0-9]/g, "");
btn = btn.replace("{PID}", pid);
document.getElementsByClassName("buttons")[0].innerHTML = btn + document.getElementsByClassName("buttons")[0].innerHTML;
}
window.addEventListener("load", seeAtScratch3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment