/* * IZKflashDalai * * @author Isaac Rivera * @version 1.5 * @date 11/01/2005 * * A DalaiLlama wrapper/decorator singleton class adds support for a
* embedded player to "float" above other browser content such as a flash * application. Provides a unified and consistent interface to access * DalaiLlama. * * CONSTRUCTOR * * Returns a IZKflashDalai instance wrapping the DalaiLlama object passed as * argument. This IZKflashDalai object should be a singleton that masks the * IZKflashDalai Class constructor. * * @param dalaiObject: an instance of DalaiLlama */ IZKflashDalai = function(dalaiObject) { // save a reference to the DalaiLlama object: this.player = dalaiObject; // this.player.DLServer = "us.video.aol.com"; // init the instance: this.player.Init("video"); // save a reference to the
which // contains the DalaiLlama object: this.layer = window.document.getElementById("IZKflashDalaiDiv"); // save a reference to the syle of the layer: this.style = this.layer.style; // save a refrence to the iframe of the player: this.iframe = window.document.getElementById( "_DL_IFRAME_" ); // curtain properties: if(!(this.curtain = window.document.getElementById("IZKcurtainDiv"))) this.curtain = false; this.curtainFrame = (this.curtain) ? window.document.getElementById("ac_frame") : null; this.curtainFrameStyle = (this.curtain) ? this.curtainFrame.style : null; // Client information: var ua = navigator.userAgent.toLowerCase(); this.client = ua.indexOf("safari") > -1 ? "safari" : ua.indexOf("firefox") > -1 ? "firefox" : ua.indexOf("aol") > -1 ? "aol" : ua.indexOf("netscape") > -1 ? "netscape" : ua.indexOf("msie") > -1 ? "msie" : "other"; this.platform = ua.indexOf("windows") > -1 ? "pc" : ua.indexOf("mac") > -1 ? "mac" : "other"; // AOL hat Adjustment: var hat = window.document.getElementById("hat"); this.hatOffset = 0; if(hat) { var fudgeNumber = 8; this.hatOffset = hat.offsetTop + hat.offsetHeight + fudgeNumber; } this.moveBy(0, this.hatOffset); } /* * METHOD setPosition * * Sets the top-left coordinates of the
containing DalaiLlama * * @param top: A Number indicating the amount to move the player vertically * @param left: A Number indicating the amount to move the player horizontally. */ IZKflashDalai.prototype.moveBy = function(left, top) { var newLayerTop = 0, newLayerLeft = 0; if(this.layer.offsetTop) { newLayerTop = "" + (this.layer.offsetTop + top) + "px"; } else if(this.style.top.length) { newLayerTop = "" + (parseInt(this.style.top.substring(0, this.style.top.length - 2)) + top) + "px" } else { newLayerTop = "" + top + "px" } if(this.layer.offsetLeft) { newLayerLeft = "" + (this.layer.offsetLeft + top) + "px"; } else if(this.style.left.length) { newLayerLeft = "" + (parseInt(this.style.left.substring(0, this.style.left.length - 2)) + left) + "px" } else { newLayerLeft = "" + left + "px" } this.setPosition(newLayerLeft, newLayerTop); } /* * METHOD setRect * * Sets the area and top-left coordinates of the
containing DalaiLlama * * @param top: CSS string indicating distance in pixels from the top of the * document * @param left: CSS string indicating distance in pixels from the left of the * document * @param width: CSS string indicating
container's width in pixels * @param height: CSS string indicating
container's height in pixels */ IZKflashDalai.prototype.setRect = function(left, top, width, height) { this.setPosition(left, top); this.setSize(width, height); } /* * METHOD setPosition * * Sets the top-left coordinates of the
containing DalaiLlama * * @param top: CSS string indicating distance in pixels from the top of the * document * @param left: CSS string indicating distance in pixels from the left of the * document */ IZKflashDalai.prototype.setPosition = function(left, top) { this.setLeft(left); this.setTop(top); } /* * METHOD setLeft * * Sets the left coordinate of the
containing DalaiLlama * * @param left: CSS string indicating distance in pixels from the left of the * document */ IZKflashDalai.prototype.setLeft = function(left) { this.style.left = left; } /* * METHOD setTop * * Sets the top coordinate of the
containing DalaiLlama * * @param top: CSS string indicating distance in pixels from the top of the * document */ IZKflashDalai.prototype.setTop = function(top) { this.style.top = top; } /* * METHOD setSize * * Sets the area of the
containing DalaiLlama * * @param width: CSS string indicating
container's width in pixels * @param height: CSS string indicating
container's height in pixels */ IZKflashDalai.prototype.setSize = function(width, height) { this.setWidth(width); this.setHeight(height); } /* * METHOD setWidth * * Sets the width of the
containing DalaiLlama * * @param width: CSS string indicating
container's width in pixels */ IZKflashDalai.prototype.setWidth = function(width) { this.style.width = width; } /* * METHOD setHeight * * Sets the height of the
containing DalaiLlama * * @param width: CSS string indicating
container's height in pixels */ IZKflashDalai.prototype.setHeight = function(height) { this.style.height = height; } /* * METHOD loadVideoClip * * Requests a new pmmsid from DalaiLlama, if the
container is hidden it * makes it visible * * @param pmmsid: string indicating a new target video clip for DalaiLlama * @param captions: An array of caption strings, empty string or null * @param skin: A string ("blue" or "grey") or null */ IZKflashDalai.prototype.loadVideoClip = function(pmmsid, captions, skin) { var _skin = skin || "grey"; var _captions = captions || ""; this.player.PlayVideoLarge(pmmsid, _captions, _skin); this.show(); } /* * METHOD openPlaylist * * Requests a playlist from DalaiLlama * * @param see DalaiLlama */ IZKflashDalai.prototype.openPlaylist = function(server, pls, start, startid) { this.player.OpenPlaylist(server, pls, start, startid); } /* * METHOD loadAudioClip * * Requests a new pmmsid from DalaiLlama, if the
container is hidden it * makes it visible * * @param pmmsid: string indicating a new target video clip for DalaiLlama * @param captions: An array of caption strings, empty string or null * @param skin: A string ("blue" or "grey") or null */ IZKflashDalai.prototype.loadAudioClip = function(pmmsid, captions, skin) { var _skin = skin || "grey"; var _captions = captions || ""; this.player.PlayAudioLarge(pmmsid, _captions, _skin); this.show(); } /* * METHOD loadURL * * Requests a new url into the player's designated area. * * @param url: string indicating the new url */ IZKflashDalai.prototype.loadURL = function(url) { this.iframe.src = url; this.show(); } /* * METHOD setBgColor * * Sets the
element's background color: * * @param color: CSS string indicating a new color value for the
* containers background */ IZKflashDalai.prototype.setBgColor = function(color) { this.style.backgroundColor = color; } /* * METHOD show * * makes the
element visible */ IZKflashDalai.prototype.show = function() { if(!this.isVisible()) { this.style.display = "block"; } if(this.curtain) { this.curtainFrameStyle.display = "none"; this.curtainFrame.src = ""; window.currentItem = null; window.newPlayerInstance = true; window.g_MotifId = null; window.g_expandOnLoad = false; } } /* * METHOD hide * * hides the
element */ IZKflashDalai.prototype.hide = function() { if(this.isVisible()) { this.style.display = "none"; this.iframe.src = ""; if(this.curtain) { this.curtainFrameStyle.display = "none"; this.curtainFrame.src = ""; window.currentItem = null; window.newPlayerInstance = true; window.g_MotifId = null; window.g_expandOnLoad = false; } } } /* * METHOD isVisible * * @returns Boolean indicating whether the
element is visible or not */ IZKflashDalai.prototype.isVisible = function() { if(this.style.display == "block") { return true; } return false; } this.IZKflashDalai = new IZKflashDalai(this.DalaiLlama);