1/*! SWFObject v2.2 <http://code.google.com/p/swfobject/> 2 is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 3*/ 4/* 5 this version has been patched - added html5 tag video to support video on iPad and iPhone 6*/ 7 8var swfobject = function() { 9 10 var UNDEF = "undefined", 11 OBJECT = "object", 12 SHOCKWAVE_FLASH = "Shockwave Flash", 13 SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash", 14 FLASH_MIME_TYPE = "application/x-shockwave-flash", 15 EXPRESS_INSTALL_ID = "SWFObjectExprInst", 16 ON_READY_STATE_CHANGE = "onreadystatechange", 17 18 win = window, 19 doc = document, 20 nav = navigator, 21 22 plugin = false, 23 domLoadFnArr = [main], 24 regObjArr = [], 25 objIdArr = [], 26 listenersArr = [], 27 storedAltContent, 28 storedAltContentId, 29 storedCallbackFn, 30 storedCallbackObj, 31 isDomLoaded = false, 32 isExpressInstallActive = false, 33 dynamicStylesheet, 34 dynamicStylesheetMedia, 35 autoHideShow = true, 36 37 /* Centralized function for browser feature detection 38 - User agent string detection is only used when no good alternative is possible 39 - Is executed directly for optimal performance 40 */ 41 ua = function() { 42 var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF, 43 u = nav.userAgent.toLowerCase(), 44 p = nav.platform.toLowerCase(), 45 windows = p ? /win/.test(p) : /win/.test(u), 46 mac = p ? /mac/.test(p) : /mac/.test(u), 47 webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit 48 ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html 49 playerVersion = [0,0,0], 50 d = null; 51 if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) { 52 d = nav.plugins[SHOCKWAVE_FLASH].description; 53 if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+ 54 plugin = true; 55 ie = false; // cascaded feature detection for Internet Explorer 56 d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1"); 57 playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10); 58 playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10); 59 playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0; 60 } 61 } 62 else if (typeof win.ActiveXObject != UNDEF) { 63 try { 64 var a = new ActiveXObject(SHOCKWAVE_FLASH_AX); 65 if (a) { // a will return null when ActiveX is disabled 66 d = a.GetVariable("$version"); 67 if (d) { 68 ie = true; // cascaded feature detection for Internet Explorer 69 d = d.split(" ")[1].split(","); 70 playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)]; 71 } 72 } 73 } 74 catch(e) {} 75 } 76 return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac }; 77 }(), 78 79 /* Cross-browser onDomLoad 80 - Will fire an event as soon as the DOM of a web page is loaded 81 - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/ 82 - Regular onload serves as fallback 83 */ 84 onDomLoad = function() { 85 if (!ua.w3) { return; } 86 if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically 87 callDomLoadFunctions(); 88 } 89 if (!isDomLoaded) { 90 if (typeof doc.addEventListener != UNDEF) { 91 doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false); 92 } 93 if (ua.ie && ua.win) { 94 doc.attachEvent(ON_READY_STATE_CHANGE, function() { 95 if (doc.readyState == "complete") { 96 doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee); 97 callDomLoadFunctions(); 98 } 99 }); 100 if (win == top) { // if not inside an iframe 101 (function(){ 102 if (isDomLoaded) { return; } 103 try { 104 doc.documentElement.doScroll("left"); 105 } 106 catch(e) { 107 setTimeout(arguments.callee, 0); 108 return; 109 } 110 callDomLoadFunctions(); 111 })(); 112 } 113 } 114 if (ua.wk) { 115 (function(){ 116 if (isDomLoaded) { return; } 117 if (!/loaded|complete/.test(doc.readyState)) { 118 setTimeout(arguments.callee, 0); 119 return; 120 } 121 callDomLoadFunctions(); 122 })(); 123 } 124 addLoadEvent(callDomLoadFunctions); 125 } 126 }(); 127 128 function callDomLoadFunctions() { 129 if (isDomLoaded) { return; } 130 try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early 131 var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span")); 132 t.parentNode.removeChild(t); 133 } 134 catch (e) { return; } 135 isDomLoaded = true; 136 var dl = domLoadFnArr.length; 137 for (var i = 0; i < dl; i++) { 138 domLoadFnArr[i](); 139 } 140 } 141 142 function addDomLoadEvent(fn) { 143 if (isDomLoaded) { 144 fn(); 145 } 146 else { 147 domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+ 148 } 149 } 150 151 /* Cross-browser onload 152 - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/ 153 - Will fire an event as soon as a web page including all of its assets are loaded 154 */ 155 function addLoadEvent(fn) { 156 if (typeof win.addEventListener != UNDEF) { 157 win.addEventListener("load", fn, false); 158 } 159 else if (typeof doc.addEventListener != UNDEF) { 160 doc.addEventListener("load", fn, false); 161 } 162 else if (typeof win.attachEvent != UNDEF) { 163 addListener(win, "onload", fn); 164 } 165 else if (typeof win.onload == "function") { 166 var fnOld = win.onload; 167 win.onload = function() { 168 fnOld(); 169 fn(); 170 }; 171 } 172 else { 173 win.onload = fn; 174 } 175 } 176 177 /* Main function 178 - Will preferably execute onDomLoad, otherwise onload (as a fallback) 179 */ 180 function main() { 181 if (plugin) { 182 testPlayerVersion(); 183 } 184 else { 185 matchVersions(); 186 } 187 } 188 189 /* Detect the Flash Player version for non-Internet Explorer browsers 190 - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description: 191 a. Both release and build numbers can be detected
192 b. Avoid wrong descriptions by corrupt installers provided by Adobe 193 c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports 194 - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available 195 */ 196 function testPlayerVersion() { 197 var b = doc.getElementsByTagName("body")[0]; 198 var o = createElement(OBJECT); 199 o.setAttribute("type", FLASH_MIME_TYPE); 200 var t = b.appendChild(o); 201 if (t) { 202 var counter = 0; 203 (function(){ 204 if (typeof t.GetVariable != UNDEF) { 205 var d = t.GetVariable("$version"); 206 if (d) { 207 d = d.split(" ")[1].split(","); 208 ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)]; 209 } 210 } 211 else if (counter < 10) { 212 counter++; 213 setTimeout(arguments.callee, 10); 214 return; 215 } 216 b.removeChild(o); 217 t = null; 218 matchVersions(); 219 })(); 220 } 221 else { 222 matchVersions(); 223 } 224 } 225 226 /* Perform Flash Player and SWF version matching; static publishing only 227 */ 228 function matchVersions() { 229 var rl = regObjArr.length; 230 if (rl > 0) { 231 for (var i = 0; i < rl; i++) { // for each registered object element 232 var id = regObjArr[i].id; 233 var cb = regObjArr[i].callbackFn; 234 var cbObj = {success:false, id:id}; 235 if (ua.pv[0] > 0) { 236 var obj = getElementById(id); 237 if (obj) { 238 if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match! 239 setVisibility(id, true); 240 if (cb) { 241 cbObj.success = true; 242 cbObj.ref = getObjectById(id); 243 cb(cbObj); 244 } 245 } 246 else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported 247 var att = {}; 248 att.data = regObjArr[i].expressInstall; 249 att.width = obj.getAttribute("width") || "0"; 250 att.height = obj.getAttribute("height") || "0"; 251 if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); } 252 if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); } 253 // parse HTML object param element's name-value pairs 254 var par = {}; 255 var p = obj.getElementsByTagName("param"); 256 var pl = p.length; 257 for (var j = 0; j < pl; j++) { 258 if (p[j].getAttribute("name").toLowerCase() != "movie") { 259 par[p[j].getAttribute("name")] = p[j].getAttribute("value"); 260 } 261 } 262 showExpressInstall(att, par, id, cb); 263 } 264 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 265 displayAltContent(obj); 266 if (cb) { cb(cbObj); } 267 } 268 } 269 } 270 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) 271 setVisibility(id, true); 272 if (cb) { 273 var o = getObjectById(id); // test whether there is an HTML object element or not 274 if (o && typeof o.SetVariable != UNDEF) { 275 cbObj.success = true; 276 cbObj.ref = o; 277 } 278 cb(cbObj); 279 } 280 } 281 } 282 } 283 } 284 285 function getObjectById(objectIdStr) { 286 var r = null; 287 var o = getElementById(objectIdStr); 288 if (o && o.nodeName == "OBJECT") { 289 if (typeof o.SetVariable != UNDEF) { 290 r = o; 291 } 292 else { 293 var n = o.getElementsByTagName(OBJECT)[0]; 294 if (n) { 295 r = n; 296 } 297 } 298 } 299 return r; 300 } 301 302 /* Requirements for Adobe Express Install 303 - only one instance can be active at a time 304 - fp 6.0.65 or higher 305 - Win/Mac OS only 306 - no Webkit engines older than version 312 307 */ 308 function canExpressInstall() { 309 return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312); 310 } 311 312 /* Show the Adobe Express Install dialog 313 - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75 314 */ 315 function showExpressInstall(att, par, replaceElemIdStr, callbackFn) { 316 isExpressInstallActive = true; 317 storedCallbackFn = callbackFn || null; 318 storedCallbackObj = {success:false, id:replaceElemIdStr}; 319 var obj = getElementById(replaceElemIdStr); 320 if (obj) { 321 if (obj.nodeName == "OBJECT") { // static publishing 322 storedAltContent = abstractAltContent(obj); 323 storedAltContentId = null; 324 } 325 else { // dynamic publishing 326 storedAltContent = obj; 327 storedAltContentId = replaceElemIdStr; 328 } 329 att.id = EXPRESS_INSTALL_ID; 330 if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; } 331 if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; } 332 doc.title = doc.title.slice(0, 47) + " - Flash Player Installation"; 333 var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn", 334 fv = "MMredirectURL=" + win.location.toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title; 335 if (typeof par.flashvars != UNDEF) { 336 par.flashvars += "&" + fv; 337 } 338 else { 339 par.flashvars = fv; 340 } 341 // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it, 342 // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work 343 if (ua.ie && ua.win && obj.readyState != 4) { 344 var newObj = createElement("div"); 345 replaceElemIdStr += "SWFObjectNew"; 346 newObj.setAttribute("id", replaceElemIdStr); 347 obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf 348 obj.style.display = "none"; 349 (function(){ 350 if (obj.readyState == 4) { 351 obj.parentNode.removeChild(obj); 352 } 353 else { 354 setTimeout(arguments.callee, 10); 355 } 356 })(); 357 } 358 createSWF(att, par, replaceElemIdStr); 359 } 360 } 361 362 /* Functions to abstract and display alternative content 363 */ 364 function displayAltContent(obj) { 365 if (ua.ie && ua.win && obj.readyState != 4) { 366 // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it, 367 // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work 368 var el = createElement("div"); 369 obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content 370 el.parentNode.replaceChild(abstractAltContent(obj), el); 371 obj.style.display = "none"; 372 (function(){ 373 if (obj.readyState == 4) { 374 obj.parentNode.removeChild(obj); 375 } 376 else { 377 setTimeout(arguments.callee, 10); 378 } 379 })(); 380 } 381 else { 382 obj.parentNode.replaceChild(abstractAltContent(obj), obj); 383 } 384 } 385 386 function abstractAltContent(obj) { 387 var ac = createElement("div"); 388 if (ua.win && ua.ie) { 389 ac.innerHTML = obj.innerHTML; 390 } 391 else { 392 var nestedObj = obj.getElementsByTagName(OBJECT)[0];
393 if (nestedObj) { 394 var c = nestedObj.childNodes; 395 if (c) { 396 var cl = c.length; 397 for (var i = 0; i < cl; i++) { 398 if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) { 399 ac.appendChild(c[i].cloneNode(true)); 400 } 401 } 402 } 403 } 404 } 405 return ac; 406 } 407 408 /* Cross-browser dynamic SWF creation 409 */ 410 function createSWF(attObj, parObj, id) { 411 var video_params; 412 if(attObj.video){ 413 video_params = attObj.video; 414 delete attObj.video; 415 } 416 var r, el = getElementById(id); 417 if (ua.wk && ua.wk < 312) { return r; } 418 if (el) { 419 if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content 420 attObj.id = id; 421 } 422 if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML 423 var att = ""; 424 for (var i in attObj) { 425 if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries 426 if (i.toLowerCase() == "data") { 427 parObj.movie = attObj[i]; 428 } 429 else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword 430 att += ' class="' + attObj[i] + '"'; 431 } 432 else if (i.toLowerCase() != "classid") { 433 att += ' ' + i + '="' + attObj[i] + '"'; 434 } 435 } 436 } 437 var par = ""; 438 for (var j in parObj) { 439 if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries 440 par += '<param name="' + j + '" value="' + parObj[j] + '" />'; 441 } 442 } 443 el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>'; 444 objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only) 445 r = getElementById(attObj.id); 446 } 447 else { // well-behaving browsers 448 var o = createElement(OBJECT); 449 o.setAttribute("type", FLASH_MIME_TYPE); 450 for (var m in attObj) { 451 if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries 452 if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword 453 o.setAttribute("class", attObj[m]); 454 } 455 else if (m.toLowerCase() != "classid") { // filter out IE specific attribute 456 o.setAttribute(m, attObj[m]); 457 } 458 } 459 } 460 for (var n in parObj) { 461 if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element 462 createObjParam(o, n, parObj[n]); 463 } 464 } 465 el.parentNode.replaceChild(o, el); 466 var video_tag = make_video_tag(video_params); 467 if(video_tag){ 468 o.appendChild(video_tag); 469 } 470 r = o; 471 } 472 } 473 return r; 474 } 475 476 function make_video_tag(params) { 477 var obj; 478 if (params){ 479 obj = document.createElement('object'); 480 obj.setAttribute('id', 'html5video'); 481 var video = document.createElement('video'); 482 for(var param in params){ 483 video.setAttribute(param, params[param]); 484 } 485 obj.appendChild(video); 486 } 487 return obj 488 } 489 490 function createObjParam(el, pName, pValue) { 491 var p = createElement("param"); 492 p.setAttribute("name", pName); 493 p.setAttribute("value", pValue); 494 el.appendChild(p); 495 } 496 497 /* Cross-browser SWF removal 498 - Especially needed to safely and completely remove a SWF in Internet Explorer 499 */ 500 function removeSWF(id) { 501 var obj = getElementById(id); 502 if (obj && obj.nodeName == "OBJECT") { 503 if (ua.ie && ua.win) { 504 obj.style.display = "none"; 505 (function(){ 506 if (obj.readyState == 4) { 507 removeObjectInIE(id); 508 } 509 else { 510 setTimeout(arguments.callee, 10); 511 } 512 })(); 513 } 514 else { 515 obj.parentNode.removeChild(obj); 516 } 517 } 518 } 519 520 function removeObjectInIE(id) { 521 var obj = getElementById(id); 522 if (obj) { 523 for (var i in obj) { 524 if (typeof obj[i] == "function") { 525 obj[i] = null; 526 } 527 } 528 obj.parentNode.removeChild(obj); 529 } 530 } 531 532 /* Functions to optimize JavaScript compression 533 */ 534 function getElementById(id) { 535 var el = null; 536 try { 537 el = doc.getElementById(id); 538 } 539 catch (e) {} 540 return el; 541 } 542 543 function createElement(el) { 544 return doc.createElement(el); 545 } 546 547 /* Updated attachEvent function for Internet Explorer 548 - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks 549 */
550 function addListener(target, eventType, fn) { 551 target.attachEvent(eventType, fn); 552 listenersArr[listenersArr.length] = [target, eventType, fn]; 553 } 554 555 /* Flash Player and SWF content version matching 556 */ 557 function hasPlayerVersion(rv) { 558 var pv = ua.pv, v = rv.split("."); 559 v[0] = parseInt(v[0], 10); 560 v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0" 561 v[2] = parseInt(v[2], 10) || 0; 562 return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false; 563 } 564 565 /* Cross-browser dynamic CSS creation 566 - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php 567 */ 568 function createCSS(sel, decl, media, newStyle) { 569 if (ua.ie && ua.mac) { return; } 570 var h = doc.getElementsByTagName("head")[0]; 571 if (!h) { return; } // to also support badly authored HTML pages that lack a head element 572 var m = (media && typeof media == "string") ? media : "screen"; 573 if (newStyle) { 574 dynamicStylesheet = null; 575 dynamicStylesheetMedia = null; 576 } 577 if (!dynamicStylesheet || dynamicStylesheetMedia != m) { 578 // create dynamic stylesheet + get a global reference to it 579 var s = createElement("style"); 580 s.setAttribute("type", "text/css"); 581 s.setAttribute("media", m); 582 dynamicStylesheet = h.appendChild(s); 583 if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) { 584 dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1]; 585 } 586 dynamicStylesheetMedia = m; 587 } 588 // add style rule 589 if (ua.ie && ua.win) { 590 if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) { 591 dynamicStylesheet.addRule(sel, decl); 592 } 593 } 594 else { 595 if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) { 596 dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}")); 597 } 598 } 599 } 600 601 function setVisibility(id, isVisible) { 602 if (!autoHideShow) { return; } 603 var v = isVisible ? "visible" : "hidden"; 604 if (isDomLoaded && getElementById(id)) { 605 getElementById(id).style.visibility = v; 606 } 607 else { 608 createCSS("#" + id, "visibility:" + v); 609 } 610 } 611 612 /* Filter to avoid XSS attacks 613 */ 614 function urlEncodeIfNecessary(s) { 615 var regex = /[\\\"<>\.;]/; 616 var hasBadChars = regex.exec(s) != null; 617 return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s; 618 } 619 620 /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only) 621 */ 622 var cleanup = function() { 623 if (ua.ie && ua.win) { 624 window.attachEvent("onunload", function() { 625 // remove listeners to avoid memory leaks 626 var ll = listenersArr.length; 627 for (var i = 0; i < ll; i++) { 628 listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]); 629 } 630 // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect 631 var il = objIdArr.length; 632 for (var j = 0; j < il; j++) { 633 removeSWF(objIdArr[j]); 634 } 635 // cleanup library's main closures to avoid memory leaks 636 for (var k in ua) { 637 ua[k] = null; 638 } 639 ua = null; 640 for (var l in swfobject) { 641 swfobject[l] = null; 642 } 643 swfobject = null; 644 }); 645 } 646 }(); 647 648 return { 649 /* Public API 650 - Reference: http://code.google.com/p/swfobject/wiki/documentation 651 */ 652 registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) { 653 if (ua.w3 && objectIdStr && swfVersionStr) { 654 var regObj = {}; 655 regObj.id = objectIdStr; 656 regObj.swfVersion = swfVersionStr; 657 regObj.expressInstall = xiSwfUrlStr; 658 regObj.callbackFn = callbackFn; 659 regObjArr[regObjArr.length] = regObj; 660 setVisibility(objectIdStr, false); 661 } 662 else if (callbackFn) { 663 callbackFn({success:false, id:objectIdStr}); 664 } 665 }, 666 667 getObjectById: function(objectIdStr) { 668 if (ua.w3) { 669 return getObjectById(objectIdStr); 670 } 671 }, 672 673 embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) { 674 var callbackObj = {success:false, id:replaceElemIdStr}; 675 if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) { 676 setVisibility(replaceElemIdStr, false); 677 addDomLoadEvent(function() { 678 widthStr += ""; // auto-convert to string 679 heightStr += ""; 680 var att = {}; 681 if (attObj && typeof attObj === OBJECT) { 682 for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs 683 att[i] = attObj[i]; 684 } 685 } 686 att.data = swfUrlStr; 687 att.width = widthStr; 688 att.height = heightStr; 689 /* 690 if (att.video){ 691 var video_attrs = att.video; 692 delete att.video; 693 } 694 */ 695 var par = {}; 696 if (parObj && typeof parObj === OBJECT) { 697 for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs 698 par[j] = parObj[j]; 699 } 700 } 701 if (flashvarsObj && typeof flashvarsObj === OBJECT) { 702 for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs 703 if (typeof par.flashvars != UNDEF) { 704 par.flashvars += "&" + k + "=" + flashvarsObj[k]; 705 } 706 else { 707 par.flashvars = k + "=" + flashvarsObj[k]; 708 } 709 } 710 } 711 if (hasPlayerVersion(swfVersionStr)) { // create SWF 712 var obj = createSWF(att, par, replaceElemIdStr); 713 if (att.id == replaceElemIdStr) { 714 setVisibility(replaceElemIdStr, true); 715 } 716 callbackObj.success = true; 717 callbackObj.ref = obj; 718 } 719 else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install 720 att.data = xiSwfUrlStr; 721 showExpressInstall(att, par, replaceElemIdStr, callbackFn); 722 return; 723 } 724 else if(att.video){// show video tag for iOS 725 var r, el = getElementById(replaceElemIdStr); 726 el.parentNode.replaceChild(make_video_tag(att.video), el); 727 } 728 else { // show alternative content 729 setVisibility(replaceElemIdStr, true); 730 } 731 if (callbackFn) { callbackFn(callbackObj); } 732 }); 733 } 734 else if (callbackFn) { callbackFn(callbackObj); } 735 }, 736 737 switchOffAutoHideShow: function() { 738 autoHideShow = false;
739 }, 740 741 ua: ua, 742 743 getFlashPlayerVersion: function() { 744 return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] }; 745 }, 746 747 hasFlashPlayerVersion: hasPlayerVersion, 748 749 createSWF: function(attObj, parObj, replaceElemIdStr) { 750 if (ua.w3) { 751 return createSWF(attObj, parObj, replaceElemIdStr); 752 } 753 else { 754 return undefined; 755 } 756 }, 757 758 showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) { 759 if (ua.w3 && canExpressInstall()) { 760 showExpressInstall(att, par, replaceElemIdStr, callbackFn); 761 } 762 }, 763 764 removeSWF: function(objElemIdStr) { 765 if (ua.w3) { 766 removeSWF(objElemIdStr); 767 } 768 }, 769 770 createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) { 771 if (ua.w3) { 772 createCSS(selStr, declStr, mediaStr, newStyleBoolean); 773 } 774 }, 775 776 addDomLoadEvent: addDomLoadEvent, 777 778 addLoadEvent: addLoadEvent, 779 780 getQueryParamValue: function(param) { 781 var q = doc.location.search || doc.location.hash; 782 if (q) { 783 if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark 784 if (param == null) { 785 return urlEncodeIfNecessary(q); 786 } 787 var pairs = q.split("&"); 788 for (var i = 0; i < pairs.length; i++) { 789 if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) { 790 return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1))); 791 } 792 } 793 } 794 return ""; 795 }, 796 797 // For internal usage only 798 expressInstallCallback: function() { 799 if (isExpressInstallActive) { 800 var obj = getElementById(EXPRESS_INSTALL_ID); 801 if (obj && storedAltContent) { 802 obj.parentNode.replaceChild(storedAltContent, obj); 803 if (storedAltContentId) { 804 setVisibility(storedAltContentId, true); 805 if (ua.ie && ua.win) { storedAltContent.style.display = "block"; } 806 } 807 if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); } 808 } 809 isExpressInstallActive = false; 810 } 811 } 812 }; 813}();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.