[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 YUI.add('yui2-swfdetect', function(Y) { Y.use('yui2-swf'); }, '3.3.0' ,{"requires": ["yui2-yahoo"]}); 2 YUI.add('yui2-swf', function(Y) { 3 var YAHOO = Y.YUI2; 4 /* 5 Copyright (c) 2011, Yahoo! Inc. All rights reserved. 6 Code licensed under the BSD License: 7 http://developer.yahoo.com/yui/license.html 8 version: 2.9.0 9 */ 10 YAHOO.namespace("widget"); 11 12 (function () { 13 14 var version = 0; 15 var UA = YAHOO.env.ua; 16 var sF = "ShockwaveFlash"; 17 var mF, eP; 18 19 if (UA.gecko || UA.webkit || UA.opera) { 20 if ((mF = navigator.mimeTypes['application/x-shockwave-flash'])) { 21 if ((eP = mF.enabledPlugin)) { 22 var vS = []; 23 vS = eP.description.replace(/\s[rd]/g, '.').replace(/[A-Za-z\s]+/g, '').split('.'); 24 version = vS[0] + '.'; 25 switch((vS[2].toString()).length) 26 { 27 case 1: 28 version += "00"; 29 break; 30 case 2: 31 version += "0"; 32 break; 33 } 34 version += vS[2]; 35 version = parseFloat(version); 36 } 37 } 38 } 39 else if(UA.ie) { 40 try 41 { 42 var ax6 = new ActiveXObject(sF + "." + sF + ".6"); 43 ax6.AllowScriptAccess = "always"; 44 } 45 catch(e) 46 { 47 if(ax6 != null) 48 { 49 version = 6.0; 50 } 51 } 52 if (version == 0) { 53 try 54 { 55 var ax = new ActiveXObject(sF + "." + sF); 56 var vS = []; 57 vS = ax.GetVariable("$version").replace(/[A-Za-z\s]+/g, '').split(','); 58 version = vS[0] + '.'; 59 switch((vS[2].toString()).length) 60 { 61 case 1: 62 version += "00"; 63 break; 64 case 2: 65 version += "0"; 66 break; 67 } 68 version += vS[2]; 69 version = parseFloat(version); 70 71 } catch (e) {} 72 } 73 } 74 75 UA.flash = version; 76 77 YAHOO.util.SWFDetect = { 78 getFlashVersion : function () { 79 return version; 80 }, 81 82 isFlashVersionAtLeast : function (ver) { 83 return version >= ver; 84 }, 85 86 parseFlashVersion : function (ver) 87 { 88 var flashVersion = ver; 89 if(YAHOO.lang.isString(ver)) 90 { 91 var verSplit = ver.split("."); 92 if(verSplit.length > 2) 93 { 94 flashVersion = parseInt(verSplit[0]); 95 flashVersion += parseInt(verSplit[2]) * .001; 96 } 97 else 98 { 99 flashVersion = parseFloat(ver); 100 } 101 } 102 return YAHOO.lang.isNumber(flashVersion) ? flashVersion : null; 103 } 104 }; 105 106 var Dom = YAHOO.util.Dom, 107 Event = YAHOO.util.Event, 108 SWFDetect = YAHOO.util.SWFDetect, 109 Lang = YAHOO.lang, 110 111 // private 112 FLASH_CID = "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000", 113 FLASH_TYPE = "application/x-shockwave-flash", 114 FLASH_VER = "10.22", 115 EXPRESS_INSTALL_URL = "http://fpdownload.macromedia.com/pub/flashplayer/update/current/swf/autoUpdater.swf?" + Math.random(), 116 EVENT_HANDLER = "YAHOO.widget.SWF.eventHandler", 117 possibleAttributes = {align:"", allowfullscreen: "", allownetworking:"", allowscriptaccess:"", base:"", bgcolor:"", devicefont: "", loop: "", menu:"", name:"", play: "", quality:"", salign:"", seamlesstabbing: "", scale:"", swliveconnect: "", tabindex:"", wmode:""}; 118 119 /** 120 * The SWF utility is a tool for embedding Flash applications in HTMl pages. 121 * @module swf 122 * @title SWF Utility 123 * @requires yahoo, dom, event 124 * @namespace YAHOO.widget 125 */ 126 127 /** 128 * Creates the SWF instance and keeps the configuration data 129 * 130 * @class SWF 131 * @extends YAHOO.util.Element 132 * @constructor 133 * @param {String|HTMLElement} id The id of the element, or the element itself that the SWF will be inserted into. 134 * The width and height of the SWF will be set to the width and height of this container element. 135 * @param {String} swfURL The URL of the SWF to be embedded into the page. 136 * @param {Object} p_oAttributes (optional) Configuration parameters for the Flash application and values for Flashvars 137 * to be passed to the SWF. 138 */ 139 140 YAHOO.widget.SWF = function (p_oElement /*:String*/, swfURL /*:String*/, p_oAttributes /*:Object*/ ) { 141 142 this._queue = this._queue || []; 143 this._events = this._events || {}; 144 this._configs = this._configs || {}; 145 146 /** 147 * The DOM id of this instance of the element. Automatically generated. 148 * @property _id 149 * @type String 150 */ 151 this._id = Dom.generateId(null, "yuiswf"); 152 153 if(p_oAttributes.host) this._host = p_oAttributes.host; 154 155 var _id = this._id; 156 var oElement = Dom.get(p_oElement); 157 var flashVersion = SWFDetect.parseFlashVersion((p_oAttributes["version"]) || FLASH_VER); 158 var isFlashVersionRight = SWFDetect.isFlashVersionAtLeast(flashVersion); 159 var canExpressInstall = (UA.flash >= 8.0); 160 var shouldExpressInstall = canExpressInstall && !isFlashVersionRight && p_oAttributes["useExpressInstall"]; 161 var flashURL = (shouldExpressInstall)?EXPRESS_INSTALL_URL:swfURL; 162 var objstring = '<object '; 163 var w, h; 164 var flashvarstring = "YUISwfId=" + _id + "&YUIBridgeCallback=" + EVENT_HANDLER; 165 166 YAHOO.widget.SWF._instances[_id] = this; 167 168 if (oElement && (isFlashVersionRight || shouldExpressInstall) && flashURL) { 169 objstring += 'id="' + _id + '" '; 170 if (UA.ie) { 171 objstring += 'classid="' + FLASH_CID + '" ' 172 } 173 else { 174 objstring += 'type="' + FLASH_TYPE + '" data="' + YAHOO.lang.escapeHTML(flashURL) + '" '; 175 } 176 177 w = "100%"; 178 h = "100%"; 179 180 objstring += 'width="' + w + '" height="' + h + '">'; 181 182 if (UA.ie) { 183 objstring += '<param name="movie" value="' + YAHOO.lang.escapeHTML(flashURL) + '"/>'; 184 } 185 186 for (var attribute in p_oAttributes.fixedAttributes) { 187 if (possibleAttributes.hasOwnProperty(attribute.toLowerCase())) { 188 objstring += '<param name="' + YAHOO.lang.escapeHTML(attribute.toLowerCase()) + '" value="' + YAHOO.lang.escapeHTML(p_oAttributes.fixedAttributes[attribute]) + '"/>'; 189 } 190 } 191 192 for (var flashvar in p_oAttributes.flashVars) { 193 var fvar = p_oAttributes.flashVars[flashvar]; 194 if (Lang.isString(fvar)) { 195 flashvarstring += "&" + YAHOO.lang.escapeHTML(flashvar) + "=" + YAHOO.lang.escapeHTML(encodeURIComponent(fvar)); 196 } 197 } 198 199 if (flashvarstring) { 200 objstring += '<param name="flashVars" value="' + flashvarstring + '"/>'; 201 } 202 203 objstring += "</object>"; 204 205 oElement.innerHTML = objstring; 206 YAHOO.widget.SWF.superclass.constructor.call(this, Dom.get(_id)); 207 this._swf = Dom.get(_id); 208 } 209 }; 210 211 /** 212 * The static collection of all instances of the SWFs on the page. 213 * @property _instances 214 * @private 215 * @type Object 216 */ 217 218 YAHOO.widget.SWF._instances = YAHOO.widget.SWF._instances || {}; 219 220 /** 221 * Handles an event coming from within the SWF and delegate it 222 * to a specific instance of SWF. 223 * @method eventHandler 224 * @param swfid {String} the id of the SWF dispatching the event 225 * @param event {Object} the event being transmitted. 226 * @private 227 */ 228 YAHOO.widget.SWF.eventHandler = function (swfid, event) { 229 YAHOO.widget.SWF._instances[swfid]._eventHandler(event); 230 }; 231 232 YAHOO.extend(YAHOO.widget.SWF, YAHOO.util.Element, { 233 _eventHandler: function(event) 234 { 235 if (event.type == "swfReady") 236 { 237 this.createEvent("swfReady", {fireOnce:true}); 238 this.fireEvent("swfReady", event); 239 } 240 else if(event.type == "log") 241 { 242 YAHOO.log(event.message, event.category, this._host ? this._host.toString() : this.toString()); 243 } 244 else 245 { 246 if(this._host && this._host.fireEvent) 247 { 248 this._host.fireEvent(event.type, event); 249 } 250 else 251 { 252 this.fireEvent(event.type, event); 253 } 254 } 255 }, 256 257 /** 258 * Calls a specific function exposed by the SWF's 259 * ExternalInterface. 260 * @method callSWF 261 * @param func {String} the name of the function to call 262 * @param args {Object} the set of arguments to pass to the function. 263 */ 264 callSWF: function (func, args) 265 { 266 if (!args) { 267 args= []; 268 }; 269 270 if (this._swf[func]) { 271 return(this._swf[func].apply(this._swf, args)); 272 } else { 273 return null; 274 } 275 }, 276 277 /** 278 * Public accessor to the unique name of the SWF instance. 279 * 280 * @method toString 281 * @return {String} Unique name of the SWF instance. 282 */ 283 toString: function() 284 { 285 return "SWF " + this._id; 286 } 287 }); 288 289 290 })(); 291 YAHOO.register("swf", YAHOO.widget.SWF, {version: "2.9.0", build: "2800"}); 292 293 }, '2.9.0' ,{"requires": ["yui2-yahoo", "yui2-dom", "yui2-event", "yui2-element"], "supersedes": ["yui2-swfdetect"]});
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |