// izk_fugu - Wrapps FUGU 11 for compatibility with EXD flash applications. // Domain must be aol.com: try {document.domain = "aol.com";} catch(err){} // Global namespace: top.exd_space = ((top.exd_space == null) ? new Object() : top.exd_space); // Event class: top.exd_space.Event = function(name) {this.name = name;}; // Task class: top.exd_space.Task = function(func, obj) { this.func = func; this.obj = obj; }; top.exd_space.Task.create = function(func, obj) {return new top.exd_space.Task(func, obj);}; top.exd_space.Task.prototype = {execute:function() {this.func.apply(this.obj);}}; top.exd_space.TaskList = function() { this.tasks = new Array(); }; top.exd_space.TaskList.prototype = { execute:function() {if(this.tasks.length) for(var t = 0, tsks = this.tasks, tk = tsks[t]; t < tsks.length; tk = tsks[++t]) try {tk.execute();} catch(err) {}}, addNew:function(func, obj) { this.tasks.push(top.exd_space.Task.create(func, obj)); } }; // IZKFugu class: top.exd_space.IZKFugu = function() { var izkfugu = this; this.debug = false; this.log = null; this.fugu = top.FUGU; this.fugu.eventHandler = function(name, value) {izkfugu.onFuguEvent(name, value);}; this.fugu.hiddenInit = true; this.initialize(5000, 0, 777, true, 500, 0, 888); this.fugu.PlayVideoLarge(); this.prevPlayerCoords = null; this.prevCurtainCoords = null; this.tasks = new Array(); }; // izk_fugu methods: top.exd_space.IZKFugu.prototype = { initialize:function(fugu_x, fugu_y, fugu_z, use_curtain, curtain_x, curtain_y, curtain_z) { this.fugu.playerx = ((fugu_x != null) ? fugu_x : this.fugu.playerx); this.fugu.playery = ((fugu_y != null) ? fugu_y : this.fugu.playery); this.fugu.playerz = ((fugu_z != null) ? fugu_z : this.fugu.playerz); this.fugu.curtain = ((use_curtain != null) ? use_curtain : true); this.fugu.curtainx = ((curtain_x != null) ? curtain_x : this.fugu.curtainx); this.fugu.curtainy = ((curtain_y != null) ? curtain_y : this.fugu.curtainy); this.fugu.curtainz = ((curtain_z != null) ? curtain_z : this.fugu.curtainz); }, addTask:function(t) {this.tasks.push(t)}, runTasks:function() {if(this.tasks.length) for(var t = 0, tsks = this.tasks, tk = tsks[t]; t < tsks.length; tk = tsks[++t]) try {tk.execute();} catch(err) {}}, stop:function() {this.fugu.ClickStop();}, previous:function() {this.fugu.ClickPrev();}, next:function() {this.fugu.ClickNext();}, pause:function() {this.fugu.ClickPause();}, mute:function() {this.fugu.ClickMute();}, fullScreen:function() {this.fugu.ClickFullScreen();}, setVolume:function(v) {if(v >= 0) this.fugu.setVolume(v);}, seek:function(s) {if(s >= 0) this.fugu.setSeek(s);}, kill:function() {this.fugu.Hide();}, hold:function() {this.fugu.ClickHold();}, hide:function() { this.hold(); if(this.prevPlayerCoords == null) { this.prevPlayerCoords = this.getPlayerCoordinates(); if(this.prevPlayerCoords) this.fugu.movePlayer(-2000, -2000); } if(this.prevCurtainCoords == null) { this.prevCurtainCoords = this.getCurtainCoordinates(); if(this.prevCurtainCoords) this.fugu.moveCurtain(-2000, -2000); } }, show:function() { if(this.prevPlayerCoords != null) { this.fugu.movePlayer(this.prevPlayerCoords.x, this.prevPlayerCoords.y); this.prevPlayerCoords = null; } if(this.prevCurtainCoords != null) { this.fugu.moveCurtain(this.prevCurtainCoords.x, this.prevCurtainCoords.y); this.prevCurtainCoords = null; } if(!this.fugu.isVisible()) { this.fugu.Show(); } }, play:function() { this.show(); this.fugu.ClickPlay(); this.runTasks(); }, getElapsedTime:function() {this.onFuguEvent("player_elapsed_time", this.fugu.getElapsedTime());}, getTotalTime:function() {this.onFuguEvent("current_media_duration", this.fugu.getTotalTime());}, onFuguEvent:function(name, value) { var event = new top.exd_space.Event(name); switch(name) { case "curtain_coordinates_response" : event.curtainX = value.x; event.curtainY = value.y; top.flashProxy.call("jsEvent", event); if(this.debug) {try {this.log(event.name + " {curtainX:" + event.curtainX + ", curtainY:" + event.curtainY + "}");} catch(err) {}} return; case "player_coordinates_response" : event.playerX = value.x; event.playerY = value.y; top.flashProxy.call("jsEvent", event); if(this.debug) {try {this.log(event.name + " {playerX:" + event.playerX + ", playerY:" + event.playerY + "}");} catch(err) {}} return; case "player_media_changed" : event.playlistCurrent = parseInt(value.playlistCurrent); event.content = (value.content == true) ? "media" : "ad"; top.flashProxy.call("jsEvent", event); if(this.debug) {try {this.log(event.name + " {sequence:" + (event.playlistCurrent + 1) + ", content:" + event.content + ", typeof(value.content):" + typeof(value.content) + "}");} catch(err) {}} return; case "current_media_duration" : event.duration = value; top.flashProxy.call("jsEvent", event); if(this.debug) {try {this.log(event.name + " {duration:" + event.duration + "}");} catch(err) {}} return; case "player_event_timer" : for(var prop in value) {event[prop] = value[prop];} top.flashProxy.call("jsEvent", event); if(this.debug) {try {this.log(event.name + " {id:" + event.id + ", time:" + event.time + "}");} catch(err) {}} return; case "player_elapsed_time" : event.time = value; top.flashProxy.call("jsEvent", event); if(this.debug) {try {this.log(event.name + " {time:" + event.time + "}");} catch(err) {}} return; case "player_full_screen" : top.flashProxy.call("jsEvent", event); if(this.debug) {try {this.log(event.name);} catch(err) {}} return; default : if(this.debug) {try {this.log(event.name + " {value:" + value + "}");} catch(err) {}} return; } }, playItem:function(sequence) { this.show(); this.fugu.PlayItem(sequence); this.runTasks(); }, playVideoLarge:function(pls, tkr_txt, skin) { this.fugu.hiddenInit = null; this.show(); this.fugu.PlayVideoLarge(pls, tkr_txt||[], skin||"grey"); this.runTasks(); }, setTimerEventsFile:function(timerEventsURL) {this.fugu.eventTimers = timerEventsURL;}, getCoords:function(o) { if (o) { var c = new Object(); c.x = parseInt(o.style.left); c.y = parseInt(o.style.top); c.z = o.style.zIndex; return c; } return null; }, movePlayer:function(x,y,z) {this.fugu.movePlayer(x,y,z);}, moveCurtain:function(x,y,z) {this.fugu.moveCurtain(x,y,z);}, moveElements:function(f_x, f_y, f_z, c_x, c_y, c_z) { this.movePlayer(f_x, f_y, f_z); this.moveCurtain(c_x, c_y, c_z); }, getPlayerCoordinates:function() { var coords = this.getCoords(document.getElementById("_FUGU_IFRAME_")); this.onFuguEvent("player_coordinates_request", coords); return coords; }, getCurtainCoordinates:function() { var coords = this.getCoords(document.getElementById("_FUGU_CURTAIN_")); this.onFuguEvent("curtain_coordinates_request", coords); return coords; } }; // Single instance of IZKFugu: if(!top.IZKFugu) {top.IZKFugu = new top.exd_space.IZKFugu();}