Created
July 29, 2017 07:23
-
-
Save GeonoTRON2000/42a453632c56c1acf8e48f4f03263663 to your computer and use it in GitHub Desktop.
Allow a Scratch 2.x project to be embedded in BBcode
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
// Usage: [scratch]projectID[/scratch] | |
var posts = document.getElementsByClassName("postmsg"); | |
var pattern = /\[scratch\]([0-9]+)\[\/scratch\]/gi; | |
for (var i = 0; i < posts.length; i++) { | |
var post = posts[i]; | |
post.innerHTML = post.innerHTML.replace(pattern, "<iframe allowtransparency=\"true\" width=\"485\" height=\"402\" src=\"http://scratch.mit.edu/projects/embed/$1/\" frameborder=\"0\" allowfullscreen></iframe>"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment