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

Commit 75d09cc

Browse files
committed
Merge pull request #1 from Felizolinha/patch-1
Merge
2 parents 27692bd + 2351b5e commit 75d09cc

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

originals/GRA0007/scratchultimate.user.js

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
// @version 0.2.1
44
// @description Useful Stuff
55
// @author GRA0007
6+
// @contributor TheGameBuilder
67
// @match http://scratch.mit.edu/*
78
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
89
// @grant none
910
// ==/UserScript==
10-
1111
if(document.URL.indexOf("mystuff/") >= 0){
1212
waitForKeyElements ("#tabs", appendSidebarItems);
1313
}
1414

15-
if(document.URL.indexOf("users/") >= 0){
15+
if(document.URL.indexOf("users/") >= 0){
1616
waitForKeyElements ("#featured-project", liveFeaturedProject);
1717
}
1818

@@ -21,8 +21,26 @@ function appendSidebarItems(jNode) {
2121
}
2222

2323
function liveFeaturedProject(jNode) {
24+
var $projName = $('.project-name'),
25+
projID = Scratch.INIT_DATA.PROFILE.featuredProject.id;
26+
$('.player .title').css('text-align', 'center');
27+
$projName.html($projName.html().trim()); //Make sure no whitespaces interefere with centering
28+
2429
jNode.remove();
25-
var projID = Scratch.INIT_DATA.PROFILE.featuredProject.id
26-
var usid = Scratch.INIT_DATA.PROFILE.featuredProject.creator
27-
$( ".stage" ).append( "<iframe allowtransparency='true' width='282' height='210' src='http://scratch.mit.edu/projects/embed/" + projID + "/?autostart=true' frameborder='0' allowfullscreen=''></iframe>" );
30+
31+
$( ".stage" ).append( "<div style='overflow: hidden; height: 216px;' id='applet'><iframe style='margin-top: -25px;' allowtransparency='true' width='282' height='237' frameborder='0' allowfullscreen=''></iframe></div>" );
32+
33+
$('.stage iframe').load(function(){
34+
var is404 = $(this).contents().find('#page-404').length > 0;
35+
if(is404) {
36+
$('.stage div').css('height', '211px');
37+
$(this).css('margin-top', '-14px');
38+
$(this).attr('height', '239');
39+
$(this).attr('src', 'http://phosphorus.github.io/app.html?id=' + projID);
40+
}
41+
else if($(this).attr('src').indexOf('http://scratch.mit.edu/projects/embed/') > -1) {
42+
setTimeout(function(){$('.stage iframe').attr('height', '238');}, 200);
43+
}
44+
});
45+
$('.stage iframe').attr("src", "http://scratch.mit.edu/projects/embed/" + projID + "/?autostart=true");
2846
}

0 commit comments

Comments
 (0)