From ce621dddea048c11316861a88d5ba1c60a4a6cde Mon Sep 17 00:00:00 2001 From: Felizolinha Date: Wed, 21 Jan 2015 23:15:55 -0200 Subject: [PATCH 1/5] Removed Top Bar and added Phosphorus loading Featured projects now automatically load with Phosphorus if iFrame page yields 404 (unshared and deleted projects). Project's top bar is now hidden as to leave more room for the project. PS: The css and height attribute changes are to work around a glitch that cuts off the bottom of the iFrame. --- originals/GRA0007/scratchultimate.user.js | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/originals/GRA0007/scratchultimate.user.js b/originals/GRA0007/scratchultimate.user.js index 6b70914..666632a 100644 --- a/originals/GRA0007/scratchultimate.user.js +++ b/originals/GRA0007/scratchultimate.user.js @@ -7,13 +7,25 @@ // @require https://gist.github.com/raw/2625891/waitForKeyElements.js // @grant none // ==/UserScript== - if(document.URL.indexOf("mystuff/") >= 0){ waitForKeyElements ("#tabs", appendSidebarItems); } if(document.URL.indexOf("users/") >= 0){ waitForKeyElements ("#featured-project", liveFeaturedProject); + $('.stage iframe').load(function(){ + var is404 = $(this).contents().find('#page-404').length > 0; + if(is404) { + $('.stage div').css('height', '211px'); + $(this).css('margin-top', '-14px'); + $(this).attr('height', '239'); + $(this).attr('src', 'http://phosphorus.github.io/app.html?id=' + projID); + } + else if($(this).attr('src').indexOf('http://scratch.mit.edu/projects/embed/') > -1) { + setTimeout(function(){$('.stage iframe').attr('height', '238')}, 100); + } + }); + $('.stage iframe').attr("src", "http://scratch.mit.edu/projects/embed/" + projID + "/?autostart=true"); } function appendSidebarItems(jNode) { @@ -22,7 +34,8 @@ function appendSidebarItems(jNode) { function liveFeaturedProject(jNode) { jNode.remove(); - var projID = Scratch.INIT_DATA.PROFILE.featuredProject.id - var usid = Scratch.INIT_DATA.PROFILE.featuredProject.creator - $( ".stage" ).append( "" ); + projID = Scratch.INIT_DATA.PROFILE.featuredProject.id; + usid = Scratch.INIT_DATA.PROFILE.featuredProject.creator; + + $( ".stage" ).append( "
" ); } From 9a9c394f8a5a201f81ebd5f8eb1832a4dc978584 Mon Sep 17 00:00:00 2001 From: Felizolinha Date: Wed, 21 Jan 2015 23:55:46 -0200 Subject: [PATCH 2/5] Centered project title Just because it looks better o/ --- originals/GRA0007/scratchultimate.user.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/originals/GRA0007/scratchultimate.user.js b/originals/GRA0007/scratchultimate.user.js index 666632a..75d3799 100644 --- a/originals/GRA0007/scratchultimate.user.js +++ b/originals/GRA0007/scratchultimate.user.js @@ -3,16 +3,22 @@ // @version 0.2.1 // @description Useful Stuff // @author GRA0007 +// @contributor TheGameBuilder // @match http://scratch.mit.edu/* // @require https://gist.github.com/raw/2625891/waitForKeyElements.js // @grant none // ==/UserScript== +var $projName = $('.project-name'); +$('.player .title').css('text-align', 'center'); +$projName.html($projName.html().trim()); //Make sure no whitespaces interefere with centering + if(document.URL.indexOf("mystuff/") >= 0){ waitForKeyElements ("#tabs", appendSidebarItems); } if(document.URL.indexOf("users/") >= 0){ waitForKeyElements ("#featured-project", liveFeaturedProject); + $('.stage iframe').load(function(){ var is404 = $(this).contents().find('#page-404').length > 0; if(is404) { @@ -22,7 +28,7 @@ if(document.URL.indexOf("users/") >= 0){ $(this).attr('src', 'http://phosphorus.github.io/app.html?id=' + projID); } else if($(this).attr('src').indexOf('http://scratch.mit.edu/projects/embed/') > -1) { - setTimeout(function(){$('.stage iframe').attr('height', '238')}, 100); + setTimeout(function(){$('.stage iframe').attr('height', '238')}, 200); } }); $('.stage iframe').attr("src", "http://scratch.mit.edu/projects/embed/" + projID + "/?autostart=true"); From 3ebc8f239d561f715e5bf33fec19e5910600336a Mon Sep 17 00:00:00 2001 From: Felizolinha Date: Thu, 22 Jan 2015 00:38:36 -0200 Subject: [PATCH 3/5] Removed unused variable and enclosed new variables Removed usid as it wasn't being used anywhere and enclosed $projName because it didn't need to be in the global scope. --- originals/GRA0007/scratchultimate.user.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/originals/GRA0007/scratchultimate.user.js b/originals/GRA0007/scratchultimate.user.js index 75d3799..a8d4697 100644 --- a/originals/GRA0007/scratchultimate.user.js +++ b/originals/GRA0007/scratchultimate.user.js @@ -8,9 +8,6 @@ // @require https://gist.github.com/raw/2625891/waitForKeyElements.js // @grant none // ==/UserScript== -var $projName = $('.project-name'); -$('.player .title').css('text-align', 'center'); -$projName.html($projName.html().trim()); //Make sure no whitespaces interefere with centering if(document.URL.indexOf("mystuff/") >= 0){ waitForKeyElements ("#tabs", appendSidebarItems); @@ -39,9 +36,12 @@ function appendSidebarItems(jNode) { } function liveFeaturedProject(jNode) { + var $projName = $('.project-name'); + $('.player .title').css('text-align', 'center'); + $projName.html($projName.html().trim()); //Make sure no whitespaces interefere with centering + jNode.remove(); projID = Scratch.INIT_DATA.PROFILE.featuredProject.id; - usid = Scratch.INIT_DATA.PROFILE.featuredProject.creator; $( ".stage" ).append( "
" ); } From 2351b5e8a25d9db1f51fe3a3ea7d5fdedb457cec Mon Sep 17 00:00:00 2001 From: Felizolinha Date: Thu, 22 Jan 2015 01:10:04 -0200 Subject: [PATCH 4/5] HOTFIX - Enclosed load function The old way caused an error on profiles that didn't have any featured projects. --- originals/GRA0007/scratchultimate.user.js | 35 +++++++++++------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/originals/GRA0007/scratchultimate.user.js b/originals/GRA0007/scratchultimate.user.js index a8d4697..5817146 100644 --- a/originals/GRA0007/scratchultimate.user.js +++ b/originals/GRA0007/scratchultimate.user.js @@ -8,27 +8,12 @@ // @require https://gist.github.com/raw/2625891/waitForKeyElements.js // @grant none // ==/UserScript== - if(document.URL.indexOf("mystuff/") >= 0){ waitForKeyElements ("#tabs", appendSidebarItems); } -if(document.URL.indexOf("users/") >= 0){ +if(document.URL.indexOf("users/") >= 0){ waitForKeyElements ("#featured-project", liveFeaturedProject); - - $('.stage iframe').load(function(){ - var is404 = $(this).contents().find('#page-404').length > 0; - if(is404) { - $('.stage div').css('height', '211px'); - $(this).css('margin-top', '-14px'); - $(this).attr('height', '239'); - $(this).attr('src', 'http://phosphorus.github.io/app.html?id=' + projID); - } - else if($(this).attr('src').indexOf('http://scratch.mit.edu/projects/embed/') > -1) { - setTimeout(function(){$('.stage iframe').attr('height', '238')}, 200); - } - }); - $('.stage iframe').attr("src", "http://scratch.mit.edu/projects/embed/" + projID + "/?autostart=true"); } function appendSidebarItems(jNode) { @@ -36,12 +21,26 @@ function appendSidebarItems(jNode) { } function liveFeaturedProject(jNode) { - var $projName = $('.project-name'); + var $projName = $('.project-name'), + projID = Scratch.INIT_DATA.PROFILE.featuredProject.id; $('.player .title').css('text-align', 'center'); $projName.html($projName.html().trim()); //Make sure no whitespaces interefere with centering jNode.remove(); - projID = Scratch.INIT_DATA.PROFILE.featuredProject.id; $( ".stage" ).append( "
" ); + + $('.stage iframe').load(function(){ + var is404 = $(this).contents().find('#page-404').length > 0; + if(is404) { + $('.stage div').css('height', '211px'); + $(this).css('margin-top', '-14px'); + $(this).attr('height', '239'); + $(this).attr('src', 'http://phosphorus.github.io/app.html?id=' + projID); + } + else if($(this).attr('src').indexOf('http://scratch.mit.edu/projects/embed/') > -1) { + setTimeout(function(){$('.stage iframe').attr('height', '238');}, 200); + } + }); + $('.stage iframe').attr("src", "http://scratch.mit.edu/projects/embed/" + projID + "/?autostart=true"); } From 27692bd5e83aa8daeafcfa0b3ae7edaed64aa7a1 Mon Sep 17 00:00:00 2001 From: Felizolinha Date: Thu, 22 Jan 2015 03:05:51 -0200 Subject: [PATCH 5/5] URLs Clean Up Changed all GitHub's raw file links to rawgit (GitHub blocks scripts from grabbing raw files) and commented out broken links. @djdolphin Please provide a new link for: http://scratch.cf/extensions/imagestuff.js this one does not work. @Thepuzzlegame Please provide new links for your extensions. --- originals/djdolphin/scratchystuff.user.js | 37 +++++++++++------------ 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/originals/djdolphin/scratchystuff.user.js b/originals/djdolphin/scratchystuff.user.js index 27fb398..3bdb609 100644 --- a/originals/djdolphin/scratchystuff.user.js +++ b/originals/djdolphin/scratchystuff.user.js @@ -12,31 +12,30 @@ window.location.search.replace(/([^?=&]+)(=([^&]*))?/g, function($0, $1, $2, $3) var username = Scratch.INIT_DATA.LOGGED_IN_USER.model ? Scratch.INIT_DATA.LOGGED_IN_USER.model.username : null; var extPresets = { - 'Mesh': {url: 'https://raw.githubusercontent.com/bobbybee/mesh-2.0/master/ext.js', author: 'bobbybee'}, + 'Mesh': {url: 'https://cdn.rawgit.com/bobbybee/mesh-2.0/master/ext.js', author: 'bobbybee'}, 'Scratch Cloud': {url: 'https://dl.dropboxusercontent.com/u/6274273/web/scratchcloud/icon.js', author: 'MathWizz'}, - 'Image Stuff': {url: 'http://scratch.cf/extensions/imagestuff.js', author: 'djdolphin'}, + //'Image Stuff': {url: 'http://scratch.cf/extensions/imagestuff.js', author: 'djdolphin'}, 'Cool helpful things extension': {url: 'http://textuploader.com/07bg/raw', author: 'PullJosh'}, 'More Math': {url: 'http://savakamyimages00000.weebly.com/uploads/6/4/5/3/6453739/more_math.js', author: 'savaka'}, - 'Debugging': {url: 'http://savakamyimages00000.weebly.com/uploads/6/4/5/3/6453739/javascript_dialogs.js', author: 'savaka'}, 'Javascript Dialogs': {url: 'http://savakamyimages00000.weebly.com/uploads/6/4/5/3/6453739/javascript_dialogs.js', author: 'savaka'}, 'Link Opener': {url: 'http://savakamyimages00000.weebly.com/uploads/6/4/5/3/6453739/link_opener.js', author: 'savaka'}, - 'littleBits': {url: 'https://raw.githubusercontent.com/khanning/scratch-littlebits-extension/master/littlebits_extension.js', author: 'khanning'}, - 'Data Blocks': {url: 'https://raw.githubusercontent.com/Thepuzzlegame/My-Scratch-Extensions/master/data_extension.js', author: 'Thepuzzlegame'}, - 'Infinity Reporter': {url: 'https://raw.githubusercontent.com/Thepuzzlegame/My-Scratch-Extensions/master/infinity_reporter.js', author: 'Thepuzzlegame'}, - 'Extension Loader': {url: 'https://raw.githubusercontent.com/Thepuzzlegame/My-Scratch-Extensions/master/extension_loader.js', author: 'Thepuzzlegame'}, - 'Alarm extension': {url: 'https://raw.githubusercontent.com/LLK/scratch-extension-docs/master/alarm_extension.js', author: 'sdg1'}, - 'Browser Stuff': {url: 'https://raw.githubusercontent.com/LLK/scratch-extension-docs/master/browser_extension.js', author: 'grokblah'}, - 'Joystick': {url: 'https://raw.githubusercontent.com/LLK/scratch-extension-docs/master/joystickExtension.js', author: 'sdg1'}, - 'Local Storage': {url: 'https://raw.githubusercontent.com/LLK/scratch-extension-docs/master/localstorage_extension.js', author: 'sdg1'}, - 'PicoBoard': {url: 'https://raw.githubusercontent.com/LLK/scratch-extension-docs/master/picoExtension.js', author: 'grokblah'}, + 'littleBits': {url: 'https://cdn.rawgit.com/khanning/scratch-littlebits-extension/master/littlebits_extension.js', author: 'khanning'}, + //'Data Blocks': {url: 'https://raw.githubusercontent.com/Thepuzzlegame/My-Scratch-Extensions/master/data_extension.js', author: 'Thepuzzlegame'}, + //'Infinity Reporter': {url: 'https://raw.githubusercontent.com/Thepuzzlegame/My-Scratch-Extensions/master/infinity_reporter.js', author: 'Thepuzzlegame'}, + //'Extension Loader': {url: 'https://raw.githubusercontent.com/Thepuzzlegame/My-Scratch-Extensions/master/extension_loader.js', author: 'Thepuzzlegame'}, + 'Alarm extension': {url: 'https://cdn.rawgit.com/LLK/scratch-extension-docs/master/alarm_extension.js', author: 'sdg1'}, + 'Browser Stuff': {url: 'https://cdn.rawgit.com/LLK/scratch-extension-docs/master/browser_extension.js', author: 'grokblah'}, + 'Joystick': {url: 'https://cdn.rawgit.com/LLK/scratch-extension-docs/master/joystickExtension.js', author: 'sdg1'}, + 'Local Storage': {url: 'https://cdn.rawgit.com/LLK/scratch-extension-docs/master/localstorage_extension.js', author: 'sdg1'}, + 'PicoBoard': {url: 'https://cdn.rawgit.com/LLK/scratch-extension-docs/master/picoExtension.js', author: 'grokblah'}, 'PicoBoard Fixed': {url: 'http://www.picaxe.com/downloads/scratch/scraxepicoextension.js', 'author': 'SCRAXE'}, - 'Power Extension': {url: 'https://raw.githubusercontent.com/LLK/scratch-extension-docs/master/power_extension.js', author: 'sdg1'}, - 'Random wait extension': {url: 'https://raw.githubusercontent.com/LLK/scratch-extension-docs/master/random_wait_extension.js', author: 'sdg1'}, - 'Speech to Text': {url: 'https://raw.githubusercontent.com/LLK/scratch-extension-docs/master/speech_to_text_extension.js', author: 'sdg1'}, - 'Text to Speech': {url: 'https://raw.githubusercontent.com/LLK/scratch-extension-docs/master/text_to_speech_extension.js', author: 'sdg1'}, - 'Text to Speech Simple': {url: 'https://raw.githubusercontent.com/LLK/scratch-extension-docs/master/text_to_speech_simple_extension.js', author: 'sdg1'}, - 'Weather Extension': {url: 'https://raw.githubusercontent.com/LLK/scratch-extension-docs/master/weather_extension.js', author: 'sdg1'}, - 'ScratchExt': {url: 'http://stefanbates.com/library/import.js', author: 'GrannyCookies, Yoda3D, Thistleeverfreen'} + 'Power Extension': {url: 'https://cdn.rawgit.com/LLK/scratch-extension-docs/master/power_extension.js', author: 'sdg1'}, + 'Random wait extension': {url: 'https://cdn.rawgit.com/LLK/scratch-extension-docs/master/random_wait_extension.js', author: 'sdg1'}, + 'Speech to Text': {url: 'https://cdn.rawgit.com/LLK/scratch-extension-docs/master/speech_to_text_extension.js', author: 'sdg1'}, + 'Text to Speech': {url: 'https://cdn.rawgit.com/LLK/scratch-extension-docs/master/text_to_speech_extension.js', author: 'sdg1'}, + 'Text to Speech Simple': {url: 'https://cdn.rawgit.com/LLK/scratch-extension-docs/master/text_to_speech_simple_extension.js', author: 'sdg1'}, + 'Weather Extension': {url: 'https://cdn.rawgit.com/LLK/scratch-extension-docs/master/weather_extension.js', author: 'sdg1'}, + 'ScratchExt': {url: 'http://stefanbates.com/library/install.js', author: 'GrannyCookies, Yoda3D, Thistleeverfreen'} }; //Thanks, Thepuzzlegame!