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