This repository has been archived by the owner on May 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A little userscript that runs embed links to projects.
- Loading branch information
1 parent
67b58bc
commit ccab744
Showing
2 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// ==UserScript== | ||
// @name Forum Project Viewer | ||
// @namespace https://Felizolinha.github.io | ||
// @version 1.0 | ||
// @description Displays embedded projects inside forum posts | ||
// @author TheGameBuilder | ||
// @match *://scratch.mit.edu/discuss/* | ||
// @run-at document-end | ||
// @grant none | ||
// ==/UserScript== | ||
$(document).ready(function() { | ||
var selectors = "div.post_body_html a[href*='://scratch.mit.edu/projects/embed/']:not(blockquote>p.bb-quote-author ~ a)", //Look for links inside forum posts, but not the ones inside quotes with authors. | ||
projectLinks = $(selectors); | ||
|
||
for (var i = 0; i < projectLinks.length; i++) { | ||
var p = $(selectors + ":eq(" + i + ")"), | ||
pLink = p.attr('href'); | ||
p.replaceWith('<br><br><iframe style="display:block; margin:0 auto;" allowtransparency="true" width="485" height="402" src="' + pLink + '" frameborder="0" allowfullscreen></iframe><br><div style="text-align:center;"><a href="' + pLink + '">' + p.html() + '</a></div><br>'); | ||
} | ||
}); |
Empty file.