This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-10-27 15:53:45

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Load a different version of a project

I'm sure most of you know that the Flash player loads the latest version of the project. And some people (such as myself) have surely tried to get it to load a different version of the player. Well, i finally got it to work!


Step 1:
View the source of the current page.

Step 2:
Copy the following:

Code:

                   function installPlayer(swfName, swfID) {
                       var flashvars = {
                           project: '/static/projects/[username]/[id].sb?version=[latest version]'};
                       var params = {
                           allowScriptAccess: 'sameDomain',
                           allowFullScreen: true
                       };
                       var attributes = {};
                       swfobject.embedSWF(swfName, swfID, 482, 401, '10.0', false, flashvars, params, attributes);
                       flashapp = document.getElementById(swfID);
                       flashapp.style.position = 'relative';
                       flashapp.style.marginLeft = '19px';
                       flashapp.parentNode.parentNode.style.overflow = 'visible'; // override CSS
                       flashapp.style.zIndex = 1000; // put in front
                       setPlayerSize(482, 401);
                   }

Step 3:
Paste into a text editor of some sort, such as boring Notepad, or maybe something good like Notepad++ (or gedit).

Step 4:
Change ?version=[latest] to ?version=[other].

Step 5:
Add to the bottom of this:

Code:

initProjectbox();installPlayer('/static/misc/Scratch.swf', 'PlayerOnly');

Step 6:
Copy all this code, and enter it into your JavaScript console. (Firefox: ctrl+shift+k, Chrome: inspect an element>console)

Step 7:
Watch the other version load!

Offline

 

#2 2012-10-27 16:01:00

dvd4
Scratcher
Registered: 2010-06-30
Posts: 1000+

Re: Load a different version of a project

Awesome guide !


I made a mod  big_smile  It's called blook!
http://i49.tinypic.com/16ia63p.png

Offline

 

#3 2012-10-28 02:41:39

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: Load a different version of a project

Safari: cmd-alt-c for console.  wink


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#4 2012-10-28 04:31:02

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Load a different version of a project

And chrome, ctrl shift J

Awesome!

Offline

 

#5 2012-10-28 07:23:05

dvd4
Scratcher
Registered: 2010-06-30
Posts: 1000+

Re: Load a different version of a project

Hardmath123 wrote:

Safari: cmd-alt-c for console.  wink

Or cmd-option-c.


I made a mod  big_smile  It's called blook!
http://i49.tinypic.com/16ia63p.png

Offline

 

#6 2012-10-28 07:37:45

nathanprocks
Scratcher
Registered: 2011-04-14
Posts: 1000+

Re: Load a different version of a project

dvd4 wrote:

Hardmath123 wrote:

Safari: cmd-alt-c for console.  wink

Or cmd-option-c.

Lol alt and option are the same thing.  tongue


http://carrot.cassiedragonandfriends.org/Scratch_Signature/randomsig.php
http://trinary.site40.net/images/scratchrank.php?username=nathanprocks&display=small

Offline

 

#7 2012-10-28 07:49:49

dvd4
Scratcher
Registered: 2010-06-30
Posts: 1000+

Re: Load a different version of a project

nathanprocks wrote:

dvd4 wrote:

Hardmath123 wrote:

Safari: cmd-alt-c for console.  wink

Or cmd-option-c.

Lol alt and option are the same thing.  tongue

They are different.


I made a mod  big_smile  It's called blook!
http://i49.tinypic.com/16ia63p.png

Offline

 

#8 2012-10-28 08:38:12

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: Load a different version of a project

But the key is the same.  wink

P.S. Sci, you should use prompts to make it a more convenient bookmarklet.


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#9 2012-10-29 14:54:09

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Load a different version of a project

Hardmath123 wrote:

But the key is the same.  wink

P.S. Sci, you should use prompts to make it a more convenient bookmarklet.

Sure thing. Just give me a few minutes...

Offline

 

#10 2012-10-29 15:28:05

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Load a different version of a project

Gah, it won't load from a bookmarklet! Well, here's something with no editing, just a single prompt asking for the version.

Code:

