Skip to content

Instantly share code, notes, and snippets.

@danburke
Last active December 18, 2015 16:29
Show Gist options
  • Save danburke/5812278 to your computer and use it in GitHub Desktop.
Save danburke/5812278 to your computer and use it in GitHub Desktop.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Scribblar Room</title>
<LINK href="//s3.amazonaws.com/media.muchosmedia.com/scribblar/styles/style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="//s3.amazonaws.com/media.muchosmedia.com/scribblar/scripts/includes.js"></script>
<script type="text/javascript">
// config
var preferredLocales="en_US";
var targetID = "scribblar";
function initialEmbed()
{
var flashvars = {};
/* pass necessary variables to the SWF */
flashvars.userid = "0";
flashvars.roomid = "k3ns5";
flashvars.preferredLocales = "en_US";
/*flashvars.username = "John Doe";*/ /* optional: pass a username if userid is 0 */
var params = {};
params.allowscriptaccess = "always";
var attributes = {};
attributes.id = targetID;
swfobject.embedSWF("//s3.amazonaws.com/media.muchosmedia.com/scribblar/v2/main.swf", "alternate", "100%", "90%", "10.2.0", "http://media.muchosmedia.com/swfobject/expressInstall.swf", flashvars, params, attributes);
}
//Support function: checks to see if target element is an object or embed element
function isObject(targetID){
var isFound = false;
var el = document.getElementById(targetID);
if(el && (el.nodeName === "OBJECT" || el.nodeName === "EMBED")){
isFound = true;
}
return isFound;
}
//Support function: creates an empty element to replace embedded SWF object
function replaceSwfWithEmptyDiv(targetID)
{
var el = document.getElementById(targetID);
if(el)
{
var div = document.createElement("div");
el.parentNode.insertBefore(div, el);
//Remove the SWF
swfobject.removeSWF(targetID);
//Give the new DIV the old element's ID
div.setAttribute("id", targetID);
}
}
function loadSWF( userid, roomid, username, locale )
{
if (locale != "")
preferredLocales = locale;
//Check for existing SWF
if(isObject(targetID)){
//replace object/element with a new div
replaceSwfWithEmptyDiv(targetID);
}
//Embed SWF
if (swfobject.hasFlashPlayerVersion("10"))
{
var attributes = { data: url, width:"100%", height:"100%" };
var params = { flashvars:"userid=" + userid + "&roomid=" + roomid + "&preferredLocales=" + preferredLocales + "&username=" + username };
params.allowscriptaccess = "always";
var obj = swfobject.createSWF(attributes, params, targetID);
}
}
function userListUpdate( users )
{
console.log(users);
}
function thisMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName];
} else {
return document[movieName];
}
}
// force assets reload
function reloadAssets()
{
thisMovie( 'scribblar' ).reloadAssets();
}
// request userlist, wait for userListUpdate to be called
function getUserList()
{
thisMovie( 'scribblar' ).getUserList();
}
// tell Flash to load the image specified with imgURL
function addImage( imgURL )
{
thisMovie( 'scribblar' ).addImage( imgURL );
}
// tell Flash to set new locale
function setLocale( locale )
{
thisMovie( 'scribblar' ).setLocale( locale );
}
initialEmbed();
</script>
</head>
<body scroll="no">
<form name="form1" onsubmit="return false;">
<input type="text" name="input" value="http://pcwin.com/media/images/screen/Perfect_Toolbar_Icons_17415.jpg" />
<input type="button" value="Send" onclick="addImage(this.form.input.value);" /><br />
</form>
<form name="form2" onsubmit="return false;">
<input type="button" value="de_DE" onclick="setLocale('de_DE')" /><br />
</form>
<form name="form3" onsubmit="return false;">
<input type="button" value="en_US" onclick="setLocale('en_US')" /><br />
</form>
<form name="form4" onsubmit="return false;">
<input type="button" value="getUserList" onclick="getUserList()" /><br />
</form>
<form name="form5" onsubmit="return false;">
<input type="button" value="reloadAssets" onclick="reloadAssets()" /><br />
</form>
<div id="alternate">
<p>&nbsp;</p>
<p>Oh, it appears that you need to upgrade Flash Player to access this page.<br />
<a href="http://www.adobe.com/go/getflashplayer"> Please download it now.</a></p>
<p>After the install you may have to restart your browser. <br />
Problems or questions? <a href="mailto:info@scribblar.com">Contact us!</a></p>
<p><br>
<a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" border="0" alt="Get Adobe Flash player" /></a></p>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment