2015-03-10 16:33:43 -04:00
<!DOCTYPE html>
< html lang = "en" > <!-- Set this to the main language of your site -->
< head >
2015-03-23 16:26:34 -07:00
< meta charset = "utf-8" >
< title > ScratchX< / title >
< meta name = "viewport" content = "width=device-width, initial-scale=1.0" >
2015-04-30 17:23:09 -04:00
< link href = "css/reset.css" rel = "stylesheet" type = "text/css" >
< link href = "css/base.css" rel = "stylesheet" type = "text/css" >
2015-03-23 16:26:34 -07:00
< link href = "css/scratchx.css" rel = "stylesheet" type = "text/css" >
< script type = "text/javascript" src = "libs/swfobject.js" > < / script >
2015-04-30 17:36:27 -04:00
< script type = "text/javascript" src = "libs/jquery-1.11.2.min.js" > < / script >
2015-03-24 00:33:19 -07:00
< script type = "text/javascript" src = "scratch_extensions/scratch_ext.js" > < / script >
2015-03-23 16:26:34 -07:00
< script type = "text/javascript" >
2015-03-24 00:33:19 -07:00
// Simulate the bare minimum of the view that exists on the main site
var Scratch = Scratch || {};
Scratch.FlashApp = Scratch.FlashApp || {};
2015-03-23 16:26:34 -07:00
function handleEmbedStatus(e) {
$('#scratch-loader').hide();
var scratch = $('#scratch');
if (!e.success) {
scratch.css('marginTop', '10');
scratch.find('IMG.proj_thumb').css('width', '179px');
scratch.find('DIV.scratch_unsupported').show();
scratch.find('DIV.scratch_loading').hide();
} else {
2015-03-24 00:33:19 -07:00
Scratch.FlashApp.ASobj = scratch[0];
2015-03-23 16:26:34 -07:00
}
}
2015-03-26 01:27:47 -07:00
// enables the SWF to log errors
function JSthrowError(e) {
if (window.onerror) window.onerror(e, 'swf', 0);
else console.error(e);
}
function JSeditorReady() {
console.log('swfReady');
try {
handleParameters();
return true;
} catch (error) {
console.error(error.message, "\n", error.stack);
throw error;
}
}
2015-03-26 13:31:41 -07:00
function JSprojectLoaded() {
loadExtensionQueue();
}
2015-03-26 01:27:47 -07:00
var extensionQueue = [];
function handleParameters() {
var project;
var queryString = window.location.search.substring(1);
var queryVars = queryString.split(/[&; ]/);
for (var i = 0; i < queryVars.length ; i + + ) {
var nameVal = queryVars[i].split('=');
switch(nameVal[0]){
case 'ext':
extensionQueue.push(nameVal[1]);
break;
case 'proj':
project = nameVal[1];
break;
}
}
2015-03-26 13:31:41 -07:00
if (project) {
Scratch.FlashApp.ASobj.ASloadSBXFromURL(project);
}
else {
loadExtensionQueue();
}
2015-03-26 01:27:47 -07:00
}
function loadExtensionQueue() {
for (var i = 0; i < extensionQueue.length ; + + i ) {
var extensionURL = extensionQueue[i];
ScratchExtensions.loadExternalJS(extensionURL);
}
extensionQueue = [];
}
2015-03-23 16:26:34 -07:00
var flashVars = {
autostart: 'false',
extensionDevMode: 'true',
server: encodeURIComponent(location.host),
cloudToken: '4af4863d-a921-4004-b2cb-e0ad00ee1927',
cdnToken: '34f16bc63e8ada7dfd7ec12c715d0c94',
urlOverrides: {
sitePrefix: "http://scratch.mit.edu/",
siteCdnPrefix: "http://cdn.scratch.mit.edu/",
assetPrefix: "http://assets.scratch.mit.edu/",
assetCdnPrefix: "http://cdn.assets.scratch.mit.edu/",
projectPrefix: "http://projects.scratch.mit.edu/",
projectCdnPrefix: "http://cdn.projects.scratch.mit.edu/",
internalAPI: "internalapi/",
siteAPI: "site-api/",
staticFiles: "scratchr2/static/"
},
inIE: (navigator.userAgent.indexOf('MSIE') > -1)
};
var params = {
allowscriptaccess: 'always',
allowfullscreen: 'true',
wmode: 'direct',
menu: 'false'
};
$.each(flashVars, function (prop, val) {
if ($.isPlainObject(val))
flashVars[prop] = encodeURIComponent(JSON.stringify(val));
});
2015-04-30 17:23:09 -04:00
swfobject.switchOffAutoHideShow();
2015-03-23 16:26:34 -07:00
swfobject.embedSWF('Scratch.swf', 'scratch', '100%', '100%', '11.7.0', 'libs/expressInstall.swf',
flashVars, params, null, handleEmbedStatus);
< / script >
2015-03-10 16:33:43 -04:00
< / head >
2015-03-23 16:26:34 -07:00
< body class = "editor scratchx" >
2015-04-30 17:23:09 -04:00
< div id = "scratch" >
2015-03-23 16:26:34 -07:00
< div class = "scratch_unsupported" >
2015-04-30 17:23:09 -04:00
< p >
2015-03-23 16:26:34 -07:00
Oh Noes! Scratch project cannot display.< br / >
Flash player is disabled, missing, or less than version 10.2.
< / p >
< a href = "http://www.adobe.com/go/getflashplayer" target = "_blank" > < img
src="//www.adobe.com/images/shared/download_buttons/get_flash_player.gif"
alt="Get Adobe Flash player"/>< / a >
< / div >
< div class = "scratch_loading" > < / div >
2015-03-10 16:33:43 -04:00
< / div >
2015-03-23 16:26:34 -07:00
< / body >
2015-03-10 16:33:43 -04:00
< / html >