function installPlayer(swfName, swfID) {
    var temps = {u: '', i: '', v: ''};
    temps.u = window.location.pathname.substring(10);
    temps.i = temps.u.substring(temps.u.indexOf('/')+1);
    temps.u = temps.u.substring(0,temps.u.indexOf('/'));
    temps.v = document.body.innerHTML.match(/.sb\?version=\d+/).toString().match(/\d+/);
    temps.v = prompt('What version? Current is '+temps.v,temps.v-1);
    var flashvars = {
        project: '/static/projects/'+temps.u+'/'+temps.i+'.sb?version='+temps.v};
    var params = {
        allowScriptAccess: 'sameDomain',
        allowFullScreen: true
    };
    var attributes = {};
    swfobject.embedSWF(swfName, swfID, 482, 401, '10.0', false, flashvars, params, attributes);
    flashapp = document.getElementById(swfID);
    flashapp.style.position = 'relative';
    flashapp.style.marginLeft = '19px';
    flashapp.parentNode.parentNode.style.overflow = 'visible'; // override CSS
    flashapp.style.zIndex = 1000; // put in front
    setPlayerSize(482, 401);
}
initProjectbox();installPlayer('/static/misc/Scratch.swf', 'PlayerOnly');

Offline

 

#11 2012-10-29 15:50:09

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: Load a different version of a project

scimonster wrote:

temps.v = document.body.innerHTML.match(/.sb\?version=\d+/).toString().match(/\d+/);

Escape your "."


nXIII

Offline

 

#12 2012-10-29 17:45:33

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: Load a different version of a project

Haha, this is amazing! Nice job!  big_smile


Hai.

Offline

 

#13 2012-10-29 20:43:51

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: Load a different version of a project

I remember I tried to do this one time--but I failed miserably!  Thanks for getting it to work!   smile

Offline

 

#14 2012-10-30 02:45:49

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Load a different version of a project

nXIII wrote:

scimonster wrote:

temps.v = document.body.innerHTML.match(/.sb\?version=\d+/).toString().match(/\d+/);

Escape your "."

I don't think it mattered too much, since it would only match a literal period.

Code:

function installPlayer(swfName, swfID) {
    var temps = {u: '', i: '', v: ''};
    temps.u = window.location.pathname.substring(10);
    temps.i = temps.u.substring(temps.u.indexOf('/')+1);
    temps.u = temps.u.substring(0,temps.u.indexOf('/'));
    temps.v = document.body.innerHTML.match(/\.sb\?version=\d+/).toString().match(/\d+/);
    temps.v = prompt('What version? Current is '+temps.v,temps.v-1);
    var flashvars = {
        project: '/static/projects/'+temps.u+'/'+temps.i+'.sb?version='+temps.v};
    var params = {
        allowScriptAccess: 'sameDomain',
        allowFullScreen: true
    };
    var attributes = {};
    swfobject.embedSWF(swfName, swfID, 482, 401, '10.0', false, flashvars, params, attributes);
    flashapp = document.getElementById(swfID);
    flashapp.style.position = 'relative';
    flashapp.style.marginLeft = '19px';
    flashapp.parentNode.parentNode.style.overflow = 'visible'; // override CSS
    flashapp.style.zIndex = 1000; // put in front
    setPlayerSize(482, 401);
}
initProjectbox();installPlayer('/static/misc/Scratch.swf', 'PlayerOnly');

It still doesn't work as a bookmarklet though. D:

Offline

 

#15 2012-10-30 02:55:08

slinger
Scratcher
Registered: 2011-06-21
Posts: 1000+

Re: Load a different version of a project

Nice find!  smile
I'll definitely have to try this!


http://s0.bcbits.com/img/buttons/bandcamp_130x27_blue.png

Offline

 

#16 2012-10-30 11:09:53

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: Load a different version of a project

scimonster wrote:

I don't think it mattered too much, since it would only match a literal period.

…No, it would match any character; that's what a dot does. For example, if I called my project ssb?version=0, it would match that instead.

Last edited by nXIII (2012-10-30 11:10:02)


nXIII

Offline

 

#17 2012-10-30 13:16:02

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Load a different version of a project

nXIII wrote:

scimonster wrote:

I don't think it mattered too much, since it would only match a literal period.

…No, it would match any character; that's what a dot does. For example, if I called my project ssb?version=0, it would match that instead.

Oh, i know that. I meant in my case, it would match the literal dot because that's what's there.

Offline

 

Board footer