Skip to content

Instantly share code, notes, and snippets.

@CST1229
Created May 18, 2021 10:50
Show Gist options
  • Save CST1229/cc570d2999031ef8fce19578b8d82458 to your computer and use it in GitHub Desktop.
Save CST1229/cc570d2999031ef8fce19578b8d82458 to your computer and use it in GitHub Desktop.
CST1229's Scratch Forum Tools
Another bookmarklet.
This one just adds tools below the forum editor. Currently there's inserting color tags (not coloring text) and mentioning users. Oh and you can close it.
javascript:BMTool&&(console.log("Tools already exist, removing tools"),BMTool.remove());var BMTool=document.createElement("div");function BMClr(){var o=prompt("Color");null!=o&&paste("[color="+o+"]Your colored text here...[/color]")}function BMMnt(){var o=prompt("Enter a username (with or without the @)");null!=o&&("@"==o[0]&&(o=o.substring(1)),paste("[url=scratch.mit.edu/users/"+o+"]@"+o+"[/url]"))}function BMCls(){window.confirm("Are you sure you want to close the tools? You'll have to reapply the bookmarklet to open them again.")&&BMTool.remove()}document.getElementsByClassName("markItUpFooter")[0].insertAdjacentElement("afterend",BMTool),BMTool.innerHTML="<br> <h2>Tools</h2>",BMTool.innerHTML+='<a onclick="BMClr()">[Add Color Tag] </a>',BMTool.innerHTML+='<a onclick="BMMnt()">[Mention User] </a>',BMTool.innerHTML+='<a onclick="BMCls()">[Close Tools] </a>';void 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment