/usr/share/javascript/yui3/swf/swf.js is in libjs-yui3-full 3.5.1-1ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | /*
YUI 3.5.1 (build 22)
Copyright 2012 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
YUI.add('swf', function(Y) {
/**
* Embed a Flash applications in a standard manner and communicate with it
* via External Interface.
* @module swf
*/
var Event = Y.Event,
SWFDetect = Y.SWFDetect,
Lang = Y.Lang,
uA = Y.UA,
Node = Y.Node,
Escape = Y.Escape,
// private
FLASH_CID = "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000",
FLASH_TYPE = "application/x-shockwave-flash",
FLASH_VER = "10.0.22",
EXPRESS_INSTALL_URL = "http://fpdownload.macromedia.com/pub/flashplayer/update/current/swf/autoUpdater.swf?" + Math.random(),
EVENT_HANDLER = "SWF.eventHandler",
possibleAttributes = {align:"", allowFullScreen:"", allowNetworking:"", allowScriptAccess:"", base:"", bgcolor:"", menu:"", name:"", quality:"", salign:"", scale:"", tabindex:"", wmode:""};
/**
* The SWF utility is a tool for embedding Flash applications in HTML pages.
* @module swf
* @title SWF Utility
* @requires event-custom, node, swfdetect
*/
/**
* Creates the SWF instance and keeps the configuration data
*
* @class SWF
* @augments Y.Event.Target
* @constructor
* @param {String|HTMLElement} id The id of the element, or the element itself that the SWF will be inserted into.
* The width and height of the SWF will be set to the width and height of this container element.
* @param {String} swfURL The URL of the SWF to be embedded into the page.
* @param {Object} p_oAttributes (optional) Configuration parameters for the Flash application and values for Flashvars
* to be passed to the SWF. The p_oAttributes object allows the following additional properties:
* <dl>
* <dt>version : String</dt>
* <dd>The minimum version of Flash required on the user's machine.</dd>
* <dt>fixedAttributes : Object</dt>
* <dd>An object literal containing one or more of the following String keys and their values: <code>align,
* allowFullScreen, allowNetworking, allowScriptAccess, base, bgcolor, menu, name, quality, salign, scale,
* tabindex, wmode.</code> event from the thumb</dd>
* </dl>
*/
function SWF (p_oElement /*:String*/, swfURL /*:String*/, p_oAttributes /*:Object*/ ) {
this._id = Y.guid("yuiswf");
var _id = this._id;
var oElement = Node.one(p_oElement);
var p_oAttributes = p_oAttributes || {};
var flashVersion = p_oAttributes.version || FLASH_VER;
var flashVersionSplit = (flashVersion + '').split(".");
var isFlashVersionRight = SWFDetect.isFlashVersionAtLeast(parseInt(flashVersionSplit[0], 10), parseInt(flashVersionSplit[1], 10), parseInt(flashVersionSplit[2], 10));
var canExpressInstall = (SWFDetect.isFlashVersionAtLeast(8,0,0));
var shouldExpressInstall = canExpressInstall && !isFlashVersionRight && p_oAttributes.useExpressInstall;
var flashURL = (shouldExpressInstall)?EXPRESS_INSTALL_URL:swfURL;
var objstring = '<object ';
var w, h;
var flashvarstring = "yId=" + Y.id + "&YUISwfId=" + _id + "&YUIBridgeCallback=" + EVENT_HANDLER + "&allowedDomain=" + document.location.hostname;
Y.SWF._instances[_id] = this;
if (oElement && (isFlashVersionRight || shouldExpressInstall) && flashURL) {
objstring += 'id="' + _id + '" ';
if (uA.ie) {
objstring += 'classid="' + FLASH_CID + '" ';
} else {
objstring += 'type="' + FLASH_TYPE + '" data="' + Escape.html(flashURL) + '" ';
}
w = "100%";
h = "100%";
objstring += 'width="' + w + '" height="' + h + '">';
if (uA.ie) {
objstring += '<param name="movie" value="' + Escape.html(flashURL) + '"/>';
}
for (var attribute in p_oAttributes.fixedAttributes) {
if (possibleAttributes.hasOwnProperty(attribute)) {
objstring += '<param name="' + Escape.html(attribute) + '" value="' + Escape.html(p_oAttributes.fixedAttributes[attribute]) + '"/>';
}
}
for (var flashvar in p_oAttributes.flashVars) {
var fvar = p_oAttributes.flashVars[flashvar];
if (Lang.isString(fvar)) {
flashvarstring += "&" + Escape.html(flashvar) + "=" + Escape.html(encodeURIComponent(fvar));
}
}
if (flashvarstring) {
objstring += '<param name="flashVars" value="' + flashvarstring + '"/>';
}
objstring += "</object>";
oElement.setContent(objstring);
this._swf = Node.one("#" + _id);
} else {
/**
* Fired when the Flash player version on the user's machine is
* below the required value.
*
* @event wrongflashversion
*/
var event = {};
event.type = "wrongflashversion";
this.publish("wrongflashversion", {fireOnce:true});
this.fire("wrongflashversion", event);
}
}
/**
* @private
* The static collection of all instances of the SWFs on the page.
* @property _instances
* @type Object
*/
SWF._instances = SWF._instances || {};
/**
* @private
* Handles an event coming from within the SWF and delegate it
* to a specific instance of SWF.
* @method eventHandler
* @param swfid {String} the id of the SWF dispatching the event
* @param event {Object} the event being transmitted.
*/
SWF.eventHandler = function (swfid, event) {
SWF._instances[swfid]._eventHandler(event);
};
SWF.prototype = {
/**
* @private
* Propagates a specific event from Flash to JS.
* @method _eventHandler
* @param event {Object} The event to be propagated from Flash.
*/
_eventHandler: function(event) {
if (event.type === "swfReady") {
this.publish("swfReady", {fireOnce:true});
this.fire("swfReady", event);
} else if(event.type === "log") {
} else {
this.fire(event.type, event);
}
},
/**
* Calls a specific function exposed by the SWF's
* ExternalInterface.
* @method callSWF
* @param func {String} the name of the function to call
* @param args {Array} the set of arguments to pass to the function.
*/
callSWF: function (func, args)
{
if (!args) {
args= [];
}
if (this._swf._node[func]) {
return(this._swf._node[func].apply(this._swf._node, args));
} else {
return null;
}
},
/**
* Public accessor to the unique name of the SWF instance.
*
* @method toString
* @return {String} Unique name of the SWF instance.
*/
toString: function()
{
return "SWF " + this._id;
}
};
Y.augment(SWF, Y.EventTarget);
Y.SWF = SWF;
}, '3.5.1' ,{requires:['event-custom','node','swfdetect','escape']});
|