This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript: window.copy_paste = function(id) { | |
let substr = id.toString().substring(1); | |
let username = document.querySelector("#" + id).querySelector(".username").innerText; | |
fetch("/discuss/post/" + substr + "/source/") | |
.then(res => res.text()) | |
.then(function(data) { | |
paste("[quote=" + username + "][small][i]([url=https://scratch.mit.edu/discuss/post/" + substr + "][color=grey]Original post[/color][/url])[/i][/small]\n" + data + " [/quote]"); | |
}); | |
}; | |
void(0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function minifyXML(source) { | |
source.value = source.value.replaceAll(/\n */g, ""); | |
source.select(); | |
})(document.querySelector("#content_xml")); | |
/* | |
Blockly { | |
https://scratch.mit.edu/discuss/topic/491165/ | |
} | |
Context { | |
https://scratch.mit.edu/discuss/post/4990156/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Inspiration from <https://gist.github.com/CST1229/1063d77b16593e036764b75e56788f8e> | |
// This will make the Scratch search bar expandable when clicked, like the Scratch Wiki (https://en.scratch-wiki.info) | |
// This is free and open source, but please use credit if you take all of the code (small snippets are free). | |
// Use at your own risk! If you do not trust the code, DO NOT USE IT! | |
const style = document.createElement("style"); | |
style.innerText = ".__hidden { display: none !important; }"; // Will hide nav items | |
document.body.append(style); | |
let setup = function(input, nav) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript: var evtHandler = function (e) { | |
e.preventDefault(); | |
e.stopPropagation(); | |
if (confirm("Do you want to delete this element?")) { | |
e.target.remove(); | |
} | |
document.body.removeEventListener("click", evtHandler); | |
}; | |
document.body.addEventListener("click", evtHandler); | |
// To use: run the code, click an element to delete it. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "dart:html"; | |
final input = querySelector("#input") as TextAreaElement; | |
final output = querySelector("#output") as TextAreaElement; | |
final button = querySelector("#format") as ButtonElement; | |
final number = querySelector("#spaces") as InputElement; | |
final oldNumber = querySelector("#oldspaces") as InputElement; | |
// Setup the variables | |
void main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "dart:html"; | |
final input = querySelector("#input") as TextAreaElement; | |
final output = querySelector("#output") as TextAreaElement; | |
final btn = querySelector("#button") as ButtonElement; | |
final radio = querySelector("#sameline") as RadioButtonInputElement; | |
// Setup elements | |
void main() { | |
btn.addEventListener("click", (Event event) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "dart:html"; | |
final input = querySelector("#input") as TextAreaElement; | |
final output = querySelector("#output") as TextAreaElement; | |
final radio = querySelector("#tabs2spaces") as RadioButtonInputElement; | |
final button = querySelector("#button") as ButtonElement; | |
final spacesPerTabs = querySelector("#spacesPerTabs") as InputElement; | |
// Setup elements | |
void main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "dart:html"; | |
final input = querySelector("#input") as TextAreaElement; | |
final target = querySelector("#output") as TextAreaElement; | |
final number = querySelector("#amount") as InputElement; | |
final trigger = querySelector("#trigger") as ButtonElement; | |
// Setup elements | |
void main() { | |
input.addEventListener("input", (Event event) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const pi = 3.1415; | |
extension NumbersAsFunctions on num { | |
num call(num other) => this * other; | |
} | |
void main() { | |
print(2(pi)); // 6.283 | |
} |
OlderNewer