MCPcopy Index your code
hub / github.com/mailru/FileAPI / matchVersions

Function matchVersions

flash/image/html-template/swfobject.js:225–280  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

223 /* Perform Flash Player and SWF version matching; static publishing only
224 */
225 function matchVersions() {
226 var rl = regObjArr.length;
227 if (rl > 0) {
228 for (var i = 0; i < rl; i++) { // for each registered object element
229 var id = regObjArr[i].id;
230 var cb = regObjArr[i].callbackFn;
231 var cbObj = {success:false, id:id};
232 if (ua.pv[0] > 0) {
233 var obj = getElementById(id);
234 if (obj) {
235 if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
236 setVisibility(id, true);
237 if (cb) {
238 cbObj.success = true;
239 cbObj.ref = getObjectById(id);
240 cb(cbObj);
241 }
242 }
243 else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
244 var att = {};
245 att.data = regObjArr[i].expressInstall;
246 att.width = obj.getAttribute("width") || "0";
247 att.height = obj.getAttribute("height") || "0";
248 if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
249 if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
250 // parse HTML object param element's name-value pairs
251 var par = {};
252 var p = obj.getElementsByTagName("param");
253 var pl = p.length;
254 for (var j = 0; j < pl; j++) {
255 if (p[j].getAttribute("name").toLowerCase() != "movie") {
256 par[p[j].getAttribute("name")] = p[j].getAttribute("value");
257 }
258 }
259 showExpressInstall(att, par, id, cb);
260 }
261 else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
262 displayAltContent(obj);
263 if (cb) { cb(cbObj); }
264 }
265 }
266 }
267 else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
268 setVisibility(id, true);
269 if (cb) {
270 var o = getObjectById(id); // test whether there is an HTML object element or not
271 if (o && typeof o.SetVariable != UNDEF) {
272 cbObj.success = true;
273 cbObj.ref = o;
274 }
275 cb(cbObj);
276 }
277 }
278 }
279 }
280 }
281
282 function getObjectById(objectIdStr) {

Callers 2

mainFunction · 0.70
testPlayerVersionFunction · 0.70

Calls 7

getElementByIdFunction · 0.70
hasPlayerVersionFunction · 0.70
setVisibilityFunction · 0.70
getObjectByIdFunction · 0.70
canExpressInstallFunction · 0.70
showExpressInstallFunction · 0.70
displayAltContentFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…