var url = document.location.origin; jQuery('#login h1').html(''+url+''); jQuery('

Welcome! Please login to continue. Not a member? Click here to sign up!

').insertAfter("#login h1"); jQuery("#login h1 a").css({ "background-image": "url("+url+"/wp-content/uploads/2019/10/logo.png)", "width": "301px", "height": "113px", "background-size": "contain", }); jQuery('#login .button-primary').css({ "margin":" 7px 0 7px", "box-shadow":" 0 0 0px rgba( 0,0,0,0.8 )", "height": "auto", "line-height":" 20px", "padding": "13px", "float": "none", "width": "100%", "background": "#222222", "font": "normal 15px 'Roboto', sans-serif", }) jQuery('#loginform').css({ "border": "none", "box-shadow": "none", "margin-top": "0", }) jQuery('body.login').css({ "background-image": "url()", "background-color": "#ffffff", "background-repeat": "no-repeat", "background-position": "right center", "background-size": "cover", "position": "relative", }) jQuery('body.login').css({ "font-size": "font-size", "margin": "24px 0 0", }) jQuery('.login #backtoblog').css({ "font-size": "13px", "padding": "0 24px", "text-align": "center", "margin": "16px 0", "word-wrap": "break-word", }) jQuery('.login #nav').css({ "text-align": "center", "margin": "0", }) jQuery('.login #backtoblog a').css({ "text-decoration": "none", "color": "#0a0a0a", "font-size": "15px", }) jQuery('.login form input[type=checkbox]').css({ "border-radius": "0", "background": "#fff", }) jQuery("#login .button-primary").hover(function(){ jQuery(this).css({ "background":"#a24c48", "color": "#ffffff", }); },function(){ jQuery(this).css({ "background":"#222222", "color": "#ffffff", }); }) ; /*! This file is auto-generated */ 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=this._limits.end?"end":"middle";if(this._stickyMode!=a){switch(a){case"start":d(this._node.style,{position:"absolute",left:this._offsetToParent.left+"px",right:this._offsetToParent.right+"px",top:this._offsetToParent.top+"px",bottom:"auto",width:"auto",marginLeft:0,marginRight:0,marginTop:0});break;case"middle":d(this._node.style,{position:"fixed",left:this._offsetToWindow.left+"px",right:this._offsetToWindow.right+"px",top:this._styles.top,bottom:"auto",width:"auto",marginLeft:0,marginRight:0,marginTop:0});break;case"end":d(this._node.style,{position:"absolute",left:this._offsetToParent.left+"px",right:this._offsetToParent.right+"px",top:"auto",bottom:0,width:"auto",marginLeft:0,marginRight:0})}this._stickyMode=a}}}},{key:"_fastCheck",value:function(){this._active&&!this._removed&&(Math.abs(f(this._clone.node)-this._clone.docOffsetTop)>1||Math.abs(this._parent.node.offsetHeight-this._parent.offsetHeight)>1)&&this.refresh()}},{key:"_deactivate",value:function(){var a=this;this._active&&!this._removed&&(this._clone.node.parentNode.removeChild(this._clone.node),delete this._clone,d(this._node.style,this._styles),delete this._styles,l.some(function(b){return b!==a&&b._parent&&b._parent.node===a._parent.node})||d(this._parent.node.style,this._parent.styles),delete this._parent,this._stickyMode=null,this._active=!1,delete this._offsetToWindow,delete this._offsetToParent,delete this._limits)}},{key:"remove",value:function(){var a=this;this._deactivate(),l.some(function(b,c){if(b._node===a._node)return l.splice(c,1),!0}),this._removed=!0}}]),g}(),n={stickies:l,Sticky:m,addOne:function(a){if(!(a instanceof HTMLElement)){if(!a.length||!a[0])return;a=a[0]}for(var b=0;bc;c++)if(a[c]===b)return!0;return!1}function e(a,b,c){return a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent?a.attachEvent("on"+b,c):void 0}function f(a,b){var c;a.createTextRange?(c=a.createTextRange(),c.move("character",b),c.select()):a.selectionStart&&(a.focus(),a.setSelectionRange(b,b))}function g(a,b){try{return a.type=b,!0}catch(c){return!1}}function h(a,b){if(a&&a.getAttribute(B))b(a);else for(var c,d=a?a.getElementsByTagName("input"):N,e=a?a.getElementsByTagName("textarea"):O,f=d?d.length:0,g=e?e.length:0,h=f+g,i=0;h>i;i++)c=f>i?d[i]:e[i-f],b(c)}function i(a){h(a,k)}function j(a){h(a,l)}function k(a,b){var c=!!b&&a.value!==b,d=a.value===a.getAttribute(B);if((c||d)&&"true"===a.getAttribute(C)){a.removeAttribute(C),a.value=a.value.replace(a.getAttribute(B),""),a.className=a.className.replace(A,"");var e=a.getAttribute(I);parseInt(e,10)>=0&&(a.setAttribute("maxLength",e),a.removeAttribute(I));var f=a.getAttribute(D);return f&&(a.type=f),!0}return!1}function l(a){var b=a.getAttribute(B);if(""===a.value&&b){a.setAttribute(C,"true"),a.value=b,a.className+=" "+z;var c=a.getAttribute(I);c||(a.setAttribute(I,a.maxLength),a.removeAttribute("maxLength"));var d=a.getAttribute(D);return d?a.type="text":"password"===a.type&&g(a,"text")&&a.setAttribute(D,"password"),!0}return!1}function m(a){return function(){P&&a.value===a.getAttribute(B)&&"true"===a.getAttribute(C)?f(a,0):k(a)}}function n(a){return function(){l(a)}}function o(a){return function(){i(a)}}function p(a){return function(b){return v=a.value,"true"===a.getAttribute(C)&&v===a.getAttribute(B)&&d(x,b.keyCode)?(b.preventDefault&&b.preventDefault(),!1):void 0}}function q(a){return function(){k(a,v),""===a.value&&(a.blur(),f(a,0))}}function r(a){return function(){a===c()&&a.value===a.getAttribute(B)&&"true"===a.getAttribute(C)&&f(a,0)}}function s(a){var b=a.form;b&&"string"==typeof b&&(b=document.getElementById(b),b.getAttribute(E)||(e(b,"submit",o(b)),b.setAttribute(E,"true"))),e(a,"focus",m(a)),e(a,"blur",n(a)),P&&(e(a,"keydown",p(a)),e(a,"keyup",q(a)),e(a,"click",r(a))),a.setAttribute(F,"true"),a.setAttribute(B,T),(P||a!==c())&&l(a)}var t=document.createElement("input"),u=void 0!==t.placeholder;if(a.Placeholders={nativeSupport:u,disable:u?b:i,enable:u?b:j},!u){var v,w=["text","search","url","tel","email","password","number","textarea"],x=[27,33,34,35,36,37,38,39,40,8,46],y="#ccc",z="placeholdersjs",A=new RegExp("(?:^|\\s)"+z+"(?!\\S)"),B="data-placeholder-value",C="data-placeholder-active",D="data-placeholder-type",E="data-placeholder-submit",F="data-placeholder-bound",G="data-placeholder-focus",H="data-placeholder-live",I="data-placeholder-maxlength",J=100,K=document.getElementsByTagName("head")[0],L=document.documentElement,M=a.Placeholders,N=document.getElementsByTagName("input"),O=document.getElementsByTagName("textarea"),P="false"===L.getAttribute(G),Q="false"!==L.getAttribute(H),R=document.createElement("style");R.type="text/css";var S=document.createTextNode("."+z+" {color:"+y+";}");R.styleSheet?R.styleSheet.cssText=S.nodeValue:R.appendChild(S),K.insertBefore(R,K.firstChild);for(var T,U,V=0,W=N.length+O.length;W>V;V++)U=Va;a++)U=a= 0) { return this.settings.strings.inPast; } var seconds = Math.abs(distanceMillis) / 1000; var minutes = seconds / 60; var hours = minutes / 60; var days = hours / 24; var years = days / 365; function substitute(stringOrFunction, number) { var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction; var value = ($l.numbers && $l.numbers[number]) || number; return string.replace(/%d/i, value); } var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || seconds < 90 && substitute($l.minute, 1) || minutes < 45 && substitute($l.minutes, Math.round(minutes)) || minutes < 90 && substitute($l.hour, 1) || hours < 24 && substitute($l.hours, Math.round(hours)) || hours < 42 && substitute($l.day, 1) || days < 30 && substitute($l.days, Math.round(days)) || days < 45 && substitute($l.month, 1) || days < 365 && substitute($l.months, Math.round(days / 30)) || years < 1.5 && substitute($l.year, 1) || substitute($l.years, Math.round(years)); var separator = $l.wordSeparator || ""; if ($l.wordSeparator === undefined) { separator = " "; } return $.trim([prefix, words, suffix].join(separator)); }, parse: function(iso8601) { var s = $.trim(iso8601); s = s.replace(/\.\d+/,""); // remove milliseconds s = s.replace(/-/,"/").replace(/-/,"/"); s = s.replace(/T/," ").replace(/Z/," UTC"); s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 s = s.replace(/([\+\-]\d\d)$/," $100"); // +09 -> +0900 return new Date(s); }, datetime: function(elem) { var iso8601 = $t.isTime(elem) ? $(elem).attr("datetime") : $(elem).attr("title"); return $t.parse(iso8601); }, isTime: function(elem) { // jQuery's `is()` doesn't play well with HTML5 in IE return $(elem).get(0).tagName.toLowerCase() === "time"; // $(elem).is("time"); } }); // functions that can be called via $(el).timeago('action') // init is default when no action is given // functions are called with context of a single element var functions = { init: function() { var refresh_el = $.proxy(refresh, this); refresh_el(); var $s = $t.settings; if ($s.refreshMillis > 0) { this._timeagoInterval = setInterval(refresh_el, $s.refreshMillis); } }, update: function(timestamp) { var date = (timestamp instanceof Date) ? timestamp : $t.parse(timestamp); $(this).data('timeago', { datetime: date }); if ($t.settings.localeTitle) $(this).attr("title", date.toLocaleString()); refresh.apply(this); }, updateFromDOM: function() { $(this).data('timeago', { datetime: $t.parse( $t.isTime(this) ? $(this).attr("datetime") : $(this).attr("title") ) }); refresh.apply(this); }, dispose: function () { if (this._timeagoInterval) { window.clearInterval(this._timeagoInterval); this._timeagoInterval = null; } } }; $.fn.timeago = function(action, options) { var fn = action ? functions[action] : functions.init; if (!fn) { throw new Error("Unknown function name '"+ action +"' for timeago"); } // each over objects here and call the requested function this.each(function() { fn.call(this, options); }); return this; }; function refresh() { var $s = $t.settings; //check if it's still visible if ($s.autoDispose && !$.contains(document.documentElement,this)) { //stop if it has been removed $(this).timeago("dispose"); return this; } var data = prepareData(this); if (!isNaN(data.datetime)) { if ( $s.cutoff == 0 || Math.abs(distance(data.datetime)) < $s.cutoff) { $(this).text(inWords(data.datetime)); } } return this; } function prepareData(element) { element = $(element); if (!element.data("timeago")) { element.data("timeago", { datetime: $t.datetime(element) }); var text = $.trim(element.text()); if ($t.settings.localeTitle) { element.attr("title", element.data('timeago').datetime.toLocaleString()); } else if (text.length > 0 && !($t.isTime(element) && element.attr("title"))) { element.attr("title", text); } } return element.data("timeago"); } function inWords(date) { return $t.inWords(distance(date)); } function distance(date) { return (new Date().getTime() - date.getTime()); } // fix for IE6 suckage document.createElement("abbr"); document.createElement("time"); }));; // English (Template) jQuery.timeago.settings.strings = { prefixAgo: null, prefixFromNow: null, suffixAgo: "ago", suffixFromNow: "from now", seconds: "less than a minute", minute: "about a minute", minutes: "%d minutes", hour: "about an hour", hours: "about %d hours", day: "a day", days: "%d days", month: "about a month", months: "%d months", year: "about a year", years: "%d years", wordSeparator: " ", numbers: [] }; ; /*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. Dual MIT/BSD license */ window.matchMedia || (window.matchMedia = function() { "use strict"; // For browsers that support matchMedium api such as IE 9 and webkit var styleMedia = (window.styleMedia || window.media); // For those that don't support matchMedium if (!styleMedia) { var style = document.createElement('style'), script = document.getElementsByTagName('script')[0], info = null; style.type = 'text/css'; style.id = 'matchmediajs-test'; script.parentNode.insertBefore(style, script); // 'style.currentStyle' is used by IE <= 8 and 'window.getComputedStyle' for all other browsers info = ('getComputedStyle' in window) && window.getComputedStyle(style, null) || style.currentStyle; styleMedia = { matchMedium: function(media) { var text = '@media ' + media + '{ #matchmediajs-test { width: 1px; } }'; // 'style.styleSheet' is used by IE <= 8 and 'style.textContent' for all other browsers if (style.styleSheet) { style.styleSheet.cssText = text; } else { style.textContent = text; } // Test if media query is true or false return info.width === '1px'; } }; } return function(media) { return { matches: styleMedia.matchMedium(media || 'all'), media: media || 'all' }; }; }()); ; /*! matchMedia() polyfill addListener/removeListener extension. Author & copyright (c) 2012: Scott Jehl. Dual MIT/BSD license */ (function(){ // Bail out for browsers that have addListener support if (window.matchMedia && window.matchMedia('all').addListener) { return false; } var localMatchMedia = window.matchMedia, hasMediaQueries = localMatchMedia('only all').matches, isListening = false, timeoutID = 0, // setTimeout for debouncing 'handleChange' queries = [], // Contains each 'mql' and associated 'listeners' if 'addListener' is used handleChange = function(evt) { // Debounce clearTimeout(timeoutID); timeoutID = setTimeout(function() { for (var i = 0, il = queries.length; i < il; i++) { var mql = queries[i].mql, listeners = queries[i].listeners || [], matches = localMatchMedia(mql.media).matches; // Update mql.matches value and call listeners // Fire listeners only if transitioning to or from matched state if (matches !== mql.matches) { mql.matches = matches; for (var j = 0, jl = listeners.length; j < jl; j++) { listeners[j].call(window, mql); } } } }, 30); }; window.matchMedia = function(media) { var mql = localMatchMedia(media), listeners = [], index = 0; mql.addListener = function(listener) { // Changes would not occur to css media type so return now (Affects IE <= 8) if (!hasMediaQueries) { return; } // Set up 'resize' listener for browsers that support CSS3 media queries (Not for IE <= 8) // There should only ever be 1 resize listener running for performance if (!isListening) { isListening = true; window.addEventListener('resize', handleChange, true); } // Push object only if it has not been pushed already if (index === 0) { index = queries.push({ mql : mql, listeners : listeners }); } listeners.push(listener); }; mql.removeListener = function(listener) { for (var i = 0, il = listeners.length; i < il; i++){ if (listeners[i] === listener){ listeners.splice(i, 1); } } }; return mql; }; }()); ; /*! Picturefill - v2.3.1 - 2015-04-09 * http://scottjehl.github.io/picturefill * Copyright (c) 2015 https://github.com/scottjehl/picturefill/blob/master/Authors.txt; Licensed MIT */ window.matchMedia||(window.matchMedia=function(){"use strict";var a=window.styleMedia||window.media;if(!a){var b=document.createElement("style"),c=document.getElementsByTagName("script")[0],d=null;b.type="text/css",b.id="matchmediajs-test",c.parentNode.insertBefore(b,c),d="getComputedStyle"in window&&window.getComputedStyle(b,null)||b.currentStyle,a={matchMedium:function(a){var c="@media "+a+"{ #matchmediajs-test { width: 1px; } }";return b.styleSheet?b.styleSheet.cssText=c:b.textContent=c,"1px"===d.width}}}return function(b){return{matches:a.matchMedium(b||"all"),media:b||"all"}}}()),function(a,b,c){"use strict";function d(b){"object"==typeof module&&"object"==typeof module.exports?module.exports=b:"function"==typeof define&&define.amd&&define("picturefill",function(){return b}),"object"==typeof a&&(a.picturefill=b)}function e(a){var b,c,d,e,f,i=a||{};b=i.elements||g.getAllElements();for(var j=0,k=b.length;k>j;j++)if(c=b[j],d=c.parentNode,e=void 0,f=void 0,"IMG"===c.nodeName.toUpperCase()&&(c[g.ns]||(c[g.ns]={}),i.reevaluate||!c[g.ns].evaluated)){if(d&&"PICTURE"===d.nodeName.toUpperCase()){if(g.removeVideoShim(d),e=g.getMatch(c,d),e===!1)continue}else e=void 0;(d&&"PICTURE"===d.nodeName.toUpperCase()||!g.sizesSupported&&c.srcset&&h.test(c.srcset))&&g.dodgeSrcset(c),e?(f=g.processSourceSet(e),g.applyBestCandidate(f,c)):(f=g.processSourceSet(c),(void 0===c.srcset||c[g.ns].srcset)&&g.applyBestCandidate(f,c)),c[g.ns].evaluated=!0}}function f(){function c(){clearTimeout(d),d=setTimeout(h,60)}g.initTypeDetects(),e();var d,f=setInterval(function(){return e(),/^loaded|^i|^c/.test(b.readyState)?void clearInterval(f):void 0},250),h=function(){e({reevaluate:!0})};a.addEventListener?a.addEventListener("resize",c,!1):a.attachEvent&&a.attachEvent("onresize",c)}if(a.HTMLPictureElement)return void d(function(){});b.createElement("picture");var g=a.picturefill||{},h=/\s+\+?\d+(e\d+)?w/;g.ns="picturefill",function(){g.srcsetSupported="srcset"in c,g.sizesSupported="sizes"in c,g.curSrcSupported="currentSrc"in c}(),g.trim=function(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")},g.makeUrl=function(){var a=b.createElement("a");return function(b){return a.href=b,a.href}}(),g.restrictsMixedContent=function(){return"https:"===a.location.protocol},g.matchesMedia=function(b){return a.matchMedia&&a.matchMedia(b).matches},g.getDpr=function(){return a.devicePixelRatio||1},g.getWidthFromLength=function(a){var c;if(!a||a.indexOf("%")>-1!=!1||!(parseFloat(a)>0||a.indexOf("calc(")>-1))return!1;a=a.replace("vw","%"),g.lengthEl||(g.lengthEl=b.createElement("div"),g.lengthEl.style.cssText="border:0;display:block;font-size:1em;left:0;margin:0;padding:0;position:absolute;visibility:hidden",g.lengthEl.className="helper-from-picturefill-js"),g.lengthEl.style.width="0px";try{g.lengthEl.style.width=a}catch(d){}return b.body.appendChild(g.lengthEl),c=g.lengthEl.offsetWidth,0>=c&&(c=!1),b.body.removeChild(g.lengthEl),c},g.detectTypeSupport=function(b,c){var d=new a.Image;return d.onerror=function(){g.types[b]=!1,e()},d.onload=function(){g.types[b]=1===d.width,e()},d.src=c,"pending"},g.types=g.types||{},g.initTypeDetects=function(){g.types["image/jpeg"]=!0,g.types["image/gif"]=!0,g.types["image/png"]=!0,g.types["image/svg+xml"]=b.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Image","1.1"),g.types["image/webp"]=g.detectTypeSupport("image/webp","data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA=")},g.verifyTypeSupport=function(a){var b=a.getAttribute("type");if(null===b||""===b)return!0;var c=g.types[b];return"string"==typeof c&&"pending"!==c?(g.types[b]=g.detectTypeSupport(b,c),"pending"):"function"==typeof c?(c(),"pending"):c},g.parseSize=function(a){var b=/(\([^)]+\))?\s*(.+)/g.exec(a);return{media:b&&b[1],length:b&&b[2]}},g.findWidthFromSourceSize=function(c){for(var d,e=g.trim(c).split(/\s*,\s*/),f=0,h=e.length;h>f;f++){var i=e[f],j=g.parseSize(i),k=j.length,l=j.media;if(k&&(!l||g.matchesMedia(l))&&(d=g.getWidthFromLength(k)))break}return d||Math.max(a.innerWidth||0,b.documentElement.clientWidth)},g.parseSrcset=function(a){for(var b=[];""!==a;){a=a.replace(/^\s+/g,"");var c,d=a.search(/\s/g),e=null;if(-1!==d){c=a.slice(0,d);var f=c.slice(-1);if((","===f||""===c)&&(c=c.replace(/,+$/,""),e=""),a=a.slice(d+1),null===e){var g=a.indexOf(",");-1!==g?(e=a.slice(0,g),a=a.slice(g+1)):(e=a,a="")}}else c=a,a="";(c||e)&&b.push({url:c,descriptor:e})}return b},g.parseDescriptor=function(a,b){var c,d=b||"100vw",e=a&&a.replace(/(^\s+|\s+$)/g,""),f=g.findWidthFromSourceSize(d);if(e)for(var h=e.split(" "),i=h.length-1;i>=0;i--){var j=h[i],k=j&&j.slice(j.length-1);if("h"!==k&&"w"!==k||g.sizesSupported){if("x"===k){var l=j&&parseFloat(j,10);c=l&&!isNaN(l)?l:1}}else c=parseFloat(parseInt(j,10)/f)}return c||1},g.getCandidatesFromSourceSet=function(a,b){for(var c=g.parseSrcset(a),d=[],e=0,f=c.length;f>e;e++){var h=c[e];d.push({url:h.url,resolution:g.parseDescriptor(h.descriptor,b)})}return d},g.dodgeSrcset=function(a){a.srcset&&(a[g.ns].srcset=a.srcset,a.srcset="",a.setAttribute("data-pfsrcset",a[g.ns].srcset))},g.processSourceSet=function(a){var b=a.getAttribute("srcset"),c=a.getAttribute("sizes"),d=[];return"IMG"===a.nodeName.toUpperCase()&&a[g.ns]&&a[g.ns].srcset&&(b=a[g.ns].srcset),b&&(d=g.getCandidatesFromSourceSet(b,c)),d},g.backfaceVisibilityFix=function(a){var b=a.style||{},c="webkitBackfaceVisibility"in b,d=b.zoom;c&&(b.zoom=".999",c=a.offsetWidth,b.zoom=d)},g.setIntrinsicSize=function(){var c={},d=function(a,b,c){b&&a.setAttribute("width",parseInt(b/c,10))};return function(e,f){var h;e[g.ns]&&!a.pfStopIntrinsicSize&&(void 0===e[g.ns].dims&&(e[g.ns].dims=e.getAttribute("width")||e.getAttribute("height")),e[g.ns].dims||(f.url in c?d(e,c[f.url],f.resolution):(h=b.createElement("img"),h.onload=function(){if(c[f.url]=h.width,!c[f.url])try{b.body.appendChild(h),c[f.url]=h.width||h.offsetWidth,b.body.removeChild(h)}catch(a){}e.src===f.url&&d(e,c[f.url],f.resolution),e=null,h.onload=null,h=null},h.src=f.url)))}}(),g.applyBestCandidate=function(a,b){var c,d,e;a.sort(g.ascendingSort),d=a.length,e=a[d-1];for(var f=0;d>f;f++)if(c=a[f],c.resolution>=g.getDpr()){e=c;break}e&&(e.url=g.makeUrl(e.url),b.src!==e.url&&(g.restrictsMixedContent()&&"http:"===e.url.substr(0,"http:".length).toLowerCase()?void 0!==window.console&&console.warn("Blocked mixed content image "+e.url):(b.src=e.url,g.curSrcSupported||(b.currentSrc=b.src),g.backfaceVisibilityFix(b))),g.setIntrinsicSize(b,e))},g.ascendingSort=function(a,b){return a.resolution-b.resolution},g.removeVideoShim=function(a){var b=a.getElementsByTagName("video");if(b.length){for(var c=b[0],d=c.getElementsByTagName("source");d.length;)a.insertBefore(d[0],c);c.parentNode.removeChild(c)}},g.getAllElements=function(){for(var a=[],c=b.getElementsByTagName("img"),d=0,e=c.length;e>d;d++){var f=c[d];("PICTURE"===f.parentNode.nodeName.toUpperCase()||null!==f.getAttribute("srcset")||f[g.ns]&&null!==f[g.ns].srcset)&&a.push(f)}return a},g.getMatch=function(a,b){for(var c,d=b.childNodes,e=0,f=d.length;f>e;e++){var h=d[e];if(1===h.nodeType){if(h===a)return c;if("SOURCE"===h.nodeName.toUpperCase()){null!==h.getAttribute("src")&&void 0!==typeof console&&console.warn("The `src` attribute is invalid on `picture` `source` element; instead, use `srcset`.");var i=h.getAttribute("media");if(h.getAttribute("srcset")&&(!i||g.matchesMedia(i))){var j=g.verifyTypeSupport(h);if(j===!0){c=h;break}if("pending"===j)return!1}}}}return c},f(),e._=g,d(e)}(window,window.document,new window.Image);; /*! Waypoints - 4.0.0 Copyright © 2011-2015 Caleb Troughton Licensed under the MIT license. https://github.com/imakewebthings/waypoints/blog/master/licenses.txt */ !function(){"use strict";function t(o){if(!o)throw new Error("No options passed to Waypoint constructor");if(!o.element)throw new Error("No element option passed to Waypoint constructor");if(!o.handler)throw new Error("No handler option passed to Waypoint constructor");this.key="waypoint-"+e,this.options=t.Adapter.extend({},t.defaults,o),this.element=this.options.element,this.adapter=new t.Adapter(this.element),this.callback=o.handler,this.axis=this.options.horizontal?"horizontal":"vertical",this.enabled=this.options.enabled,this.triggerPoint=null,this.group=t.Group.findOrCreate({name:this.options.group,axis:this.axis}),this.context=t.Context.findOrCreateByElement(this.options.context),t.offsetAliases[this.options.offset]&&(this.options.offset=t.offsetAliases[this.options.offset]),this.group.add(this),this.context.add(this),i[this.key]=this,e+=1}var e=0,i={};t.prototype.queueTrigger=function(t){this.group.queueTrigger(this,t)},t.prototype.trigger=function(t){this.enabled&&this.callback&&this.callback.apply(this,t)},t.prototype.destroy=function(){this.context.remove(this),this.group.remove(this),delete i[this.key]},t.prototype.disable=function(){return this.enabled=!1,this},t.prototype.enable=function(){return this.context.refresh(),this.enabled=!0,this},t.prototype.next=function(){return this.group.next(this)},t.prototype.previous=function(){return this.group.previous(this)},t.invokeAll=function(t){var e=[];for(var o in i)e.push(i[o]);for(var n=0,r=e.length;r>n;n++)e[n][t]()},t.destroyAll=function(){t.invokeAll("destroy")},t.disableAll=function(){t.invokeAll("disable")},t.enableAll=function(){t.invokeAll("enable")},t.refreshAll=function(){t.Context.refreshAll()},t.viewportHeight=function(){return window.innerHeight||document.documentElement.clientHeight},t.viewportWidth=function(){return document.documentElement.clientWidth},t.adapters=[],t.defaults={context:window,continuous:!0,enabled:!0,group:"default",horizontal:!1,offset:0},t.offsetAliases={"bottom-in-view":function(){return this.context.innerHeight()-this.adapter.outerHeight()},"right-in-view":function(){return this.context.innerWidth()-this.adapter.outerWidth()}},window.Waypoint=t}(),function(){"use strict";function t(t){window.setTimeout(t,1e3/60)}function e(t){this.element=t,this.Adapter=n.Adapter,this.adapter=new this.Adapter(t),this.key="waypoint-context-"+i,this.didScroll=!1,this.didResize=!1,this.oldScroll={x:this.adapter.scrollLeft(),y:this.adapter.scrollTop()},this.waypoints={vertical:{},horizontal:{}},t.waypointContextKey=this.key,o[t.waypointContextKey]=this,i+=1,this.createThrottledScrollHandler(),this.createThrottledResizeHandler()}var i=0,o={},n=window.Waypoint,r=window.onload;e.prototype.add=function(t){var e=t.options.horizontal?"horizontal":"vertical";this.waypoints[e][t.key]=t,this.refresh()},e.prototype.checkEmpty=function(){var t=this.Adapter.isEmptyObject(this.waypoints.horizontal),e=this.Adapter.isEmptyObject(this.waypoints.vertical);t&&e&&(this.adapter.off(".waypoints"),delete o[this.key])},e.prototype.createThrottledResizeHandler=function(){function t(){e.handleResize(),e.didResize=!1}var e=this;this.adapter.on("resize.waypoints",function(){e.didResize||(e.didResize=!0,n.requestAnimationFrame(t))})},e.prototype.createThrottledScrollHandler=function(){function t(){e.handleScroll(),e.didScroll=!1}var e=this;this.adapter.on("scroll.waypoints",function(){(!e.didScroll||n.isTouch)&&(e.didScroll=!0,n.requestAnimationFrame(t))})},e.prototype.handleResize=function(){n.Context.refreshAll()},e.prototype.handleScroll=function(){var t={},e={horizontal:{newScroll:this.adapter.scrollLeft(),oldScroll:this.oldScroll.x,forward:"right",backward:"left"},vertical:{newScroll:this.adapter.scrollTop(),oldScroll:this.oldScroll.y,forward:"down",backward:"up"}};for(var i in e){var o=e[i],n=o.newScroll>o.oldScroll,r=n?o.forward:o.backward;for(var s in this.waypoints[i]){var a=this.waypoints[i][s],l=o.oldScroll=a.triggerPoint,p=l&&h,u=!l&&!h;(p||u)&&(a.queueTrigger(r),t[a.group.id]=a.group)}}for(var c in t)t[c].flushTriggers();this.oldScroll={x:e.horizontal.newScroll,y:e.vertical.newScroll}},e.prototype.innerHeight=function(){return this.element==this.element.window?n.viewportHeight():this.adapter.innerHeight()},e.prototype.remove=function(t){delete this.waypoints[t.axis][t.key],this.checkEmpty()},e.prototype.innerWidth=function(){return this.element==this.element.window?n.viewportWidth():this.adapter.innerWidth()},e.prototype.destroy=function(){var t=[];for(var e in this.waypoints)for(var i in this.waypoints[e])t.push(this.waypoints[e][i]);for(var o=0,n=t.length;n>o;o++)t[o].destroy()},e.prototype.refresh=function(){var t,e=this.element==this.element.window,i=e?void 0:this.adapter.offset(),o={};this.handleScroll(),t={horizontal:{contextOffset:e?0:i.left,contextScroll:e?0:this.oldScroll.x,contextDimension:this.innerWidth(),oldScroll:this.oldScroll.x,forward:"right",backward:"left",offsetProp:"left"},vertical:{contextOffset:e?0:i.top,contextScroll:e?0:this.oldScroll.y,contextDimension:this.innerHeight(),oldScroll:this.oldScroll.y,forward:"down",backward:"up",offsetProp:"top"}};for(var r in t){var s=t[r];for(var a in this.waypoints[r]){var l,h,p,u,c,d=this.waypoints[r][a],f=d.options.offset,w=d.triggerPoint,y=0,g=null==w;d.element!==d.element.window&&(y=d.adapter.offset()[s.offsetProp]),"function"==typeof f?f=f.apply(d):"string"==typeof f&&(f=parseFloat(f),d.options.offset.indexOf("%")>-1&&(f=Math.ceil(s.contextDimension*f/100))),l=s.contextScroll-s.contextOffset,d.triggerPoint=y+l-f,h=w=s.oldScroll,u=h&&p,c=!h&&!p,!g&&u?(d.queueTrigger(s.backward),o[d.group.id]=d.group):!g&&c?(d.queueTrigger(s.forward),o[d.group.id]=d.group):g&&s.oldScroll>=d.triggerPoint&&(d.queueTrigger(s.forward),o[d.group.id]=d.group)}}return n.requestAnimationFrame(function(){for(var t in o)o[t].flushTriggers()}),this},e.findOrCreateByElement=function(t){return e.findByElement(t)||new e(t)},e.refreshAll=function(){for(var t in o)o[t].refresh()},e.findByElement=function(t){return o[t.waypointContextKey]},window.onload=function(){r&&r(),e.refreshAll()},n.requestAnimationFrame=function(e){var i=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||t;i.call(window,e)},n.Context=e}(),function(){"use strict";function t(t,e){return t.triggerPoint-e.triggerPoint}function e(t,e){return e.triggerPoint-t.triggerPoint}function i(t){this.name=t.name,this.axis=t.axis,this.id=this.name+"-"+this.axis,this.waypoints=[],this.clearTriggerQueues(),o[this.axis][this.name]=this}var o={vertical:{},horizontal:{}},n=window.Waypoint;i.prototype.add=function(t){this.waypoints.push(t)},i.prototype.clearTriggerQueues=function(){this.triggerQueues={up:[],down:[],left:[],right:[]}},i.prototype.flushTriggers=function(){for(var i in this.triggerQueues){var o=this.triggerQueues[i],n="up"===i||"left"===i;o.sort(n?e:t);for(var r=0,s=o.length;s>r;r+=1){var a=o[r];(a.options.continuous||r===o.length-1)&&a.trigger([i])}}this.clearTriggerQueues()},i.prototype.next=function(e){this.waypoints.sort(t);var i=n.Adapter.inArray(e,this.waypoints),o=i===this.waypoints.length-1;return o?null:this.waypoints[i+1]},i.prototype.previous=function(e){this.waypoints.sort(t);var i=n.Adapter.inArray(e,this.waypoints);return i?this.waypoints[i-1]:null},i.prototype.queueTrigger=function(t,e){this.triggerQueues[e].push(t)},i.prototype.remove=function(t){var e=n.Adapter.inArray(t,this.waypoints);e>-1&&this.waypoints.splice(e,1)},i.prototype.first=function(){return this.waypoints[0]},i.prototype.last=function(){return this.waypoints[this.waypoints.length-1]},i.findOrCreate=function(t){return o[t.axis][t.name]||new i(t)},n.Group=i}(),function(){"use strict";function t(t){this.$element=e(t)}var e=window.jQuery,i=window.Waypoint;e.each(["innerHeight","innerWidth","off","offset","on","outerHeight","outerWidth","scrollLeft","scrollTop"],function(e,i){t.prototype[i]=function(){var t=Array.prototype.slice.call(arguments);return this.$element[i].apply(this.$element,t)}}),e.each(["extend","inArray","isEmptyObject"],function(i,o){t[o]=e[o]}),i.adapters.push({name:"jquery",Adapter:t}),i.Adapter=t}(),function(){"use strict";function t(t){return function(){var i=[],o=arguments[0];return t.isFunction(arguments[0])&&(o=t.extend({},arguments[1]),o.handler=arguments[0]),this.each(function(){var n=t.extend({},o,{element:this});"string"==typeof n.context&&(n.context=t(this).closest(n.context)[0]),i.push(new e(n))}),i}}var e=window.Waypoint;window.jQuery&&(window.jQuery.fn.waypoint=t(window.jQuery)),window.Zepto&&(window.Zepto.fn.waypoint=t(window.Zepto))}();; /*! * enquire.js v2.1.2 - Awesome Media Queries in JavaScript * Copyright (c) 2014 Nick Williams - http://wicky.nillia.ms/enquire.js * License: MIT (http://www.opensource.org/licenses/mit-license.php) */ !function(a,b,c){var d=window.matchMedia;"undefined"!=typeof module&&module.exports?module.exports=c(d):"function"==typeof define&&define.amd?define(function(){return b[a]=c(d)}):b[a]=c(d)}("enquire",this,function(a){"use strict";function b(a,b){var c,d=0,e=a.length;for(d;e>d&&(c=b(a[d],d),c!==!1);d++);}function c(a){return"[object Array]"===Object.prototype.toString.apply(a)}function d(a){return"function"==typeof a}function e(a){this.options=a,!a.deferSetup&&this.setup()}function f(b,c){this.query=b,this.isUnconditional=c,this.handlers=[],this.mql=a(b);var d=this;this.listener=function(a){d.mql=a,d.assess()},this.mql.addListener(this.listener)}function g(){if(!a)throw new Error("matchMedia not present, legacy browsers require a polyfill");this.queries={},this.browserIsIncapable=!a("only all").matches}return e.prototype={setup:function(){this.options.setup&&this.options.setup(),this.initialised=!0},on:function(){!this.initialised&&this.setup(),this.options.match&&this.options.match()},off:function(){this.options.unmatch&&this.options.unmatch()},destroy:function(){this.options.destroy?this.options.destroy():this.off()},equals:function(a){return this.options===a||this.options.match===a}},f.prototype={addHandler:function(a){var b=new e(a);this.handlers.push(b),this.matches()&&b.on()},removeHandler:function(a){var c=this.handlers;b(c,function(b,d){return b.equals(a)?(b.destroy(),!c.splice(d,1)):void 0})},matches:function(){return this.mql.matches||this.isUnconditional},clear:function(){b(this.handlers,function(a){a.destroy()}),this.mql.removeListener(this.listener),this.handlers.length=0},assess:function(){var a=this.matches()?"on":"off";b(this.handlers,function(b){b[a]()})}},g.prototype={register:function(a,e,g){var h=this.queries,i=g&&this.browserIsIncapable;return h[a]||(h[a]=new f(a,i)),d(e)&&(e={match:e}),c(e)||(e=[e]),b(e,function(b){d(b)&&(b={match:b}),h[a].addHandler(b)}),this},unregister:function(a,b){var c=this.queries[a];return c&&(b?c.removeHandler(b):(c.clear(),delete this.queries[a])),this}},new g});; /* global window */ /* global document */ /* global jQuery */ /* global g1 */ /* global bimber_front_config */ /* global SuperGif */ /* global Waypoint */ /* global enquire */ /* global mashsb */ /* global auto_load_next_post_params */ /* global FB */ /* global mejs */ /* global ga */ /* global embedly */ /* global console */ /************* * * Init env * *************/ (function($) { 'use strict'; var config = bimber_front_config; // namespace var g1 = { 'config': config }; g1.getWindowWidth = function () { if (typeof window.innerWidth !== 'undefined') { return window.innerWidth; } return $(window).width(); }; g1.isDesktopDevice = function () { return g1.getWindowWidth() > g1.getDesktopBreakpoint(); }; g1.getDesktopBreakpoint = function () { var desktopBreakPoint = $('#g1-breakpoint-desktop').css('min-width'); if ( ! desktopBreakPoint ) { return 9999; } desktopBreakPoint = parseInt( desktopBreakPoint, 10 ); // not set explicitly via css if (desktopBreakPoint === 0) { return 9999; } return desktopBreakPoint; }; g1.isTouchDevice = function () { return ('ontouchstart' in window) || navigator.msMaxTouchPoints; }; g1.isStickySupported = function () { var prefixes = ['', '-webkit-', '-moz-', '-ms-']; var block = document.createElement('div'); var supported = false; var i; // Test for native support. for (i = prefixes.length - 1; i >= 0; i--) { try { block.style.position = prefixes[i] + 'sticky'; } catch(e) {} if (block.style.position !== '') { supported = true; } } return supported; }; g1.isRTL = function () { return $('body').is('.rtl'); }; g1.log = function(data) { if ((g1.config.debug_mode || window.bimberDebugMode) && typeof console !== 'undefined') { if ($.isArray(data)) { for (var i in data) { console.log(data[i]); } } else { console.log(data); } } }; g1.createCookie = function (name,value,time) { var expires; if (time) { var date = new Date(); var ms = time; if (typeof time === 'object') { ms = time.value; switch (time.type) { case 'days': ms = ms * 24 * 60 * 60 * 1000; break; } } date.setTime(date.getTime() + ms); expires = '; expires=' + date.toGMTString(); } else { expires = ''; } document.cookie = name + '=' + value + expires + '; path=/'; }; g1.readCookie = function (name) { var nameEQ = name + '='; var ca = document.cookie.split(';'); for(var i = 0; i < ca.length; i += 1) { var c = ca[i]; while (c.charAt(0) === ' ') { c = c.substring(1,c.length); } if (c.indexOf(nameEQ) === 0) { return c.substring(nameEQ.length,c.length); } } return null; }; g1.removeCookie = function (name) { g1.createCookie(name, '', -1); }; // expose to the world window.g1 = g1; })(jQuery); /************* * * UI Helpers * ************/ (function ($) { 'use strict'; g1.uiHelpers = function () { if (g1.isTouchDevice()) { $('body').removeClass( 'g1-hoverable' ); } // ----------------- // Mailchimp widget. // ----------------- var mc4wpClasses = [ 'g1-box', 'g1-box-tpl-frame', 'g1-newsletter' ]; var mc4wpBackgroundClasses = [ 'g1-box-background' ]; if ('original-2018' === g1.config.stack || 'food' === g1.config.stack ) { mc4wpBackgroundClasses.push('g1-current-background'); } if ( 'miami' === g1.config.stack || 'music' === g1.config.stack ) { mc4wpClasses.push('g1-dark'); } $('.widget_mc4wp_form_widget'). addClass(mc4wpClasses.join(' ')). wrapInner('
'). prepend('
'). append('
'); // ----------- // bbPress. // ----------- var bbPressBackgroundClasses = [ 'g1-box-background' ]; if ('original-2018' === g1.config.stack || 'food' === g1.config.stack ) { bbPressBackgroundClasses.push('g1-current-background'); } $('.bbp_widget_login'). addClass('g1-box g1-box-tpl-frame'). wrapInner('
'). append('
'); // ---------- // Search UI. // ---------- $('.g1-drop-the-search').on('click', '.g1-drop-toggle', function (e) { e.preventDefault(); $('.g1-drop-the-search input.search-field').focus(); }); $('.search-submit').on('click', function(e){ var $form = $(this).closest('form'); var $input = $('input.search-field', $form); if ( ! $input.val()){ e.preventDefault(); } }); $('#buddypress .load-more').click(function() { var i = 0; var intervalID = setInterval( function() { $('body').trigger( 'g1PageHeightChanged' ); i++; if (i === 5){ window.clearInterval(intervalID); } },1000); }); }; })(jQuery); /**************** * * Facebook SDK * ****************/ (function ($) { 'use strict'; g1.resetFacebookSDK = function () { $('script#facebook-jssdk').remove(); $('#fb-root').remove(); if (window.FB) { delete window.FB; } }; $('body').on( 'g1BeforeNewContentReady', function ( e, $newContent ) { if ($newContent.find('.fb-video').length > 0) { g1.resetFacebookSDK(); } } ); })(jQuery); /**************** * * Instagram SDK * ****************/ (function ($) { 'use strict'; $('body').on( 'g1NewContentLoaded', function ( e, $newContent ) { if ($newContent.find('.instagram-media').length > 0) { if (typeof instgrm !== 'undefined' && typeof instgrm.Embeds !== 'undefined') { instgrm.Embeds.process(); } } } ); })(jQuery); /******************** * * Load More Button * ********************/ (function ($) { 'use strict'; // prevent triggering the action more than once at the time var loading = false; var startingUrl = window.location.href; var setTargetBlank = g1.config.setTargetBlank; var useWaypoints = g1.config.useWaypoints; g1.loadMoreButton = function () { $('.g1-load-more').on('click', function (e) { if (loading) { return; } loading = true; e.preventDefault(); var $button = $(this); var $collectionMore = $button.parents('.g1-collection-more'); var url = $button.attr('data-g1-next-page-url'); var $endMessage = $('.g1-pagination-end'); $collectionMore.addClass('g1-collection-more-loading'); // load page var xhr = $.get(url); // on success xhr.done(function (data) { var collectionSelector = '#primary > .g1-collection .g1-collection-items'; // find elements in response var $resCollectionItems = $(data).find(collectionSelector).find('.g1-collection-item'); var $resButton = $(data).find('.g1-load-more'); // find collection on page var $collection = $(collectionSelector); // add extra classes to new loaded items $resCollectionItems.addClass('g1-collection-item-added'); // If there are insta embeds BEFORE the load, we will force to refresh them AFTER the load var $insta = $('script[src="//platform.instagram.com/en_US/embeds.js"]'); // make sure that mejs is loaded if (window.wp && typeof window.wp.mediaelement === 'undefined') { var matches = data.match(//g); var mejsCode = ''; matches.forEach(function( match ) { if ( match.indexOf('mejs') > 0 || match.indexOf('mediaelement') > 0 ){ match = match.replace('/g); matches.forEach(function( match ) { if ( match.indexOf('mejs') > 0 || match.indexOf('mediaelement') > 0 ){ mejsCode+=match; } }); $collection.after(mejsCode); } if (setTargetBlank) { $('a',$resCollectionItems).attr('target','_blank'); } var $collection_waypoint = ''; $collection.append($collection_waypoint); // add new elements to collection $collection.append($resCollectionItems); // Google Analytics. if ( typeof ga !== 'undefined' && typeof ga.getAll !== 'undefined') { ga('create', ga.getAll()[0].get('trackingId'), 'auto'); ga('set', { location: url }); ga('send', 'pageview'); } if ( $insta.length > 0) { window.instgrm.Embeds.process(); } if (window.wp && typeof window.wp.mediaelement !== 'undefined') { window.wp.mediaelement.initialize(); } // load all dependent functions $('body').trigger( 'g1PageHeightChanged' ); $('body').trigger( 'g1NewContentLoaded', [ $resCollectionItems ] ); // update more button if ($resButton.length > 0) { $button.attr('data-g1-next-page-url', $resButton.attr('data-g1-next-page-url')); } else { $collectionMore.remove(); } //bind auto play video events if (typeof g1.autoPlayVideo === 'function') { g1.autoPlayVideo(); } if ( useWaypoints ){ $('.bimber-collection-waypoint').waypoint(function(direction) { var $waypoint = $(this.element); if('up' === direction) { var $waypointUp = $waypoint.prevAll('.bimber-collection-waypoint'); if ($waypointUp.length > 0){ $waypoint = $($waypointUp[0]); } else { window.history.replaceState( {} , '', startingUrl ); return; } } var waypointUrl = $waypoint.attr('data-bimber-archive-url'); var currentUrl = window.location.href; if ( waypointUrl !== currentUrl ){ window.history.replaceState( {} , '', waypointUrl ); } }, { offset: '-5%' }); } }); xhr.fail(function () { $button.addClass('g1-info-error'); $button.remove(); $endMessage.show(); }); xhr.always(function () { $collectionMore.removeClass('g1-collection-more-loading'); loading = false; }); }); }; })(jQuery); /******************* * * Infinite scroll * ******************/ (function ($) { 'use strict'; g1.infiniteScrollConfig = { 'offset': '150%' }; var triggeredByClick = false; g1.infiniteScroll = function () { $('.g1-collection-more.infinite-scroll').each(function () { var $this = $(this); if ($this.is('.on-demand') && !triggeredByClick) { return false; } $this.waypoint(function(direction) { if('down' === direction) { $this.find('.g1-load-more').trigger('click'); } }, { // trigger when the "Load More" container is 10% under the browser window offset: g1.infiniteScrollConfig.offset }); }); }; // wait for new content and apply infinite scroll events to it $('body').on( 'g1NewContentLoaded', function () { triggeredByClick = true; g1.infiniteScroll(); } ); })(jQuery); /******************* * * Date > Time ago * ******************/ (function ($) { 'use strict'; g1.dateToTimeago = function () { if (!$.fn.timeago) { return; } var $body = $('body'); $('time.entry-date, span.entry-date > time, .comment-metadata time, time.snax-item-date').timeago(); $body.on( 'g1NewContentLoaded', function (e, $newContent) { if ($newContent) { $newContent.find('time.entry-date, .comment-metadata time, time.snax-item-date').timeago(); } } ); // CommentAce integration. $body.on( 'caceWpCommentInitialized', function (e) { $(e.detail).find('time.entry-date, .comment-metadata time, time.snax-item-date').timeago(); } ); }; })(jQuery); /********** * * Canvas * *********/ (function($) { 'use strict'; var selectors = { 'toggle': '.g1-hamburger' }; g1.globalCanvasSelectors = selectors; var canvas; g1.canvas = function() { canvas = Canvas(); // Allow global access. g1.canvasInstance = canvas; $(selectors.toggle).on('click', function (e) { e.preventDefault(); //$('html, body').animate({ // @maybe // scrollTop: 0 // @maybe //}, 10); // @maybe canvas.toggle(); }); }; function Canvas () { var that = {}; var listeners = { 'open': [], 'close': [] }; var currentContent = ''; var currentScroll = 0; // @maybe var _clientY; var init = function () { var $overlay = $( '.g1-canvas-overlay'); // toogle canvas events $overlay.on('click', that.toggle); $('.g1-canvas').on('toggle-canvas', function () { that.toggle(); }); $('.g1-canvas .g1-canvas-toggle').on('click', that.toggle); if ( $('html.g1-off-outside').length ) { enquire.register('screen and ( min-width: 700px )', { match : function() { that.close(); } }); } if ( $('html.g1-off-inside').length ) { enquire.register('screen and ( max-width: 1024px )', { match : function() { that.close(); } }); enquire.register('screen and ( min-width: 1025px )', { match : function() { that.lazyload(); } }); } return that; }; that.getContent = function() { return $('.g1-canvas-global .g1-canvas-content'); }; that.captureClientY = function (event) { // only respond to a single touch //if (event.targetTouches.length === 1) { _clientY = event.targetTouches[0].clientY; //} }; that.disableCanvasScroll = function( e ) { // only respond to a single touch //if (e.targetTouches.length !== 1) { // return; //} var _element = $('.g1-canvas'); var clientY = e.targetTouches[0].clientY - _clientY; // The element at the top of its scroll, // and the user scrolls down if (_element.scrollTop === 0 && clientY > 0) { alert('top scroll'); e.preventDefault(); e.stopPropagation(); return false; } // The element at the bottom of its scroll, // and the user scrolls up // https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight#Problems_and_solutions if ((_element.scrollHeight - _element.scrollTop <= _element.clientHeight) && clientY < 0) { alert('bottom scroll'); e.preventDefault(); e.stopPropagation(); return false; } }; that.disableBodyScroll = function( e ) { //e.preventDefault(); //e.stopPropagation(); //return false; }; that.lazyload = function() { $('.g1-canvas-background[data-bg]:not(.lazyloaded)').addClass('lazyload'); }; that.open = function (content) { //$('.g1-canvas').on('touchstart', that.captureClientY); //$('.g1-canvas').on('touchmove', that.disableCanvasScroll); that.lazyload(); window.requestAnimationFrame(function () { var breakpoint = $(document).width(); var cssClass = breakpoint >= 1025 ? 'g1-off-global-desktop' : 'g1-off-global'; $('html').addClass(cssClass); currentContent = content; var $canvas = $('.g1-canvas-global'); if (content) { if (typeof content === 'string') { $canvas.find('.g1-canvas-content').html(content); } else { $canvas.find('.g1-canvas-content').empty().append(content); } // notify about adding new content to DOM so other elements can be reloaded $canvas.find('.g1-canvas-content').trigger('g1-new-content'); } that.notify('open'); }); }; that.close = function () { //$('.g1-canvas').off('touchmove', that.disableCanvasScroll); //$('.g1-canvas').off('touchstart', that.captureClientY); window.requestAnimationFrame(function () { $('html').removeClass('g1-off-global g1-off-global-desktop'); that.notify('close'); }); }; that.toggle = function (e) { if (e) { e.preventDefault(); } // is opened? if ( $('html').is('.g1-off-global, .g1-off-global-desktop') ) { that.close(); } else { that.open(null); } }; that.notify = function (eventType) { var callbacks = listeners[eventType]; for (var i = 0; i < callbacks.length; i++) { callbacks[i](that.getContent()); } }; that.on = function (eventType, listener, priority) { listeners[eventType][priority] = listener; }; return init(); } })(jQuery); /******************** * * Sticky sidebar * ********************/ (function($) { 'use strict'; var $waypointElem = false; var selectors = { 'stickyWidgetWrapper': '.g1-sticky-widget-wrapper', 'stickyWidget': '.g1-sticky-widget', 'widget': '.widget', 'content': '#primary .entry-content' }; var sidebarSelectors = [ '#secondary', '#tertiary' ]; g1.stickyTopOffsetSelectors = [ '#wpadminbar', '.g1-iframe-bar', '.g1-sharebar-loaded', '.g1-sticky-top-wrapper' ]; g1.resetStickyElements = function() { $(selectors.stickyWidgetWrapper).css('height', ''); $(selectors.stickyWidget).css('position', 'block'); }; g1.stickySidebar = function() { if (!g1.isDesktopDevice()) { g1.resetStickyElements(); return; } var $widgets = $(selectors.stickyWidget); if ($widgets.length === 0) { return; } // Calc top offset for sticky elements. var topOffset = 0; $(g1.stickyTopOffsetSelectors).each(function() { var $element = $(this); if ($element.length > 0 && $element.is(':visible')) { topOffset += parseInt($element.outerHeight(), 10); } }); // Adjust widgets top offset to keep them always fully visible. $widgets.each(function() { var $widget = $(this); var top = parseInt($widget.css('top'), 10); if (topOffset > 0) { top += topOffset; $widget.css('top', top + 'px'); } }); // Apply "position: sticky" pollyfill (IE9+). if (typeof Stickyfill !== 'undefined') { Stickyfill.add($widgets); } /** * Increase the last widget height to cover entire sidebar. * * @param {Boolean} isVariableContent - Determines which element is used for widget height calculation. */ var adjustLastWidgetHeight = function(isVariableContent) { $(sidebarSelectors).each(function() { var $sidebar = $(this); var $widgets = $sidebar.children(selectors.widget + ',' + selectors.stickyWidgetWrapper); var $lastWidget = $widgets.last(); if ($lastWidget.is(selectors.stickyWidgetWrapper)) { // Reset height (if previously set) to calculate it from scratch. $lastWidget.css('height', ''); var sidebarHeight; // Lazy loaded dynamic content elements (like embeds) affects its height. // At this point, we don't know what will be the final height. // So when we calculate the first time the last widget height, we do this based on current content height, // and then when we reach the end of the content, we recalculate (assuming that all elements // have already thier final size) the widget height based on current sidebar height (flexbox gives us a certainty // that both #primary and #secondary/#tetriary elements have the same height). if (isVariableContent) { sidebarHeight = parseInt($(selectors.content).outerHeight(), 10); } else { sidebarHeight = parseInt($sidebar.outerHeight(), 10); } var widgetsHeight = 0; $widgets.each(function() { widgetsHeight += parseInt($(this).outerHeight(true), 10); }); // Increase last widget height if exists a space to cover. if (widgetsHeight < sidebarHeight) { var diffHeight = sidebarHeight - widgetsHeight; var lastWidgetHeight = parseInt($lastWidget.css('height'), 10); lastWidgetHeight += diffHeight; $lastWidget.css('height', lastWidgetHeight + 'px'); } $waypointElem = $lastWidget; } }); }; var $body = $('body'); // For a single post, use entry content height to calculate the last widget height at first. var isVariableContent = $body.is('.single'); adjustLastWidgetHeight(isVariableContent); // Listen to page height changes. // ------------------------------ // New content is added (e.g. via auto-load next post) or dynamic element is fully loaded (e.g. Facebook widget). $body.on( 'g1NewContentLoaded g1PageHeightChanged', function(e) { adjustLastWidgetHeight(); } ); // Entry content is entirely in the viewport (all inside elements should have final size), adjust widget height. if (false !== $waypointElem) { $waypointElem.waypoint(function(direction) { if ('down' === direction) { adjustLastWidgetHeight(); } }, { // When the bottom of the element hits the bottom of the viewport. offset: 'bottom-in-view' }); } }; })(jQuery); /***************** * * Sticky Elements * ****************/ (function ($) { 'use strict'; var selectors = [ '#wpadminbar', '.g1-iframe-bar', '.g1-sharebar-loaded', '.g1-sticky-top-wrapper' ]; // Accessible globally. g1.stickyElementsTopOffsetSelectors = selectors; g1.stickyPosition = function ($context) { $context = $context || $('body'); // Sticky top. var $stickyTop = $('.g1-sticky-top-wrapper'); // If exists and not loaded already. if ($stickyTop.length > 0 && !$stickyTop.is('.g1-loaded')) { var disableStickyHeader = false; var isDesktop = g1.getWindowWidth() > 800; // Disable if sharebar enabled. var sharebarLoaded = $('.g1-sharebar-loaded').length > 0 || $('.essb_topbar').length > 0; if (sharebarLoaded && isDesktop) { disableStickyHeader = true; } if (disableStickyHeader) { // Prevent native sticky support, like on FF. $stickyTop.removeClass('g1-sticky-top-wrapper'); } else { // Apply pollyfill only if not supported. if (!g1.isStickySupported()) { Stickyfill.add($stickyTop); } $stickyTop.addClass('g1-loaded'); } } // Calculate topOffset after disabling the sticky header! var topOffset = 0; for (var i = 0; i < selectors.length; i++) { var $elem = $(selectors[i]); if ($elem.length > 0 && $elem.is(':visible')) { topOffset += $elem.outerHeight(); } } // Sticky Item Actions (shares, votes etc). $context.find('.g1-wrapper-with-stickies > .entry-actions').each(function() { var $this = $(this); $this.css('top', topOffset); Stickyfill.add($this); }); // Sticky snax form sidebar. Stickyfill.add($('.snax-form-frontend .snax-form-side')); // Sticky Item Actions (shares, votes etc). $context.find('.entry-tpl-index-stickies > .entry-actions, .entry-tpl-feat-stickies .entry-actions').each(function() { var $this = $(this); $this.css('top', topOffset + 10); Stickyfill.add($this); }); }; $('body').on( 'g1NewContentLoaded', function ( e, $newContent ) { if ($newContent) { g1.stickyPosition($newContent); } } ); })(jQuery); /********************** * * Droppable Elements * **********************/ (function ($) { 'use strict'; var selectors = { 'drop' : '.g1-drop', 'dropExpanded': '.g1-drop-expanded', 'dropToggle': '.g1-drop-toggle' }; var classes = { 'dropExpanded': 'g1-drop-expanded' }; g1.droppableElements = function () { // Hide drop on focus out. $('body').on('click touchstart', function (e) { var $activeDrop = $(e.target).parents('.g1-drop-expanded'); // Collapse all except active. $(selectors.dropExpanded).not($activeDrop).removeClass(classes.dropExpanded); }); // Handle drop state (expanded | collapsed). // For touch devices we need to toggle CSS class to trigger state change. if ( g1.isTouchDevice() ) { $('body').on( 'click', selectors.drop, function(e) { var $drop = $(this); // If there is no drop-content inside, skip. if ($drop.find('.g1-drop-content').length === 0) { return; } // Drop is expanded, collapse it on toggle click. if ($drop.is(selectors.dropExpanded)) { var $clickedElement = $(e.target); var toggleClicked = $clickedElement.parents(selectors.dropToggle).length > 0; if (toggleClicked) { $drop.removeClass(classes.dropExpanded); e.preventDefault(); } // Drop is collapsed, expand it. } else { $drop.addClass(classes.dropExpanded); e.preventDefault(); } } ); // Devices without touch events, state is handled via CSS :hover } else { // Prevent click on toggle. $(selectors.dropToggle).on( 'click', function() {}); } }; })(jQuery); /******************************** * * Mailchimp for WP Integration * *******************************/ (function ($) { 'use strict'; $('body').on('submit', '.mc4wp-form', function (e) { e.preventDefault(); var $form = $(this); $.ajax({ 'type': 'POST', 'url': window.location.href, 'data': $form.serialize() }).done(function (res) { var $response = $(res).find('#' + $form.attr('id') + ' .mc4wp-response'); $response.prependTo($form); }); }); })(jQuery); /******************* * * Snax Integration * ******************/ (function ($) { 'use strict'; g1.snax = function () { var $body = $('body'); $body.on('snaxFullFormLoaded', function(e, $post) { $post.find('.g1-button-m.g1-button-solid').removeClass('g1-button-m g1-button-solid').addClass('g1-button-s g1-button-simple'); $post.find('.g1-beta.g1-beta-1st').removeClass('g1-beta g1-beta-1st').addClass('g1-gamma g1-gamma-1st'); }); }; // Integration between Snax and CommentAce. window.caceWpCommentListPropsFilter = function (props, comments) { if ($(comments).parents('.snax-item').length > 0) { props.loadMoreType = 'load_more'; } return props; } })(jQuery); /******************* * * Media Ace Integration * ******************/ (function ($) { 'use strict'; g1.mediaAce = function () { $('body').on('g1NewContentLoaded', function() { $('body').trigger('maceLoadYoutube'); }); $(document).on('lazybeforeunveil', function(e) { var $target = $(e.target); var targetSrc = $target.attr('data-src'); if (targetSrc && targetSrc.endsWith('.gif')) { // Wait till image fully loaded. $target.on('load', function() { $target.addClass('g1-enable-gif-player'); // Wait a while before applying player. setTimeout(function() { if (typeof g1.gifPlayer === 'function') { g1.gifPlayer($target.parent()); } }, 100); }); } }); $(document).on('bimberGifPlayerLoaded', function(e, $canvasWrapper) { if ($canvasWrapper.hasClass('lazyloading')) { $canvasWrapper.removeClass('lazyloading'); $canvasWrapper.addClass('lazyloaded'); } }); }; })(jQuery); /******* * * Menu * *******/ (function (context, $, i18n) { 'use strict'; $(document).ready(function () { PrimaryMenu(); }); function PrimaryMenu () { var that = {}; that.init = function () { that.registerEventsHandlers(); // add toggle to menu $('.menu-item-has-children > a, .menu-item-g1-mega > a').append( '' ); return that; }; that.registerEventsHandlers = function () { that.handleMenuItemClick(); that.handleMenuItemFocusOut(); }; that.handleMenuItemFocusOut = function () { $('body').on('click', function (e) { if ($(e.target).parents('.mtm-drop-expanded').length === 0 ) { // Only horizontal menus. if ($(e.target).parents('.g1-menu-h').length ) { that.collapseAllOpenedSubmenus(); } } }); }; that.handleMenuItemClick = function () { $('.g1-primary-nav, .g1-secondary-nav').on('click', '.menu-item > a', function (e) { var $menu = $(this).parents('.g1-primary-nav'); if ($menu.length === 0) { $menu = $(this).parents('.g1-secondary-nav'); } var isSimpleList = $menu.is('#g1-canvas-primary-nav') || $menu.is('#g1-canvas-secondary-nav'); if (g1.isTouchDevice() || isSimpleList) { that.handleMenuTouchEvent($(this), e); } }); }; that.handleMenuTouchEvent = function ($link, event) { var $li = $link.parent('li'); that.collapseAllOpenedSubmenus($li); if ($li.hasClass('menu-item-has-children')) { event.preventDefault(); var $helper = $li.find('ul.sub-menu:first > li.g1-menu-item-helper'); if ($helper.length === 0) { var href = $link.attr('href'); if ( href && href.length ) { var anchor = i18n.go_to + ' '+ $link.html() +''; $helper = $(''); $li.find('ul.sub-menu:first').prepend($helper); } } if (!$li.is('.mtm-drop-expanded')) { $li.find('.mtm-drop-expanded .g1-menu-item-helper').remove(); $li.addClass('mtm-drop-expanded'); } else { $li.find('.mtm-drop-expanded').removeClass('mtm-drop-expanded'); $li.removeClass('mtm-drop-expanded'); } } }; that.collapseAllOpenedSubmenus = function ($currentItem) { if ($currentItem) { var $currentMenu = $currentItem.parents('nav'); var $topLevelLi = $currentItem.parents('li.menu-item'); // We are at top level of menu if($topLevelLi.length === 0) { // Collapse all, except current. // This will collapse current item subtree items but not item itself. Item will be collapse by the "handleMenuTouchEvent" handler. $currentMenu.find('.mtm-drop-expanded').not($currentItem).removeClass('mtm-drop-expanded'); } else { // Collapse all opened submenus in current menu, except current subtree. $topLevelLi.siblings('li').find('.mtm-drop-expanded').removeClass('mtm-drop-expanded'); } // Collapse all opened submenus in all other menus. $('nav').not($currentMenu).find('.mtm-drop-expanded').removeClass('mtm-drop-expanded'); } else { // collapse all opened, site wide, submenus $('.mtm-drop-expanded').removeClass('mtm-drop-expanded'); } }; return that.init(); } })(window, jQuery, g1.config.i18n.menu); // http://paulirish.com/2011/requestanimationframe-for-smart-animating/ // http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating // requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel // MIT license (function() { var lastTime = 0; var vendors = ['ms', 'moz', 'webkit', 'o']; for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame']; window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame'] || window[vendors[x]+'CancelRequestAnimationFrame']; } if (!window.requestAnimationFrame) { window.requestAnimationFrame = function(callback) { var currTime = new Date().getTime(); var timeToCall = Math.max(0, 16 - (currTime - lastTime)); var id = window.setTimeout(function() { callback(currTime + timeToCall); }, timeToCall); lastTime = currTime + timeToCall; return id; }; } if (!window.cancelAnimationFrame) { window.cancelAnimationFrame = function(id) { clearTimeout(id); }; } }()); /**************** * * Popup/Slideup * ****************/ (function ($) { 'use strict'; g1.popup = function () { var HTMLBase = $('html'), Popup = $('.g1-popup-newsletter'), PopupCookie = g1.readCookie('g1_popup_disabled'), PopupCloser = $('.g1-popup-base, .g1-popup-closer'); // If we dont have popup exit. if( PopupCookie ){ HTMLBase.addClass('exit-intent-disabled'); } if( Popup.length <= 0 ){ return; } $(document).on('mouseleave', function(e){ if( e.clientY < 10 && ! HTMLBase.hasClass('exit-intent-disabled') && ! HTMLBase.hasClass('g1-slideup-visible') ){ HTMLBase.addClass('g1-popup-ready'); setTimeout(function(){ HTMLBase.addClass('g1-popup-visible').addClass('exit-intent-disabled'); }, 50); } }); PopupCloser.on('click', function(e){ e.preventDefault(); HTMLBase.removeClass('g1-popup-visible'); g1.createCookie('g1_popup_disabled', 1, 24 * 60 * 60 * 1000); }); } g1.slideup = function () { var HTMLBase = $('html'), Slideup = $('.g1-slideup-newsletter'), SlideupCloser = $('.g1-slideup-newsletter-closer'), SlideupCookie = g1.readCookie('g1_slideup_disabled'), ScrollPositon = $(document).scrollTop(), ScrollTarget = $('.single-post article .entry-content'), ScrollTargetOffset = ScrollTarget.offset(), ScrollTargetHeight = ScrollTarget.height(), ShowOn = 50; // If we dont have popup exit. SlideupCloser.on('click', function(e){ e.preventDefault(); HTMLBase.removeClass('g1-slideup-visible').addClass('slideup-intent-disabled'); g1.createCookie('g1_slideup_disabled', 1, 24 * 60 * 60 * 1000); }); if( SlideupCookie ){ HTMLBase.addClass('slideup-intent-disabled'); } if( Slideup.length <= 0 ){ return; } if( ScrollTarget.length <= 0 ){ return; } $(window).on('scroll', function(){ ScrollPositon = $(document).scrollTop(); ScrollTargetOffset = ScrollTarget.offset(); ScrollTargetHeight = ScrollTarget.height(); if( ( (ScrollPositon - ScrollTargetOffset.top) / (ScrollTargetHeight) ).toFixed(6) * 100 >= ShowOn && ! HTMLBase.hasClass('slideup-intent-disabled') && ! HTMLBase.hasClass('g1-popup-visible') ){ HTMLBase.addClass('g1-slideup-visible'); } }); } })(jQuery); /**************** * * GDPR * ****************/ (function ($) { 'use strict'; $(document).ready(function () { $('.wp-social-login-provider-list').on('click', function() { if ($(this).hasClass('wp-social-login-provider-list-active')){ return; } $('.snax-wpsl-gdpr-consent').addClass('snax-wpsl-gdpr-consent-blink'); setTimeout(function(){ $('.snax-wpsl-gdpr-consent').removeClass('snax-wpsl-gdpr-consent-blink'); }, 2000); }); $('.snax-wpsl-gdpr-consent input').on('click', function() { var enabled = $(this).is(':checked'); if (enabled) { $('.wp-social-login-provider-list').addClass('wp-social-login-provider-list-active'); } else { $('.wp-social-login-provider-list').removeClass('wp-social-login-provider-list-active'); } }); }); })(jQuery); /************************** * * WordPress Popular Posts * **************************/ (function ($) { 'use strict'; g1.updatePostViews = function(nonce,postId) { $.ajax({ 'type': 'POST', 'url': g1.config.ajax_url, 'data': { 'action': 'update_views_ajax', 'wpp_id': postId, 'token': nonce } }); }; // ------------ // Update views // ------------ $('.bimber-count-view').on('click', function() { var postId; var $body = $('body'); if ( $body.is('.single-format-link') ) { var res = $body.attr('class').match(/postid-(\d+)/); if (res) { postId = res[1]; } } else { var $article = $(this).parents('article.format-link'); if ( $article.length > 0 ) { postId = $article.attr('class').match(/post\-(\d+)/)[1]; } } if (postId) { $.ajax({ 'type': 'POST', 'url': g1.config.ajax_url, 'data': { //'action': 'bimber_update_post_views', //'post_id': postId 'action': 'update_views_ajax', 'wpp_id': postId, 'token': g1.config.wpp.token } }); } }); })(jQuery); /******************* * * Flickity * ******************/ (function ($) { 'use strict'; g1.flickity = function ($context) { $context = $context || $('body'); var FlickitySpots = $context.find('.adace-shop-the-post-wrap.carousel-wrap .woocommerce .products, .g1-products-widget-carousel .product_list_widget'); FlickitySpots.each(function () { if ($(this).hasClass('.flickity-enabled')) { return; } var ThisFlickityItems = $(this).children(), ThisFlickityItemsWidth = ThisFlickityItems.outerWidth() * ThisFlickityItems.length, ThisFlickityArgs = { cellAlign: 'left', wrapAround: true, prevNextButtons: true, pageDots: false, groupCells: true, rightToLeft: g1.isRTL(), imagesLoaded: true }; if (ThisFlickityItemsWidth <= $(this).outerWidth()) { ThisFlickityArgs.cellAlign = 'center'; ThisFlickityArgs.wrapAround = false; } else { var ThisRequiredNumber = Math.round($(this).outerWidth() / ThisFlickityItems.outerWidth()) * ThisFlickityItems.length; while (ThisFlickityItems.length < ThisRequiredNumber) { $(this).append(ThisFlickityItems.clone(true)); ThisFlickityItems = $(this).children(); } } $(this).flickity(ThisFlickityArgs); }); }; $('body').on('g1NewContentLoaded', function (e, $newContent) { g1.flickity($newContent); }); })(jQuery); // Sticky off-canvas top offset adjustments. (function ($) { 'use strict'; $(document).ready(function () { var selectors = [ '#wpadminbar', '.g1-iframe-bar', '.g1-sticky-top-wrapper' ]; var applyOffset = function() { // Calculate the total height of all sticky elements. var topOffset = 0; for (var i = 0; i < selectors.length; i++) { var $elem = $(selectors[i]); if ($elem.length > 0 && $elem.is(':visible')) { topOffset += $elem.outerHeight(); } } var cssRule = 'html.g1-off-inside.g1-off-global-desktop .g1-canvas {top:' + topOffset + 'px;' $('#g1-canvas-js-css').remove(); $('head').append( '' ); $('html.g1-off-inside .g1-canvas').removeClass('g1-canvas-no-js').addClass('g1-canvas-js'); }; $('body').on( 'g1PageHeightChanged', function(e) { applyOffset(); } ); $('html.g1-off-inside .g1-canvas.g1-canvas-no-js').each(function() { applyOffset(); }); } ); })(jQuery); /************************** * * document ready functions (keep this at the end for better compatibillity with optimizing plugins) * *************************/ (function ($) { 'use strict'; $(document).ready(function () { g1.uiHelpers(); if (g1.config.timeago === 'on') { g1.dateToTimeago(); } g1.loadMoreButton(); g1.infiniteScroll(); g1.stickyPosition(); g1.droppableElements(); g1.canvas(); g1.snax(); g1.mediaAce(); g1.flickity(); g1.popup(); g1.slideup(); g1.stickySidebar(); }); })(jQuery); ; /* SuperGif Example usage: Image tag attributes: rel:animated_src - If this url is specified, it's loaded into the player instead of src. This allows a preview frame to be shown until animated gif data is streamed into the canvas rel:auto_play - Defaults to 1 if not specified. If set to zero, a call to the play() method is needed Constructor options args gif Required. The DOM element of an img tag. loop_mode Optional. Setting this to false will force disable looping of the gif. auto_play Optional. Same as the rel:auto_play attribute above, this arg overrides the img tag info. max_width Optional. Scale images over max_width down to max_width. Helpful with mobile. on_end Optional. Add a callback for when the gif reaches the end of a single loop (one iteration). The first argument passed will be the gif HTMLElement. loop_delay Optional. The amount of time to pause (in ms) after each single loop (iteration). draw_while_loading Optional. Determines whether the gif will be drawn to the canvas whilst it is loaded. show_progress_bar Optional. Only applies when draw_while_loading is set to true. Instance methods // loading load( callback ) Loads the gif specified by the src or rel:animated_src sttributie of the img tag into a canvas element and then calls callback if one is passed load_url( src, callback ) Loads the gif file specified in the src argument into a canvas element and then calls callback if one is passed // play controls play - Start playing the gif pause - Stop playing the gif move_to(i) - Move to frame i of the gif move_relative(i) - Move i frames ahead (or behind if i < 0) // getters get_canvas The canvas element that the gif is playing in. Handy for assigning event handlers to. get_playing Whether or not the gif is currently playing get_loading Whether or not the gif has finished loading/parsing get_auto_play Whether or not the gif is set to play automatically get_length The number of frames in the gif get_current_frame The index of the currently displayed frame of the gif For additional customization (viewport inside iframe) these params may be passed: c_w, c_h - width and height of canvas vp_t, vp_l, vp_ w, vp_h - top, left, width and height of the viewport A bonus: few articles to understand what is going on http://enthusiasms.org/post/16976438906 http://www.matthewflickinger.com/lab/whatsinagif/bits_and_bytes.asp http://humpy77.deviantart.com/journal/Frame-Delay-Times-for-Animated-GIFs-214150546 */ (function (root, factory) { if (typeof define === 'function' && define.amd) { define([], factory); } else if (typeof exports === 'object') { module.exports = factory(); } else { root.SuperGif = factory(); } }(this, function () { // Generic functions var bitsToNum = function (ba) { return ba.reduce(function (s, n) { return s * 2 + n; }, 0); }; var byteToBitArr = function (bite) { var a = []; for (var i = 7; i >= 0; i--) { a.push( !! (bite & (1 << i))); } return a; }; // Stream /** * @constructor */ // Make compiler happy. var Stream = function (data) { this.data = data; this.len = this.data.length; this.pos = 0; this.readByte = function () { if (this.pos >= this.data.length) { throw new Error('Attempted to read past end of stream.'); } if (data instanceof Uint8Array) return data[this.pos++]; else return data.charCodeAt(this.pos++) & 0xFF; }; this.readBytes = function (n) { var bytes = []; for (var i = 0; i < n; i++) { bytes.push(this.readByte()); } return bytes; }; this.read = function (n) { var s = ''; for (var i = 0; i < n; i++) { s += String.fromCharCode(this.readByte()); } return s; }; this.readUnsigned = function () { // Little-endian. var a = this.readBytes(2); return (a[1] << 8) + a[0]; }; }; var lzwDecode = function (minCodeSize, data) { // TODO: Now that the GIF parser is a bit different, maybe this should get an array of bytes instead of a String? var pos = 0; // Maybe this streaming thing should be merged with the Stream? var readCode = function (size) { var code = 0; for (var i = 0; i < size; i++) { if (data.charCodeAt(pos >> 3) & (1 << (pos & 7))) { code |= 1 << i; } pos++; } return code; }; var output = []; var clearCode = 1 << minCodeSize; var eoiCode = clearCode + 1; var codeSize = minCodeSize + 1; var dict = []; var clear = function () { dict = []; codeSize = minCodeSize + 1; for (var i = 0; i < clearCode; i++) { dict[i] = [i]; } dict[clearCode] = []; dict[eoiCode] = null; }; var code; var last; while (true) { last = code; code = readCode(codeSize); if (code === clearCode) { clear(); continue; } if (code === eoiCode) break; if (code < dict.length) { if (last !== clearCode) { dict.push(dict[last].concat(dict[code][0])); } } else { if (code !== dict.length) throw new Error('Invalid LZW code.'); dict.push(dict[last].concat(dict[last][0])); } output.push.apply(output, dict[code]); if (dict.length === (1 << codeSize) && codeSize < 12) { // If we're at the last code and codeSize is 12, the next code will be a clearCode, and it'll be 12 bits long. codeSize++; } } // I don't know if this is technically an error, but some GIFs do it. //if (Math.ceil(pos / 8) !== data.length) throw new Error('Extraneous LZW bytes.'); return output; }; // The actual parsing; returns an object with properties. var parseGIF = function (st, handler) { handler || (handler = {}); // LZW (GIF-specific) var parseCT = function (entries) { // Each entry is 3 bytes, for RGB. var ct = []; for (var i = 0; i < entries; i++) { ct.push(st.readBytes(3)); } return ct; }; var readSubBlocks = function () { var size, data; data = ''; do { size = st.readByte(); data += st.read(size); } while (size !== 0); return data; }; var parseHeader = function () { var hdr = {}; hdr.sig = st.read(3); hdr.ver = st.read(3); if (hdr.sig !== 'GIF') throw new Error('Not a GIF file.'); // XXX: This should probably be handled more nicely. hdr.width = st.readUnsigned(); hdr.height = st.readUnsigned(); var bits = byteToBitArr(st.readByte()); hdr.gctFlag = bits.shift(); hdr.colorRes = bitsToNum(bits.splice(0, 3)); hdr.sorted = bits.shift(); hdr.gctSize = bitsToNum(bits.splice(0, 3)); hdr.bgColor = st.readByte(); hdr.pixelAspectRatio = st.readByte(); // if not 0, aspectRatio = (pixelAspectRatio + 15) / 64 if (hdr.gctFlag) { hdr.gct = parseCT(1 << (hdr.gctSize + 1)); } handler.hdr && handler.hdr(hdr); }; var parseExt = function (block) { var parseGCExt = function (block) { var blockSize = st.readByte(); // Always 4 var bits = byteToBitArr(st.readByte()); block.reserved = bits.splice(0, 3); // Reserved; should be 000. block.disposalMethod = bitsToNum(bits.splice(0, 3)); block.userInput = bits.shift(); block.transparencyGiven = bits.shift(); block.delayTime = st.readUnsigned(); block.transparencyIndex = st.readByte(); block.terminator = st.readByte(); handler.gce && handler.gce(block); }; var parseComExt = function (block) { block.comment = readSubBlocks(); handler.com && handler.com(block); }; var parsePTExt = function (block) { // No one *ever* uses this. If you use it, deal with parsing it yourself. var blockSize = st.readByte(); // Always 12 block.ptHeader = st.readBytes(12); block.ptData = readSubBlocks(); handler.pte && handler.pte(block); }; var parseAppExt = function (block) { var parseNetscapeExt = function (block) { var blockSize = st.readByte(); // Always 3 block.unknown = st.readByte(); // ??? Always 1? What is this? block.iterations = st.readUnsigned(); block.terminator = st.readByte(); handler.app && handler.app.NETSCAPE && handler.app.NETSCAPE(block); }; var parseUnknownAppExt = function (block) { block.appData = readSubBlocks(); // FIXME: This won't work if a handler wants to match on any identifier. handler.app && handler.app[block.identifier] && handler.app[block.identifier](block); }; var blockSize = st.readByte(); // Always 11 block.identifier = st.read(8); block.authCode = st.read(3); switch (block.identifier) { case 'NETSCAPE': parseNetscapeExt(block); break; default: parseUnknownAppExt(block); break; } }; var parseUnknownExt = function (block) { block.data = readSubBlocks(); handler.unknown && handler.unknown(block); }; block.label = st.readByte(); switch (block.label) { case 0xF9: block.extType = 'gce'; parseGCExt(block); break; case 0xFE: block.extType = 'com'; parseComExt(block); break; case 0x01: block.extType = 'pte'; parsePTExt(block); break; case 0xFF: block.extType = 'app'; parseAppExt(block); break; default: block.extType = 'unknown'; parseUnknownExt(block); break; } }; var parseImg = function (img) { var deinterlace = function (pixels, width) { // Of course this defeats the purpose of interlacing. And it's *probably* // the least efficient way it's ever been implemented. But nevertheless... var newPixels = new Array(pixels.length); var rows = pixels.length / width; var cpRow = function (toRow, fromRow) { var fromPixels = pixels.slice(fromRow * width, (fromRow + 1) * width); newPixels.splice.apply(newPixels, [toRow * width, width].concat(fromPixels)); }; // See appendix E. var offsets = [0, 4, 2, 1]; var steps = [8, 8, 4, 2]; var fromRow = 0; for (var pass = 0; pass < 4; pass++) { for (var toRow = offsets[pass]; toRow < rows; toRow += steps[pass]) { cpRow(toRow, fromRow) fromRow++; } } return newPixels; }; img.leftPos = st.readUnsigned(); img.topPos = st.readUnsigned(); img.width = st.readUnsigned(); img.height = st.readUnsigned(); var bits = byteToBitArr(st.readByte()); img.lctFlag = bits.shift(); img.interlaced = bits.shift(); img.sorted = bits.shift(); img.reserved = bits.splice(0, 2); img.lctSize = bitsToNum(bits.splice(0, 3)); if (img.lctFlag) { img.lct = parseCT(1 << (img.lctSize + 1)); } img.lzwMinCodeSize = st.readByte(); var lzwData = readSubBlocks(); img.pixels = lzwDecode(img.lzwMinCodeSize, lzwData); if (img.interlaced) { // Move img.pixels = deinterlace(img.pixels, img.width); } handler.img && handler.img(img); }; var parseBlock = function () { var block = {}; block.sentinel = st.readByte(); switch (String.fromCharCode(block.sentinel)) { // For ease of matching case '!': block.type = 'ext'; parseExt(block); break; case ',': block.type = 'img'; parseImg(block); break; case ';': block.type = 'eof'; handler.eof && handler.eof(block); break; default: throw new Error('Unknown block: 0x' + block.sentinel.toString(16)); // TODO: Pad this with a 0. } if (block.type !== 'eof') setTimeout(parseBlock, 0); }; var parse = function () { parseHeader(); setTimeout(parseBlock, 0); }; parse(); }; var SuperGif = function ( opts ) { var options = { //viewport position vp_l: 0, vp_t: 0, vp_w: null, vp_h: null, //canvas sizes c_w: null, c_h: null }; for (var i in opts ) { options[i] = opts[i] } if (options.vp_w && options.vp_h) options.is_vp = true; var stream; var hdr; var loadError = null; var loading = false; var transparency = null; var delay = null; var disposalMethod = null; var disposalRestoreFromIdx = 0; var lastDisposalMethod = null; var frame = null; var lastImg = null; var playing = true; var forward = true; var ctx_scaled = false; var frames = []; var frameOffsets = []; // elements have .x and .y properties var gif = options.gif; if (typeof options.auto_play == 'undefined') options.auto_play = (!gif.getAttribute('rel:auto_play') || gif.getAttribute('rel:auto_play') == '1'); var onEndListener = (options.hasOwnProperty('on_end') ? options.on_end : null); var loopDelay = (options.hasOwnProperty('loop_delay') ? options.loop_delay : 0); var overrideLoopMode = (options.hasOwnProperty('loop_mode') ? options.loop_mode : 'auto'); var drawWhileLoading = (options.hasOwnProperty('draw_while_loading') ? options.draw_while_loading : true); var showProgressBar = drawWhileLoading ? (options.hasOwnProperty('show_progress_bar') ? options.show_progress_bar : true) : false; var clear = function () { transparency = null; delay = null; lastDisposalMethod = disposalMethod; disposalMethod = null; frame = null; }; // XXX: There's probably a better way to handle catching exceptions when // callbacks are involved. var doParse = function () { try { parseGIF(stream, handler); } catch (err) { doLoadError('parse'); } }; var doText = function (text) { toolbar.innerHTML = text; // innerText? Escaping? Whatever. toolbar.style.visibility = 'visible'; }; var setSizes = function(w, h) { canvas.width = w * get_canvas_scale(); canvas.height = h * get_canvas_scale(); toolbar.style.minWidth = ( w * get_canvas_scale() ) + 'px'; tmpCanvas.width = w; tmpCanvas.height = h; tmpCanvas.style.width = w + 'px'; tmpCanvas.style.height = h + 'px'; tmpCanvas.getContext('2d').setTransform(1, 0, 0, 1, 0, 0); }; var setFrameOffset = function(frame, offset) { if (!frameOffsets[frame]) { frameOffsets[frame] = offset; return; } if (typeof offset.x !== 'undefined') { frameOffsets[frame].x = offset.x; } if (typeof offset.y !== 'undefined') { frameOffsets[frame].y = offset.y; } }; var doShowProgress = function (pos, length, draw) { if (draw && showProgressBar) { var height = 25; var left, mid, top, width; if (options.is_vp) { if (!ctx_scaled) { top = (options.vp_t + options.vp_h - height); height = height; left = options.vp_l; mid = left + (pos / length) * options.vp_w; width = canvas.width; } else { top = (options.vp_t + options.vp_h - height) / get_canvas_scale(); height = height / get_canvas_scale(); left = (options.vp_l / get_canvas_scale() ); mid = left + (pos / length) * (options.vp_w / get_canvas_scale()); width = canvas.width / get_canvas_scale(); } //some debugging, draw rect around viewport if (false) { if (!ctx_scaled) { var l = options.vp_l, t = options.vp_t; var w = options.vp_w, h = options.vp_h; } else { var l = options.vp_l/get_canvas_scale(), t = options.vp_t/get_canvas_scale(); var w = options.vp_w/get_canvas_scale(), h = options.vp_h/get_canvas_scale(); } ctx.rect(l,t,w,h); ctx.stroke(); } } else { top = (canvas.height - height) / (ctx_scaled ? get_canvas_scale() : 1); mid = ((pos / length) * canvas.width) / (ctx_scaled ? get_canvas_scale() : 1); width = canvas.width / (ctx_scaled ? get_canvas_scale() : 1 ); height /= ctx_scaled ? get_canvas_scale() : 1; } // XXX Figure out alpha fillRect. //ctx.fillStyle = 'salmon'; ctx.fillStyle = 'rgba(255,255,255,0.4)'; ctx.fillRect(mid, top, width - mid, height); //ctx.fillStyle = 'teal'; ctx.fillStyle = 'rgba(255,0,22,.8)'; ctx.fillRect(0, top, mid, height); } }; var doLoadError = function (originOfError) { var drawError = function () { ctx.fillStyle = 'black'; ctx.fillRect(0, 0, options.c_w ? options.c_w : hdr.width, options.c_h ? options.c_h : hdr.height); ctx.strokeStyle = '`red`'; ctx.lineWidth = 3; ctx.moveTo(0, 0); ctx.lineTo(options.c_w ? options.c_w : hdr.width, options.c_h ? options.c_h : hdr.height); ctx.moveTo(0, options.c_h ? options.c_h : hdr.height); ctx.lineTo(options.c_w ? options.c_w : hdr.width, 0); ctx.stroke(); }; loadError = originOfError; hdr = { width: gif.width, height: gif.height }; // Fake header. frames = []; drawError(); }; var doHdr = function (_hdr) { hdr = _hdr; setSizes(hdr.width, hdr.height) }; var doGCE = function (gce) { pushFrame(); clear(); transparency = gce.transparencyGiven ? gce.transparencyIndex : null; delay = gce.delayTime; disposalMethod = gce.disposalMethod; // We don't have much to do with the rest of GCE. }; var pushFrame = function () { if (!frame) return; frames.push({ data: frame.getImageData(0, 0, hdr.width, hdr.height), delay: delay }); frameOffsets.push({ x: 0, y: 0 }); }; var doImg = function (img) { if (!frame) frame = tmpCanvas.getContext('2d'); var currIdx = frames.length; //ct = color table, gct = global color table var ct = img.lctFlag ? img.lct : hdr.gct; // TODO: What if neither exists? /* Disposal method indicates the way in which the graphic is to be treated after being displayed. Values : 0 - No disposal specified. The decoder is not required to take any action. 1 - Do not dispose. The graphic is to be left in place. 2 - Restore to background color. The area used by the graphic must be restored to the background color. 3 - Restore to previous. The decoder is required to restore the area overwritten by the graphic with what was there prior to rendering the graphic. Importantly, "previous" means the frame state after the last disposal of method 0, 1, or 2. */ if (currIdx > 0) { if (lastDisposalMethod === 3) { // Restore to previous frame.putImageData(frames[disposalRestoreFromIdx].data, 0, 0); } else { disposalRestoreFromIdx = currIdx - 1; } if (lastDisposalMethod === 2) { // Restore to background color // Browser implementations historically restore to transparent; we do the same. // http://www.wizards-toolkit.org/discourse-server/viewtopic.php?f=1&t=21172#p86079 frame.clearRect(lastImg.leftPos, lastImg.topPos, lastImg.width, lastImg.height); } } // else, Undefined/Do not dispose. // frame contains final pixel data from the last frame; do nothing //Get existing pixels for img region after applying disposal method var imgData = frame.getImageData(img.leftPos, img.topPos, img.width, img.height); //apply color table colors var cdd = imgData.data; img.pixels.forEach(function (pixel, i) { // imgData.data === [R,G,B,A,R,G,B,A,...] if (pixel !== transparency) { cdd[i * 4 + 0] = ct[pixel][0]; cdd[i * 4 + 1] = ct[pixel][1]; cdd[i * 4 + 2] = ct[pixel][2]; cdd[i * 4 + 3] = 255; // Opaque. } }); imgData.data.set(cdd); frame.putImageData(imgData, img.leftPos, img.topPos); if (!ctx_scaled) { ctx.scale(get_canvas_scale(),get_canvas_scale()); ctx_scaled = true; } // We could use the on-page canvas directly, except that we draw a progress // bar for each image chunk (not just the final image). if (drawWhileLoading) ctx.drawImage(tmpCanvas, 0, 0); lastImg = img; }; var player = (function () { var i = -1; var iterationCount = 0; var showingInfo = false; var pinned = false; /** * Gets the index of the frame "up next". * @returns {number} */ var getNextFrameNo = function () { var delta = (forward ? 1 : -1); return (i + delta + frames.length) % frames.length; }; var stepFrame = function (amount) { // XXX: Name is confusing. i = i + amount; putFrame(); }; var completeLoop = function () { if (onEndListener !== null) onEndListener(gif); iterationCount++; }; var step = (function () { var stepping = false; var doStep = function () { stepping = playing; if (!stepping) return; stepFrame(1); var delay = frames[i].delay * 10; if (!delay) delay = 100; // FIXME: Should this even default at all? What should it be? var nextFrameNo = getNextFrameNo(); if (nextFrameNo === 0) { delay += loopDelay; setTimeout(completeLoop, delay - 1); } if ((overrideLoopMode !== false || nextFrameNo !== 0 || iterationCount < 0)) setTimeout(doStep, delay); }; return function () { if (!stepping) setTimeout(doStep, 0); }; }()); var putFrame = function () { var offset; i = parseInt(i, 10); if (i > frames.length - 1){ i = 0; } if (i < 0){ i = 0; } offset = frameOffsets[i]; tmpCanvas.getContext("2d").putImageData(frames[i].data, offset.x, offset.y); ctx.globalCompositeOperation = "copy"; ctx.drawImage(tmpCanvas, 0, 0); }; var play = function () { playing = true; step(); }; var pause = function () { playing = false; }; return { init: function () { if (loadError) return; if ( ! (options.c_w && options.c_h) ) { ctx.scale(get_canvas_scale(),get_canvas_scale()); } if (options.auto_play) { step(); } else { i = 0; putFrame(); } }, step: step, play: play, pause: pause, playing: playing, move_relative: stepFrame, current_frame: function() { return i; }, length: function() { return frames.length }, move_to: function ( frame_idx ) { i = frame_idx; putFrame(); } } }()); var doDecodeProgress = function (draw) { doShowProgress(stream.pos, stream.data.length, draw); }; var doNothing = function () {}; /** * @param{boolean=} draw Whether to draw progress bar or not; this is not idempotent because of translucency. * Note that this means that the text will be unsynchronized with the progress bar on non-frames; * but those are typically so small (GCE etc.) that it doesn't really matter. TODO: Do this properly. */ var withProgress = function (fn, draw) { return function (block) { fn(block); doDecodeProgress(draw); }; }; var handler = { hdr: withProgress(doHdr), gce: withProgress(doGCE), com: withProgress(doNothing), // I guess that's all for now. app: { // TODO: Is there much point in actually supporting iterations? NETSCAPE: withProgress(doNothing) }, img: withProgress(doImg, true), eof: function (block) { //toolbar.style.display = ''; pushFrame(); doDecodeProgress(false); if ( ! (options.c_w && options.c_h) ) { canvas.width = hdr.width * get_canvas_scale(); canvas.height = hdr.height * get_canvas_scale(); } player.init(); loading = false; if (load_callback) { load_callback(gif); } } }; var init = function () { var parent = gif.parentNode; var div = document.createElement('div'); canvas = document.createElement('canvas'); ctx = canvas.getContext('2d'); toolbar = document.createElement('div'); tmpCanvas = document.createElement('canvas'); div.width = canvas.width = gif.width; div.height = canvas.height = gif.height; toolbar.style.minWidth = gif.width + 'px'; div.className = 'jsgif'; toolbar.className = 'jsgif_toolbar'; div.appendChild(canvas); div.appendChild(toolbar); parent.insertBefore(div, gif); parent.removeChild(gif); if (options.c_w && options.c_h) setSizes(options.c_w, options.c_h); initialized=true; }; var get_canvas_scale = function() { var scale; if (options.max_width && hdr && hdr.width > options.max_width) { scale = options.max_width / hdr.width; } else { scale = 1; } return scale; } var canvas, ctx, toolbar, tmpCanvas; var initialized = false; var load_callback = false; var load_setup = function(callback) { if (loading) return false; if (callback) load_callback = callback; else load_callback = false; loading = true; frames = []; clear(); disposalRestoreFromIdx = 0; lastDisposalMethod = null; frame = null; lastImg = null; return true; } return { // play controls play: player.play, pause: player.pause, move_relative: player.move_relative, move_to: player.move_to, // getters for instance vars get_playing : function() { return player.playing }, get_canvas : function() { return canvas }, get_canvas_scale : function() { return get_canvas_scale() }, get_loading : function() { return loading }, get_auto_play : function() { return options.auto_play }, get_length : function() { return player.length() }, get_current_frame: function() { return player.current_frame() }, load_url: function(src,callback){ if (!load_setup(callback)) return; var h = new XMLHttpRequest(); h.overrideMimeType('text/plain; charset=x-user-defined'); h.onloadstart = function() { // Wait until connection is opened to replace the gif element with a canvas to avoid a blank img if (!initialized) init(); }; h.onload = function(e) { stream = new Stream(h.responseText); setTimeout(doParse, 0); }; h.onprogress = function (e) { if (e.lengthComputable) doShowProgress(e.loaded, e.total, true); }; h.onerror = function() { doLoadError('xhr'); }; h.open('GET', src, true); h.send(); }, load: function (callback) { this.load_url(gif.getAttribute('rel:animated_src') || gif.src,callback); }, load_raw: function(arr, callback) { if (!load_setup(callback)) return; if (!initialized) init(); stream = new Stream(arr); setTimeout(doParse, 0); }, set_frame_offset: setFrameOffset }; }; return SuperGif; })); ; /****************** * * Init GIF Player * *****************/ (function ($) { 'use strict'; var isEnabled = g1.config.use_gif_player; g1.gifPlayer = function ($scope) { if ( ! isEnabled ) { return; } if (! $scope ) { $scope = $('body'); } // SuperGif library depends on the overrideMimeType method of the XMLHttpRequest object // if browser doesn't support this method, we can't use that library if ( typeof XMLHttpRequest.prototype.overrideMimeType === 'undefined' ) { return; } g1.gifPlayerIncludeSelectors =[ '.entry-content img.aligncenter[src$=".gif"]', '.entry-content .aligncenter img[src$=".gif"]', 'img.g1-enable-gif-player', '.entry-featured-media-main img[src$=".gif"]', '.entry-tpl-stream .entry-featured-media img[src$=".gif"]', '.entry-tpl-grid-l .entry-featured-media img[src$=".gif"]' ]; g1.gifPlayerExcludeSelectors = [ '.ajax-loader', // for Contact Form 7 '.g1-disable-gif-player', '.wp-block-image.g1-disable-gif-player img[src$=".gif"]' ]; $( g1.gifPlayerIncludeSelectors.join(','), $scope ).not( g1.gifPlayerExcludeSelectors.join(',') ).each(function () { var $img = $(this); var imgClasses = $img.attr('class'); var imgSrc = $img.attr('src'); // Check only absolute paths. Relative paths, by nature, are from the same domain. // Seems like the GIFs from outside of the site's domain work too. // if (-1 !== imgSrc.indexOf('http')) { // // Only locally stored gifs, unless user decided otherwise. // if (imgSrc.indexOf(location.hostname) === -1 && !$img.is('.g1-enable-gif-player')) { // return; // } // } var gifObj = new SuperGif({ gif: this, auto_play: 0 }); var $gitIndicator = $(''); gifObj.load(function() { var frames = gifObj.get_length(); var $canvasWrapper = $(gifObj.get_canvas()).parent(); // Only for animated gifs. if (frames > 1) { gifObj.isPlaying = false; // Store references to original methods. var playRef = gifObj.play; var pauseRef = gifObj.pause; var playGif = function() { playRef(); gifObj.isPlaying = true; $gitIndicator.addClass('g1-indicator-gif-playing'); }; var pauseGif = function() { pauseRef(); gifObj.isPlaying = false; $gitIndicator.removeClass('g1-indicator-gif-playing'); }; // Override and extend the API. gifObj.play = playGif; gifObj.pause = pauseGif; // Play/stop the GIF. $canvasWrapper.on('click', function(e) { // Prevent redirecting to single post. e.preventDefault(); if (gifObj.isPlaying) { pauseGif(); } else { playGif(); } }); $gitIndicator.toggleClass('g1-loading g1-loaded'); $(document).trigger('bimberGifPlayerLoaded', [$canvasWrapper]); } else { // It's just a gif type image, not animation to play. $gitIndicator.remove(); } }); // canvas parent can be fetched after gifObj.load() call var $canvasWrapper = $(gifObj.get_canvas()).parent(); $canvasWrapper. addClass(imgClasses + ' g1-enable-share-links'). attr('data-img-src', imgSrc). append($gitIndicator). data('gifPlayer', gifObj); }); }; // Listeners. $('body').on('g1NewContentLoaded', function(e, $newContent) { g1.gifPlayer($newContent); }); })(jQuery); /************************ * * Media Players Factory * ***********************/ (function ($) { 'use strict'; var selectors = { 'iframe': 'iframe', 'mp4': '.mejs-video', 'gif': '.jsgif', 'html5Video': '.snax-native-video', 'embedly': '.embedly-card iframe', 'maceYT': '.mace-youtube' }; g1.mediaPlayers = {}; g1.getMediaPlayer = function(element) { var player = $(element).data('g1MediaPlayer'); if (player) { g1.log('Returning a player (' + player.getType() + ') assigned to the element.'); return player; } // IFRAME. var $iframe = $(selectors.iframe, element); if ($iframe.length > 0) { var iframesrc = false; if ($iframe.attr('data-src')) { iframesrc = $iframe.attr('data-src'); } else { iframesrc= $iframe.attr('src'); } if (iframesrc) { // YouTube? if (iframesrc.indexOf('youtu') > 0) { player = g1.mediaPlayers.youtube($iframe); $(element).data('g1MediaPlayer', player); return player; } // Vimeo? if (iframesrc.indexOf('vimeo') > 0) { player = g1.mediaPlayers.vimeo($iframe); $(element).data('g1MediaPlayer', player); return player; } // Dailymotion? if (iframesrc.indexOf('dailymotion') > 0) { player = g1.mediaPlayers.dailymotion($iframe); $(element).data('g1MediaPlayer', player); return player; } // Gfycat? if (iframesrc.indexOf('gfycat') > 0) { player = g1.mediaPlayers.gfycat($iframe); $(element).data('g1MediaPlayer', player); return player; } } return false; } // MP4. var $mp4 = $(selectors.mp4, element); if ($mp4.length > 0) { var playerId = $mp4.attr('id'); if (playerId && mejs && typeof mejs.players !== 'undefined') { if (typeof mejs.players[playerId] !== 'undefined') { var mejsPlayer = mejs.players[playerId]; player = g1.mediaPlayers.mp4(mejsPlayer); $(element).data('g1MediaPlayer', player); return player; } } return false; } // GIF. var $gif = $(selectors.gif, element); if ($gif.length > 0) { var gifPlayer = $gif.data('gifPlayer'); if (gifPlayer) { player = g1.mediaPlayers.gif(gifPlayer); $(element).data('g1MediaPlayer', player); return player; } return false; } // MediaAce Lazy Loaded video. var $maceYT = $(selectors.maceYT, element); // HTML5 native videos. var $html5 = $(selectors.html5Video, element); if ( $html5.length > 0 ) { player = g1.mediaPlayers.html5video($html5[0]); $(element).data('g1MediaPlayer', player); return player; } // Embedly. if (typeof embedly !== 'undefined') { var $embedly = $(selectors.embedly, element); if ($embedly.length > 0 ) { // The following iterates over all the instances of the player. embedly('player', function(embedlyPlayer){ if ($embedly[0] === $(embedlyPlayer.frame.elem)[0]) { player = g1.mediaPlayers.embedly(embedlyPlayer); $(element).data('g1MediaPlayer', player); return player; } else { player.pause(); } }); return false; } else { embedly('player', function(player){ player.pause(); }); } } // MediaAce YouTube lazy loader. if ($maceYT.length > 0) { // Start to load YouTube player. $maceYT.find('.mace-play-button').trigger('click'); // YouTube player (iframe) loaded. $maceYT.on('maceIframeLoaded', function(e, $iframe) { // Get YT player to initialize YT properly. player = g1.getMediaPlayer($maceYT); // Assign the player to the element. $(element).data('g1MediaPlayer', player); }); // We don't want to return an instance of the MaceYT player here, as the MaceYT is just a wrapper for YT player. // So we return false here and wait for YT iframe. When it's loaded, we assigned the YT player to the element. return false; } }; })(jQuery); /******************* * * YouTube Player * ******************/ (function ($) { 'use strict'; g1.mediaPlayers.youtube = function ($iframe) { let obj = {}; let isPlaying = false; function init() { g1.log('YouTube player object initialized'); $iframe.on('load', function() { // Mute on load. $iframe[0].contentWindow.postMessage(JSON.stringify({ 'event': 'command', 'func': 'mute', 'args': ''}), '*'); }); let iframesrc = ''; let separator = '?'; if ($iframe.attr('data-src')) { iframesrc = $iframe.attr('data-src'); } else { iframesrc = $iframe.attr('src'); } if (iframesrc.indexOf('?') > 0){ separator = '&'; } // Trigger the "load" event, with new params. $iframe.attr('src', iframesrc + separator + 'autoplay=1&enablejsapi=1&loop=1'); return obj; } obj.getType = function() { return 'YouTube'; }; obj.play = function () { $iframe[0].contentWindow.postMessage(JSON.stringify({ 'event': 'command', 'func': 'playVideo', 'args': ''}), '*'); isPlaying = true; }; obj.pause = function () { $iframe[0].contentWindow.postMessage(JSON.stringify({ 'event': 'command', 'func': 'pauseVideo', 'args': ''}), '*'); isPlaying = false; }; obj.isPlaying = function() { return isPlaying; }; return init(); }; })(jQuery); /******************* * * Vimoe Player * ******************/ (function ($) { 'use strict'; g1.mediaPlayers.vimeo = function ($iframe) { let obj = {}; let isPlaying = false; function init() { g1.log('Vimeo player object initialized'); $iframe.on('load', function() { $iframe[0].contentWindow.postMessage(JSON.stringify({ method: 'setVolume', value: 0 }), '*'); }); let iframesrc = ''; let separator = '?'; if ($iframe.attr('data-src')) { iframesrc = $iframe.attr('data-src'); } else { iframesrc = $iframe.attr('src'); } if (iframesrc.indexOf('?') > 0){ separator = '&'; } $iframe.attr('src', iframesrc + separator + 'autoplay=1&autopause=0'); return obj; } obj.getType = function() { return 'Vimeo'; }; obj.play = function () { $iframe[0].contentWindow.postMessage(JSON.stringify({ method: 'play' }), '*'); isPlaying = true; }; obj.pause = function () { $iframe[0].contentWindow.postMessage(JSON.stringify({ method: 'pause' }), '*'); isPlaying = false; }; obj.isPlaying = function() { return isPlaying; }; return init(); }; })(jQuery); /******************* * * DailyMotion Player * ******************/ (function ($) { 'use strict'; g1.mediaPlayers.dailymotion = function ($iframe) { let obj = {}; let isPlaying = false; function init() { g1.log('DailyMotion player object initialized'); // Mute on load. let iframesrc = ''; let separator = '?'; if ($iframe.attr('data-src')) { iframesrc = $iframe.attr('data-src'); } else { iframesrc = $iframe.attr('src'); } if (iframesrc.indexOf('?') > 0){ separator = '&'; } $iframe.attr('src', iframesrc + separator + 'autoplay=1&api=postMessage&mute=1'); return obj; } obj.getType = function() { return 'DailyMotion'; }; obj.play = function () { $iframe[0].contentWindow.postMessage('play', '*'); isPlaying = true; }; obj.pause = function () { $iframe[0].contentWindow.postMessage('pause', '*'); isPlaying = false; }; obj.isPlaying = function() { return isPlaying; }; return init(); }; })(jQuery); /******************* * * Gfycat Player * ******************/ (function ($) { 'use strict'; g1.mediaPlayers.gfycat = function ($iframe) { let obj = {}; let isPlaying = false; function init() { g1.log('Gfycat player object initialized'); return obj; } obj.getType = function() { return 'Gfycat'; }; obj.play = function () { $iframe[0].contentWindow.postMessage('play', '*'); isPlaying = true; }; obj.pause = function () { $iframe[0].contentWindow.postMessage('pause', '*'); isPlaying = false; }; obj.isPlaying = function() { return isPlaying; }; return init(); }; })(jQuery); /******************* * * MP4 Player * ******************/ (function ($) { 'use strict'; g1.mediaPlayers.mp4 = function (mejsPlayer) { let obj = {}; let isPlaying = false; function init() { g1.log('MP4 player initialized'); // Start muted. mejsPlayer.setMuted(true); // Play in loop. mejsPlayer.media.addEventListener('ended', function() { mejsPlayer.play(); }, false); return obj; } obj.getType = function() { return 'MP4'; }; obj.play = function() { mejsPlayer.play(); isPlaying = true; }; obj.pause = function() { mejsPlayer.pause(); isPlaying = false; }; obj.isPlaying = function() { return isPlaying; }; return init(); }; })(jQuery); /******************* * * GIF Player * ******************/ (function ($) { 'use strict'; g1.mediaPlayers.gif = function (gifPlayer) { let obj = {}; function init() { g1.log('GIF player initialized'); return obj; } obj.getType = function() { return 'GIF'; }; obj.play = function() { gifPlayer.play(); }; obj.pause = function() { gifPlayer.pause(); }; obj.isPlaying = function() { return gifPlayer.isPlaying; }; return init(); }; })(jQuery); /******************* * * HTML Video Player * ******************/ (function ($) { 'use strict'; g1.mediaPlayers.html5video = function (video) { let obj = {}; let isPlaying = false; function init() { g1.log('HTML5 Video player initialized'); return obj; } obj.getType = function() { return 'HTML5 Video'; }; obj.play = function() { video.play(); isPlaying = true; }; obj.pause = function() { video.pause(); isPlaying = false; }; obj.isPlaying = function() { return isPlaying; }; return init(); }; })(jQuery); /******************* * * Embedly Player * ******************/ (function ($) { 'use strict'; g1.mediaPlayers.embedly = function (embedlyPlayer) { let obj = {}; let isPlaying = false; function init() { g1.log('Embedly player initialized'); embedlyPlayer.mute(); return obj; } obj.getType = function() { return 'Embedly'; }; obj.play = function() { embedlyPlayer.play(); isPlaying = true; }; obj.pause = function() { embedlyPlayer.pause(); isPlaying = false; }; obj.isPlaying = function() { return isPlaying; }; return init(); }; })(jQuery); /********************** /********************** * * Auto Play Controller * ********************** **********************/ (function ($) { 'use strict'; var selectors = { 'postMedia': '.archive-body-stream .entry-tpl-stream .entry-featured-media:not(.entry-media-nsfw-embed)' }; // Due to varied autoplay browsers' policies, it's almost impossible to guarantee autoplying on mobiles, so we turn it off. g1.isAutoPlayEnabled = g1.config.auto_play_videos && ! g1.isTouchDevice(); var players = {}; // Initialized players. g1.autoPlayVideo = function () { if ( ! g1.isAutoPlayEnabled ) { return; } var pauseAllVideos = function() { g1.log('Pausing all videos'); for(var i in players) { players[i].pause(); } }; var play = function(element) { var postId = $(element).parents('article').attr('id'); g1.log('Trying to play media...'); var player = g1.getMediaPlayer(element); if (!player) { g1.log('Media player not defined for the element'); return; } // Before playing this video we want to make sure that others video are paused too. pauseAllVideos(); player.play(); g1.log(player.getType() + ' played'); // Store reference. if (!players[postId]) { players[postId] = player; } }; var pause = function (element) { g1.log('Trying to pause media...'); var player = g1.getMediaPlayer(element); if (!player) { g1.log('Media player not defined for the element'); return; } player.pause(); g1.log(player.getType() + ' paused'); }; var bindEvents = function() { // Delay waypoint. User scroll activate events. var scrollEvents = 0; var allowPlaying = false; // Wait for user scroll. Not scroll event while page loading. $(document).scroll(function() { scrollEvents++; if (scrollEvents > 5) { allowPlaying = true; } }); // ENTER, while up to down scrolling. $(selectors.postMedia).waypoint(function(direction) { if ('down' === direction) { if (allowPlaying) { g1.log([ '>>> ENTER post (direction: DOWN)', this.element ] ); play(this.element); } } }, { // When the bottom of the element hits the bottom of the viewport. offset: 'bottom-in-view' }); // ENTER, while down to up scrolling. $(selectors.postMedia).waypoint(function(direction) { if ('up' === direction) { if (allowPlaying) { g1.log([ '>>> ENTER post (direction: UP)', this.element ] ); play(this.element); } } }, { // When the top of the element hits the top of the viewport. offset: '0' }); // EXIT, while up to down scrolling. $(selectors.postMedia).waypoint(function(direction) { if ('down' === direction) { g1.log([ '>>> EXIT post (direction: DOWN)', this.element ] ); pause(this.element); } }, { offset: function() { // Fires when top of the element is (HALF OF ELEMENT HEIGHT)px from the top of the window. return -Math.round(this.element.clientHeight / 2); } }); // EXIT, while down to up scrolling. $(selectors.postMedia).waypoint(function(direction) { if ('up' === direction) { g1.log([ '>>> EXIT post (direction: UP)', this.element ] ); pause(this.element); } }, { offset: function() { var viewportHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); // Fires when top of the element is (HALF OF ELEMENT HEIGHT)px from the bottom of the window. return viewportHeight - Math.round(this.element.clientHeight / 2); } }); // Play on demand. $(selectors.postMedia).on('bimber:play', function() { g1.log([ '>>> PLAY ', $(this).get(0) ] ); play($(this).get(0)); }); // Pause on demand. $(selectors.postMedia).on('bimber:pause', function() { g1.log([ '>>> PAUSE ', $(this).get(0) ] ); pause($(this).get(0)); }); }; bindEvents(); }; })(jQuery); /************************** * * document ready functions (keep this at the end for better compatibillity with optimizing plugins) * *************************/ (function ($) { 'use strict'; $(document).ready(function () { // Init GIF player. g1.gifPlayer(); // Init videos auto load on scroll. g1.autoPlayVideo(); }); })(jQuery);; /*! jQuery UI - v1.13.3 - 2024-04-26 * https://jqueryui.com * Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-patch.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js * Copyright jQuery Foundation and other contributors; Licensed MIT */ !function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)}(function(x){"use strict";var t,e,i,n,W,C,o,s,r,l,a,h,u;function E(t,e,i){return[parseFloat(t[0])*(a.test(t[0])?e/100:1),parseFloat(t[1])*(a.test(t[1])?i/100:1)]}function L(t,e){return parseInt(x.css(t,e),10)||0}function N(t){return null!=t&&t===t.window}x.ui=x.ui||{},x.ui.version="1.13.3", /*! * jQuery UI :data 1.13.3 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * https://jquery.org/license */ x.extend(x.expr.pseudos,{data:x.expr.createPseudo?x.expr.createPseudo(function(e){return function(t){return!!x.data(t,e)}}):function(t,e,i){return!!x.data(t,i[3])}}), /*! * jQuery UI Disable Selection 1.13.3 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * https://jquery.org/license */ x.fn.extend({disableSelection:(t="onselectstart"in document.createElement("div")?"selectstart":"mousedown",function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}),enableSelection:function(){return this.off(".ui-disableSelection")}}), /*! * jQuery UI Focusable 1.13.3 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * https://jquery.org/license */ x.ui.focusable=function(t,e){var i,n,o,s=t.nodeName.toLowerCase();return"area"===s?(o=(i=t.parentNode).name,!(!t.href||!o||"map"!==i.nodeName.toLowerCase())&&0<(i=x("img[usemap='#"+o+"']")).length&&i.is(":visible")):(/^(input|select|textarea|button|object)$/.test(s)?(n=!t.disabled)&&(o=x(t).closest("fieldset")[0])&&(n=!o.disabled):n="a"===s&&t.href||e,n&&x(t).is(":visible")&&function(t){var e=t.css("visibility");for(;"inherit"===e;)t=t.parent(),e=t.css("visibility");return"visible"===e}(x(t)))},x.extend(x.expr.pseudos,{focusable:function(t){return x.ui.focusable(t,null!=x.attr(t,"tabindex"))}}),x.fn._form=function(){return"string"==typeof this[0].form?this.closest("form"):x(this[0].form)}, /*! * jQuery UI Form Reset Mixin 1.13.3 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * https://jquery.org/license */ x.ui.formResetMixin={_formResetHandler:function(){var e=x(this);setTimeout(function(){var t=e.data("ui-form-reset-instances");x.each(t,function(){this.refresh()})})},_bindFormResetHandler:function(){var t;this.form=this.element._form(),this.form.length&&((t=this.form.data("ui-form-reset-instances")||[]).length||this.form.on("reset.ui-form-reset",this._formResetHandler),t.push(this),this.form.data("ui-form-reset-instances",t))},_unbindFormResetHandler:function(){var t;this.form.length&&((t=this.form.data("ui-form-reset-instances")).splice(x.inArray(this,t),1),t.length?this.form.data("ui-form-reset-instances",t):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset"))}},x.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()), /*! * jQuery UI Support for jQuery core 1.8.x and newer 1.13.3 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * https://jquery.org/license * */ x.expr.pseudos||(x.expr.pseudos=x.expr[":"]),x.uniqueSort||(x.uniqueSort=x.unique),x.escapeSelector||(e=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,i=function(t,e){return e?"\0"===t?"�":t.slice(0,-1)+"\\"+t.charCodeAt(t.length-1).toString(16)+" ":"\\"+t},x.escapeSelector=function(t){return(t+"").replace(e,i)}),x.fn.even&&x.fn.odd||x.fn.extend({even:function(){return this.filter(function(t){return t%2==0})},odd:function(){return this.filter(function(t){return t%2==1})}}), /*! * jQuery UI Keycode 1.13.3 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * https://jquery.org/license */ x.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}, /*! * jQuery UI Labels 1.13.3 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * https://jquery.org/license */ x.fn.labels=function(){var t,e,i;return this.length?this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(e=this.eq(0).parents("label"),(t=this.attr("id"))&&(i=(i=this.eq(0).parents().last()).add((i.length?i:this).siblings()),t="label[for='"+x.escapeSelector(t)+"']",e=e.add(i.find(t).addBack(t))),this.pushStack(e)):this.pushStack([])},x.ui.plugin={add:function(t,e,i){var n,o=x.ui[t].prototype;for(n in i)o.plugins[n]=o.plugins[n]||[],o.plugins[n].push([e,i[n]])},call:function(t,e,i,n){var o,s=t.plugins[e];if(s&&(n||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(o=0;o
")).children()[0],x("body").append(e),t=i.offsetWidth,e.css("overflow","scroll"),t===(i=i.offsetWidth)&&(i=e[0].clientWidth),e.remove(),n=t-i)},getScrollInfo:function(t){var e=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),i=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),e="scroll"===e||"auto"===e&&t.widthW(C(n),C(o))?s.important="horizontal":s.important="vertical",f.using.call(this,t,s)}),r.offset(x.extend(h,{using:t}))})):h.apply(this,arguments)},x.ui.position={fit:{left:function(t,e){var i,n=e.within,o=n.isWindow?n.scrollLeft:n.offset.left,n=n.width,s=t.left-e.collisionPosition.marginLeft,r=o-s,l=s+e.collisionWidth-n-o;n",options:{classes:{},disabled:!1,create:null},_createWidget:function(t,e){e=x(e||this.defaultElement||this)[0],this.element=x(e),this.uuid=c++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=x(),this.hoverable=x(),this.focusable=x(),this.classesElementLookup={},e!==this&&(x.data(e,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===e&&this.destroy()}}),this.document=x(e.style?e.ownerDocument:e.document||e),this.window=x(this.document[0].defaultView||this.document[0].parentWindow)),this.options=x.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:x.noop,_create:x.noop,_init:x.noop,destroy:function(){var i=this;this._destroy(),x.each(this.classesElementLookup,function(t,e){i._removeClass(e,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:x.noop,widget:function(){return this.element},option:function(t,e){var i,n,o,s=t;if(0===arguments.length)return x.widget.extend({},this.options);if("string"==typeof t)if(s={},t=(i=t.split(".")).shift(),i.length){for(n=s[t]=x.widget.extend({},this.options[t]),o=0;o",delay:300,options:{icons:{submenu:"ui-icon-caret-1-e"},items:"> *",menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.lastMousePosition={x:null,y:null},this.element.uniqueId().attr({role:this.options.role,tabIndex:0}),this._addClass("ui-menu","ui-widget ui-widget-content"),this._on({"mousedown .ui-menu-item":function(e){e.preventDefault(),this._activateItem(e)},"click .ui-menu-item":function(e){var t=a(e.target),i=a(a.ui.safeActiveElement(this.document[0]));!this.mouseHandled&&t.not(".ui-state-disabled").length&&(this.select(e),e.isPropagationStopped()||(this.mouseHandled=!0),t.has(".ui-menu").length?this.expand(e):!this.element.is(":focus")&&i.closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active)&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer))},"mouseenter .ui-menu-item":"_activateItem","mousemove .ui-menu-item":"_activateItem",mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(e,t){var i=this.active||this._menuItems().first();t||this.focus(e,i)},blur:function(e){this._delay(function(){a.contains(this.element[0],a.ui.safeActiveElement(this.document[0]))||this.collapseAll(e)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(e){this._closeOnDocumentClick(e)&&this.collapseAll(e,!0),this.mouseHandled=!1}})},_activateItem:function(e){var t,i;this.previousFilter||e.clientX===this.lastMousePosition.x&&e.clientY===this.lastMousePosition.y||(this.lastMousePosition={x:e.clientX,y:e.clientY},t=a(e.target).closest(".ui-menu-item"),i=a(e.currentTarget),t[0]!==i[0])||i.is(".ui-state-active")||(this._removeClass(i.siblings().children(".ui-state-active"),null,"ui-state-active"),this.focus(e,i))},_destroy:function(){var e=this.element.find(".ui-menu-item").removeAttr("role aria-disabled").children(".ui-menu-item-wrapper").removeUniqueId().removeAttr("tabIndex role aria-haspopup");this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled tabIndex").removeUniqueId().show(),e.children().each(function(){var e=a(this);e.data("ui-menu-submenu-caret")&&e.remove()})},_keydown:function(e){var t,i,s,n=!0;switch(e.keyCode){case a.ui.keyCode.PAGE_UP:this.previousPage(e);break;case a.ui.keyCode.PAGE_DOWN:this.nextPage(e);break;case a.ui.keyCode.HOME:this._move("first","first",e);break;case a.ui.keyCode.END:this._move("last","last",e);break;case a.ui.keyCode.UP:this.previous(e);break;case a.ui.keyCode.DOWN:this.next(e);break;case a.ui.keyCode.LEFT:this.collapse(e);break;case a.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(e);break;case a.ui.keyCode.ENTER:case a.ui.keyCode.SPACE:this._activate(e);break;case a.ui.keyCode.ESCAPE:this.collapse(e);break;default:t=this.previousFilter||"",s=n=!1,i=96<=e.keyCode&&e.keyCode<=105?(e.keyCode-96).toString():String.fromCharCode(e.keyCode),clearTimeout(this.filterTimer),i===t?s=!0:i=t+i,t=this._filterMenuItems(i),(t=s&&-1!==t.index(this.active.next())?this.active.nextAll(".ui-menu-item"):t).length||(i=String.fromCharCode(e.keyCode),t=this._filterMenuItems(i)),t.length?(this.focus(e,t),this.previousFilter=i,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}n&&e.preventDefault()},_activate:function(e){this.active&&!this.active.is(".ui-state-disabled")&&(this.active.children("[aria-haspopup='true']").length?this.expand(e):this.select(e))},refresh:function(){var e,t,s=this,n=this.options.icons.submenu,i=this.element.find(this.options.menus);this._toggleClass("ui-menu-icons",null,!!this.element.find(".ui-icon").length),e=i.filter(":not(.ui-menu)").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var e=a(this),t=e.prev(),i=a("").data("ui-menu-submenu-caret",!0);s._addClass(i,"ui-menu-icon","ui-icon "+n),t.attr("aria-haspopup","true").prepend(i),e.attr("aria-labelledby",t.attr("id"))}),this._addClass(e,"ui-menu","ui-widget ui-widget-content ui-front"),(e=i.add(this.element).find(this.options.items)).not(".ui-menu-item").each(function(){var e=a(this);s._isDivider(e)&&s._addClass(e,"ui-menu-divider","ui-widget-content")}),t=(i=e.not(".ui-menu-item, .ui-menu-divider")).children().not(".ui-menu").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),this._addClass(i,"ui-menu-item")._addClass(t,"ui-menu-item-wrapper"),e.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!a.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(e,t){var i;"icons"===e&&(i=this.element.find(".ui-menu-icon"),this._removeClass(i,null,this.options.icons.submenu)._addClass(i,null,t.submenu)),this._super(e,t)},_setOptionDisabled:function(e){this._super(e),this.element.attr("aria-disabled",String(e)),this._toggleClass(null,"ui-state-disabled",!!e)},focus:function(e,t){var i;this.blur(e,e&&"focus"===e.type),this._scrollIntoView(t),this.active=t.first(),i=this.active.children(".ui-menu-item-wrapper"),this._addClass(i,null,"ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",i.attr("id")),i=this.active.parent().closest(".ui-menu-item").children(".ui-menu-item-wrapper"),this._addClass(i,null,"ui-state-active"),e&&"keydown"===e.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),(i=t.children(".ui-menu")).length&&e&&/^mouse/.test(e.type)&&this._startOpening(i),this.activeMenu=t.parent(),this._trigger("focus",e,{item:t})},_scrollIntoView:function(e){var t,i,s;this._hasScroll()&&(t=parseFloat(a.css(this.activeMenu[0],"borderTopWidth"))||0,i=parseFloat(a.css(this.activeMenu[0],"paddingTop"))||0,t=e.offset().top-this.activeMenu.offset().top-t-i,i=this.activeMenu.scrollTop(),s=this.activeMenu.height(),e=e.outerHeight(),t<0?this.activeMenu.scrollTop(i+t):s{"use strict";var e={d:(t,d)=>{for(var o in d)e.o(d,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:d[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},t={};function d(e){"undefined"!=typeof document&&("complete"!==document.readyState&&"interactive"!==document.readyState?document.addEventListener("DOMContentLoaded",e):e())}e.d(t,{default:()=>d}),(window.wp=window.wp||{}).domReady=t.default})();;