/** * ---------------------------------------- * DomReady - http://code.google.com/p/domready/ */ (function () { var DomReady = window.DomReady = {}; var userAgent = navigator.userAgent.toLowerCase(); /** * Figure out what browser is being used */ var browser = { version: (userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1], safari: /webkit/.test(userAgent), opera: /opera/.test(userAgent), msie: (/msie/.test(userAgent)) && (!/opera/.test(userAgent)), mozilla: (/mozilla/.test(userAgent)) && (!/(compatible|webkit)/.test(userAgent)) }; var readyBound = false; var isReady = false; var readyList = []; /** * Handle when the DOM is ready */ function domReady() { if (!isReady) { isReady = true; if (readyList) { for (var fn = 0; fn < readyList.length; fn++) { readyList[fn].call(window, []); } readyList = []; } } } /** * From Simon Willison. A safe way to fire onload w/o screwing up everyone else. */ function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function () { if (oldonload) { oldonload(); } func(); }; } } /** * does the heavy work to hook onload. */ function bindReady() { if (readyBound) { return; } readyBound = true; if (document.addEventListener && !browser.opera) { document.addEventListener("DOMContentLoaded", domReady, false); } if (browser.msie && window == top) (function () { if (isReady) { return; } try { document.documentElement.doScroll("left"); } catch (error) { setTimeout(arguments.callee, 0); return; } domReady(); })(); if (browser.opera) { document.addEventListener("DOMContentLoaded", function () { if (isReady) { return; } for (var i = 0; i < document.styleSheets.length; i++) { if (document.styleSheets[i].disabled) { setTimeout(arguments.callee, 0); return; } } domReady(); }, false); } if (browser.safari) { var numStyles; (function () { if (isReady) { return; } if (document.readyState != "loaded" && document.readyState != "complete") { setTimeout(arguments.callee, 0); return; } if (numStyles === undefined) { var links = document.getElementsByTagName("link"); for (var i = 0; i < links.length; i++) { if (links[i].getAttribute('rel') == 'stylesheet') { numStyles++; } } var styles = document.getElementsByTagName("style"); numStyles += styles.length; } if (document.styleSheets.length != numStyles) { setTimeout(arguments.callee, 0); return; } domReady(); })(); } addLoadEvent(domReady); } DomReady.ready = function (fn, args) { bindReady(); if (isReady) { fn.call(window, []); } else { readyList.push(function () { return fn.call(window, []); }); } }; bindReady(); })(); /** * ------------------------------------------------------------------- * VARIABLES */ var version = '0.0.1', exoPlayerTypes = ['jwplayer'], exoPlayerType = null, exoAd = null; if (typeof exoOpts === 'undefined') { var exoOpts = {}; } /** * ------------------------------------------------------------------- * Helpers */ var helper = { /** * Merges the 2 given objects into one (only 1 level) * @param object obj1 * @param object obj2 * @return object */ mergeOptions: function (obj1, obj2) { var obj3 = {}, attrname; for (attrname in obj1) { obj3[attrname] = obj1[attrname]; } for (attrname in obj2) { obj3[attrname] = obj2[attrname]; } return obj3; } }; /** * ---------------------------------------- * Exads functions */ var exo = { /** * Prepare options object, * then creates the main container div covering the whole video object */ init: function () { if (exoPlayerType === 'jwplayerV6') { var cfg = jwplayer().getConfig(); cfg.advertising = { client: "vast", schedule: { "myAds": { "offset": "pre", "tag": '//syndication.exdynsrv.com/splash.php?idzone=3995554' } } }; jwplayer().setup(cfg); } } } /** * CALLBACKS */ var exoJw = { readyV6: function (e) { exo.init(); } }; // JW PLAYER V6+ if (null === exoPlayerType && typeof jwplayer === 'function') { DomReady.ready(function () { try { // test a v6-only function jwplayer().getCurrentQuality(); exoPlayerType = 'jwplayerV6'; jwplayer().onReady(function (e) { exoJw.readyV6(this); }); } catch (e) { } }); }