Skip to content
This repository has been archived by the owner on May 30, 2021. It is now read-only.

Commit

Permalink
Project Player 4 Forum Posts
Browse files Browse the repository at this point in the history
A little userscript that runs embed links to projects.
  • Loading branch information
Felizolinha committed Jan 29, 2015
1 parent 67b58bc commit ccab744
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions originals/TheGameBuilder/forumProjectPlayer.user.js
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.

0 comments on commit ccab744

Please sign in to comment.