scratch-html5/compare.html

139 lines
5.8 KiB
HTML

<?
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
?>
<!DOCTYPE html>
<html>
<head>
<title>Scratch HTML5 vs. Flash</title>
<meta charset="utf-8">
<style type="text/css">
body {
background: #222;
color: #fff;
margin: 0;
}
</style>
<link href="player.css" type="text/css" rel="stylesheet" />
<link href="compare.css" type="text/css" rel="stylesheet" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
<script src="js/util/Timer.js"></script>
<script src="js/util/OffsetBuffer.js"></script>
<script src="js/util/Color.js"></script>
<script src="js/util/Rectangle.js"></script>
<script src="js/Sprite.js"></script>
<script src="js/Reporter.js"></script>
<script src="js/Stage.js"></script>
<script src="js/sound/WAVFile.js"></script>
<script src="js/sound/SoundDecoder.js"></script>
<script src="js/sound/SoundBank.js"></script>
<script src="js/sound/NotePlayer.js"></script>
<script src="soundbank/Instr.js"></script>
<script src="js/IO.js"></script>
<script src="js/primitives/VarListPrims.js"></script>
<script src="js/primitives/MotionAndPenPrims.js"></script>
<script src="js/primitives/LooksPrims.js"></script>
<script src="js/primitives/SensingPrims.js"></script>
<script src="js/primitives/SoundPrims.js"></script>
<script src="js/primitives/Primitives.js"></script>
<script src="js/Interpreter.js"></script>
<script src="js/Runtime.js"></script>
<script src="js/Scratch.js"></script>
<script type="text/javascript">
if (window.location.hash) {
var project_id = parseInt(window.location.hash.substr(1));
} else {
var project_id = 10000160; // Default project for display
}
</script>
<script>
var flashLog = null;
$(function() {
// The flashvars tell flash about the project data (and autostart=true)
var flashvars = {
server: encodeURIComponent('scratch.mit.edu'),
debugOps: true,
debugOpCmd: 'debugFlash',
project_id: project_id
};
var params = {
allowscriptaccess: 'always',
allowfullscreen: 'false',
wmode: 'direct',
menu: 'false'
};
var flashPlayer = null;
//var swf_url = "http://cdn.scratch.mit.edu/scratchr2/static/Scratch.swf";
var swf_url = "http://jiggler.media.mit.edu/shanemc/scratchr2/static/Scratch.swf";
swfobject.embedSWF(swf_url, "flashScratch", "482", "402", "10.2.0",
"http://cdn.scratch.mit.edu/scratchr2/static/expressInstall.swf",
flashvars, params, null, function(e) {
$('#flashScratch').css('visibility', 'visible');
if (e.success) flashPlayer = e.ref;
});
$('#trigger_green_flag, #greenSlide').click(function() {
flashPlayer.ASstartRunning();
});
// Stop button behavior
$('#trigger_stop').click(function() {
flashPlayer.ASstopRunning();
});
flashLog = $('#flashDebug');
var jsLog = $('#jsDebug');
interp.debugOps = true;
interp.debugFunc = function(opCount, opName, args) {
var text = opCount + ': '+opName+'('+args.join(', ')+')';
jsLog.val(jsLog.val() + text + "\n");
}
// Setup synchronized scrolling
flashLog.scroll(function() {
jsLog.scrollTop(flashLog.scrollTop());
});
jsLog.scroll(function() {
flashLog.scrollTop(jsLog.scrollTop());
});
});
function debugFlash(opCount, opName, args) {
var text = opCount + ': '+opName+'('+args.join(', ')+')';
flashLog.val(flashLog.val() + text + "\n");
}
</script>
</head>
<body>
<div>
<div id="info">Loading...</div>
<button id="trigger_green_flag">Green flag</button>
<button id="trigger_stop">Stop</button>
<input type="text" name="project_id" id="project_id" /><button id='go_project'>Go!</button>
</div>
<div class="playerContainer">
<div id="up">&nbsp;</div>
<div id="left">&nbsp;</div>
<div id="overContainer">
<div id="greenSlide"><div id="greenSlideFg"><img src="img/greenflag.png"></div></div>
<div id="container"></div>
</div>
<div id="right">&nbsp;</div>
<div id="down">&nbsp;</div>
<textarea id="jsDebug"></textarea>
</div>
<div class="playerContainer">
<div id="flashScratch" style="text-align:center;visibility:hidden;">
<p style="color:#aaa;font-size:22px;margin-top:14px;line-height:28px;">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">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" target="_blank" />
</a>
</div>
<textarea id="flashDebug"></textarea>
</div>
</body>
</html>