var EasyAffiliateLinks;
(()=> {
var __webpack_modules__=({
4181:
(function(){
var _this=this;
function _createForOfIteratorHelper(o, allowArrayLike){ var it=typeof Symbol!=="undefined"&&o[Symbol.iterator]||o["@@iterator"]; if(!it){ if(Array.isArray(o)||(it=_unsupportedIterableToArray(o))||allowArrayLike&&o && typeof o.length==="number"){ if(it) o=it; var i=0; var F=function F(){}; return { s: F, n: function n(){ if(i >=o.length) return { done: true }; return { done: false, value: o[i++] };}, e: function e(_e){ throw _e; }, f: F };} throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion=true, didErr=false, err; return { s: function s(){ it=it.call(o); }, n: function n(){ var step=it.next(); normalCompletion=step.done; return step; }, e: function e(_e2){ didErr=true; err=_e2; }, f: function f(){ try { if(!normalCompletion&&it["return"]!=null) it["return"](); } finally { if(didErr) throw err; }} };}
function _toConsumableArray(arr){ return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread(); }
function _nonIterableSpread(){ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen){ if(!o) return; if(typeof o==="string") return _arrayLikeToArray(o, minLen); var n=Object.prototype.toString.call(o).slice(8, -1); if(n==="Object"&&o.constructor) n=o.constructor.name; if(n==="Map"||n==="Set") return Array.from(o); if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _iterableToArray(iter){ if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null) return Array.from(iter); }
function _arrayWithoutHoles(arr){ if(Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len){ if(len==null||len > arr.length) len=arr.length; for (var i=0, arr2=new Array(len); i < len; i++){ arr2[i]=arr[i]; } return arr2; }
window.EasyAffiliateLinks=window.EasyAffiliateLinks||{};
window.EasyAffiliateLinks.clicks={
init: function init(){
document.addEventListener('click', function (e){
for (var target=e.target; target&&target!=_this; target=target.parentNode){
if(target.classList&&target.classList.contains('eafl-link-direct')){
window.EasyAffiliateLinks.clicks.onClickDirectLink(target, e);
break;
}}
}, false);
var htmlLinks=_toConsumableArray(document.querySelectorAll('.eafl-link-html'));
var _iterator=_createForOfIteratorHelper(htmlLinks),
_step;
try {
for (_iterator.s(); !(_step=_iterator.n()).done;){
var htmlLink=_step.value;
window.EasyAffiliateLinks.clicks.initHtmlLink(htmlLink);
}} catch (err){
_iterator.e(err);
} finally {
_iterator.f();
}},
initHtmlLink: function initHtmlLink(container){
var eaflId=parseInt(container.dataset.eaflId);
if(0 < eaflId){
var links=_toConsumableArray(container.querySelectorAll('a'));
if(0 < links.length){
var _iterator2=_createForOfIteratorHelper(links),
_step2;
try {
for (_iterator2.s(); !(_step2=_iterator2.n()).done;){
var link=_step2.value;
link.addEventListener('click', function (e){
window.EasyAffiliateLinks.clicks.register(eaflId);
});
}} catch (err){
_iterator2.e(err);
} finally {
_iterator2.f();
}}else{
var iframes=_toConsumableArray(container.querySelectorAll('iframe'));
var _iterator3=_createForOfIteratorHelper(iframes),
_step3;
try {
for (_iterator3.s(); !(_step3=_iterator3.n()).done;){
var iframe=_step3.value;
window.EasyAffiliateLinks.clicks.iframeListen(eaflId, iframe);
}} catch (err){
_iterator3.e(err);
} finally {
_iterator3.f();
}}
}},
iframeElems: [],
iframeIds: [],
iframeLastClicked: false,
iframeTimeout: false,
iframeListen: function iframeListen(eaflId, elem){
var clicks=window.EasyAffiliateLinks.clicks;
if(false===clicks.iframeTimeout){
clicks.iframeTimeout=setInterval(function (){
var elem=document.activeElement;
if(elem&&elem.tagName=='IFRAME'&&clicks.iframeElems.includes(elem)){
var index=clicks.iframeElems.indexOf(elem);
var eaflIdClicked=clicks.iframeIds[index];
if(eaflIdClicked&&eaflIdClicked!==clicks.iframeLastClicked){
clicks.register(eaflIdClicked);
clicks.iframeLastClicked=eaflIdClicked;
}}
}, 250);
}
clicks.iframeElems.push(elem);
clicks.iframeIds.push(eaflId);
},
onClickDirectLink: function onClickDirectLink(elem, e){
var id=elem.dataset.eaflId;
if(!id){
id=elem.dataset.eaflGridId;
}
if(id){
window.EasyAffiliateLinks.clicks.register(id);
}},
register: function register(id){
id=parseInt(id);
if(0 < id){
fetch(eafl_public.ajax_url, {
method: 'POST',
credentials: 'same-origin',
body: 'action=eafl_register_click&link=' + id + '&security=' + eafl_public.nonce,
headers: {
'Accept': 'application/json, text/plain, * })
});
var __webpack_module_cache__={};
function __webpack_require__(moduleId){
var cachedModule=__webpack_module_cache__[moduleId];
if(cachedModule!==undefined){
return cachedModule.exports;
}
var module=__webpack_module_cache__[moduleId]={
exports: {}
};
__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
return module.exports;
}
(()=> {
__webpack_require__.r=(exports)=> {
if(typeof Symbol!=='undefined'&&Symbol.toStringTag){
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
}
Object.defineProperty(exports, '__esModule', { value: true });
};
})();
var __webpack_exports__={};
(()=> {
"use strict";
__webpack_require__.r(__webpack_exports__);
;
var global =
(typeof globalThis!=='undefined'&&globalThis) ||
(typeof self!=='undefined'&&self) ||
(typeof global!=='undefined'&&global)
var support={
searchParams: 'URLSearchParams' in global,
iterable: 'Symbol' in global&&'iterator' in Symbol,
blob:
'FileReader' in global &&
'Blob' in global &&
(function(){
try {
new Blob()
return true
} catch (e){
return false
}})(),
formData: 'FormData' in global,
arrayBuffer: 'ArrayBuffer' in global
}
function isDataView(obj){
return obj&&DataView.prototype.isPrototypeOf(obj)
}
if(support.arrayBuffer){
var viewClasses=[
'[object Int8Array]',
'[object Uint8Array]',
'[object Uint8ClampedArray]',
'[object Int16Array]',
'[object Uint16Array]',
'[object Int32Array]',
'[object Uint32Array]',
'[object Float32Array]',
'[object Float64Array]'
]
var isArrayBufferView =
ArrayBuffer.isView ||
function(obj){
return obj&&viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1
}}
function normalizeName(name){
if(typeof name!=='string'){
name=String(name)
}
if(/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(name)||name===''){
throw new TypeError('Invalid character in header field name: "' + name + '"')
}
return name.toLowerCase()
}
function normalizeValue(value){
if(typeof value!=='string'){
value=String(value)
}
return value
}
function iteratorFor(items){
var iterator={
next: function(){
var value=items.shift()
return {done: value===undefined, value: value}}
}
if(support.iterable){
iterator[Symbol.iterator]=function(){
return iterator
}}
return iterator
}
function Headers(headers){
this.map={}
if(headers instanceof Headers){
headers.forEach(function(value, name){
this.append(name, value)
}, this)
}else if(Array.isArray(headers)){
headers.forEach(function(header){
this.append(header[0], header[1])
}, this)
}else if(headers){
Object.getOwnPropertyNames(headers).forEach(function(name){
this.append(name, headers[name])
}, this)
}}
Headers.prototype.append=function(name, value){
name=normalizeName(name)
value=normalizeValue(value)
var oldValue=this.map[name]
this.map[name]=oldValue ? oldValue + ', ' + value:value
}
Headers.prototype['delete']=function(name){
delete this.map[normalizeName(name)]
}
Headers.prototype.get=function(name){
name=normalizeName(name)
return this.has(name) ? this.map[name]:null
}
Headers.prototype.has=function(name){
return this.map.hasOwnProperty(normalizeName(name))
}
Headers.prototype.set=function(name, value){
this.map[normalizeName(name)]=normalizeValue(value)
}
Headers.prototype.forEach=function(callback, thisArg){
for (var name in this.map){
if(this.map.hasOwnProperty(name)){
callback.call(thisArg, this.map[name], name, this)
}}
}
Headers.prototype.keys=function(){
var items=[]
this.forEach(function(value, name){
items.push(name)
})
return iteratorFor(items)
}
Headers.prototype.values=function(){
var items=[]
this.forEach(function(value){
items.push(value)
})
return iteratorFor(items)
}
Headers.prototype.entries=function(){
var items=[]
this.forEach(function(value, name){
items.push([name, value])
})
return iteratorFor(items)
}
if(support.iterable){
Headers.prototype[Symbol.iterator]=Headers.prototype.entries
}
function consumed(body){
if(body.bodyUsed){
return Promise.reject(new TypeError('Already read'))
}
body.bodyUsed=true
}
function fileReaderReady(reader){
return new Promise(function(resolve, reject){
reader.onload=function(){
resolve(reader.result)
}
reader.onerror=function(){
reject(reader.error)
}})
}
function readBlobAsArrayBuffer(blob){
var reader=new FileReader()
var promise=fileReaderReady(reader)
reader.readAsArrayBuffer(blob)
return promise
}
function readBlobAsText(blob){
var reader=new FileReader()
var promise=fileReaderReady(reader)
reader.readAsText(blob)
return promise
}
function readArrayBufferAsText(buf){
var view=new Uint8Array(buf)
var chars=new Array(view.length)
for (var i=0; i < view.length; i++){
chars[i]=String.fromCharCode(view[i])
}
return chars.join('')
}
function bufferClone(buf){
if(buf.slice){
return buf.slice(0)
}else{
var view=new Uint8Array(buf.byteLength)
view.set(new Uint8Array(buf))
return view.buffer
}}
function Body(){
this.bodyUsed=false
this._initBody=function(body){
this.bodyUsed=this.bodyUsed
this._bodyInit=body
if(!body){
this._bodyText=''
}else if(typeof body==='string'){
this._bodyText=body
}else if(support.blob&&Blob.prototype.isPrototypeOf(body)){
this._bodyBlob=body
}else if(support.formData&&FormData.prototype.isPrototypeOf(body)){
this._bodyFormData=body
}else if(support.searchParams&&URLSearchParams.prototype.isPrototypeOf(body)){
this._bodyText=body.toString()
}else if(support.arrayBuffer&&support.blob&&isDataView(body)){
this._bodyArrayBuffer=bufferClone(body.buffer)
this._bodyInit=new Blob([this._bodyArrayBuffer])
}else if(support.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(body)||isArrayBufferView(body))){
this._bodyArrayBuffer=bufferClone(body)
}else{
this._bodyText=body=Object.prototype.toString.call(body)
}
if(!this.headers.get('content-type')){
if(typeof body==='string'){
this.headers.set('content-type', 'text/plain;charset=UTF-8')
}else if(this._bodyBlob&&this._bodyBlob.type){
this.headers.set('content-type', this._bodyBlob.type)
}else if(support.searchParams&&URLSearchParams.prototype.isPrototypeOf(body)){
this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8')
}}
}
if(support.blob){
this.blob=function(){
var rejected=consumed(this)
if(rejected){
return rejected
}
if(this._bodyBlob){
return Promise.resolve(this._bodyBlob)
}else if(this._bodyArrayBuffer){
return Promise.resolve(new Blob([this._bodyArrayBuffer]))
}else if(this._bodyFormData){
throw new Error('could not read FormData body as blob')
}else{
return Promise.resolve(new Blob([this._bodyText]))
}}
this.arrayBuffer=function(){
if(this._bodyArrayBuffer){
var isConsumed=consumed(this)
if(isConsumed){
return isConsumed
}
if(ArrayBuffer.isView(this._bodyArrayBuffer)){
return Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,
this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
)
)
}else{
return Promise.resolve(this._bodyArrayBuffer)
}}else{
return this.blob().then(readBlobAsArrayBuffer)
}}
}
this.text=function(){
var rejected=consumed(this)
if(rejected){
return rejected
}
if(this._bodyBlob){
return readBlobAsText(this._bodyBlob)
}else if(this._bodyArrayBuffer){
return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))
}else if(this._bodyFormData){
throw new Error('could not read FormData body as text')
}else{
return Promise.resolve(this._bodyText)
}}
if(support.formData){
this.formData=function(){
return this.text().then(decode)
}}
this.json=function(){
return this.text().then(JSON.parse)
}
return this
}
var methods=['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']
function normalizeMethod(method){
var upcased=method.toUpperCase()
return methods.indexOf(upcased) > -1 ? upcased:method
}
function Request(input, options){
if(!(this instanceof Request)){
throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.')
}
options=options||{}
var body=options.body
if(input instanceof Request){
if(input.bodyUsed){
throw new TypeError('Already read')
}
this.url=input.url
this.credentials=input.credentials
if(!options.headers){
this.headers=new Headers(input.headers)
}
this.method=input.method
this.mode=input.mode
this.signal=input.signal
if(!body&&input._bodyInit!=null){
body=input._bodyInit
input.bodyUsed=true
}}else{
this.url=String(input)
}
this.credentials=options.credentials||this.credentials||'same-origin'
if(options.headers||!this.headers){
this.headers=new Headers(options.headers)
}
this.method=normalizeMethod(options.method||this.method||'GET')
this.mode=options.mode||this.mode||null
this.signal=options.signal||this.signal
this.referrer=null
if((this.method==='GET'||this.method==='HEAD')&&body){
throw new TypeError('Body not allowed for GET or HEAD requests')
}
this._initBody(body)
if(this.method==='GET'||this.method==='HEAD'){
if(options.cache==='no-store'||options.cache==='no-cache'){
var reParamSearch=/([?&])_=[^&]*/
if(reParamSearch.test(this.url)){
this.url=this.url.replace(reParamSearch, '$1_=' + new Date().getTime())
}else{
var reQueryString=/\?/
this.url +=(reQueryString.test(this.url) ? '&':'?') + '_=' + new Date().getTime()
}}
}}
Request.prototype.clone=function(){
return new Request(this, {body: this._bodyInit})
}
function decode(body){
var form=new FormData()
body
.trim()
.split('&')
.forEach(function(bytes){
if(bytes){
var split=bytes.split('=')
var name=split.shift().replace(/\+/g, ' ')
var value=split.join('=').replace(/\+/g, ' ')
form.append(decodeURIComponent(name), decodeURIComponent(value))
}})
return form
}
function parseHeaders(rawHeaders){
var headers=new Headers()
var preProcessedHeaders=rawHeaders.replace(/\r?\n[\t ]+/g, ' ')
preProcessedHeaders
.split('\r')
.map(function(header){
return header.indexOf('\n')===0 ? header.substr(1, header.length):header
})
.forEach(function(line){
var parts=line.split(':')
var key=parts.shift().trim()
if(key){
var value=parts.join(':').trim()
headers.append(key, value)
}})
return headers
}
Body.call(Request.prototype)
function Response(bodyInit, options){
if(!(this instanceof Response)){
throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.')
}
if(!options){
options={}}
this.type='default'
this.status=options.status===undefined ? 200:options.status
this.ok=this.status >=200&&this.status < 300
this.statusText=options.statusText===undefined ? '':'' + options.statusText
this.headers=new Headers(options.headers)
this.url=options.url||''
this._initBody(bodyInit)
}
Body.call(Response.prototype)
Response.prototype.clone=function(){
return new Response(this._bodyInit, {
status: this.status,
statusText: this.statusText,
headers: new Headers(this.headers),
url: this.url
})
}
Response.error=function(){
var response=new Response(null, {status: 0, statusText: ''})
response.type='error'
return response
}
var redirectStatuses=[301, 302, 303, 307, 308]
Response.redirect=function(url, status){
if(redirectStatuses.indexOf(status)===-1){
throw new RangeError('Invalid status code')
}
return new Response(null, {status: status, headers: {location: url}})
}
var DOMException=global.DOMException
try {
new DOMException()
} catch (err){
DOMException=function(message, name){
this.message=message
this.name=name
var error=Error(message)
this.stack=error.stack
}
DOMException.prototype=Object.create(Error.prototype)
DOMException.prototype.constructor=DOMException
}
function fetch(input, init){
return new Promise(function(resolve, reject){
var request=new Request(input, init)
if(request.signal&&request.signal.aborted){
return reject(new DOMException('Aborted', 'AbortError'))
}
var xhr=new XMLHttpRequest()
function abortXhr(){
xhr.abort()
}
xhr.onload=function(){
var options={
status: xhr.status,
statusText: xhr.statusText,
headers: parseHeaders(xhr.getAllResponseHeaders()||'')
}
options.url='responseURL' in xhr ? xhr.responseURL:options.headers.get('X-Request-URL')
var body='response' in xhr ? xhr.response:xhr.responseText
setTimeout(function(){
resolve(new Response(body, options))
}, 0)
}
xhr.onerror=function(){
setTimeout(function(){
reject(new TypeError('Network request failed'))
}, 0)
}
xhr.ontimeout=function(){
setTimeout(function(){
reject(new TypeError('Network request failed'))
}, 0)
}
xhr.onabort=function(){
setTimeout(function(){
reject(new DOMException('Aborted', 'AbortError'))
}, 0)
}
function fixUrl(url){
try {
return url===''&&global.location.href ? global.location.href:url
} catch (e){
return url
}}
xhr.open(request.method, fixUrl(request.url), true)
if(request.credentials==='include'){
xhr.withCredentials=true
}else if(request.credentials==='omit'){
xhr.withCredentials=false
}
if('responseType' in xhr){
if(support.blob){
xhr.responseType='blob'
}else if(support.arrayBuffer &&
request.headers.get('Content-Type') &&
request.headers.get('Content-Type').indexOf('application/octet-stream')!==-1
){
xhr.responseType='arraybuffer'
}}
if(init&&typeof init.headers==='object'&&!(init.headers instanceof Headers)){
Object.getOwnPropertyNames(init.headers).forEach(function(name){
xhr.setRequestHeader(name, normalizeValue(init.headers[name]))
})
}else{
request.headers.forEach(function(value, name){
xhr.setRequestHeader(name, value)
})
}
if(request.signal){
request.signal.addEventListener('abort', abortXhr)
xhr.onreadystatechange=function(){
if(xhr.readyState===4){
request.signal.removeEventListener('abort', abortXhr)
}}
}
xhr.send(typeof request._bodyInit==='undefined' ? null:request._bodyInit)
})
}
fetch.polyfill=true
if(!global.fetch){
global.fetch=fetch
global.Headers=Headers
global.Request=Request
global.Response=Response
}
var clicks=__webpack_require__(4181);
;
})();
(EasyAffiliateLinks=typeof EasyAffiliateLinks==="undefined" ? {}:EasyAffiliateLinks)["public"]=__webpack_exports__;
})()
;
!function(a,b){function c(b){var c,d=a("<div></div>").css({width:"100%"});return b.append(d),c=b.width()-d.width(),d.remove(),c}function d(e,f){var g=e.getBoundingClientRect(),h=g.top,i=g.bottom,j=g.left,k=g.right,l=a.extend({tolerance:0,viewport:b},f),m=!1,n=l.viewport.jquery?l.viewport:a(l.viewport);n.length||(console.warn("isInViewport: The viewport selector you have provided matches no element on page."),console.warn("isInViewport: Defaulting to viewport as window"),n=a(b));var o=n.height(),p=n.width(),q=n[0].toString();if(n[0]!==b&&"[object Window]"!==q&&"[object DOMWindow]"!==q){var r=n[0].getBoundingClientRect();h-=r.top,i-=r.top,j-=r.left,k-=r.left,d.scrollBarWidth=d.scrollBarWidth||c(n),p-=d.scrollBarWidth}return l.tolerance=~~Math.round(parseFloat(l.tolerance)),l.tolerance<0&&(l.tolerance=o+l.tolerance),0>=k||j>=p?m:m=l.tolerance?h<=l.tolerance&&i>=l.tolerance:i>0&&o>=h}String.prototype.hasOwnProperty("trim")||(String.prototype.trim=function(){return this.replace(/^\s*(.*?)\s*$/,"$1")});var e=function(b){if(1===arguments.length&&"function"==typeof b&&(b=[b]),!(b instanceof Array))throw new SyntaxError("isInViewport: Argument(s) passed to .do/.run should be a function or an array of functions");for(var c=0;c<b.length;c++)if("function"==typeof b[c])for(var d=0;d<this.length;d++)b[c].call(a(this[d]));else console.warn("isInViewport: Argument(s) passed to .do/.run should be a function or an array of functions"),console.warn("isInViewport: Ignoring non-function values in array and moving on");return this};a.fn["do"]=function(a){return console.warn("isInViewport: .do is deprecated as it causes issues in IE and some browsers since it's a reserved word. Use $.fn.run instead i.e., $(el).run(fn)."),e(a)},a.fn.run=e;var f=function(b){if(b){var c=b.split(",");return 1===c.length&&isNaN(c[0])&&(c[1]=c[0],c[0]=void 0),{tolerance:c[0]?c[0].trim():void 0,viewport:c[1]?a(c[1].trim()):void 0}}return{}};a.extend(a.expr[":"],{"in-viewport":a.expr.createPseudo?a.expr.createPseudo(function(a){return function(b){return d(b,f(a))}}):function(a,b,c){return d(a,f(c[3]))}}),a.fn.isInViewport=function(a){return this.filter(function(b,c){return d(c,a)})}}(jQuery,window);
(function ($){
$.fn.embedvideo=function (options){
options=$.extend({
description_html: '<p class="wp-caption-text"></p>',
forcehd: false,
showinfo: false,
loop: false,
mediatypes: {
youtube: {
label: 'YouTube',
linksyntax: 'youtube.com/watch?',
thumb_w: 4,
thumb_h: 3,
iframeurl: 'https://www.youtube.com/embed/',
timeregex: new RegExp(/^[^t]+t.(.{6}).*/),
urlpostfix: '&amp;showinfo=0&amp;rel=0&amp;border=0&amp;fs=1&amp;iv_load_policy=1',
thumb_asy: false
},
vimeo: {
label: 'VIMEO',
linksyntax: 'vimeo.com',
thumb_w: 16,
thumb_h: 9,
iframeurl: 'https://player.vimeo.com/video/',
timeregex: new RegExp(/^[^t]+t.(.{5}).*/),
urlpostfix: '',
thumb_asy: true
}}
}, options);
$.fn.buildPlayer=function (mediaID, time, mediatype){
var vidobj='';
var vidimg='';
var offset='';
var loop=''
if(time){
offset='&start=' + time;
}
var hd="";
if(options.forcehd){
hd='&amp;vq=hd720&amp;hd=1';
}
var showinfo="&showinfo=0";
if(options.showinfo){
hd='&amp;showinfo=1';
}
if(options.loop){
loop='&amp;loop=1&amp;playlist=' + mediaID;
}
iframeurl=options.mediatypes[mediatype].iframeurl;
label=options.mediatypes[mediatype].label;
vidobj=$('<iframe height="720" width="1280" src="' + iframeurl + mediaID + '?autoplay=1&modestbranding=1&rel=0' + showinfo + offset + hd + loop + '" frameborder="0" scrolling="no" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>');
vidimg=$('<div class="crop">' +
'<span class="layer"> </span>' +
'<span class="playicon_area dashicons dashicons-video-alt3"> </span>' +
'<span class="videotype">' + label + '</span>' +
'<div class="img"></div>');
var title=this.html();
if(title){
$(vidimg).find('.videotype').html(label + ' - ' + title);
}
var caption_markup=$(options.description_html).html('<a href="' + this.attr('href') + '">' + title + '</a>');
this.wrap('<div class="jqvideo wp-caption" />').after(caption_markup).after(vidimg).hide().parent().parent("p").addClass("jqvideoplayer");
var jqplayer=$(this).parent('.jqvideo');
if(this.hasClass('no-caption')){
$(jqplayer).removeClass("wp-caption").addClass("no-caption");
}
switch (mediatype){
case "vimeo":
$.ajax({
url: 'https://vimeo.com/api/v2/video/' + mediaID + '.json',
dataType: 'jsonp',
success: function (data){
$("a.embedvideo", jqplayer).html(data[0].title);
$(".img", vidimg).replaceWith('<img src="' + data[0].thumbnail_large + '">');
$(jqplayer).setSize();
}});
break;
case "youtube":
$(".img", vidimg).replaceWith('<img src="https://i1.ytimg.com/vi/' + mediaID + '/hqdefault.jpg">');
$(jqplayer).setSize();
var img=new Image();
img.onload=function (){
if(this.width > 300){
$("img", vidimg).attr('src', this.src);
}
$(jqplayer).setSize();
};
img.src='https://i1.ytimg.com/vi/' + mediaID + '/maxresdefault.jpg';
break;
default:
}
$(".crop", jqplayer).click(function (){
var img_width=0;
img_width=$("img", this).width();
if(img_width < 1){
img_width=$(".img", this).width();
}
var img_height=aspectHeight(img_width, 16, 9);
$(this).html(vidobj);
$("iframe", this).css({
'width': img_width,
'height': img_height
});
$("iframe", this).css({
"height": this.height - 1
});
var title=$("a.embedvideo", jqplayer).html();
gaEvent(mediatype, 'play', title);
});
$(".crop", jqplayer).hover(function (){
$(".layer", this).fadeTo(100, 0.1);
},
function (){
$(".layer", this).fadeTo(100, 0.2);
}
);
};
$.fn.setSize=function (ar){
this.each(function (){
var media=parseVideoURL($("a", this).attr('href'));
var margintop=0;
var marginbottom=0;
var thumb_w=options.mediatypes[media.provider].thumb_w;
var thumb_h=options.mediatypes[media.provider].thumb_h;
if(($("img", this).attr("src")!==undefined)&&$("img", this).attr("src").indexOf("maxres")!==-1){
thumb_w=16;
thumb_h=9;
}
var img_width=$(this).width();
var img_height_wide=aspectHeight(img_width, 16, 9);
var img_height_input=aspectHeight(img_width, thumb_w, thumb_h);
if(options.mediatypes[media.provider].thumb_w===4){
marginbottom=((((img_height_input - img_height_wide) / 2)) * -1);
marginbottom=marginbottom;
margintop=marginbottom;
}
var playbt_left=(img_width / 2) - 53;
var playbt_top=(img_height_wide / 2) - 50;
$(this).children(".crop").children(".playicon_area").css({
'left': playbt_left,
'top': playbt_top
});
$("img", this).css({
'width': img_width,
'height': img_height_input,
'margin-top': margintop,
'margin-bottom': marginbottom,
});
$(".videotype", this).fadeTo(0, 0.8);
$(".layer", this).css({
'width': img_width,
'height': img_height_wide,
'background': '#000'
}).fadeTo(100, 0.2);
$("iframe", this).css({
'width': img_width,
'height': img_height_wide
});
$(".img", this).css({
'width': img_width,
'height': img_height_wide,
'background': '#bbb'
});
});
};
var gaEvent=function (category, action, label){
if(window._gaq&&_gaq.push){
_gaq.push(['_trackEvent', category, action, label]);
}
if(window.ga&&ga.create){
ga('send', 'event', {
eventCategory: category,
eventAction: action,
eventLabel: label
});
}
if(window.__gaTracker&&__gaTracker.create){
__gaTracker('send', 'event', {
eventCategory: category,
eventAction: action,
eventLabel: label
});
}
if('undefined'!==typeof _paq){
_paq.push(['trackEvent', category, action, label]);
}};
var getQuerystring=function (key, url){
key=key.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex=new RegExp("[\\?&]" + key + "=([^&#]*)");
var qs=regex.exec(url);
if(qs===null){
return false;
}else{
return qs[1];
}};
var getSeconds=function (url){
var timestr=getQuerystring('t', url);
if(timestr){
var arr=(timestr.split('m'));
var min=arr[0];
var sec=arr[1].split('s')[0];
var seconds=parseInt(min * 60, 10) + parseInt(sec, 10);
return seconds;
}else{
return false;
}};
var aspectHeight=function (width, aspect_w, aspect_h){
var height=width / aspect_w * aspect_h;
return height;
};
var getOptions=function (myClasses){
for (var i=0; i < myClasses.length; i++){
if(myClasses[i]==="forcehd"){
options.forcehd=true;
}
if(myClasses[i]==="showinfo"){
options.showinfo=true;
}
if(myClasses[i]==="loop"){
options.loop=true;
}}
};
var getParm=function (url, base){
var re=new RegExp("(\\?|&)" + base + "\\=([^&]*)(&|$)");
var matches=url.match(re);
if(matches){
return (matches[2]);
}else{
return ("");
}}
var parseVideoURL=function (url){
var retVal={};
var video_id_regExp=/^.*((youtu.be\/|vimeo.com\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/,
match=url.match(video_id_regExp),
video_id;
if(match&&match[7]){
video_id=match[7];
}else{
retVal.provider=false;
retVal.id=false;
return retVal;
}
if(url.indexOf("youtu")!==-1){
retVal.provider="youtube";
retVal.id=video_id;
}else{
matches=url.match(/vimeo.com\/(\d+)/);
retVal.provider="vimeo";
retVal.id=video_id;
}
return retVal;
}
return this.each(function (){
getOptions($(this).attr('class').split(' '));
var link=$(this).attr('href');
var media=parseVideoURL(link);
var offset=getSeconds(link);
if(media.id!==false){
$(this).buildPlayer(media.id, offset, media.provider);
}});
};
$(document).ready(function ($){
$('.embedvideo:in-viewport').embedvideo();
$(window).scroll(function (){
$('.embedvideo:in-viewport').embedvideo();
});
function resizeStuff(){
$(".jqvideo").setSize();
}
var TO=false;
$(window).resize(function (){
if(TO!==false)
clearTimeout(TO);
TO=setTimeout(resizeStuff, 200);
});
});
}(jQuery));
window.addComment=function(v){var I,C,h,E=v.document,b={commentReplyClass:"comment-reply-link",commentReplyTitleId:"reply-title",cancelReplyId:"cancel-comment-reply-link",commentFormId:"commentform",temporaryFormId:"wp-temp-form-div",parentIdFieldId:"comment_parent",postIdFieldId:"comment_post_ID"},e=v.MutationObserver||v.WebKitMutationObserver||v.MozMutationObserver,r="querySelector"in E&&"addEventListener"in v,n=!!E.documentElement.dataset;function t(){d(),e&&new e(o).observe(E.body,{childList:!0,subtree:!0})}function d(e){if(r&&(I=g(b.cancelReplyId),C=g(b.commentFormId),I)){I.addEventListener("touchstart",l),I.addEventListener("click",l);function t(e){if((e.metaKey||e.ctrlKey)&&13===e.keyCode&&"a"!==E.activeElement.tagName.toLowerCase())return C.removeEventListener("keydown",t),e.preventDefault(),C.submit.click(),!1}C&&C.addEventListener("keydown",t);for(var n,d=function(e){var t=b.commentReplyClass;e&&e.childNodes||(e=E);e=E.getElementsByClassName?e.getElementsByClassName(t):e.querySelectorAll("."+t);return e}(e),o=0,i=d.length;o<i;o++)(n=d[o]).addEventListener("touchstart",a),n.addEventListener("click",a)}}function l(e){var t,n,d=g(b.temporaryFormId);d&&h&&(g(b.parentIdFieldId).value="0",t=d.textContent,d.parentNode.replaceChild(h,d),this.style.display="none",n=(d=(d=g(b.commentReplyTitleId))&&d.firstChild)&&d.nextSibling,d&&d.nodeType===Node.TEXT_NODE&&t&&(n&&"A"===n.nodeName&&n.id!==b.cancelReplyId&&(n.style.display=""),d.textContent=t),e.preventDefault())}function a(e){var t=g(b.commentReplyTitleId),t=t&&t.firstChild.textContent,n=this,d=m(n,"belowelement"),o=m(n,"commentid"),i=m(n,"respondelement"),r=m(n,"postid"),n=m(n,"replyto")||t;d&&o&&i&&r&&!1===v.addComment.moveForm(d,o,i,r,n)&&e.preventDefault()}function o(e){for(var t=e.length;t--;)if(e[t].addedNodes.length)return void d()}function m(e,t){return n?e.dataset[t]:e.getAttribute("data-"+t)}function g(e){return E.getElementById(e)}return r&&"loading"!==E.readyState?t():r&&v.addEventListener("DOMContentLoaded",t,!1),{init:d,moveForm:function(e,t,n,d,o){var i,r,l,a,m,c,s,e=g(e),n=(h=g(n),g(b.parentIdFieldId)),y=g(b.postIdFieldId),p=g(b.commentReplyTitleId),u=(p=p&&p.firstChild)&&p.nextSibling;if(e&&h&&n){void 0===o&&(o=p&&p.textContent),a=h,m=b.temporaryFormId,c=g(m),s=(s=g(b.commentReplyTitleId))?s.firstChild.textContent:"",c||((c=E.createElement("div")).id=m,c.style.display="none",c.textContent=s,a.parentNode.insertBefore(c,a)),d&&y&&(y.value=d),n.value=t,I.style.display="",e.parentNode.insertBefore(h,e.nextSibling),p&&p.nodeType===Node.TEXT_NODE&&(u&&"A"===u.nodeName&&u.id!==b.cancelReplyId&&(u.style.display="none"),p.textContent=o),I.onclick=function(){return!1};try{for(var f=0;f<C.elements.length;f++)if(i=C.elements[f],r=!1,"getComputedStyle"in v?l=v.getComputedStyle(i):E.documentElement.currentStyle&&(l=i.currentStyle),(i.offsetWidth<=0&&i.offsetHeight<=0||"hidden"===l.visibility)&&(r=!0),"hidden"!==i.type&&!i.disabled&&!r){i.focus();break}}catch(e){}return!1}}}}(window);