1var url = document.location.origin; 2 3jQuery('#login h1').html('<a href="'+url+'">'+url+'</a>'); 4 5jQuery('<p class="message">Welcome! Please login to continue. Not a member? Click <a href="'+url+'/offers/membership-offers-songwriter/">here</a> to sign up! </p>').insertAfter("#login h1"); 6 7jQuery("#login h1 a").css({ 8 "background-image": "url("+url+"/wp-content/uploads/2019/10/logo.png)", 9 "width": "301px", 10 "height": "113px", 11 "background-size": "contain", 12}); 13 14 15jQuery('#login .button-primary').css({ 16 "margin":" 7px 0 7px", 17 "box-shadow":" 0 0 0px rgba( 0,0,0,0.8 )", 18 "height": "auto", 19 "line-height":" 20px", 20 "padding": "13px", 21 "float": "none", 22 "width": "100%", 23 "background": "#222222", 24 "font": "normal 15px 'Roboto', sans-serif", 25}) 26 27jQuery('#loginform').css({ 28 "border": "none", 29 "box-shadow": "none", 30 "margin-top": "0", 31}) 32 33jQuery('body.login').css({ 34 "background-image": "url()", 35 "background-color": "#ffffff", 36 "background-repeat": "no-repeat", 37 "background-position": "right center", 38 "background-size": "cover", 39 "position": "relative", 40}) 41 42jQuery('body.login').css({ 43 "font-size": "font-size", 44 "margin": "24px 0 0", 45}) 46 47jQuery('.login #backtoblog').css({ 48 "font-size": "13px", 49 "padding": "0 24px", 50 "text-align": "center", 51 "margin": "16px 0", 52 "word-wrap": "break-word", 53}) 54 55jQuery('.login #nav').css({ 56 "text-align": "center", 57 "margin": "0", 58}) 59 60jQuery('.login #backtoblog a').css({ 61 "text-decoration": "none", 62 "color": "#0a0a0a", 63 "font-size": "15px", 64}) 65 66jQuery('.login form input[type=checkbox]').css({ 67 "border-radius": "0", 68 "background": "#fff", 69}) 70 71jQuery("#login .button-primary").hover(function(){ 72 jQuery(this).css({ 73 "background":"#a24c48", 74 "color": "#ffffff", 75 }); 76},function(){ 77 jQuery(this).css({ 78 "background":"#222222", 79 "color": "#ffffff", 80 }); 81}) 82; 83/*! This file is auto-generated */ 84window.addComment=function(v){var I,C,h,E=v.document,b={commentReplyClass:"comment-reply-link",commentReplyTitleId:"reply-title",cancelReplyId:"cancel-comment-reply-link",commentFormId:"commentform",temporaryFormId:"wp-temp-form-div",parentIdFieldId:"comment_parent",postIdFieldId:"comment_post_ID"},e=v.MutationObserver||v.WebKitMutationObserver||v.MozMutationObserver,r="querySelector"in E&&"addEventListener"in v,n=!!E.documentElement.dataset;function t(){d(),e&&new e(o).observe(E.body,{childList:!0,subtree:!0})}function d(e){if(r&&(I=g(b.cancelReplyId),C=g(b.commentFormId),I)){I.addEventListener("touchstart",l),I.addEventListener("click",l);function t(e){if((e.metaKey||e.ctrlKey)&&13===e.keyCode&&"a"!==E.activeElement.tagName.toLowerCase())return C.removeEventListener("keydown",t),e.preventDefault(),C.submit.click(),!1}C&&C.addEventListener("keydown",t);for(var n,d=function(e){var t=b.commentReplyClass;e&&e.childNodes||(e=E);e=E.getElementsByClassName?e.getElementsByClassName(t):e.querySelectorAll("."+t);return e}(e),o=0,i=d.length;o<i;o++)(n=d[o]).addEventListener("touchstart",a),n.addEventListener("click",a)}}function l(e){var t,n,d=g(b.temporaryFormId);d&&h&&(g(b.parentIdFieldId).value="0",t=d.textContent,d.parentNode.replaceChild(h,d),this.style.display="none",n=(d=(d=g(b.commentReplyTitleId))&&d.firstChild)&&d.nextSibling,d&&d.nodeType===Node.TEXT_NODE&&t&&(n&&"A"===n.nodeName&&n.id!==b.cancelReplyId&&(n.style.display=""),d.textContent=t),e.preventDefault())}function a(e){var t=g(b.commentReplyTitleId),t=t&&t.firstChild.textContent,n=this,d=m(n,"belowelement"),o=m(n,"commentid"),i=m(n,"respondelement"),r=m(n,"postid"),n=m(n,"replyto")||t;d&&o&&i&&r&&!1===v.addComment.moveForm(d,o,i,r,n)&&e.preventDefault()}function o(e){for(var t=e.length;t--;)if(e[t].addedNodes.length)return void d()}function m(e,t){return n?e.dataset[t]:e.getAttribute("data-"+t)}function g(e){return E.getElementById(e)}return r&&"loading"!==E.readyState?t():r&&v.addEventListener("DOMContentLoaded",t,!1),{init:d,moveForm:function(e,t,n,d,o){var i,r,l,a,m,c,s,e=g(e),n=(h=g(n),g(b.parentIdFieldId)),y=g(b.postIdFieldId),p=g(b.commentReplyTitleId),u=(p=p&&p.firstChild)&&p.nextSibling;if(e&&h&&n){void 0===o&&(o=p&&p.textContent),a=h,m=b.temporaryFormId,c=g(m),s=(s=g(b.commentReplyTitleId))?s.firstChild.textContent:"",c||((c=E.createElement("div")).id=m,c.style.display="none",c.textContent=s,a.parentNode.insertBefore(c,a)),d&&y&&(y.value=d),n.value=t,I.style.display="",e.parentNode.insertBefore(h,e.nextSibling),p&&p.nodeType===Node.TEXT_NODE&&(u&&"A"===u.nodeName&&u.id!==b.cancelReplyId&&(u.style.display="none"),p.textContent=o),I.onclick=function(){return!1};try{for(var f=0;f<C.elements.length;f++)if(i=C.elements[f],r=!1,"getComputedStyle"in v?l=v.getComputedStyle(i):E.documentElement.currentStyle&&(l=i.currentStyle),(i.offsetWidth<=0&&i.offsetHeight<=0||"hidden"===l.visibility)&&(r=!0),"hidden"
vendor: 4,215 bytes, lines 84-90
84!==i.type&&!i.disabled&&!r){i.focus();break}}catch(e){}return!1}}}}(window);; 85/*! 86 * Stickyfill â `position: sticky` polyfill 87 * v. 2.0.3 | https://github.com/wilddeer/stickyfill 88 * MIT License 89 */ 90!function(a,b){"use strict";function c(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function d(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])}function e(a){return parseFloat(a)||0}function f(a){for(var b=0;a;)b+=a.offsetTop,a=a.offsetParent;return b}function g(){function c(){a.pageXOffset!=k.left?(k.top=a.pageYOffset,k.left=a.pageXOffset,n.refreshAll()):a.pageYOffset!=k.top&&(k.top=a.pageYOffset,k.left=a.pageXOffset,l.forEach(function(a){return a._recalcPosition()}))}function d(){f=setInterval(function(){l.forEach(function(a){return a._fastCheck()})},500)}function e(){clearInterval(f)}c(),a.addEventListener("scroll",c),a.addEventListener("resize",n.refreshAll),a.addEventListener("orientationchange",n.refreshAll);var f=void 0,g=void 0,h=void 0;"hidden"in b?(g="hidden",h="visibilitychange"):"webkitHidden"in b&&(g="webkitHidden",h="webkitvisibilitychange"),h?(b[g]||d(),b.addEventListener(h,function(){b[g]?e():d()})):d()}var h=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),i=!1;a.getComputedStyle?!function(){var a=b.createElement("div");["","-webkit-","-moz-","-ms-"].some(function(b){try{a.style.position=b+"sticky"}catch(a){}return""!=a.style.position})&&(i=!0)}():i=!0;var j="undefined"!=typeof ShadowRoot,k={top:null,left:null},l=[],m=function(){function g(a){if(c(this,g),!(a instanceof HTMLElement))throw new Error("First argument must be HTMLElement");if(l.some(function(b){return b._node===a}))throw new Error("Stickyfill is already applied to this node");this._node=a,this._stickyMode=null,this._active=!1,l.push(this),this.refresh()}return h(g,[{key:"refresh",value:function(){if(!i&&!this._removed){this._active&&this._deactivate();var c=this._node,g=getComputedStyle(c),h={top:g.top,display:g.display,marginTop:g.marginTop,marginBottom:g.marginBottom,marginLeft:g.marginLeft,marginRight:g.marginRight,cssFloat:g.cssFloat};if(!isNaN(parseFloat(h.top))&&"table-cell"!=h.display&&"none"!=h.display){this._active=!0;var k=c.parentNode,l=j&&k instanceof ShadowRoot?k.host:k,m=c.getBoundingClientRect(),n=l.getBoundingClientRect(),o=getComputedStyle(l);this._parent={node:l,styles:{position:l.style.position},offsetHeight:l.offsetHeight},this._offsetToWindow={left:m.left,right:b.documentElement.clientWidth-m.right},this._offsetToParent={top:m.top-n.top-e(o.borderTopWidth),left:m.left-n.left-e(o.borderLeftWidth),right:-m.right+n.right-e(o.borderRightWidth)},this._styles={position:c.style.position,top:c.style.top,bottom:c.style.bottom,left:c.style.left,right:c.style.right,width:c.style.width,marginTop:c.style.marginTop,marginLeft:c.style.marginLeft,marginRight:c.style.marginRight};var p=e(h.top);this._limits={start:m.top+a.pageYOffset-p,end:n.top+a.pageYOffset+l.offsetHeight-e(o.borderBottomWidth)-c.offsetHeight-p-e(h.marginBottom)};var q=o.position;"absolute"!=q&&"relative"!=q&&(l.style.position="relative"),this._recalcPosition();var r=this._clone={};r.node=b.createElement("div"),d(r.node.style,{width:m.right-m.left+"px",height:m.bottom-m.top+"px",marginTop:h.marginTop,marginBottom:h.marginBottom,marginLeft:h.marginLeft,marginRight:h.marginRight,cssFloat:h.cssFloat,padding:0,border:0,borderSpacing:0,fontSize:"1em",position:"static"}),k.insertBefore(r.node,c),r.docOffsetTop=f(r.node)}}}},{key:"_recalcPosition",value:function(){if(this._active&&!this._removed){var a=k.top<=this._limits.start?"start":k.top>=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",to
90p: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;b<l.length;b++)if(l[b]._node===a)return l[b];return new m(a)},add:function(a){if(a instanceof HTMLElement&&(a=[a]),a.length){for(var b=[],c=function(c){var d=a[c];return d instanceof HTMLElement?l.some(function(a){if(a._node===d)return b.push(a),!0})?"continue":void b.push(new m(d)):(b.push(void 0),"continue")},d=0;d<a.length;d++){c(d)}return b}},refreshAll:function(){l.forEach(function(a){return a.refresh()})},removeOne:function(a){if(!(a instanceof HTMLElement)){if(!a.length||!a[0])return;a=a[0]}l.some(function(b){if(b._node===a)return b.remove(),!0})},remove:function(a){if(a instanceof HTMLElement&&(a=[a]),a.length)for(var b=function(b){var c=a[b];l.some(function(a){if(a._node===c)return a.remove(),!0})},c=0;c<a.length;c++)b(c)},removeAll:function(){for(;l.length;)l[0].remove()}};i||g(),"undefined"!=typeof module&&module.exports?module.exports=n:a.Stickyfill=n}(window,document);; 91/* Placeholders.js v4.0.1 */ 92/*! 93 * The MIT License 94 * 95 * Copyright (c) 2012 James Allardice 96 * 97 * Permission is hereby granted, free of charge, to any person obtaining a copy 98 * of this software and associated documentation files (the "Software"), to 99 * deal in the Software without restriction, including without limitation the 100 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 101 * sell copies of the Software, and to permit persons to whom the Software is 102 * furnished to do so, subject to the following conditions: 103 * 104 * The above copyright notice and this permission notice shall be included in 105 * all copies or substantial portions of the Software. 106 * 107 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 108 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 109 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 110 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 111 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 112 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 113 * IN THE SOFTWARE. 114 */ 115!function(a){"use strict";function b(){}function c(){try{return document.activeElement}catch(a){}}function d(a,b){for(var c=0,d=a.length;d>c;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}}
115function 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=V<N.length?N[V]:O[V-N.length],T=U.attributes.placeholder,T&&(T=T.nodeValue,T&&d(w,U.type)&&s(U));var X=setInterval(function(){for(var a=0,b=N.length+O.length;b>a;a++)U=a<N.length?N[a]:O[a-N.length],T=U.attributes.placeholder,T?(T=T.nodeValue,T&&d(w,U.type)&&(U.getAttribute(F)||s(U),(T!==U.getAttribute(B)||"password"===U.type&&!U.getAttribute(D))&&("password"===U.type&&!U.getAttribute(D)&&g(U,"text")&&U.setAttribute(D,"password"),U.value===U.getAttribute(B)&&(U.value=T),U.setAttribute(B,T)))):U.getAttribute(C)&&(k(U),U.removeAttribute(B));Q||clearInterval(X)},J);e(a,"beforeunload",function(){M.disable()})}}(this),function(a,b){"use strict";var c=a.fn.val,d=a.fn.prop;b.Placeholders.nativeSupport||(a.fn.val=function(a){var b=c.apply(this,arguments),d=this.eq(0).data("placeholder-value");return void 0===a&&this.eq(0).data("placeholder-active")&&b===d?"":b},a.fn.prop=function(a,b){return void 0===b&&this.eq(0).data("placeholder-active")&&"value"===a?"":d.apply(this,arguments)})}(jQuery,this);; 116/** 117 * Timeago is a jQuery plugin that makes it easy to support automatically 118 * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). 119 * 120 * @name timeago 121 * @version 1.5.2 122 * @requires jQuery v1.2.3+ 123 * @author Ryan McGeary 124 * @license MIT License - http://www.opensource.org/licenses/mit-license.php 125 * 126 * For usage and examples, visit: 127 * http://timeago.yarp.com/ 128 * 129 * Copyright (c) 2008-2015, Ryan McGeary (ryan -[at]- mcgeary [*dot*] org) 130 */ 131 132(function (factory) { 133 if (typeof define === 'function' && define.amd) { 134 // AMD. Register as an anonymous module. 135 define(['jquery'], factory); 136 } else if (typeof module === 'object' && typeof module.exports === 'object') { 137 factory(require('jquery')); 138 } else { 139 // Browser globals 140 factory(jQuery); 141 } 142}(function ($) { 143 $.timeago = function(timestamp) { 144 if (timestamp instanceof Date) { 145 return inWords(timestamp); 146 } else if (typeof timestamp === "string") { 147 return inWords($.timeago.parse(timestamp)); 148 } else if (typeof timestamp === "number") { 149 return inWords(new Date(timestamp)); 150 } else { 151 return inWords($.timeago.datetime(timestamp)); 152 } 153 }; 154 var $t = $.timeago; 155 156 $.extend($.timeago, { 157 settings: { 158 refreshMillis: 60000, 159 allowPast: true, 160 allowFuture: false, 161 localeTitle: false, 162 cutoff: 0, 163 autoDispose: true, 164 strings: { 165 prefixAgo: null, 166 prefixFromNow: null, 167 suffixAgo: "ago", 168 suffixFromNow: "from now", 169 inPast: 'any moment now', 170 seconds: "less than a minute", 171 minute: "about a minute", 172 minutes: "%d minutes", 173 hour: "about an hour", 174 hours: "about %d hours", 175 day: "a day", 176 days: "%d days", 177 month: "about a month", 178 months: "%d months", 179 year: "about a year", 180 years: "%d years", 181 wordSeparator: " ", 182 numbers: [] 183 } 184 }, 185 186 inWords: function(distanceMillis) { 187 if (!this.settings.allowPast && ! this.settings.allowFuture) { 188 throw 'timeago allowPast and allowFuture settings can not both be set to false.'; 189 } 190 191 var $l = this.settings.strings; 192 var prefix = $l.prefixAgo; 193 var suffix = $l.suffixAgo; 194 if (this.settings.allowFuture) { 195 if (distanceMillis < 0) { 196 prefix = $l.prefixFromNow; 197 suffix = $l.suffixFromNow; 198 } 199 } 200 201 if (!this.settings.allowPast && distanceMillis >= 0) { 202 return this.settings.strings.inPast; 203 } 204 205 var seconds = Math.abs(distanceMillis) / 1000; 206 var minutes = seconds / 60; 207 var hours = minutes / 60; 208 var days = hours / 24; 209 var years = days / 365; 210 211 function substitute(stringOrFunction, number) { 212 var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction; 213 var value = ($l.numbers && $l.numbers[number]) || number; 214 return string.replace(/%d/i, value); 215 } 216 217 var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || 218 seconds < 90 && substitute($l.minute, 1) || 219 minutes < 45 && substitute($l.minutes, Math.round(minutes)) || 220 minutes < 90 && substitute($l.hour, 1) || 221 hours < 24 && substitute($l.hours, Math.round(hours)) || 222 hours < 42 && substitute($l.day, 1) || 223 days < 30 && substitute($l.days, Math.round(days)) || 224 days < 45 && substitute($l.month, 1) || 225 days < 365 && substitute($l.months, Math.round(days / 30)) || 226 years < 1.5 && substitute($l.year, 1) || 227 substitute($l.years, Math.round(years)); 228 229 var separator = $l.wordSeparator || ""; 230 if ($l.wordSeparator === undefined) { separator = " "; } 231 return $.trim([prefix, words, suffix].join(separator)); 232 }, 233 234 parse: function(iso8601) { 235 var s = $.trim(iso8601); 236 s = s.replace(/\.\d+/,""); // remove milliseconds 237 s = s.replace(/-/,"/").replace(/-/,"/"); 238 s = s.replace(/T/," ").replace(/Z/," UTC"); 239 s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 240 s = s.replace(/([\+\-]\d\d)$/," $100"); // +09 -> +0900 241 return new Date(s); 242 }, 243 datetime: function(elem) { 244 var iso8601 = $t.isTime(elem) ? $(elem).attr("datetime") : $(elem).attr("title"); 245 return $t.parse(iso8601); 246 }, 247 isTime: function(elem) { 248 // jQuery's `is()` doesn't play well with HTML5 in IE 249 return $(elem).get(0).tagName.toLowerCase() === "time"; // $(elem).is("time"); 250 } 251 }); 252 253 // functions that can be called via $(el).timeago('action') 254 // init is default when no action is given 255 // functions are called with context of a single element 256 var functions = { 257 init: function() { 258 var refresh_el = $.proxy(refresh, this); 259 refresh_el(); 260 var $s = $t.settings; 261 if ($s.refreshMillis > 0) { 262 this._timeagoInterval = setInterval(refresh_el, $s.refreshMillis); 263 } 264 }, 265 update: function(timestamp) { 266 var date = (timestamp instanceof Date) ? timestamp : $t.parse(timestamp); 267 $(this).data('timeago', { datetime: date }); 268 if ($t.settings.localeTitle) $(this).attr("title", date.toLocaleStr
268ing()); 269 refresh.apply(this); 270 }, 271 updateFromDOM: function() { 272 $(this).data('timeago', { datetime: $t.parse( $t.isTime(this) ? $(this).attr("datetime") : $(this).attr("title") ) }); 273 refresh.apply(this); 274 }, 275 dispose: function () { 276 if (this._timeagoInterval) { 277 window.clearInterval(this._timeagoInterval); 278 this._timeagoInterval = null; 279 } 280 } 281 }; 282 283 $.fn.timeago = function(action, options) { 284 var fn = action ? functions[action] : functions.init; 285 if (!fn) { 286 throw new Error("Unknown function name '"+ action +"' for timeago"); 287 } 288 // each over objects here and call the requested function 289 this.each(function() { 290 fn.call(this, options); 291 }); 292 return this; 293 }; 294 295 function refresh() { 296 var $s = $t.settings; 297 298 //check if it's still visible 299 if ($s.autoDispose && !$.contains(document.documentElement,this)) { 300 //stop if it has been removed 301 $(this).timeago("dispose"); 302 return this; 303 } 304 305 var data = prepareData(this); 306 307 if (!isNaN(data.datetime)) { 308 if ( $s.cutoff == 0 || Math.abs(distance(data.datetime)) < $s.cutoff) { 309 $(this).text(inWords(data.datetime)); 310 } 311 } 312 return this; 313 } 314 315 function prepareData(element) { 316 element = $(element); 317 if (!element.data("timeago")) { 318 element.data("timeago", { datetime: $t.datetime(element) }); 319 var text = $.trim(element.text()); 320 if ($t.settings.localeTitle) { 321 element.attr("title", element.data('timeago').datetime.toLocaleString()); 322 } else if (text.length > 0 && !($t.isTime(element) && element.attr("title"))) { 323 element.attr("title", text); 324 } 325 } 326 return element.data("timeago"); 327 } 328 329 function inWords(date) { 330 return $t.inWords(distance(date)); 331 } 332 333 function distance(date) { 334 return (new Date().getTime() - date.getTime()); 335 } 336 337 // fix for IE6 suckage 338 document.createElement("abbr"); 339 document.createElement("time"); 340}));; 341// English (Template) 342jQuery.timeago.settings.strings = { 343 prefixAgo: null, 344 prefixFromNow: null, 345 suffixAgo: "ago", 346 suffixFromNow: "from now", 347 seconds: "less than a minute", 348 minute: "about a minute", 349 minutes: "%d minutes", 350 hour: "about an hour", 351 hours: "about %d hours", 352 day: "a day", 353 days: "%d days", 354 month: "about a month", 355 months: "%d months", 356 year: "about a year", 357 years: "%d years", 358 wordSeparator: " ", 359 numbers: [] 360}; 361; 362/*! 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 */ 363 364window.matchMedia || (window.matchMedia = function() { 365 "use strict"; 366 367 // For browsers that support matchMedium api such as IE 9 and webkit 368 var styleMedia = (window.styleMedia || window.media); 369 370 // For those that don't support matchMedium 371 if (!styleMedia) { 372 var style = document.createElement('style'), 373 script = document.getElementsByTagName('script')[0], 374 info = null; 375 376 style.type = 'text/css'; 377 style.id = 'matchmediajs-test'; 378 379 script.parentNode.insertBefore(style, script); 380 381 // 'style.currentStyle' is used by IE <= 8 and 'window.getComputedStyle' for all other browsers 382 info = ('getComputedStyle' in window) && window.getComputedStyle(style, null) || style.currentStyle; 383 384 styleMedia = { 385 matchMedium: function(media) { 386 var text = '@media ' + media + '{ #matchmediajs-test { width: 1px; } }'; 387 388 // 'style.styleSheet' is used by IE <= 8 and 'style.textContent' for all other browsers 389 if (style.styleSheet) { 390 style.styleSheet.cssText = text; 391 } else { 392 style.textContent = text; 393 } 394 395 // Test if media query is true or false 396 return info.width === '1px'; 397 } 398 }; 399 } 400 401 return function(media) { 402 return { 403 matches: styleMedia.matchMedium(media || 'all'), 404 media: media || 'all' 405 }; 406 }; 407}()); 408; 409/*! matchMedia() polyfill addListener/removeListener extension. Author & copyright (c) 2012: Scott Jehl. Dual MIT/BSD license */ 410(function(){ 411 // Bail out for browsers that have addListener support 412 if (window.matchMedia && window.matchMedia('all').addListener) { 413 return false;
414 } 415 416 var localMatchMedia = window.matchMedia, 417 hasMediaQueries = localMatchMedia('only all').matches, 418 isListening = false, 419 timeoutID = 0, // setTimeout for debouncing 'handleChange' 420 queries = [], // Contains each 'mql' and associated 'listeners' if 'addListener' is used 421 handleChange = function(evt) { 422 // Debounce 423 clearTimeout(timeoutID); 424 425 timeoutID = setTimeout(function() { 426 for (var i = 0, il = queries.length; i < il; i++) { 427 var mql = queries[i].mql, 428 listeners = queries[i].listeners || [], 429 matches = localMatchMedia(mql.media).matches; 430 431 // Update mql.matches value and call listeners 432 // Fire listeners only if transitioning to or from matched state 433 if (matches !== mql.matches) { 434 mql.matches = matches; 435 436 for (var j = 0, jl = listeners.length; j < jl; j++) { 437 listeners[j].call(window, mql); 438 } 439 } 440 } 441 }, 30); 442 }; 443 444 window.matchMedia = function(media) { 445 var mql = localMatchMedia(media), 446 listeners = [], 447 index = 0; 448 449 mql.addListener = function(listener) { 450 // Changes would not occur to css media type so return now (Affects IE <= 8) 451 if (!hasMediaQueries) { 452 return; 453 } 454 455 // Set up 'resize' listener for browsers that support CSS3 media queries (Not for IE <= 8) 456 // There should only ever be 1 resize listener running for performance 457 if (!isListening) { 458 isListening = true; 459 window.addEventListener('resize', handleChange, true); 460 } 461 462 // Push object only if it has not been pushed already 463 if (index === 0) { 464 index = queries.push({ 465 mql : mql, 466 listeners : listeners 467 }); 468 } 469 470 listeners.push(listener); 471 }; 472 473 mql.removeListener = function(listener) { 474 for (var i = 0, il = listeners.length; i < il; i++){ 475 if (listeners[i] === listener){ 476 listeners.splice(i, 1); 477 } 478 } 479 }; 480 481 return mql; 482 }; 483}()); 484; 485/*! Picturefill - v2.3.1 - 2015-04-09 486* http://scottjehl.github.io/picturefill 487* Copyright (c) 2015 https://github.com/scottjehl/picturefill/blob/master/Authors.txt; Licensed MIT */ 488window.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;
488left: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;
vendor: 10,125 bytes, lines 488-502
488if("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);; 489/*! 490Waypoints - 4.0.0 491Copyright © 2011-2015 Caleb Troughton 492Licensed under the MIT license. 493https://github.com/imakewebthings/waypoints/blog/master/licenses.txt 494*/ 495!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,h=o.newScroll>=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,p=d.triggerPoint>=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))}();; 496/*! 497 * enquire.js v2.1.2 - Awesome Media Queries in JavaScript 498 * Copyright (c) 2014 Nick Williams - http://wicky.nillia.ms/enquire.js 499 * License: MIT (http://www.opensource.org/licenses/mit-license.php) 500 */ 501 502!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)}
502function 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});; 503/* global window */ 504/* global document */ 505/* global jQuery */ 506/* global g1 */ 507/* global bimber_front_config */ 508/* global SuperGif */ 509/* global Waypoint */ 510/* global enquire */ 511/* global mashsb */ 512/* global auto_load_next_post_params */ 513/* global FB */ 514/* global mejs */ 515/* global ga */ 516/* global embedly */ 517/* global console */ 518 519/************* 520 * 521 * Init env 522 * 523 *************/ 524 525(function($) { 526 'use strict'; 527 528 var config = bimber_front_config; 529 530 // namespace 531 var g1 = { 532 'config': config 533 }; 534 535 g1.getWindowWidth = function () { 536 if (typeof window.innerWidth !== 'undefined') { 537 return window.innerWidth; 538 } 539 540 return $(window).width(); 541 }; 542 543 g1.isDesktopDevice = function () { 544 return g1.getWindowWidth() > g1.getDesktopBreakpoint(); 545 }; 546 547 g1.getDesktopBreakpoint = function () { 548 var desktopBreakPoint = $('#g1-breakpoint-desktop').css('min-width'); 549 550 if ( ! desktopBreakPoint ) { 551 return 9999; 552 } 553 554 desktopBreakPoint = parseInt( desktopBreakPoint, 10 ); 555 556 // not set explicitly via css 557 if (desktopBreakPoint === 0) { 558 return 9999; 559 } 560 561 return desktopBreakPoint; 562 }; 563 564 g1.isTouchDevice = function () { 565 return ('ontouchstart' in window) || navigator.msMaxTouchPoints; 566 }; 567 568 g1.isStickySupported = function () { 569 var prefixes = ['', '-webkit-', '-moz-', '-ms-']; 570 var block = document.createElement('div'); 571 var supported = false; 572 var i; 573 574 // Test for native support. 575 for (i = prefixes.length - 1; i >= 0; i--) { 576 try { 577 block.style.position = prefixes[i] + 'sticky'; 578 } 579 catch(e) {} 580 if (block.style.position !== '') { 581 supported = true; 582 } 583 } 584 585 return supported; 586 }; 587 588 g1.isRTL = function () { 589 return $('body').is('.rtl'); 590 }; 591 592 g1.log = function(data) { 593 if ((g1.config.debug_mode || window.bimberDebugMode) && typeof console !== 'undefined') { 594 if ($.isArray(data)) { 595 for (var i in data) { 596 console.log(data[i]); 597 } 598 } else { 599 console.log(data); 600 } 601 } 602 }; 603 604 g1.createCookie = function (name,value,time) { 605 var expires; 606 607 if (time) { 608 var date = new Date(); 609 var ms = time; 610 611 if (typeof time === 'object') { 612 ms = time.value; 613 614 switch (time.type) { 615 case 'days': 616 ms = ms * 24 * 60 * 60 * 1000; 617 break; 618 } 619 } 620 621 date.setTime(date.getTime() + ms); 622 expires = '; expires=' + date.toGMTString(); 623 } 624 else { 625 expires = ''; 626 } 627 628 document.cookie = name + '=' + value + expires + '; path=/'; 629 }; 630 631 g1.readCookie = function (name) { 632 var nameEQ = name + '='; 633 var ca = document.cookie.split(';'); 634 635 for(var i = 0; i < ca.length; i += 1) { 636 var c = ca[i]; 637 while (c.charAt(0) === ' ') { 638 c = c.substring(1,c.length); 639 } 640 641 if (c.indexOf(nameEQ) === 0) { 642 return c.substring(nameEQ.length,c.length); 643 } 644 } 645 646 return null; 647 }; 648 649 g1.removeCookie = function (name) { 650 g1.createCookie(name, '', -1); 651 }; 652 653 // expose to the world 654 window.g1 = g1; 655})(jQuery); 656 657/************* 658 * 659 * UI Helpers 660 * 661 ************/ 662 663(function ($) { 664 665 'use strict'; 666 667 g1.uiHelpers = function () { 668 if (g1.isTouchDevice()) { 669 $('body').removeClass( 'g1-hoverable' ); 670 } 671 672 // ----------------- 673 // Mailchimp widget. 674 // ----------------- 675 676 var mc4wpClasses = [ 677 'g1-box', 678 'g1-box-tpl-frame', 679 'g1-newsletter' 680 ]; 681
682 var mc4wpBackgroundClasses = [ 683 'g1-box-background' 684 ]; 685 686 if ('original-2018' === g1.config.stack || 'food' === g1.config.stack ) { 687 mc4wpBackgroundClasses.push('g1-current-background'); 688 } 689 690 if ( 'miami' === g1.config.stack || 'music' === g1.config.stack ) { 691 mc4wpClasses.push('g1-dark'); 692 } 693 694 $('.widget_mc4wp_form_widget'). 695 addClass(mc4wpClasses.join(' ')). 696 wrapInner('<div class="g1-box-inner"></div>'). 697 prepend('<div class="g1-box-icon"></div>'). 698 append('<div class="' + mc4wpBackgroundClasses.join(' ') + '"></div>'); 699 700 701 702 // ----------- 703 // bbPress. 704 // ----------- 705 706 var bbPressBackgroundClasses = [ 707 'g1-box-background' 708 ]; 709 710 if ('original-2018' === g1.config.stack || 'food' === g1.config.stack ) { 711 bbPressBackgroundClasses.push('g1-current-background'); 712 } 713 714 $('.bbp_widget_login'). 715 addClass('g1-box g1-box-tpl-frame'). 716 wrapInner('<div class="g1-box-inner"></div>'). 717 append('<div class="' + bbPressBackgroundClasses.join(' ') + '"></div>'); 718 719 720 // ---------- 721 // Search UI. 722 // ---------- 723 724 $('.g1-drop-the-search').on('click', '.g1-drop-toggle', function (e) { 725 e.preventDefault(); 726 727 $('.g1-drop-the-search input.search-field').focus(); 728 }); 729 730 $('.search-submit').on('click', function(e){ 731 var $form = $(this).closest('form'); 732 var $input = $('input.search-field', $form); 733 if ( ! $input.val()){ 734 e.preventDefault(); 735 } 736 }); 737 738 $('#buddypress .load-more').click(function() { 739 var i = 0; 740 var intervalID = setInterval( function() { 741 $('body').trigger( 'g1PageHeightChanged' ); 742 i++; 743 if (i === 5){ 744 window.clearInterval(intervalID); 745 } 746 },1000); 747 }); 748 }; 749 750})(jQuery); 751 752/**************** 753 * 754 * Facebook SDK 755 * 756 ****************/ 757 758(function ($) { 759 760 'use strict'; 761 762 g1.resetFacebookSDK = function () { 763 $('script#facebook-jssdk').remove(); 764 $('#fb-root').remove(); 765 if (window.FB) { 766 delete window.FB; 767 } 768 }; 769 770 $('body').on( 'g1BeforeNewContentReady', function ( e, $newContent ) { 771 if ($newContent.find('.fb-video').length > 0) { 772 g1.resetFacebookSDK(); 773 } 774 } ); 775 776})(jQuery); 777 778/**************** 779 * 780 * Instagram SDK 781 * 782 ****************/ 783 784(function ($) { 785 786 'use strict'; 787 788 $('body').on( 'g1NewContentLoaded', function ( e, $newContent ) { 789 if ($newContent.find('.instagram-media').length > 0) { 790 if (typeof instgrm !== 'undefined' && typeof instgrm.Embeds !== 'undefined') { 791 instgrm.Embeds.process(); 792 } 793 } 794 } ); 795 796})(jQuery); 797 798/******************** 799 * 800 * Load More Button 801 * 802 ********************/ 803 804(function ($) { 805 806 'use strict'; 807 808 // prevent triggering the action more than once at the time 809 var loading = false; 810 var startingUrl = window.location.href; 811 var setTargetBlank = g1.config.setTargetBlank; 812 var useWaypoints = g1.config.useWaypoints; 813 814 g1.loadMoreButton = function () { 815 $('.g1-load-more').on('click', function (e) { 816 if (loading) { 817 return; 818 } 819 820 loading = true; 821 822 e.preventDefault(); 823 824 var $button = $(this); 825 var $collectionMore = $button.parents('.g1-collection-more'); 826 var url = $button.attr('data-g1-next-page-url'); 827 var $endMessage = $('.g1-pagination-end'); 828 829 $collectionMore.addClass('g1-collection-more-loading'); 830 831 // load page 832 var xhr = $.get(url); 833 834 // on success 835 xhr.done(function (data) { 836 var collectionSelector = '#primary > .g1-collection .g1-collection-items'; 837 838 // find elements in response 839 var $resCollectionItems = $(data).find(collectionSelector).find('.g1-collection-item'); 840 var $resButton = $(data).find('.g1-load-more'); 841 842 // find collection on page 843 var $collection = $(collectionSelector); 844 845 // add extra classes to new loaded items 846 $resCollectionItems.addClass('g1-collection-item-ad
846ded'); 847 848 // If there are insta embeds BEFORE the load, we will force to refresh them AFTER the load 849 var $insta = $('script[src="//platform.instagram.com/en_US/embeds.js"]'); 850 851 // make sure that mejs is loaded 852 if (window.wp && typeof window.wp.mediaelement === 'undefined') { 853 var matches = data.match(/<script(.|\n)*?<\/script>/g); 854 var mejsCode = ''; 855 matches.forEach(function( match ) { 856 if ( match.indexOf('mejs') > 0 || match.indexOf('mediaelement') > 0 ){ 857 match = match.replace('<script','<script async'); 858 mejsCode+=match; 859 } 860 }); 861 matches = data.match(/<link(.|\n)*?\/>/g); 862 matches.forEach(function( match ) { 863 if ( match.indexOf('mejs') > 0 || match.indexOf('mediaelement') > 0 ){ 864 mejsCode+=match; 865 } 866 }); 867 $collection.after(mejsCode); 868 } 869 if (setTargetBlank) { 870 $('a',$resCollectionItems).attr('target','_blank'); 871 } 872 873 var $collection_waypoint = '<span class="bimber-collection-waypoint" data-bimber-archive-url="' + url + '"></span>'; 874 $collection.append($collection_waypoint); 875 // add new elements to collection 876 $collection.append($resCollectionItems); 877 878 // Google Analytics. 879 if ( typeof ga !== 'undefined' && typeof ga.getAll !== 'undefined') { 880 ga('create', ga.getAll()[0].get('trackingId'), 'auto'); 881 ga('set', { location: url }); 882 ga('send', 'pageview'); 883 } 884 885 if ( $insta.length > 0) { 886 window.instgrm.Embeds.process(); 887 } 888 889 if (window.wp && typeof window.wp.mediaelement !== 'undefined') { 890 window.wp.mediaelement.initialize(); 891 } 892 893 // load all dependent functions 894 $('body').trigger( 'g1PageHeightChanged' ); 895 $('body').trigger( 'g1NewContentLoaded', [ $resCollectionItems ] ); 896 897 // update more button 898 if ($resButton.length > 0) { 899 $button.attr('data-g1-next-page-url', $resButton.attr('data-g1-next-page-url')); 900 } else { 901 $collectionMore.remove(); 902 } 903 904 //bind auto play video events 905 if (typeof g1.autoPlayVideo === 'function') { 906 g1.autoPlayVideo(); 907 } 908 909 if ( useWaypoints ){ 910 $('.bimber-collection-waypoint').waypoint(function(direction) { 911 var $waypoint = $(this.element); 912 if('up' === direction) { 913 var $waypointUp = $waypoint.prevAll('.bimber-collection-waypoint'); 914 if ($waypointUp.length > 0){ 915 $waypoint = $($waypointUp[0]); 916 } else { 917 window.history.replaceState( {} , '', startingUrl ); 918 return; 919 } 920 } 921 var waypointUrl = $waypoint.attr('data-bimber-archive-url'); 922 var currentUrl = window.location.href; 923 if ( waypointUrl !== currentUrl ){ 924 window.history.replaceState( {} , '', waypointUrl ); 925 } 926 }, { 927 offset: '-5%' 928 }); 929 } 930 }); 931 932 xhr.fail(function () { 933 $button.addClass('g1-info-error'); 934 $button.remove(); 935 $endMessage.show(); 936 }); 937 938 xhr.always(function () { 939 $collectionMore.removeClass('g1-collection-more-loading'); 940 loading = false;
941 }); 942 }); 943 }; 944 945})(jQuery); 946 947 948/******************* 949 * 950 * Infinite scroll 951 * 952 ******************/ 953 954(function ($) { 955 956 'use strict'; 957 958 g1.infiniteScrollConfig = { 959 'offset': '150%' 960 }; 961 962 var triggeredByClick = false; 963 964 g1.infiniteScroll = function () { 965 $('.g1-collection-more.infinite-scroll').each(function () { 966 var $this = $(this); 967 968 if ($this.is('.on-demand') && !triggeredByClick) { 969 return false; 970 } 971 972 $this.waypoint(function(direction) { 973 if('down' === direction) { 974 $this.find('.g1-load-more').trigger('click'); 975 } 976 }, { 977 // trigger when the "Load More" container is 10% under the browser window 978 offset: g1.infiniteScrollConfig.offset 979 }); 980 }); 981 }; 982 983 // wait for new content and apply infinite scroll events to it 984 $('body').on( 'g1NewContentLoaded', function () { 985 triggeredByClick = true; 986 g1.infiniteScroll(); 987 } ); 988 989})(jQuery); 990 991 992 993/******************* 994 * 995 * Date > Time ago 996 * 997 ******************/ 998 999(function ($) { 1000 1001 'use strict'; 1002 1003 g1.dateToTimeago = function () { 1004 if (!$.fn.timeago) { 1005 return; 1006 } 1007 1008 var $body = $('body'); 1009 1010 $('time.entry-date, span.entry-date > time, .comment-metadata time, time.snax-item-date').timeago(); 1011 1012 $body.on( 'g1NewContentLoaded', function (e, $newContent) { 1013 if ($newContent) { 1014 $newContent.find('time.entry-date, .comment-metadata time, time.snax-item-date').timeago(); 1015 } 1016 } ); 1017 1018 // CommentAce integration. 1019 $body.on( 'caceWpCommentInitialized', function (e) { 1020 $(e.detail).find('time.entry-date, .comment-metadata time, time.snax-item-date').timeago(); 1021 } ); 1022 }; 1023 1024})(jQuery); 1025 1026 1027/********** 1028 * 1029 * Canvas 1030 * 1031 *********/ 1032 1033(function($) { 1034 'use strict'; 1035 1036 var selectors = { 1037 'toggle': '.g1-hamburger' 1038 }; 1039 1040 g1.globalCanvasSelectors = selectors; 1041 1042 var canvas; 1043 1044 g1.canvas = function() { 1045 canvas = Canvas(); 1046 1047 // Allow global access. 1048 g1.canvasInstance = canvas; 1049 1050 $(selectors.toggle).on('click', function (e) { 1051 e.preventDefault(); 1052 1053 //$('html, body').animate({ // @maybe 1054 // scrollTop: 0 // @maybe 1055 //}, 10); // @maybe 1056 1057 canvas.toggle(); 1058 }); 1059 }; 1060 1061 function Canvas () { 1062 var that = {}; 1063 var listeners = { 1064 'open': [], 1065 'close': [] 1066 }; 1067 1068 var currentContent = ''; 1069 1070 var currentScroll = 0; // @maybe 1071 1072 var _clientY; 1073 1074 var init = function () {
1075 var $overlay = $( '.g1-canvas-overlay'); 1076 1077 // toogle canvas events 1078 $overlay.on('click', that.toggle); 1079 1080 $('.g1-canvas').on('toggle-canvas', function () { 1081 that.toggle(); 1082 }); 1083 1084 $('.g1-canvas .g1-canvas-toggle').on('click', that.toggle); 1085 1086 1087 if ( $('html.g1-off-outside').length ) { 1088 enquire.register('screen and ( min-width: 700px )', { 1089 match : function() { 1090 that.close(); 1091 } 1092 }); 1093 } 1094 1095 if ( $('html.g1-off-inside').length ) { 1096 enquire.register('screen and ( max-width: 1024px )', { 1097 match : function() { 1098 that.close(); 1099 } 1100 }); 1101 1102 enquire.register('screen and ( min-width: 1025px )', { 1103 match : function() { 1104 that.lazyload(); 1105 } 1106 }); 1107 } 1108 1109 return that; 1110 }; 1111 1112 that.getContent = function() { 1113 return $('.g1-canvas-global .g1-canvas-content'); 1114 }; 1115 1116 that.captureClientY = function (event) { 1117 // only respond to a single touch 1118 //if (event.targetTouches.length === 1) { 1119 _clientY = event.targetTouches[0].clientY; 1120 //} 1121 }; 1122 1123 that.disableCanvasScroll = function( e ) { 1124 // only respond to a single touch 1125 //if (e.targetTouches.length !== 1) { 1126 // return; 1127 //} 1128 1129 var _element = $('.g1-canvas'); 1130 1131 var clientY = e.targetTouches[0].clientY - _clientY; 1132 1133 // The element at the top of its scroll, 1134 // and the user scrolls down 1135 if (_element.scrollTop === 0 && clientY > 0) { 1136 1137 alert('top scroll'); 1138 1139 e.preventDefault(); 1140 e.stopPropagation(); 1141 return false; 1142 } 1143 1144 // The element at the bottom of its scroll, 1145 // and the user scrolls up 1146 // https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight#Problems_and_solutions 1147 if ((_element.scrollHeight - _element.scrollTop <= _element.clientHeight) && clientY < 0) { 1148 alert('bottom scroll'); 1149 1150 e.preventDefault(); 1151 e.stopPropagation(); 1152 return false; 1153 } 1154 }; 1155 1156 that.disableBodyScroll = function( e ) { 1157 //e.preventDefault(); 1158 //e.stopPropagation(); 1159 //return false; 1160 }; 1161 1162 that.lazyload = function() { 1163 $('.g1-canvas-background[data-bg]:not(.lazyloaded)').addClass('lazyload'); 1164 }; 1165 1166 that.open = function (content) { 1167 //$('.g1-canvas').on('touchstart', that.captureClientY); 1168 //$('.g1-canvas').on('touchmove', that.disableCanvasScroll); 1169 1170 that.lazyload(); 1171 1172 window.requestAnimationFrame(function () { 1173 var breakpoint = $(document).width(); 1174 var cssClass = breakpoint >= 1025 ? 'g1-off-global-desktop' : 'g1-off-global'; 1175 $('html').addClass(cssClass); 1176 1177 currentContent = content; 1178 var $canvas = $('.g1-canvas-global'); 1179 1180 if (content) { 1181 if (typeof content === 'string') { 1182 $canvas.find('.g1-canvas-content').html(content); 1183 } else { 1184 $canvas.find('.g1-canvas-content').empty().append(content); 1185 } 1186 1187 // notify about adding new content to DOM so other elements can be reloaded 1188 $canvas.find('.g1-canvas-content').trigger('g1-new-content'); 1189 1190 } 1191 1192 that.notify('open'); 1193 }); 1194 }; 1195 1196 that.close = function () { 1197 //$('.g1-canvas').off('touchmove', that.disableCanvasScroll); 1198 //$('.g1-canvas').off('touchstart', that.captureClientY); 1199 1200 window.requestAnimationFrame(function () { 1201 $('html').removeClass('g1-off-global g1-off-global-desktop'); 1202 1203 that.notify('close'); 1204 }); 1205 }; 1206 1207 that.toggle = function (e) { 1208 if (e) { 1209 e.preventDefault(); 1210 } 1211 1212 // is opened? 1213 if ( $('html').is('.g1-off-global, .g1-off-global-desktop') ) { 1214 that.close(); 1215 } else { 1216 that.open(null); 1217 } 1218 }; 1219 1220 that.notify = function (eventType) { 1221 var callbacks = listeners[eventType]; 1222 1223 for (var i = 0; i < callbacks.length; i++) { 1224 callbacks[i](that.getContent()); 1225 } 1226 }; 1227 1228 that.on = function (eventType, listener, priority) { 1229 listeners[eventType][priority] = listener; 1230 }; 1231 1232 return init(); 1233 } 1234 1235})(jQuery); 1236 1237 1238/******************** 1239 * 1240 * Sticky sidebar 1241 * 1242 ********************/ 1243 1244(function($) { 1245 'use strict'; 1246 1247 var $waypointElem = false;
1248 1249 var selectors = { 1250 'stickyWidgetWrapper': '.g1-sticky-widget-wrapper', 1251 'stickyWidget': '.g1-sticky-widget', 1252 'widget': '.widget', 1253 'content': '#primary .entry-content' 1254 }; 1255 1256 var sidebarSelectors = [ 1257 '#secondary', 1258 '#tertiary' 1259 ]; 1260 1261 g1.stickyTopOffsetSelectors = [ 1262 '#wpadminbar', 1263 '.g1-iframe-bar', 1264 '.g1-sharebar-loaded', 1265 '.g1-sticky-top-wrapper' 1266 ]; 1267 1268 g1.resetStickyElements = function() { 1269 $(selectors.stickyWidgetWrapper).css('height', ''); 1270 $(selectors.stickyWidget).css('position', 'block'); 1271 }; 1272 1273 g1.stickySidebar = function() { 1274 if (!g1.isDesktopDevice()) { 1275 g1.resetStickyElements(); 1276 return; 1277 } 1278 1279 var $widgets = $(selectors.stickyWidget); 1280 1281 if ($widgets.length === 0) { 1282 return; 1283 } 1284 1285 // Calc top offset for sticky elements. 1286 var topOffset = 0; 1287 1288 $(g1.stickyTopOffsetSelectors).each(function() { 1289 var $element = $(this); 1290 1291 if ($element.length > 0 && $element.is(':visible')) { 1292 topOffset += parseInt($element.outerHeight(), 10); 1293 } 1294 }); 1295 1296 // Adjust widgets top offset to keep them always fully visible. 1297 $widgets.each(function() { 1298 var $widget = $(this); 1299 var top = parseInt($widget.css('top'), 10); 1300 1301 if (topOffset > 0) { 1302 top += topOffset; 1303 1304 $widget.css('top', top + 'px'); 1305 } 1306 }); 1307 1308 // Apply "position: sticky" pollyfill (IE9+). 1309 if (typeof Stickyfill !== 'undefined') { 1310 Stickyfill.add($widgets); 1311 } 1312 1313 /** 1314 * Increase the last widget height to cover entire sidebar. 1315 * 1316 * @param {Boolean} isVariableContent - Determines which element is used for widget height calculation. 1317 */ 1318 var adjustLastWidgetHeight = function(isVariableContent) { 1319 $(sidebarSelectors).each(function() { 1320 var $sidebar = $(this); 1321 var $widgets = $sidebar.children(selectors.widget + ',' + selectors.stickyWidgetWrapper); 1322 var $lastWidget = $widgets.last(); 1323 1324 if ($lastWidget.is(selectors.stickyWidgetWrapper)) { 1325 // Reset height (if previously set) to calculate it from scratch. 1326 $lastWidget.css('height', ''); 1327 1328 var sidebarHeight; 1329 1330 // Lazy loaded dynamic content elements (like embeds) affects its height. 1331 // At this point, we don't know what will be the final height. 1332 // So when we calculate the first time the last widget height, we do this based on current content height, 1333 // and then when we reach the end of the content, we recalculate (assuming that all elements 1334 // have already thier final size) the widget height based on current sidebar height (flexbox gives us a certainty 1335 // that both #primary and #secondary/#tetriary elements have the same height). 1336 if (isVariableContent) { 1337 sidebarHeight = parseInt($(selectors.content).outerHeight(), 10); 1338 } else { 1339 sidebarHeight = parseInt($sidebar.outerHeight(), 10); 1340 } 1341 1342 var widgetsHeight = 0; 1343 1344 $widgets.each(function() { 1345 widgetsHeight += parseInt($(this).outerHeight(true), 10); 1346 }); 1347 1348 // Increase last widget height if exists a space to cover. 1349 if (widgetsHeight < sidebarHeight) { 1350 var diffHeight = sidebarHeight - widgetsHeight; 1351 1352 var lastWidgetHeight = parseInt($lastWidget.css('height'), 10); 1353 1354 lastWidgetHeight += diffHeight; 1355 1356 $lastWidget.css('height', lastWidgetHeight + 'px'); 1357 } 1358 1359 $waypointElem = $lastWidget; 1360 } 1361 }); 1362 }; 1363 1364 var $body = $('body'); 1365 1366 // For a single post, use entry content height to calculate the last widget height at first. 1367 var isVariableContent = $body.is('.single'); 1368 1369 adjustLastWidgetHeight(isVariableContent); 1370 1371 // Listen to page height changes. 1372 // ------------------------------ 1373 1374 // New content is added (e.g. via auto-load next post) or dynamic element is fully loaded (e.g. Facebook widget). 1375 $body.on( 'g1NewContentLoaded g1PageHeightChanged', function(e) { 1376 adjustLastWidgetHeight(); 1377 } ); 1378 1379 // Entry content is entirely in the viewport (all inside elements should have final size), adjust widget height. 1380 if (false !== $waypointElem) { 1381 $waypointElem.waypoint(function(direction) { 1382 if ('down' === direction) { 1383 adjustLastWidgetHeight(); 1384 } 1385 }, { 1386 // When the bottom of the element hits the bottom of the viewport. 1387 offset: 'bottom-in-view' 1388 }); 1389 } 1390 }; 1391 1392})(jQuery); 1393 1394 1395/***************** 1396 * 1397 * Sticky Elements 1398 * 1399 ****************/ 1400 1401(function ($) { 1402 1403 'use strict'; 1404 1405 var selectors = [ 1406 '#wpadminbar', 1407 '.g1-iframe-bar', 1408 '.g1-sharebar-loaded', 1409 '.g1-sticky-top-wrapper' 1410 ]; 1411 1412 // Accessible globally. 1413 g1.stickyElementsTopOffsetSelectors = selectors; 1414 1415 g1.stickyPosition = function ($context) { 1416 $context = $context || $('body'); 1417 1418 // Sticky top. 1419 var $stickyTop = $('.g1-sticky-top-wrapper'); 1420 1421 // If exists and not loaded already. 1422 if ($stickyTop.length > 0 && !$stickyTop.is('.g1-loaded')) { 1423 var disableStickyHeader = false;
1424 var isDesktop = g1.getWindowWidth() > 800; 1425 1426 1427 1428 // Disable if sharebar enabled. 1429 var sharebarLoaded = $('.g1-sharebar-loaded').length > 0 || $('.essb_topbar').length > 0; 1430 1431 if (sharebarLoaded && isDesktop) { 1432 disableStickyHeader = true; 1433 } 1434 1435 if (disableStickyHeader) { 1436 // Prevent native sticky support, like on FF. 1437 $stickyTop.removeClass('g1-sticky-top-wrapper'); 1438 } else { 1439 // Apply pollyfill only if not supported. 1440 if (!g1.isStickySupported()) { 1441 Stickyfill.add($stickyTop); 1442 } 1443 1444 $stickyTop.addClass('g1-loaded'); 1445 } 1446 } 1447 1448 // Calculate topOffset after disabling the sticky header! 1449 var topOffset = 0; 1450 for (var i = 0; i < selectors.length; i++) { 1451 var $elem = $(selectors[i]); 1452 1453 if ($elem.length > 0 && $elem.is(':visible')) { 1454 topOffset += $elem.outerHeight(); 1455 } 1456 } 1457 1458 1459 // Sticky Item Actions (shares, votes etc). 1460 $context.find('.g1-wrapper-with-stickies > .entry-actions').each(function() { 1461 var $this = $(this); 1462 1463 $this.css('top', topOffset); 1464 1465 Stickyfill.add($this); 1466 }); 1467 1468 // Sticky snax form sidebar. 1469 Stickyfill.add($('.snax-form-frontend .snax-form-side')); 1470 1471 1472 // Sticky Item Actions (shares, votes etc). 1473 $context.find('.entry-tpl-index-stickies > .entry-actions, .entry-tpl-feat-stickies .entry-actions').each(function() { 1474 var $this = $(this); 1475 1476 $this.css('top', topOffset + 10); 1477 1478 Stickyfill.add($this); 1479 }); 1480 }; 1481 1482 $('body').on( 'g1NewContentLoaded', function ( e, $newContent ) { 1483 if ($newContent) { 1484 g1.stickyPosition($newContent); 1485 } 1486 } ); 1487 1488})(jQuery); 1489 1490 1491/********************** 1492 * 1493 * Droppable Elements 1494 * 1495 **********************/ 1496 1497(function ($) { 1498 1499 'use strict'; 1500 1501 var selectors = { 1502 'drop' : '.g1-drop', 1503 'dropExpanded': '.g1-drop-expanded', 1504 'dropToggle': '.g1-drop-toggle' 1505 }; 1506 1507 var classes = { 1508 'dropExpanded': 'g1-drop-expanded' 1509 }; 1510 1511 g1.droppableElements = function () { 1512 // Hide drop on focus out. 1513 $('body').on('click touchstart', function (e) { 1514 var $activeDrop = $(e.target).parents('.g1-drop-expanded'); 1515 1516 // Collapse all except active. 1517 $(selectors.dropExpanded).not($activeDrop).removeClass(classes.dropExpanded); 1518 }); 1519 1520 // Handle drop state (expanded | collapsed). 1521 1522 // For touch devices we need to toggle CSS class to trigger state change. 1523 if ( g1.isTouchDevice() ) { 1524 $('body').on( 'click', selectors.drop, function(e) { 1525 var $drop = $(this); 1526 1527 // If there is no drop-content inside, skip. 1528 if ($drop.find('.g1-drop-content').length === 0) { 1529 return; 1530 } 1531 1532 // Drop is expanded, collapse it on toggle click. 1533 if ($drop.is(selectors.dropExpanded)) { 1534 var $clickedElement = $(e.target); 1535 1536 var toggleClicked = $clickedElement.parents(selectors.dropToggle).length > 0; 1537 1538 if (toggleClicked) { 1539 $drop.removeClass(classes.dropExpanded); 1540 e.preventDefault(); 1541 } 1542 // Drop is collapsed, expand it. 1543 } else {
1544 $drop.addClass(classes.dropExpanded); 1545 e.preventDefault(); 1546 } 1547 } ); 1548 // Devices without touch events, state is handled via CSS :hover 1549 } else { 1550 // Prevent click on toggle. 1551 $(selectors.dropToggle).on( 'click', function() {}); 1552 } 1553 }; 1554 1555})(jQuery); 1556 1557/******************************** 1558 * 1559 * Mailchimp for WP Integration 1560 * 1561 *******************************/ 1562 1563(function ($) { 1564 1565 'use strict'; 1566 1567 $('body').on('submit', '.mc4wp-form', function (e) { 1568 e.preventDefault(); 1569 1570 var $form = $(this); 1571 1572 $.ajax({ 1573 'type': 'POST', 1574 'url': window.location.href, 1575 'data': $form.serialize() 1576 }).done(function (res) { 1577 var $response = $(res).find('#' + $form.attr('id') + ' .mc4wp-response'); 1578 1579 $response.prependTo($form); 1580 }); 1581 }); 1582 1583})(jQuery); 1584 1585/******************* 1586 * 1587 * Snax Integration 1588 * 1589 ******************/ 1590 1591(function ($) { 1592 1593 'use strict'; 1594 1595 g1.snax = function () { 1596 var $body = $('body'); 1597 1598 $body.on('snaxFullFormLoaded', function(e, $post) { 1599 $post.find('.g1-button-m.g1-button-solid').removeClass('g1-button-m g1-button-solid').addClass('g1-button-s g1-button-simple'); 1600 $post.find('.g1-beta.g1-beta-1st').removeClass('g1-beta g1-beta-1st').addClass('g1-gamma g1-gamma-1st'); 1601 }); 1602 }; 1603 1604 // Integration between Snax and CommentAce. 1605 window.caceWpCommentListPropsFilter = function (props, comments) { 1606 if ($(comments).parents('.snax-item').length > 0) { 1607 props.loadMoreType = 'load_more'; 1608 } 1609 1610 return props; 1611 } 1612 1613})(jQuery); 1614 1615/******************* 1616 * 1617 * Media Ace Integration 1618 * 1619 ******************/ 1620 1621(function ($) { 1622 1623 'use strict'; 1624 1625 g1.mediaAce = function () { 1626 1627 $('body').on('g1NewContentLoaded', function() { 1628 $('body').trigger('maceLoadYoutube'); 1629 }); 1630 1631 $(document).on('lazybeforeunveil', function(e) { 1632 var $target = $(e.target); 1633 var targetSrc = $target.attr('data-src'); 1634 1635 if (targetSrc && targetSrc.endsWith('.gif')) { 1636 // Wait till image fully loaded. 1637 $target.on('load', function() { 1638 $target.addClass('g1-enable-gif-player'); 1639 1640 // Wait a while before applying player. 1641 setTimeout(function() { 1642 if (typeof g1.gifPlayer === 'function') { 1643 g1.gifPlayer($target.parent()); 1644 } 1645 }, 100); 1646 }); 1647 } 1648 }); 1649 1650 $(document).on('bimberGifPlayerLoaded', function(e, $canvasWrapper) { 1651 if ($canvasWrapper.hasClass('lazyloading')) { 1652 $canvasWrapper.removeClass('lazyloading'); 1653 $canvasWrapper.addClass('lazyloaded'); 1654 } 1655 }); 1656 }; 1657 1658})(jQuery); 1659 1660 1661/******* 1662 * 1663 * Menu 1664 * 1665 *******/ 1666(function (context, $, i18n) { 1667 1668 'use strict'; 1669 1670 $(document).ready(function () { 1671 PrimaryMenu(); 1672 }); 1673 1674 function PrimaryMenu () { 1675 var that = {}; 1676 1677 that.init = function () { 1678 that.registerEventsHandlers(); 1679 1680 // add toggle to menu 1681 $('.menu-item-has-children > a, .menu-item-g1-mega > a').append( '<span class="g1-link-toggle"></span>' ); 1682 1683 return that; 1684 }; 1685 1686 that.registerEventsHandlers = function () { 1687 that.handleMenuItemClick(); 1688 that.handleMenuItemFocusOut(); 1689 }; 1690 1691 that.handleMenuItemFocusOut = function () { 1692 $('body').on('click', function (e) { 1693 if ($(e.target).parents('.mtm-drop-expanded').length === 0 ) { 1694 1695 // Only horizontal menus. 1696 if ($(e.target).parents('.g1-menu-h').length ) { 1697 that.collapseAllOpenedSubmenus(); 1698 } 1699 } 1700 }); 1701 }; 1702 1703 that.handleMenuItemClick = function () { 1704 $('.g1-primary-nav, .g1-secondary-nav').on('click', '.menu-item > a', function (e) { 1705 var $menu = $(this).parents('.g1-primary-nav'); 1706 1707 if ($menu.length === 0) { 1708 $menu = $(this).parents('.g1-secondary-nav'); 1709 } 1710 1711 var isSimpleList = $menu.is('#g1-canvas-primary-nav') || $menu.is('#g1-canvas-secondary-nav'); 1712 1713 if (g1.isTouchDevice() || isSimpleList) { 1714 that.handleMenuTouchEvent($(this), e); 1715 } 1716 }); 1717 }; 1718 1719 that.handleMenuTouchEvent = function ($link, event) { 1720 var $li = $link.parent('li'); 1721 1722 that.collapseAllOpenedSubmenus($li); 1723 1724 if ($li.hasClass('menu-item-has-children')) { 1725 event.preventDefault(); 1726 1727 var $helper = $li.find('ul.sub-menu:first > li.g1-menu-item-helper'); 1728 1729 if ($helper.length === 0) { 1730 var href = $link.attr('href'); 1731 1732 if ( href && href.length ) { 1733 var anchor = i18n.go_to + ' <span class="mtm-item-helper-title">'+ $link.html() +'</span>'; 1734 1735 $helper = $('<li class="menu-item g1-menu-item-helper"><a class="mtm-link" href="'+ href +'"><span class="mtm-link-text"><span class="mtm-link-title">' + anchor +'</span></span></a></li>'); 1736 1737 $li.find('ul.sub-menu:first').prepend($helper); 1738 } 1739 } 1740 1741 if (!$li.is('.mtm-drop-expanded')) { 1742 $li.find('.mtm-drop-expanded .g1-menu-item-helper').remove(); 1743 $li.addClass('mtm-drop-expanded'); 1744 } else { 1745 $li.find('.mtm-drop-expanded').removeClass('mtm-drop-expanded'); 1746 $li.removeClass('mtm-drop-expanded'); 1747 } 1748 } 1749 }; 1750 1751 that.collapseAllOpenedSubmenus = function ($currentItem) { 1752 if ($currentItem) { 1753 var $currentMenu = $currentItem.parents('nav'); 1754 var $topLevelLi = $currentItem.parents('li.menu-item'); 1755 1756 // We are at top level of menu 1757 if($topLevelLi.length === 0) { 1758 // Collapse all, except current. 1759 // This will collapse current item subtree items but not item itself. Item will be collapse by the "handleMenuTouchEvent" handler. 1760 $currentMenu.find('.mtm-drop-expanded').not($currentItem).removeClass('mtm-drop-expanded'); 1761 } else { 1762 // Collapse all opened submenus in current menu, except current subtree. 1763 $topLevelLi.siblings('li').find('.mtm-drop-expanded').removeClass('mtm-drop-expanded'); 1764 } 1765 1766 // Collapse all opened submenus in all other menus. 1767 $('nav').not($currentMenu).find('.mtm-drop-expanded').removeClass('mtm-drop-expanded'); 1768 } else { 1769 // collapse all opened, site wide, submenus 1770 $('.mtm-drop-expanded').removeClass('mtm-drop-expanded'); 1771 } 1772 }; 1773 1774 return that.init(); 1775 } 1776 1777})(window, jQuery, g1.config.i18n.menu); 1778 1779// http://paulirish.com/2011/requestanimationframe-for-smart-animating/ 1780// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating 1781// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel 1782// MIT license 1783 1784(function() { 1785 var lastTime = 0; 1786 var vendors = ['ms', 'moz', 'webkit', 'o']; 1787 for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { 1788 window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame']; 1789 window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame'] || window[vendors[x]+'CancelRequestAnimationFrame']; 1790 } 1791 1792 if (!window.requestAnimationFrame) { 1793 window.requestAnimationFrame = function(callback) { 1794 var currTime = new Date().getTime(); 1795 var timeToCall = Math.max(0, 16 - (currTime - lastTime)); 1796 var id = window.setTimeout(function() { callback(currTime + timeToCall); }, 1797 timeToCall); 1798 lastTime = currTime + timeToCall; 1799 return id; 1800 }; 1801 } 1802 1803 if (!window.cancelAnimationFrame) { 1804 window.cancelAnimationFrame = function(id) { 1805 clearTimeout(id); 1806 }; 1807 } 1808}()); 1809 1810 1811 1812/**************** 1813 * 1814 * Popup/Slideup 1815 * 1816 ****************/ 1817 1818(function ($) { 1819 'use strict'; 1820 g1.popup = function () { 1821 var 1822 HTMLBase = $('html'), 1823 Popup = $('.g1-popup-newsletter'), 1824 PopupCookie = g1.readCookie('g1_popup_disabled'), 1825 PopupCloser = $('.g1-popup-base, .g1-popup-closer'); 1826 // If we dont have popup exit. 1827 if( PopupCookie ){ HTMLBase.addClass('exit-intent-disabled'); } 1828 if( Popup.length <= 0 ){ return; } 1829 $(document).on('mouseleave', function(e){ 1830 if( e.clientY < 10 && ! HTMLBase.hasClass('exit-intent-disabled') && ! HTMLBase.hasClass('g1-slideup-visible') ){ 1831 HTMLBase.addClass('g1-popup-ready'); 1832 setTimeout(function(){ 1833 HTMLBase.addClass('g1-popup-visible').addClass('exit-intent-disabled'); 1834 }, 50); 1835 } 1836 }); 1837 PopupCloser.on('click', function(e){ 1838 e.preventDefault(); 1839 HTMLBase.removeClass('g1-popup-visible'); 1840 g1.createCookie('g1_popup_disabled', 1, 24 * 60 * 60 * 1000); 1841 }); 1842 } 1843 1844 1845 1846 g1.slideup = function () { 1847 var 1848 HTMLBase = $('html'), 1849 Slideup = $('.g1-slideup-newsletter'), 1850 SlideupCloser = $('.g1-slideup-newsletter-closer'), 1851 SlideupCookie = g1.readCookie('g1_slideup_disabled'), 1852 ScrollPositon = $(document).scrollTop(), 1853 ScrollTarget = $('.single-post article .entry-content'), 1854 ScrollTargetOffset = ScrollTarget.offset(), 1855 ScrollTargetHeight = ScrollTarget.height(), 1856 ShowOn = 50; 1857 // If we dont have popup exit. 1858 SlideupCloser.on('click', function(e){ 1859 e.preventDefault(); 1860 HTMLBase.removeClass('g1-slideup-visible').addClass('slideup-intent-disabled'); 1861 g1.createCookie('g1_slideup_disabled', 1, 24 * 60 * 60 * 1000); 1862 }); 1863 if( SlideupCookie ){ HTMLBase.addClass('slideup-intent-disabled'); } 1864 if( Slideup.length <= 0 ){ return; } 1865 if( ScrollTarget.length <= 0 ){ return; } 1866 $(window).on('scroll', function(){ 1867 ScrollPositon = $(document).scrollTop(); 1868 ScrollTargetOffset = ScrollTarget.offset(); 1869 ScrollTargetHeight = ScrollTarget.height(); 1870 if( ( (ScrollPositon - ScrollTargetOffset.top) / (ScrollTargetHeight) ).toFixed(6) * 100 >= ShowOn && ! HTMLBase.hasClass('slideup-intent-disabled') && ! HTMLBase.hasClass('g1-popup-visible') ){ 1871 HTMLBase.addClass('g1-slideup-visible'); 1872 } 1873 }); 1874 } 1875})(jQuery); 1876 1877/**************** 1878 * 1879 * GDPR 1880 * 1881 ****************/ 1882 1883(function ($) { 1884 'use strict'; 1885 $(document).ready(function () { 1886 $('.wp-social-login-provider-list').on('click', function() { 1887 if ($(this).hasClass('wp-social-login-provider-list-active')){ 1888 return; 1889 } 1890 $('.snax-wpsl-gdpr-consent').addClass('snax-wpsl-gdpr-consent-blink'); 1891 setTimeout(function(){ 1892 $('.snax-wpsl-gdpr-consent').removeClass('snax-wpsl-gdpr-consent-blink'); 1893 }, 1894 2000); 1895 }); 1896 $('.snax-wpsl-gdpr-consent input').on('click', function() { 1897 var enabled = $(this).is(':checked'); 1898 if (enabled) { 1899 $('.wp-social-login-provider-list').addClass('wp-social-login-provider-list-active'); 1900 } else { 1901 $('.wp-social-login-provider-list').removeClass('wp-social-login-provider-list-active'); 1902 } 1903 }); 1904 }); 1905})(jQuery); 1906 1907/************************** 1908 * 1909 * WordPress Popular Posts 1910 * 1911 **************************/ 1912 1913(function ($) { 1914 1915 'use strict'; 1916 1917 g1.updatePostViews = function(nonce,postId) { 1918 $.ajax({ 1919 'type': 'POST', 1920 'url': g1.config.ajax_url, 1921 'data': { 1922 'action': 'update_views_ajax', 1923 'wpp_id': postId, 1924 'token': nonce 1925 } 1926 }); 1927 }; 1928 1929 // ------------ 1930 // Update views 1931 // ------------ 1932 1933 $('.bimber-count-view').on('click', function() { 1934 var postId; 1935 var $body = $('body'); 1936 1937 if ( $body.is('.single-format-link') ) { 1938 var res = $body.attr('class').match(/postid-(\d+)/); 1939 1940 if (res) { 1941 postId = res[1]; 1942 } 1943 } else { 1944 var $article = $(this).parents('article.format-link'); 1945 if ( $article.length > 0 ) { 1946 postId = $article.attr('class').match(/post\-(\d+)/)[1]; 1947 } 1948 } 1949 1950 if (postId) { 1951 $.ajax({ 1952 'type': 'POST', 1953 'url': g1.config.ajax_url, 1954 'data': { 1955 //'action': 'bimber_update_post_views', 1956 //'post_id': postId 1957 'action': 'update_views_ajax', 1958 'wpp_id': postId, 1959 'token': g1.config.wpp.token 1960 } 1961 }); 1962 } 1963 }); 1964 1965})(jQuery); 1966 1967/******************* 1968 * 1969 * Flickity 1970 * 1971 ******************/ 1972 1973 1974(function ($) { 1975 1976 'use strict'; 1977 1978 g1.flickity = function ($context) { 1979 $context = $context || $('body'); 1980 1981 var 1982 FlickitySpots = $context.find('.adace-shop-the-post-wrap.carousel-wrap .woocommerce .products, .g1-products-widget-carousel .product_list_widget'); 1983 1984 FlickitySpots.each(function () { 1985 if ($(this).hasClass('.flickity-enabled')) { 1986 return; 1987 } 1988 1989 var 1990 ThisFlickityItems = $(this).children(), 1991 ThisFlickityItemsWidth = ThisFlickityItems.outerWidth() * ThisFlickityItems.length, 1992 ThisFlickityArgs = { 1993 cellAlign: 'left', 1994 wrapAround: true, 1995 prevNextButtons: true, 1996 pageDots: false, 1997 groupCells: true, 1998 rightToLeft: g1.isRTL(), 1999 imagesLoaded: true 2000 }; 2001 if (ThisFlickityItemsWidth <= $(this).outerWidth()) { 2002 ThisFlickityArgs.cellAlign = 'center'; 2003 ThisFlickityArgs.wrapAround = false;
2004 } else { 2005 var ThisRequiredNumber = Math.round($(this).outerWidth() / ThisFlickityItems.outerWidth()) * ThisFlickityItems.length; 2006 2007 while (ThisFlickityItems.length < ThisRequiredNumber) { 2008 $(this).append(ThisFlickityItems.clone(true)); 2009 ThisFlickityItems = $(this).children(); 2010 } 2011 } 2012 $(this).flickity(ThisFlickityArgs); 2013 }); 2014 }; 2015 2016 $('body').on('g1NewContentLoaded', function (e, $newContent) { 2017 g1.flickity($newContent); 2018 }); 2019})(jQuery); 2020 2021 2022// Sticky off-canvas top offset adjustments. 2023(function ($) { 2024 'use strict'; 2025 2026 $(document).ready(function () { 2027 var selectors = [ 2028 '#wpadminbar', 2029 '.g1-iframe-bar', 2030 '.g1-sticky-top-wrapper' 2031 ]; 2032 2033 var applyOffset = function() { 2034 // Calculate the total height of all sticky elements. 2035 var topOffset = 0; 2036 for (var i = 0; i < selectors.length; i++) { 2037 var $elem = $(selectors[i]); 2038 2039 if ($elem.length > 0 && $elem.is(':visible')) { 2040 topOffset += $elem.outerHeight(); 2041 } 2042 } 2043 2044 2045 var cssRule = 'html.g1-off-inside.g1-off-global-desktop .g1-canvas {top:' + topOffset + 'px;' 2046 2047 $('#g1-canvas-js-css').remove(); 2048 $('head').append( '<style id="g1-canvas-js-css">' + cssRule + '</style>' ); 2049 $('html.g1-off-inside .g1-canvas').removeClass('g1-canvas-no-js').addClass('g1-canvas-js'); 2050 }; 2051 2052 $('body').on( 'g1PageHeightChanged', function(e) { 2053 applyOffset(); 2054 } ); 2055 2056 $('html.g1-off-inside .g1-canvas.g1-canvas-no-js').each(function() { 2057 applyOffset(); 2058 }); 2059 } ); 2060})(jQuery); 2061 2062 2063/************************** 2064 * 2065 * document ready functions (keep this at the end for better compatibillity with optimizing plugins) 2066 * 2067 *************************/ 2068 2069(function ($) { 2070 2071 'use strict'; 2072 2073 $(document).ready(function () { 2074 g1.uiHelpers(); 2075 2076 if (g1.config.timeago === 'on') { 2077 g1.dateToTimeago(); 2078 } 2079 2080 g1.loadMoreButton(); 2081 g1.infiniteScroll(); 2082 g1.stickyPosition(); 2083 g1.droppableElements(); 2084 g1.canvas(); 2085 g1.snax(); 2086 g1.mediaAce(); 2087 g1.flickity(); 2088 g1.popup(); 2089 g1.slideup(); 2090 g1.stickySidebar(); 2091 }); 2092 2093})(jQuery); 2094; 2095/* 2096 SuperGif 2097 2098 Example usage: 2099 2100 <img src="./example1_preview.gif" rel:animated_src="./example1.gif" width="360" height="360" rel:auto_play="1" /> 2101 2102 <script type="text/javascript"> 2103 $$('img').each(function (img_tag) { 2104 if (/.*\.gif/.test(img_tag.src)) { 2105 var rub = new SuperGif({ gif: img_tag } ); 2106 rub.load(); 2107 } 2108 }); 2109 </script> 2110 2111 Image tag attributes: 2112 2113 rel:animated_src - If this url is specified, it's loaded into the player instead of src. 2114 This allows a preview frame to be shown until animated gif data is streamed into the canvas 2115 2116 rel:auto_play - Defaults to 1 if not specified. If set to zero, a call to the play() method is needed 2117 2118 Constructor options args 2119 2120 gif Required. The DOM element of an img tag. 2121 loop_mode Optional. Setting this to false will force disable looping of the gif. 2122 auto_play Optional. Same as the rel:auto_play attribute above, this arg overrides the img tag info. 2123 max_width Optional. Scale images over max_width down to max_width. Helpful with mobile. 2124 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. 2125 loop_delay Optional. The amount of time to pause (in ms) after each single loop (iteration). 2126 draw_while_loading Optional. Determines whether the gif will be drawn to the canvas whilst it is loaded. 2127 show_progress_bar Optional. Only applies when draw_while_loading is set to true. 2128 2129 Instance methods 2130 2131 // loading 2132 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 2133 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 2134 2135 // play controls 2136 play - Start playing the gif 2137 pause - Stop playing the gif 2138 move_to(i) - Move to frame i of the gif 2139 move_relative(i) - Move i frames ahead (or behind if i < 0) 2140 2141 // getters 2142 get_canvas The canvas element that the gif is playing in. Handy for assigning event handlers to. 2143 get_playing Whether or not the gif is currently playing 2144 get_loading Whether or not the gif has finished loading/parsing 2145 get_auto_play Whether or not the gif is set to play automatically 2146 get_length The number of frames in the gif 2147 get_current_frame The index of the currently displayed frame of the gif 2148 2149 For additional customization (viewport inside iframe) these params may be passed: 2150 c_w, c_h - width and height of canvas 2151 vp_t, vp_l, vp_ w, vp_h - top, left, width and height of the viewport 2152 2153 A bonus: few articles to understand what is going on 2154 http://enthusiasms.org/post/16976438906 2155 http://www.matthewflickinger.com/lab/whatsinagif/bits_and_bytes.asp 2156 http://humpy77.deviantart.com/journal/Frame-Delay-Times-for-Animated-GIFs-214150546 2157 2158*/ 2159(function (root, factory) { 2160 if (typeof define === 'function' && define.amd) { 2161 define([], factory); 2162 } else if (typeof exports === 'object') { 2163 module.exports = factory(); 2164 } else { 2165 root.SuperGif = factory(); 2166
vendor: 12,236 bytes, lines 2166-2539
2166} 2167}(this, function () { 2168 // Generic functions 2169 var bitsToNum = function (ba) { 2170 return ba.reduce(function (s, n) { 2171 return s * 2 + n; 2172 }, 0); 2173 }; 2174 2175 var byteToBitArr = function (bite) { 2176 var a = []; 2177 for (var i = 7; i >= 0; i--) { 2178 a.push( !! (bite & (1 << i))); 2179 } 2180 return a; 2181 }; 2182 2183 // Stream 2184 /** 2185 * @constructor 2186 */ 2187 // Make compiler happy. 2188 var Stream = function (data) { 2189 this.data = data; 2190 this.len = this.data.length; 2191 this.pos = 0; 2192 2193 this.readByte = function () { 2194 if (this.pos >= this.data.length) { 2195 throw new Error('Attempted to read past end of stream.'); 2196 } 2197 if (data instanceof Uint8Array) 2198 return data[this.pos++]; 2199 else 2200 return data.charCodeAt(this.pos++) & 0xFF; 2201 }; 2202 2203 this.readBytes = function (n) { 2204 var bytes = []; 2205 for (var i = 0; i < n; i++) { 2206 bytes.push(this.readByte()); 2207 } 2208 return bytes; 2209 }; 2210 2211 this.read = function (n) { 2212 var s = ''; 2213 for (var i = 0; i < n; i++) { 2214 s += String.fromCharCode(this.readByte()); 2215 } 2216 return s; 2217 }; 2218 2219 this.readUnsigned = function () { // Little-endian. 2220 var a = this.readBytes(2); 2221 return (a[1] << 8) + a[0]; 2222 }; 2223 }; 2224 2225 var lzwDecode = function (minCodeSize, data) { 2226 // TODO: Now that the GIF parser is a bit different, maybe this should get an array of bytes instead of a String? 2227 var pos = 0; // Maybe this streaming thing should be merged with the Stream? 2228 var readCode = function (size) { 2229 var code = 0; 2230 for (var i = 0; i < size; i++) { 2231 if (data.charCodeAt(pos >> 3) & (1 << (pos & 7))) { 2232 code |= 1 << i; 2233 } 2234 pos++; 2235 } 2236 return code; 2237 }; 2238 2239 var output = []; 2240 2241 var clearCode = 1 << minCodeSize; 2242 var eoiCode = clearCode + 1; 2243 2244 var codeSize = minCodeSize + 1; 2245 2246 var dict = []; 2247 2248 var clear = function () { 2249 dict = []; 2250 codeSize = minCodeSize + 1; 2251 for (var i = 0; i < clearCode; i++) { 2252 dict[i] = [i]; 2253 } 2254 dict[clearCode] = []; 2255 dict[eoiCode] = null; 2256 2257 }; 2258 2259 var code; 2260 var last; 2261 2262 while (true) { 2263 last = code; 2264 code = readCode(codeSize); 2265 2266 if (code === clearCode) { 2267 clear(); 2268 continue; 2269 } 2270 if (code === eoiCode) break; 2271 2272 if (code < dict.length) { 2273 if (last !== clearCode) { 2274 dict.push(dict[last].concat(dict[code][0])); 2275 } 2276 } 2277 else { 2278 if (code !== dict.length) throw new Error('Invalid LZW code.'); 2279 dict.push(dict[last].concat(dict[last][0])); 2280 } 2281 output.push.apply(output, dict[code]); 2282 2283 if (dict.length === (1 << codeSize) && codeSize < 12) { 2284 // 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. 2285 codeSize++; 2286 } 2287 } 2288 2289 // I don't know if this is technically an error, but some GIFs do it. 2290 //if (Math.ceil(pos / 8) !== data.length) throw new Error('Extraneous LZW bytes.'); 2291 return output; 2292 }; 2293 2294 2295 // The actual parsing; returns an object with properties. 2296 var parseGIF = function (st, handler) { 2297 handler || (handler = {}); 2298 2299 // LZW (GIF-specific) 2300 var parseCT = function (entries) { // Each entry is 3 bytes, for RGB. 2301 var ct = []; 2302 for (var i = 0; i < entries; i++) { 2303 ct.push(st.readBytes(3)); 2304 } 2305 return ct; 2306 }; 2307 2308 var readSubBlocks = function () { 2309 var size, data; 2310 data = ''; 2311 do { 2312 size = st.readByte(); 2313 data += st.read(size); 2314 } while (size !== 0); 2315 return data; 2316 }; 2317 2318 var parseHeader = function () { 2319 var hdr = {}; 2320 hdr.sig = st.read(3); 2321 hdr.ver = st.read(3); 2322 if (hdr.sig !== 'GIF') throw new Error('Not a GIF file.'); // XXX: This should probably be handled more nicely. 2323 hdr.width = st.readUnsigned(); 2324 hdr.height = st.readUnsigned(); 2325 2326 var bits = byteToBitArr(st.readByte()); 2327 hdr.gctFlag = bits.shift(); 2328 hdr.colorRes = bitsToNum(bits.splice(0, 3)); 2329 hdr.sorted = bits.shift(); 2330 hdr.gctSize = bitsToNum(bits.splice(0, 3)); 2331 2332 hdr.bgColor = st.readByte(); 2333 hdr.pixelAspectRatio = st.readByte(); // if not 0, aspectRatio = (pixelAspectRatio + 15) / 64 2334 if (hdr.gctFlag) { 2335 hdr.gct = parseCT(1 << (hdr.gctSize + 1)); 2336 } 2337 handler.hdr && handler.hdr(hdr); 2338 }; 2339 2340 var parseExt = function (block) { 2341 var parseGCExt = function (block) { 2342 var blockSize = st.readByte(); // Always 4 2343 var bits = byteToBitArr(st.readByte()); 2344 block.reserved = bits.splice(0, 3); // Reserved; should be 000. 2345 block.disposalMethod = bitsToNum(bits.splice(0, 3)); 2346 block.userInput = bits.shift(); 2347 block.transparencyGiven = bits.shift(); 2348 2349 block.delayTime = st.readUnsigned(); 2350 2351 block.transparencyIndex = st.readByte(); 2352 2353 block.terminator = st.readByte(); 2354 2355 handler.gce && handler.gce(block); 2356 }; 2357 2358 var parseComExt = function (block) { 2359 block.comment = readSubBlocks(); 2360 handler.com && handler.com(block); 2361 }; 2362 2363 var parsePTExt = function (block) { 2364 // No one *ever* uses this. If you use it, deal with parsing it yourself. 2365 var blockSize = st.readByte(); // Always 12 2366 block.ptHeader = st.readBytes(12); 2367 block.ptData = readSubBlocks(); 2368 handler.pte && handler.pte(block); 2369 }; 2370 2371 var parseAppExt = function (block) { 2372 var parseNetscapeExt = function (block) { 2373 var blockSize = st.readByte(); // Always 3 2374 block.unknown = st.readByte(); // ??? Always 1? What is this? 2375 block.iterations = st.readUnsigned(); 2376 block.terminator = st.readByte(); 2377 handler.app && handler.app.NETSCAPE && handler.app.NETSCAPE(block); 2378 }; 2379 2380 var parseUnknownAppExt = function (block) { 2381 block.appData = readSubBlocks(); 2382 // FIXME: This won't work if a handler wants to match on any identifier. 2383 handler.app && handler.app[block.identifier] && handler.app[block.identifier](block); 2384 }; 2385 2386 var blockSize = st.readByte(); // Always 11 2387 block.identifier = st.read(8); 2388 block.authCode = st.read(3); 2389 switch (block.identifier) { 2390 case 'NETSCAPE': 2391 parseNetscapeExt(block); 2392 break; 2393 default: 2394 parseUnknownAppExt(block); 2395 break; 2396 } 2397 }; 2398 2399 var parseUnknownExt = function (block) { 2400 block.data = readSubBlocks(); 2401 handler.unknown && handler.unknown(block); 2402 }; 2403 2404 block.label = st.readByte(); 2405 switch (block.label) { 2406 case 0xF9: 2407 block.extType = 'gce'; 2408 parseGCExt(block); 2409 break; 2410 case 0xFE: 2411 block.extType = 'com'; 2412 parseComExt(block); 2413 break; 2414 case 0x01: 2415 block.extType = 'pte'; 2416 parsePTExt(block); 2417 break; 2418 case 0xFF: 2419 block.extType = 'app'; 2420 parseAppExt(block); 2421 break; 2422 default: 2423 block.extType = 'unknown'; 2424 parseUnknownExt(block); 2425 break; 2426 } 2427 }; 2428 2429 var parseImg = function (img) { 2430 var deinterlace = function (pixels, width) { 2431 // Of course this defeats the purpose of interlacing. And it's *probably* 2432 // the least efficient way it's ever been implemented. But nevertheless... 2433 var newPixels = new Array(pixels.length); 2434 var rows = pixels.length / width; 2435 var cpRow = function (toRow, fromRow) { 2436 var fromPixels = pixels.slice(fromRow * width, (fromRow + 1) * width); 2437 newPixels.splice.apply(newPixels, [toRow * width, width].concat(fromPixels)); 2438 }; 2439 2440 // See appendix E. 2441 var offsets = [0, 4, 2, 1]; 2442 var steps = [8, 8, 4, 2]; 2443 2444 var fromRow = 0; 2445 for (var pass = 0; pass < 4; pass++) { 2446 for (var toRow = offsets[pass]; toRow < rows; toRow += steps[pass]) { 2447 cpRow(toRow, fromRow) 2448 fromRow++; 2449 } 2450 } 2451 2452 return newPixels; 2453 }; 2454 2455 img.leftPos = st.readUnsigned(); 2456 img.topPos = st.readUnsigned(); 2457 img.width = st.readUnsigned(); 2458 img.height = st.readUnsigned(); 2459 2460 var bits = byteToBitArr(st.readByte()); 2461 img.lctFlag = bits.shift(); 2462 img.interlaced = bits.shift(); 2463 img.sorted = bits.shift(); 2464 img.reserved = bits.splice(0, 2); 2465 img.lctSize = bitsToNum(bits.splice(0, 3)); 2466 2467 if (img.lctFlag) { 2468 img.lct = parseCT(1 << (img.lctSize + 1)); 2469 } 2470 2471 img.lzwMinCodeSize = st.readByte(); 2472 2473 var lzwData = readSubBlocks(); 2474 2475 img.pixels = lzwDecode(img.lzwMinCodeSize, lzwData); 2476 2477 if (img.interlaced) { // Move 2478 img.pixels = deinterlace(img.pixels, img.width); 2479 } 2480 2481 handler.img && handler.img(img); 2482 }; 2483 2484 var parseBlock = function () { 2485 var block = {}; 2486 block.sentinel = st.readByte(); 2487 2488 switch (String.fromCharCode(block.sentinel)) { // For ease of matching 2489 case '!': 2490 block.type = 'ext'; 2491 parseExt(block); 2492 break; 2493 case ',': 2494 block.type = 'img'; 2495 parseImg(block); 2496 break; 2497 case ';': 2498 block.type = 'eof'; 2499 handler.eof && handler.eof(block); 2500 break; 2501 default: 2502 throw new Error('Unknown block: 0x' + block.sentinel.toString(16)); // TODO: Pad this with a 0. 2503 } 2504 2505 if (block.type !== 'eof') setTimeout(parseBlock, 0); 2506 }; 2507 2508 var parse = function () { 2509 parseHeader(); 2510 setTimeout(parseBlock, 0); 2511 }; 2512 2513 parse(); 2514 }; 2515 2516 var SuperGif = function ( opts ) { 2517 var options = { 2518 //viewport position 2519 vp_l: 0, 2520 vp_t: 0, 2521 vp_w: null, 2522 vp_h: null, 2523 //canvas sizes 2524 c_w: null, 2525 c_h: null 2526 }; 2527 for (var i in opts ) { options[i] = opts[i] } 2528 if (options.vp_w && options.vp_h) options.is_vp = true; 2529 2530 var stream; 2531 var hdr; 2532 2533 var loadError = null; 2534 var loading = false; 2535 2536 var transparency = null; 2537 var delay = null; 2538 var disposalMethod = null; 2539 var disposalRestoreFromIdx =
vendor: 6,148 bytes, lines 2539-2689
25390; 2540 var lastDisposalMethod = null; 2541 var frame = null; 2542 var lastImg = null; 2543 2544 var playing = true; 2545 var forward = true; 2546 2547 var ctx_scaled = false; 2548 2549 var frames = []; 2550 var frameOffsets = []; // elements have .x and .y properties 2551 2552 var gif = options.gif; 2553 if (typeof options.auto_play == 'undefined') 2554 options.auto_play = (!gif.getAttribute('rel:auto_play') || gif.getAttribute('rel:auto_play') == '1'); 2555 2556 var onEndListener = (options.hasOwnProperty('on_end') ? options.on_end : null); 2557 var loopDelay = (options.hasOwnProperty('loop_delay') ? options.loop_delay : 0); 2558 var overrideLoopMode = (options.hasOwnProperty('loop_mode') ? options.loop_mode : 'auto'); 2559 var drawWhileLoading = (options.hasOwnProperty('draw_while_loading') ? options.draw_while_loading : true); 2560 var showProgressBar = drawWhileLoading ? (options.hasOwnProperty('show_progress_bar') ? options.show_progress_bar : true) : false; 2561 2562 var clear = function () { 2563 transparency = null; 2564 delay = null; 2565 lastDisposalMethod = disposalMethod; 2566 disposalMethod = null; 2567 frame = null; 2568 }; 2569 2570 // XXX: There's probably a better way to handle catching exceptions when 2571 // callbacks are involved. 2572 var doParse = function () { 2573 try { 2574 parseGIF(stream, handler); 2575 } 2576 catch (err) { 2577 doLoadError('parse'); 2578 } 2579 }; 2580 2581 var doText = function (text) { 2582 toolbar.innerHTML = text; // innerText? Escaping? Whatever. 2583 toolbar.style.visibility = 'visible'; 2584 }; 2585 2586 var setSizes = function(w, h) { 2587 canvas.width = w * get_canvas_scale(); 2588 canvas.height = h * get_canvas_scale(); 2589 toolbar.style.minWidth = ( w * get_canvas_scale() ) + 'px'; 2590 2591 tmpCanvas.width = w; 2592 tmpCanvas.height = h; 2593 tmpCanvas.style.width = w + 'px'; 2594 tmpCanvas.style.height = h + 'px'; 2595 tmpCanvas.getContext('2d').setTransform(1, 0, 0, 1, 0, 0); 2596 }; 2597 2598 var setFrameOffset = function(frame, offset) { 2599 if (!frameOffsets[frame]) { 2600 frameOffsets[frame] = offset; 2601 return; 2602 } 2603 if (typeof offset.x !== 'undefined') { 2604 frameOffsets[frame].x = offset.x; 2605 } 2606 if (typeof offset.y !== 'undefined') { 2607 frameOffsets[frame].y = offset.y; 2608 } 2609 }; 2610 2611 var doShowProgress = function (pos, length, draw) { 2612 if (draw && showProgressBar) { 2613 var height = 25; 2614 var left, mid, top, width; 2615 if (options.is_vp) { 2616 if (!ctx_scaled) { 2617 top = (options.vp_t + options.vp_h - height); 2618 height = height; 2619 left = options.vp_l; 2620 mid = left + (pos / length) * options.vp_w; 2621 width = canvas.width; 2622 } else { 2623 top = (options.vp_t + options.vp_h - height) / get_canvas_scale(); 2624 height = height / get_canvas_scale(); 2625 left = (options.vp_l / get_canvas_scale() ); 2626 mid = left + (pos / length) * (options.vp_w / get_canvas_scale()); 2627 width = canvas.width / get_canvas_scale(); 2628 } 2629 //some debugging, draw rect around viewport 2630 if (false) { 2631 if (!ctx_scaled) { 2632 var l = options.vp_l, t = options.vp_t; 2633 var w = options.vp_w, h = options.vp_h; 2634 } else { 2635 var l = options.vp_l/get_canvas_scale(), t = options.vp_t/get_canvas_scale(); 2636 var w = options.vp_w/get_canvas_scale(), h = options.vp_h/get_canvas_scale(); 2637 } 2638 ctx.rect(l,t,w,h); 2639 ctx.stroke(); 2640 } 2641 } 2642 else { 2643 top = (canvas.height - height) / (ctx_scaled ? get_canvas_scale() : 1); 2644 mid = ((pos / length) * canvas.width) / (ctx_scaled ? get_canvas_scale() : 1); 2645 width = canvas.width / (ctx_scaled ? get_canvas_scale() : 1 ); 2646 height /= ctx_scaled ? get_canvas_scale() : 1; 2647 } 2648 // XXX Figure out alpha fillRect. 2649 //ctx.fillStyle = 'salmon'; 2650 ctx.fillStyle = 'rgba(255,255,255,0.4)'; 2651 ctx.fillRect(mid, top, width - mid, height); 2652 2653 //ctx.fillStyle = 'teal'; 2654 ctx.fillStyle = 'rgba(255,0,22,.8)'; 2655 ctx.fillRect(0, top, mid, height); 2656 } 2657 }; 2658 2659 var doLoadError = function (originOfError) { 2660 var drawError = function () { 2661 ctx.fillStyle = 'black'; 2662 ctx.fillRect(0, 0, options.c_w ? options.c_w : hdr.width, options.c_h ? options.c_h : hdr.height); 2663 ctx.strokeStyle = '`red`'; 2664 ctx.lineWidth = 3; 2665 ctx.moveTo(0, 0); 2666 ctx.lineTo(options.c_w ? options.c_w : hdr.width, options.c_h ? options.c_h : hdr.height); 2667 ctx.moveTo(0, options.c_h ? options.c_h : hdr.height); 2668 ctx.lineTo(options.c_w ? options.c_w : hdr.width, 0); 2669 ctx.stroke(); 2670 }; 2671 2672 loadError = originOfError; 2673 hdr = { 2674 width: gif.width, 2675 height: gif.height 2676 }; // Fake header. 2677 frames = []; 2678 drawError(); 2679 }; 2680 2681 var doHdr = function (_hdr) { 2682 hdr = _hdr; 2683 setSizes(hdr.width, hdr.height) 2684 }; 2685 2686 var doGCE = function (gce) { 2687 pushFrame(); 2688 clear(); 2689 transparency = gce.transparencyGiven ? gce.transparencyIndex : null;
2690 delay = gce.delayTime; 2691 disposalMethod = gce.disposalMethod; 2692 // We don't have much to do with the rest of GCE. 2693 }; 2694 2695 var pushFrame = function () { 2696 if (!frame) return; 2697 frames.push({ 2698 data: frame.getImageData(0, 0, hdr.width, hdr.height), 2699 delay: delay 2700 }); 2701 frameOffsets.push({ x: 0, y: 0 }); 2702 }; 2703 2704 var doImg = function (img) { 2705 if (!frame) frame = tmpCanvas.getContext('2d'); 2706 2707 var currIdx = frames.length; 2708 2709 //ct = color table, gct = global color table 2710 var ct = img.lctFlag ? img.lct : hdr.gct; // TODO: What if neither exists? 2711 2712 /* 2713 Disposal method indicates the way in which the graphic is to 2714 be treated after being displayed. 2715 2716 Values : 0 - No disposal specified. The decoder is 2717 not required to take any action. 2718 1 - Do not dispose. The graphic is to be left 2719 in place. 2720 2 - Restore to background color. The area used by the 2721 graphic must be restored to the background color. 2722 3 - Restore to previous. The decoder is required to 2723 restore the area overwritten by the graphic with 2724 what was there prior to rendering the graphic. 2725 2726 Importantly, "previous" means the frame state 2727 after the last disposal of method 0, 1, or 2. 2728 */ 2729 if (currIdx > 0) { 2730 if (lastDisposalMethod === 3) { 2731 // Restore to previous 2732 frame.putImageData(frames[disposalRestoreFromIdx].data, 0, 0); 2733 } else { 2734 disposalRestoreFromIdx = currIdx - 1; 2735 } 2736 2737 if (lastDisposalMethod === 2) { 2738 // Restore to background color 2739 // Browser implementations historically restore to transparent; we do the same. 2740 // http://www.wizards-toolkit.org/discourse-server/viewtopic.php?f=1&t=21172#p86079 2741 frame.clearRect(lastImg.leftPos, lastImg.topPos, lastImg.width, lastImg.height); 2742 } 2743 } 2744 // else, Undefined/Do not dispose. 2745 // frame contains final pixel data from the last frame; do nothing 2746 2747 //Get existing pixels for img region after applying disposal method 2748 var imgData = frame.getImageData(img.leftPos, img.topPos, img.width, img.height); 2749 2750 //apply color table colors 2751 var cdd = imgData.data; 2752 img.pixels.forEach(function (pixel, i) { 2753 // imgData.data === [R,G,B,A,R,G,B,A,...] 2754 if (pixel !== transparency) { 2755 cdd[i * 4 + 0] = ct[pixel][0]; 2756 cdd[i * 4 + 1] = ct[pixel][1]; 2757 cdd[i * 4 + 2] = ct[pixel][2]; 2758 cdd[i * 4 + 3] = 255; // Opaque. 2759 } 2760 }); 2761 imgData.data.set(cdd); 2762 2763 frame.putImageData(imgData, img.leftPos, img.topPos); 2764 2765 if (!ctx_scaled) { 2766 ctx.scale(get_canvas_scale(),get_canvas_scale()); 2767 ctx_scaled = true; 2768 } 2769 2770 // We could use the on-page canvas directly, except that we draw a progress 2771 // bar for each image chunk (not just the final image). 2772 if (drawWhileLoading) 2773 ctx.drawImage(tmpCanvas, 0, 0); 2774 2775 lastImg = img; 2776 }; 2777 2778 var player = (function () { 2779 var i = -1; 2780 var iterationCount = 0; 2781 2782 var showingInfo = false; 2783 var pinned = false; 2784 2785 /** 2786 * Gets the index of the frame "up next". 2787 * @returns {number} 2788 */ 2789 var getNextFrameNo = function () { 2790 var delta = (forward ? 1 : -1); 2791 return (i + delta + frames.length) % frames.length; 2792 }; 2793 2794 var stepFrame = function (amount) { // XXX: Name is confusing. 2795 i = i + amount; 2796 2797 putFrame(); 2798 }; 2799 2800 var completeLoop = function () { 2801 if (onEndListener !== null) 2802 onEndListener(gif); 2803 iterationCount++; 2804 }; 2805 2806 var step = (function () { 2807 var stepping = false;
vendor: 5,457 bytes, lines 2808-2975
2808 2809 var doStep = function () { 2810 stepping = playing; 2811 if (!stepping) return; 2812 2813 stepFrame(1); 2814 var delay = frames[i].delay * 10; 2815 if (!delay) delay = 100; // FIXME: Should this even default at all? What should it be? 2816 2817 var nextFrameNo = getNextFrameNo(); 2818 if (nextFrameNo === 0) { 2819 delay += loopDelay; 2820 setTimeout(completeLoop, delay - 1); 2821 } 2822 2823 if ((overrideLoopMode !== false || nextFrameNo !== 0 || iterationCount < 0)) 2824 setTimeout(doStep, delay); 2825 2826 }; 2827 2828 return function () { 2829 if (!stepping) setTimeout(doStep, 0); 2830 }; 2831 }()); 2832 2833 var putFrame = function () { 2834 var offset; 2835 i = parseInt(i, 10); 2836 2837 if (i > frames.length - 1){ 2838 i = 0; 2839 } 2840 2841 if (i < 0){ 2842 i = 0; 2843 } 2844 2845 offset = frameOffsets[i]; 2846 2847 tmpCanvas.getContext("2d").putImageData(frames[i].data, offset.x, offset.y); 2848 ctx.globalCompositeOperation = "copy"; 2849 ctx.drawImage(tmpCanvas, 0, 0); 2850 }; 2851 2852 var play = function () { 2853 playing = true; 2854 step(); 2855 }; 2856 2857 var pause = function () { 2858 playing = false; 2859 }; 2860 2861 2862 return { 2863 init: function () { 2864 if (loadError) return; 2865 2866 if ( ! (options.c_w && options.c_h) ) { 2867 ctx.scale(get_canvas_scale(),get_canvas_scale()); 2868 } 2869 2870 if (options.auto_play) { 2871 step(); 2872 } 2873 else { 2874 i = 0; 2875 putFrame(); 2876 } 2877 }, 2878 step: step, 2879 play: play, 2880 pause: pause, 2881 playing: playing, 2882 move_relative: stepFrame, 2883 current_frame: function() { return i; }, 2884 length: function() { return frames.length }, 2885 move_to: function ( frame_idx ) { 2886 i = frame_idx; 2887 putFrame(); 2888 } 2889 } 2890 }()); 2891 2892 var doDecodeProgress = function (draw) { 2893 doShowProgress(stream.pos, stream.data.length, draw); 2894 }; 2895 2896 var doNothing = function () {}; 2897 /** 2898 * @param{boolean=} draw Whether to draw progress bar or not; this is not idempotent because of translucency. 2899 * Note that this means that the text will be unsynchronized with the progress bar on non-frames; 2900 * but those are typically so small (GCE etc.) that it doesn't really matter. TODO: Do this properly. 2901 */ 2902 var withProgress = function (fn, draw) { 2903 return function (block) { 2904 fn(block); 2905 doDecodeProgress(draw); 2906 }; 2907 }; 2908 2909 2910 var handler = { 2911 hdr: withProgress(doHdr), 2912 gce: withProgress(doGCE), 2913 com: withProgress(doNothing), 2914 // I guess that's all for now. 2915 app: { 2916 // TODO: Is there much point in actually supporting iterations? 2917 NETSCAPE: withProgress(doNothing) 2918 }, 2919 img: withProgress(doImg, true), 2920 eof: function (block) { 2921 //toolbar.style.display = ''; 2922 pushFrame(); 2923 doDecodeProgress(false); 2924 if ( ! (options.c_w && options.c_h) ) { 2925 canvas.width = hdr.width * get_canvas_scale(); 2926 canvas.height = hdr.height * get_canvas_scale(); 2927 } 2928 player.init(); 2929 loading = false; 2930 if (load_callback) { 2931 load_callback(gif); 2932 } 2933 2934 } 2935 }; 2936 2937 var init = function () { 2938 var parent = gif.parentNode; 2939 2940 var div = document.createElement('div'); 2941 canvas = document.createElement('canvas'); 2942 ctx = canvas.getContext('2d'); 2943 toolbar = document.createElement('div'); 2944 2945 tmpCanvas = document.createElement('canvas'); 2946 2947 div.width = canvas.width = gif.width; 2948 div.height = canvas.height = gif.height; 2949 toolbar.style.minWidth = gif.width + 'px'; 2950 2951 div.className = 'jsgif'; 2952 toolbar.className = 'jsgif_toolbar'; 2953 div.appendChild(canvas); 2954 div.appendChild(toolbar); 2955 2956 parent.insertBefore(div, gif); 2957 parent.removeChild(gif); 2958 2959 if (options.c_w && options.c_h) setSizes(options.c_w, options.c_h); 2960 initialized=true; 2961 }; 2962 2963 var get_canvas_scale = function() { 2964 var scale; 2965 if (options.max_width && hdr && hdr.width > options.max_width) { 2966 scale = options.max_width / hdr.width; 2967 } 2968 else { 2969 scale = 1; 2970 } 2971 return scale; 2972 } 2973 2974 var canvas, ctx, toolbar, tmpCanvas; 2975 var initialized = false;
2976 var load_callback = false; 2977 2978 var load_setup = function(callback) { 2979 if (loading) return false; 2980 if (callback) load_callback = callback; 2981 else load_callback = false; 2982 2983 loading = true; 2984 frames = []; 2985 clear(); 2986 disposalRestoreFromIdx = 0; 2987 lastDisposalMethod = null; 2988 frame = null; 2989 lastImg = null; 2990 2991 return true; 2992 } 2993 2994 return { 2995 // play controls 2996 play: player.play, 2997 pause: player.pause, 2998 move_relative: player.move_relative, 2999 move_to: player.move_to, 3000 3001 // getters for instance vars 3002 get_playing : function() { return player.playing }, 3003 get_canvas : function() { return canvas }, 3004 get_canvas_scale : function() { return get_canvas_scale() }, 3005 get_loading : function() { return loading }, 3006 get_auto_play : function() { return options.auto_play }, 3007 get_length : function() { return player.length() }, 3008 get_current_frame: function() { return player.current_frame() }, 3009 load_url: function(src,callback){ 3010 if (!load_setup(callback)) return; 3011 3012 var h = new XMLHttpRequest(); 3013 h.overrideMimeType('text/plain; charset=x-user-defined'); 3014 h.onloadstart = function() { 3015 // Wait until connection is opened to replace the gif element with a canvas to avoid a blank img 3016 if (!initialized) init(); 3017 }; 3018 h.onload = function(e) { 3019 stream = new Stream(h.responseText); 3020 setTimeout(doParse, 0); 3021 }; 3022 h.onprogress = function (e) { 3023 if (e.lengthComputable) doShowProgress(e.loaded, e.total, true); 3024 }; 3025 h.onerror = function() { doLoadError('xhr'); }; 3026 h.open('GET', src, true); 3027 h.send(); 3028 }, 3029 load: function (callback) { 3030 this.load_url(gif.getAttribute('rel:animated_src') || gif.src,callback); 3031 }, 3032 load_raw: function(arr, callback) { 3033 if (!load_setup(callback)) return; 3034 if (!initialized) init(); 3035 stream = new Stream(arr); 3036 setTimeout(doParse, 0); 3037 }, 3038 set_frame_offset: setFrameOffset 3039 }; 3040 }; 3041 3042 return SuperGif; 3043})); 3044 3045 3046; 3047/****************** 3048 * 3049 * Init GIF Player 3050 * 3051 *****************/ 3052 3053(function ($) { 3054 3055 'use strict'; 3056 var isEnabled = g1.config.use_gif_player; 3057 3058 g1.gifPlayer = function ($scope) { 3059 if ( ! isEnabled ) { 3060 return; 3061 } 3062 if (! $scope ) { 3063 $scope = $('body'); 3064 } 3065 3066 // SuperGif library depends on the overrideMimeType method of the XMLHttpRequest object 3067 // if browser doesn't support this method, we can't use that library 3068 if ( typeof XMLHttpRequest.prototype.overrideMimeType === 'undefined' ) { 3069 return; 3070 } 3071 3072 g1.gifPlayerIncludeSelectors =[ 3073 '.entry-content img.aligncenter[src$=".gif"]', 3074 '.entry-content .aligncenter img[src$=".gif"]', 3075 'img.g1-enable-gif-player', 3076 '.entry-featured-media-main img[src$=".gif"]', 3077 '.entry-tpl-stream .entry-featured-media img[src$=".gif"]', 3078 '.entry-tpl-grid-l .entry-featured-media img[src$=".gif"]' 3079 ]; 3080 3081 g1.gifPlayerExcludeSelectors = [ 3082 '.ajax-loader', // for Contact Form 7 3083 '.g1-disable-gif-player', 3084 '.wp-block-image.g1-disable-gif-player img[src$=".gif"]' 3085 ]; 3086 3087 $( g1.gifPlayerIncludeSelectors.join(','), $scope ).not( g1.gifPlayerExcludeSelectors.join(',') ).each(function () { 3088 var $img = $(this); 3089 var imgClasses = $img.attr('class'); 3090 var imgSrc = $img.attr('src'); 3091 3092 // Check only absolute paths. Relative paths, by nature, are from the same domain. 3093 // Seems like the GIFs from outside of the site's domain work too. 3094 // if (-1 !== imgSrc.indexOf('http')) { 3095 // // Only locally stored gifs, unless user decided otherwise. 3096 // if (imgSrc.indexOf(location.hostname) === -1 && !$img.is('.g1-enable-gif-player')) { 3097 // return; 3098 // } 3099 // } 3100 3101 3102 var gifObj = new SuperGif({ 3103 gif: this, 3104 auto_play: 0 3105 }); 3106 3107 var $gitIndicator = $('<span class="g1-indicator-gif g1-loading">'); 3108 3109 gifObj.load(function() { 3110 var frames = gifObj.get_length(); 3111 3112 var $canvasWrapper = $(gifObj.get_canvas()).parent(); 3113 3114 // Only for animated gifs. 3115 if (frames > 1) { 3116 gifObj.isPlaying = false;
3117 3118 // Store references to original methods. 3119 var playRef = gifObj.play; 3120 var pauseRef = gifObj.pause; 3121 3122 var playGif = function() { 3123 playRef(); 3124 gifObj.isPlaying = true; 3125 $gitIndicator.addClass('g1-indicator-gif-playing'); 3126 }; 3127 3128 var pauseGif = function() { 3129 pauseRef(); 3130 gifObj.isPlaying = false; 3131 $gitIndicator.removeClass('g1-indicator-gif-playing'); 3132 }; 3133 3134 // Override and extend the API. 3135 gifObj.play = playGif; 3136 gifObj.pause = pauseGif; 3137 3138 // Play/stop the GIF. 3139 $canvasWrapper.on('click', function(e) { 3140 // Prevent redirecting to single post. 3141 e.preventDefault(); 3142 3143 if (gifObj.isPlaying) { 3144 pauseGif(); 3145 } else { 3146 playGif(); 3147 } 3148 }); 3149 3150 $gitIndicator.toggleClass('g1-loading g1-loaded'); 3151
3152 $(document).trigger('bimberGifPlayerLoaded', [$canvasWrapper]); 3153 } else { 3154 // It's just a gif type image, not animation to play. 3155 $gitIndicator.remove(); 3156 } 3157 }); 3158 3159 // canvas parent can be fetched after gifObj.load() call 3160 var $canvasWrapper = $(gifObj.get_canvas()).parent(); 3161 3162 $canvasWrapper. 3163 addClass(imgClasses + ' g1-enable-share-links'). 3164 attr('data-img-src', imgSrc). 3165 append($gitIndicator). 3166 data('gifPlayer', gifObj); 3167 }); 3168 }; 3169 3170 // Listeners. 3171 $('body').on('g1NewContentLoaded', function(e, $newContent) { 3172 g1.gifPlayer($newContent); 3173 }); 3174 3175})(jQuery); 3176 3177/************************ 3178 * 3179 * Media Players Factory 3180 * 3181 ***********************/ 3182 3183(function ($) { 3184 3185 'use strict'; 3186 3187 var selectors = { 3188 'iframe': 'iframe', 3189 'mp4': '.mejs-video', 3190 'gif': '.jsgif', 3191 'html5Video': '.snax-native-video', 3192 'embedly': '.embedly-card iframe', 3193 'maceYT': '.mace-youtube' 3194 }; 3195 3196 g1.mediaPlayers = {}; 3197 3198 g1.getMediaPlayer = function(element) { 3199 var player = $(element).data('g1MediaPlayer'); 3200 3201 if (player) { 3202 g1.log('Returning a player (' + player.getType() + ') assigned to the element.'); 3203 return player; 3204 } 3205 3206 // IFRAME. 3207 var $iframe = $(selectors.iframe, element); 3208 3209 if ($iframe.length > 0) { 3210 var iframesrc = false; 3211 3212 if ($iframe.attr('data-src')) { 3213 iframesrc = $iframe.attr('data-src'); 3214 } else { 3215 iframesrc= $iframe.attr('src'); 3216 } 3217 3218 if (iframesrc) { 3219 // YouTube? 3220 if (iframesrc.indexOf('youtu') > 0) { 3221 player = g1.mediaPlayers.youtube($iframe); 3222 $(element).data('g1MediaPlayer', player); 3223 3224 return player; 3225 } 3226 3227 // Vimeo? 3228 if (iframesrc.indexOf('vimeo') > 0) { 3229 player = g1.mediaPlayers.vimeo($iframe); 3230 $(element).data('g1MediaPlayer', player); 3231 3232 return player; 3233 } 3234 3235 // Dailymotion? 3236 if (iframesrc.indexOf('dailymotion') > 0) { 3237 player = g1.mediaPlayers.dailymotion($iframe); 3238 $(element).data('g1MediaPlayer', player); 3239 3240 return player; 3241 } 3242 3243 // Gfycat? 3244 if (iframesrc.indexOf('gfycat') > 0) { 3245 player = g1.mediaPlayers.gfycat($iframe); 3246 $(element).data('g1MediaPlayer', player); 3247 3248 return player; 3249 } 3250 3251 3252 } 3253 3254 3255 return false; 3256 } 3257 3258 // MP4. 3259 var $mp4 = $(selectors.mp4, element); 3260 3261 if ($mp4.length > 0) { 3262 var playerId = $mp4.attr('id'); 3263 3264 if (playerId && mejs && typeof mejs.players !== 'undefined') { 3265 if (typeof mejs.players[playerId] !== 'undefined') { 3266 var mejsPlayer = mejs.players[playerId]; 3267 player = g1.mediaPlayers.mp4(mejsPlayer); 3268 3269 $(element).data('g1MediaPlayer', player); 3270 3271 return player; 3272 } 3273 } 3274 3275 return false; 3276 } 3277 3278 // GIF. 3279 var $gif = $(selectors.gif, element); 3280 3281 if ($gif.length > 0) { 3282 var gifPlayer = $gif.data('gifPlayer'); 3283 3284 if (gifPlayer) { 3285 player = g1.mediaPlayers.gif(gifPlayer); 3286 3287 $(element).data('g1MediaPlayer', player); 3288 3289 return player; 3290 } 3291 3292 return false; 3293 } 3294 3295 // MediaAce Lazy Loaded video. 3296 var $maceYT = $(selectors.maceYT, element); 3297 3298 // HTML5 native videos. 3299 var $html5 = $(selectors.html5Video, element); 3300 3301 if ( $html5.length > 0 ) { 3302 player = g1.mediaPlayers.html5video($html5[0]); 3303 3304 $(element).data('g1MediaPlayer', player); 3305 3306 return player; 3307 } 3308 3309 // Embedly. 3310 if (typeof embedly !== 'undefined') { 3311 var $embedly = $(selectors.embedly, element); 3312 3313 if ($embedly.length > 0 ) { 3314 // The following iterates over all the instances of the player. 3315 embedly('player', function(embedlyPlayer){ 3316 if ($embedly[0] === $(embedlyPlayer.frame.elem)[0]) { 3317 player = g1.mediaPlayers.embedly(embedlyPlayer); 3318 3319 $(element).data('g1MediaPlayer', player); 3320 3321 return player; 3322 } else { 3323 player.pause(); 3324 } 3325 }); 3326 3327 return false;
3328 } else { 3329 embedly('player', function(player){ 3330 player.pause(); 3331 }); 3332 } 3333 } 3334 3335 // MediaAce YouTube lazy loader. 3336 if ($maceYT.length > 0) { 3337 // Start to load YouTube player. 3338 $maceYT.find('.mace-play-button').trigger('click'); 3339 3340 // YouTube player (iframe) loaded. 3341 $maceYT.on('maceIframeLoaded', function(e, $iframe) { 3342 // Get YT player to initialize YT properly. 3343 player = g1.getMediaPlayer($maceYT); 3344 3345 // Assign the player to the element. 3346 $(element).data('g1MediaPlayer', player); 3347 }); 3348 3349 // We don't want to return an instance of the MaceYT player here, as the MaceYT is just a wrapper for YT player. 3350 // So we return false here and wait for YT iframe. When it's loaded, we assigned the YT player to the element. 3351 return false; 3352 } 3353 }; 3354 3355})(jQuery); 3356 3357/******************* 3358 * 3359 * YouTube Player 3360 * 3361 ******************/ 3362 3363(function ($) { 3364 3365 'use strict'; 3366 3367 g1.mediaPlayers.youtube = function ($iframe) { 3368 let obj = {}; 3369 let isPlaying = false; 3370 3371 function init() { 3372 g1.log('YouTube player object initialized'); 3373 3374 $iframe.on('load', function() { 3375 // Mute on load. 3376 $iframe[0].contentWindow.postMessage(JSON.stringify({ 3377 'event': 'command', 3378 'func': 'mute', 3379 'args': ''}), 3380 '*'); 3381 }); 3382 3383 let iframesrc = ''; 3384 let separator = '?'; 3385 3386 if ($iframe.attr('data-src')) { 3387 iframesrc = $iframe.attr('data-src'); 3388 } else { 3389 iframesrc = $iframe.attr('src'); 3390 } 3391 3392 if (iframesrc.indexOf('?') > 0){ 3393 separator = '&'; 3394 } 3395 3396 // Trigger the "load" event, with new params. 3397 $iframe.attr('src', iframesrc + separator + 'autoplay=1&enablejsapi=1&loop=1'); 3398 3399 return obj; 3400 } 3401 3402 obj.getType = function() { 3403 return 'YouTube'; 3404 }; 3405 3406 obj.play = function () { 3407 $iframe[0].contentWindow.postMessage(JSON.stringify({ 3408 'event': 'command', 3409 'func': 'playVideo', 3410 'args': ''}), 3411 '*'); 3412 3413 isPlaying = true; 3414 }; 3415 3416 obj.pause = function () { 3417 $iframe[0].contentWindow.postMessage(JSON.stringify({ 3418 'event': 'command', 3419 'func': 'pauseVideo', 3420 'args': ''}), 3421 '*'); 3422 3423 isPlaying = false; 3424 }; 3425 3426 obj.isPlaying = function() { 3427 return isPlaying; 3428 }; 3429 3430 return init(); 3431 }; 3432 3433})(jQuery); 3434 3435/******************* 3436 * 3437 * Vimoe Player 3438 * 3439 ******************/ 3440 3441(function ($) { 3442 3443 'use strict'; 3444 3445 g1.mediaPlayers.vimeo = function ($iframe) { 3446 let obj = {}; 3447 let isPlaying = false; 3448 3449 function init() { 3450 g1.log('Vimeo player object initialized'); 3451 3452 $iframe.on('load', function() { 3453 $iframe[0].contentWindow.postMessage(JSON.stringify({ 3454 method: 'setVolume', 3455 value: 0 3456 }), '*'); 3457 }); 3458 3459 let iframesrc = ''; 3460 let separator = '?'; 3461 3462 if ($iframe.attr('data-src')) { 3463 iframesrc = $iframe.attr('data-src'); 3464 } else { 3465 iframesrc = $iframe.attr('src'); 3466 } 3467 3468 if (iframesrc.indexOf('?') > 0){ 3469 separator = '&'; 3470 } 3471 3472 $iframe.attr('src', iframesrc + separator + 'autoplay=1&autopause=0'); 3473 3474 return obj; 3475 } 3476 3477 obj.getType = function() { 3478 return 'Vimeo'; 3479 }; 3480 3481 obj.play = function () { 3482 $iframe[0].contentWindow.postMessage(JSON.stringify({ 3483 method: 'play' 3484 }), '*'); 3485 3486 isPlaying = true; 3487 }; 3488 3489 obj.pause = function () { 3490 $iframe[0].contentWindow.postMessage(JSON.stringify({ 3491 method: 'pause' 3492 }), '*'); 3493 3494 isPlaying = false;
3495 }; 3496 3497 obj.isPlaying = function() { 3498 return isPlaying; 3499 }; 3500 3501 return init(); 3502 }; 3503 3504})(jQuery); 3505 3506/******************* 3507 * 3508 * DailyMotion Player 3509 * 3510 ******************/ 3511 3512(function ($) { 3513 3514 'use strict'; 3515 3516 g1.mediaPlayers.dailymotion = function ($iframe) { 3517 let obj = {}; 3518 let isPlaying = false; 3519 3520 function init() { 3521 g1.log('DailyMotion player object initialized'); 3522 3523 // Mute on load. 3524 let iframesrc = ''; 3525 let separator = '?'; 3526 3527 if ($iframe.attr('data-src')) { 3528 iframesrc = $iframe.attr('data-src'); 3529 } else { 3530 iframesrc = $iframe.attr('src'); 3531 } 3532 3533 if (iframesrc.indexOf('?') > 0){ 3534 separator = '&'; 3535 } 3536 3537 $iframe.attr('src', iframesrc + separator + 'autoplay=1&api=postMessage&mute=1'); 3538 3539 return obj; 3540 } 3541 3542 obj.getType = function() { 3543 return 'DailyMotion'; 3544 }; 3545 3546 obj.play = function () { 3547 $iframe[0].contentWindow.postMessage('play', '*'); 3548 3549 isPlaying = true; 3550 }; 3551 3552 obj.pause = function () { 3553 $iframe[0].contentWindow.postMessage('pause', '*'); 3554 3555 isPlaying = false; 3556 }; 3557 3558 obj.isPlaying = function() { 3559 return isPlaying; 3560 }; 3561 3562 return init(); 3563 }; 3564 3565})(jQuery); 3566 3567/******************* 3568 * 3569 * Gfycat Player 3570 * 3571 ******************/ 3572 3573(function ($) { 3574 3575 'use strict'; 3576 3577 g1.mediaPlayers.gfycat = function ($iframe) { 3578 let obj = {}; 3579 let isPlaying = false; 3580 3581 function init() { 3582 g1.log('Gfycat player object initialized'); 3583 return obj; 3584 } 3585 3586 obj.getType = function() { 3587 return 'Gfycat'; 3588 }; 3589 3590 obj.play = function () { 3591 $iframe[0].contentWindow.postMessage('play', '*'); 3592 3593 isPlaying = true; 3594 }; 3595 3596 obj.pause = function () { 3597 $iframe[0].contentWindow.postMessage('pause', '*'); 3598 3599 isPlaying = false; 3600 }; 3601 3602 obj.isPlaying = function() { 3603 return isPlaying; 3604 }; 3605 3606 return init(); 3607 }; 3608 3609})(jQuery); 3610 3611/******************* 3612 * 3613 * MP4 Player 3614 * 3615 ******************/ 3616 3617(function ($) { 3618 3619 'use strict'; 3620 3621 g1.mediaPlayers.mp4 = function (mejsPlayer) { 3622 let obj = {}; 3623 let isPlaying = false; 3624 3625 function init() { 3626 g1.log('MP4 player initialized'); 3627 3628 // Start muted. 3629 mejsPlayer.setMuted(true); 3630 3631 // Play in loop. 3632 mejsPlayer.media.addEventListener('ended', function() { 3633 mejsPlayer.play(); 3634 }, false); 3635 3636 return obj; 3637 } 3638 3639 obj.getType = function() { 3640 return 'MP4'; 3641 }; 3642 3643 obj.play = function() { 3644 mejsPlayer.play(); 3645 3646 isPlaying = true; 3647 }; 3648 3649 obj.pause = function() { 3650 mejsPlayer.pause(); 3651 3652 isPlaying = false; 3653 }; 3654 3655 obj.isPlaying = function() { 3656 return isPlaying; 3657 }; 3658 3659 return init(); 3660 }; 3661 3662})(jQuery); 3663 3664/******************* 3665 * 3666 * GIF Player 3667 * 3668 ******************/ 3669 3670(function ($) { 3671 3672 'use strict'; 3673 3674 g1.mediaPlayers.gif = function (gifPlayer) { 3675 let obj = {}; 3676 3677 function init() { 3678 g1.log('GIF player initialized'); 3679 3680 return obj; 3681 } 3682 3683 obj.getType = function() { 3684 return 'GIF'; 3685 }; 3686 3687 obj.play = function() { 3688 gifPlayer.play(); 3689 }; 3690 3691 obj.pause = function() { 3692 gifPlayer.pause(); 3693 }; 3694 3695 obj.isPlaying = function() { 3696 return gifPlayer.isPlaying; 3697 }; 3698 3699 return init(); 3700 }; 3701 3702})(jQuery); 3703 3704/******************* 3705 * 3706 * HTML Video Player 3707 * 3708 ******************/ 3709 3710(function ($) { 3711 3712 'use strict'; 3713 3714 g1.mediaPlayers.html5video = function (video) { 3715 let obj = {}; 3716 let isPlaying = false; 3717 3718 function init() { 3719 g1.log('HTML5 Video player initialized'); 3720 3721 return obj; 3722 } 3723 3724 obj.getType = function() { 3725 return 'HTML5 Video'; 3726 }; 3727 3728 obj.play = function() { 3729 video.play(); 3730 3731 isPlaying = true; 3732 }; 3733 3734 obj.pause = function() { 3735 video.pause(); 3736 3737 isPlaying = false;
3738 }; 3739 3740 obj.isPlaying = function() { 3741 return isPlaying; 3742 }; 3743 3744 return init(); 3745 }; 3746 3747})(jQuery); 3748 3749/******************* 3750 * 3751 * Embedly Player 3752 * 3753 ******************/ 3754 3755(function ($) { 3756 3757 'use strict'; 3758 3759 g1.mediaPlayers.embedly = function (embedlyPlayer) { 3760 let obj = {}; 3761 let isPlaying = false; 3762 3763 function init() { 3764 g1.log('Embedly player initialized'); 3765 3766 embedlyPlayer.mute(); 3767 3768 return obj; 3769 } 3770 3771 obj.getType = function() { 3772 return 'Embedly'; 3773 }; 3774 3775 obj.play = function() { 3776 embedlyPlayer.play(); 3777 3778 isPlaying = true; 3779 }; 3780 3781 obj.pause = function() { 3782 embedlyPlayer.pause(); 3783 3784 isPlaying = false; 3785 }; 3786 3787 obj.isPlaying = function() { 3788 return isPlaying; 3789 }; 3790 3791 return init(); 3792 }; 3793 3794})(jQuery); 3795 3796 3797/********************** 3798/********************** 3799 * 3800 * Auto Play Controller 3801 * 3802 ********************** 3803 **********************/ 3804 3805(function ($) { 3806 3807 'use strict'; 3808 3809 var selectors = { 3810 'postMedia': '.archive-body-stream .entry-tpl-stream .entry-featured-media:not(.entry-media-nsfw-embed)' 3811 }; 3812 3813 // Due to varied autoplay browsers' policies, it's almost impossible to guarantee autoplying on mobiles, so we turn it off. 3814 g1.isAutoPlayEnabled = g1.config.auto_play_videos && ! g1.isTouchDevice(); 3815 3816 var players = {}; // Initialized players. 3817 3818 g1.autoPlayVideo = function () { 3819 if ( ! g1.isAutoPlayEnabled ) { 3820 return; 3821 } 3822 3823 var pauseAllVideos = function() { 3824 g1.log('Pausing all videos'); 3825 3826 for(var i in players) { 3827 players[i].pause(); 3828 } 3829 }; 3830 3831 var play = function(element) { 3832 var postId = $(element).parents('article').attr('id'); 3833 3834 g1.log('Trying to play media...'); 3835 3836 var player = g1.getMediaPlayer(element); 3837 3838 if (!player) { 3839 g1.log('Media player not defined for the element'); 3840 return; 3841 } 3842 3843 // Before playing this video we want to make sure that others video are paused too. 3844 pauseAllVideos(); 3845 3846 player.play(); 3847 3848 g1.log(player.getType() + ' played'); 3849 3850 // Store reference. 3851 if (!players[postId]) { 3852 players[postId] = player; 3853 } 3854 }; 3855 3856 var pause = function (element) { 3857 g1.log('Trying to pause media...'); 3858 3859 var player = g1.getMediaPlayer(element); 3860 3861 if (!player) { 3862 g1.log('Media player not defined for the element'); 3863 return; 3864 } 3865 3866 player.pause(); 3867 3868 g1.log(player.getType() + ' paused'); 3869 }; 3870 3871 var bindEvents = function() { 3872 3873 // Delay waypoint. User scroll activate events. 3874 var scrollEvents = 0; 3875 var allowPlaying = false; 3876 3877 // Wait for user scroll. Not scroll event while page loading. 3878 $(document).scroll(function() { 3879 scrollEvents++; 3880 3881 if (scrollEvents > 5) { 3882 allowPlaying = true; 3883 } 3884 }); 3885 3886 // ENTER, while up to down scrolling. 3887 $(selectors.postMedia).waypoint(function(direction) { 3888 if ('down' === direction) { 3889 if (allowPlaying) { 3890 g1.log([ '>>> ENTER post (direction: DOWN)', this.element ] ); 3891 3892 play(this.element); 3893 } 3894 3895 } 3896 }, { 3897 // When the bottom of the element hits the bottom of the viewport. 3898 offset: 'bottom-in-view' 3899 }); 3900 3901 // ENTER, while down to up scrolling. 3902 $(selectors.postMedia).waypoint(function(direction) { 3903 if ('up' === direction) { 3904 if (allowPlaying) { 3905 g1.log([ '>>> ENTER post (direction: UP)', this.element ] ); 3906 3907 play(this.element); 3908 } 3909 } 3910 }, { 3911 // When the top of the element hits the top of the viewport. 3912 offset: '0' 3913 }); 3914 3915 // EXIT, while up to down scrolling. 3916 $(selectors.postMedia).waypoint(function(direction) { 3917 if ('down' === direction) { 3918 g1.log([ '>>> EXIT post (direction: DOWN)', this.element ] ); 3919 3920 pause(this.element); 3921 } 3922 }, { 3923 offset: function() { 3924 // Fires when top of the element is (HALF OF ELEMENT HEIGHT)px from the top of the window. 3925 return -Math.round(this.element.clientHeight / 2); 3926 } 3927 }); 3928 3929 // EXIT, while down to up scrolling. 3930 $(selectors.postMedia).waypoint(function(direction) { 3931 if ('up' === direction) { 3932 g1.log([ '>>> EXIT post (direction: UP)', this.element ] ); 3933 3934 pause(this.element); 3935 } 3936 }, { 3937 offset: function() {
vendor: 30,334 bytes, lines 3938-4108
3938 var viewportHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); 3939 3940 // Fires when top of the element is (HALF OF ELEMENT HEIGHT)px from the bottom of the window. 3941 return viewportHeight - Math.round(this.element.clientHeight / 2); 3942 } 3943 }); 3944 3945 // Play on demand. 3946 $(selectors.postMedia).on('bimber:play', function() { 3947 g1.log([ '>>> PLAY ', $(this).get(0) ] ); 3948 3949 play($(this).get(0)); 3950 }); 3951 3952 // Pause on demand. 3953 $(selectors.postMedia).on('bimber:pause', function() { 3954 g1.log([ '>>> PAUSE ', $(this).get(0) ] ); 3955 3956 pause($(this).get(0)); 3957 }); 3958 }; 3959 3960 bindEvents(); 3961 }; 3962 3963})(jQuery); 3964 3965/************************** 3966 * 3967 * document ready functions (keep this at the end for better compatibillity with optimizing plugins) 3968 * 3969 *************************/ 3970 3971(function ($) { 3972 3973 'use strict'; 3974 3975 $(document).ready(function () { 3976 // Init GIF player. 3977 g1.gifPlayer(); 3978 3979 // Init videos auto load on scroll. 3980 g1.autoPlayVideo(); 3981 }); 3982 3983})(jQuery);; 3984/*! jQuery UI - v1.13.3 - 2024-04-26 3985* https://jqueryui.com 3986* 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 3987* Copyright jQuery Foundation and other contributors; Licensed MIT */ 3988!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", 3989/*! 3990 * jQuery UI :data 1.13.3 3991 * https://jqueryui.com 3992 * 3993 * Copyright OpenJS Foundation and other contributors 3994 * Released under the MIT license. 3995 * https://jquery.org/license 3996 */ 3997x.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])}}), 3998/*! 3999 * jQuery UI Disable Selection 1.13.3 4000 * https://jqueryui.com 4001 * 4002 * Copyright OpenJS Foundation and other contributors 4003 * Released under the MIT license. 4004 * https://jquery.org/license 4005 */ 4006x.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")}}), 4007/*! 4008 * jQuery UI Focusable 1.13.3 4009 * https://jqueryui.com 4010 * 4011 * Copyright OpenJS Foundation and other contributors 4012 * Released under the MIT license. 4013 * https://jquery.org/license 4014 */ 4015x.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)}, 4016/*! 4017 * jQuery UI Form Reset Mixin 1.13.3 4018 * https://jqueryui.com 4019 * 4020 * Copyright OpenJS Foundation and other contributors 4021 * Released under the MIT license. 4022 * https://jquery.org/license 4023 */ 4024x.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()), 4025/*! 4026 * jQuery UI Support for jQuery core 1.8.x and newer 1.13.3 4027 * https://jqueryui.com 4028 * 4029 * Copyright OpenJS Foundation and other contributors 4030 * Released under the MIT license. 4031 * https://jquery.org/license 4032 * 4033 */ 4034x.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})}}), 4035/*! 4036 * jQuery UI Keycode 1.13.3 4037 * https://jqueryui.com 4038 * 4039 * Copyright OpenJS Foundation and other contributors 4040 * Released under the MIT license. 4041 * https://jquery.org/license 4042 */ 4043x.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}, 4044/*! 4045 * jQuery UI Labels 1.13.3 4046 * https://jqueryui.com 4047 * 4048 * Copyright OpenJS Foundation and other contributors 4049 * Released under the MIT license. 4050 * https://jquery.org/license 4051 */ 4052x.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<s.length;o++)t.options[s[o][0]]&&s[o][1].apply(t.element,i)}}, 4053/*! 4054 * jQuery UI Position 1.13.3 4055 * https://jqueryui.com 4056 * 4057 * Copyright OpenJS Foundation and other contributors 4058 * Released under the MIT license. 4059 * https://jquery.org/license 4060 * 4061 * https://api.jqueryui.com/position/ 4062 */ 4063W=Math.max,C=Math.abs,o=/left|center|right/,s=/top|center|bottom/,r=/[\+\-]\d+(\.[\d]+)?%?/,l=/^\w+/,a=/%$/,h=x.fn.position,x.position={scrollbarWidth:function(){var t,e,i;return void 0!==n?n:(i=(e=x("<div style='display:block;position:absolute;width:200px;height:200px;overflow:hidden;'><div style='height:300px;width:auto;'></div></div>")).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.width<t.element[0].scrollWidth;return{width:"scroll"===i||"auto"===i&&t.height<t.element[0].scrollHeight?x.position.scrollbarWidth():0,height:e?x.position.scrollbarWidth():0}},getWithinInfo:function(t){var e=x(t||window),i=N(e[0]),n=!!e[0]&&9===e[0].nodeType;return{element:e,isWindow:i,isDocument:n,offset:!i&&!n?x(t).offset():{left:0,top:0},scrollLeft:e.scrollLeft(),scrollTop:e.scrollTop(),width:e.outerWidth(),height:e.outerHeight()}}},x.fn.position=function(f){var c,d,p,g,m,v,y,w,b,_,t,e;return f&&f.of?(v="string"==typeof(f=x.extend({},f)).of?x(document).find(f.of):x(f.of),y=x.position.getWithinInfo(f.within),w=x.position.getScrollInfo(y),b=(f.collision||"flip").split(" "),_={},e=9===(e=(t=v)[0]).nodeType?{width:t.width(),height:t.height(),offset:{top:0,left:0}}:N(e)?{width:t.width(),height:t.height(),offset:{top:t.scrollTop(),left:t.scrollLeft()}}:e.preventDefault?{width:0,height:0,offset:{top:e.pageY,left:e.pageX}}:{width:t.outerWidth(),height:t.outerHeight(),offset:t.offset()},v[0].preventDefault&&(f.at="left top"),d=e.width,p=e.height,m=x.extend({},g=e.offset),x.each(["my","at"],function(){var t,e,i=(f[this]||"").split(" ");(i=1===i.length?o.test(i[0])?i.concat(["center"]):s.test(i[0])?["center"].concat(i):["center","center"]:i)[0]=o.test(i[0])?i[0]:"center",i[1]=s.test(i[1])?i[1]:"center",t=r.exec(i[0]),e=r.exec(i[1]),_[this]=[t?t[0]:0,e?e[0]:0],f[this]=[l.exec(i[0])[0],l.exec(i[1])[0]]}),1===b.length&&(b[1]=b[0]),"right"===f.at[0]?m.left+=d:"center"===f.at[0]&&(m.left+=d/2),"bottom"===f.at[1]?m.top+=p:"center"===f.at[1]&&(m.top+=p/2),c=E(_.at,d,p),m.left+=c[0],m.top+=c[1],this.each(function(){var i,t,r=x(this),l=r.outerWidth(),a=r.outerHeight(),e=L(this,"marginLeft"),n=L(this,"marginTop"),o=l+e+L(this,"marginRight")+w.width,s=a+n+L(this,"marginBottom")+w.height,h=x.extend({},m),u=E(_.my,r.outerWidth(),r.outerHeight());"right"===f.my[0]?h.left-=l:"center"===f.my[0]&&(h.left-=l/2),"bottom"===f.my[1]?h.top-=a:"center"===f.my[1]&&(h.top-=a/2),h.left+=u[0],h.top+=u[1],i={marginLeft:e,marginTop:n},x.each(["left","top"],function(t,e){x.ui.position[b[t]]&&x.ui.position[b[t]][e](h,{targetWidth:d,targetHeight:p,elemWidth:l,elemHeight:a,collisionPosition:i,collisionWidth:o,collisionHeight:s,offset:[c[0]+u[0],c[1]+u[1]],my:f.my,at:f.at,within:y,elem:r})}),f.using&&(t=function(t){var e=g.left-h.left,i=e+d-l,n=g.top-h.top,o=n+p-a,s={target:{element:v,left:g.left,top:g.top,width:d,height:p},element:{element:r,left:h.left,top:h.top,width:l,height:a},horizontal:i<0?"left":0<e?"right":"center",vertical:o<0?"top":0<n?"bottom":"middle"};d<l&&C(e+i)<d&&(s.horizontal="center"),p<a&&C(n+o)<p&&(s.vertical="middle"),W(C(e),C(i))>W(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<e.collisionWidth?0<r&&l<=0?(i=t.left+r+e.collisionWidth-n-o,t.left+=r-i):t.left=!(0<l&&r<=0)&&l<r?o+n-e.collisionWidth:o:0<r?t.left+=r:0<l?t.left-=l:t.left=W(t.left-s,t.left)},top:function(t,e){var i,n=e.within,n=n.isWindow?n.scrollTop:n.offset.top,o=e.within.height,s=t.top-e.collisionPosition.marginTop,r=n-s,l=s+e.collisionHeight-o-n;o<e.collisionHeight?0<r&&l<=0?(i=t.top+r+e.collisionHeight-o-n,t.top+=r-i):t.top=!(0<l&&r<=0)&&l<r?n+o-e.collisionHeight:n:0<r?t.top+=r:0<l?t.top-=l:t.top=W(t.top-s,t.top)}},flip:{left:function(t,e){var i=e.within,n=i.offset.left+i.scrollLeft,o=i.width,i=i.isWindow?i.scrollLeft:i.offset.left,s=t.left-e.collisionPosition.marginLeft,r=s-i,s=s+e.collisionWidth-o-i,l="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,a="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,h=-2*e.offset[0];r<0?((o=t.left+l+a+h+e.collisionWidth-o-n)<0||o<C(r))&&(t.left+=l+a+h):0<s&&(0<(n=t.left-e.collisionPosition.marginLeft+l+a+h-i)||C(n)<s)&&(t.left+=l+a+h)},top:function(t,e){var i=e.within,n=i.offset.top+i.scrollTop,o=i.height,i=i.isWindow?i.scrollTop:i.offset.top,s=t.top-e.collisionPosition.marginTop,r=s-i,s=s+e.collisionHeight-o-i,l="top"===e.my[1]?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,a="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,h=-2*e.offset[1];r<0?((o=t.top+l+a+h+e.collisionHeight-o-n)<0||o<C(r))&&(t.top+=l+a+h):0<s&&(0<(n=t.top-e.collisionPosition.marginTop+l+a+h-i)||C(n)<s)&&(t.top+=l+a+h)}},flipfit:{left:function(){x.ui.position.flip.left.apply(this,arguments),x.ui.position.fit.left.apply(this,arguments)},top:function(){x.ui.position.flip.top.apply(this,arguments),x.ui.position.fit.top.apply(this,arguments)}}},x.ui.safeActiveElement=function(e){var i;try{i=e.activeElement}catch(t){i=e.body}return i=(i=i||e.body).nodeName?i:e.body},x.ui.safeBlur=function(t){t&&"body"!==t.nodeName.toLowerCase()&&x(t).trigger("blur")}, 4064/*! 4065 * jQuery UI Scroll Parent 1.13.3 4066 * https://jqueryui.com 4067 * 4068 * Copyright OpenJS Foundation and other contributors 4069 * Released under the MIT license. 4070 * https://jquery.org/license 4071 */ 4072x.fn.scrollParent=function(t){var e=this.css("position"),i="absolute"===e,n=t?/(auto|scroll|hidden)/:/(auto|scroll)/,t=this.parents().filter(function(){var t=x(this);return(!i||"static"!==t.css("position"))&&n.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==e&&t.length?t:x(this[0].ownerDocument||document)}, 4073/*! 4074 * jQuery UI Tabbable 1.13.3 4075 * https://jqueryui.com 4076 * 4077 * Copyright OpenJS Foundation and other contributors 4078 * Released under the MIT license. 4079 * https://jquery.org/license 4080 */ 4081x.extend(x.expr.pseudos,{tabbable:function(t){var e=x.attr(t,"tabindex"),i=null!=e;return(!i||0<=e)&&x.ui.focusable(t,i)}}), 4082/*! 4083 * jQuery UI Unique ID 1.13.3 4084 * https://jqueryui.com 4085 * 4086 * Copyright OpenJS Foundation and other contributors 4087 * Released under the MIT license. 4088 * https://jquery.org/license 4089 */ 4090x.fn.extend({uniqueId:(u=0,function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++u)})}),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&x(this).removeAttr("id")})}}); 4091/*! 4092 * jQuery UI Widget 1.13.3 4093 * https://jqueryui.com 4094 * 4095 * Copyright OpenJS Foundation and other contributors 4096 * Released under the MIT license. 4097 * https://jquery.org/license 4098 */ 4099var f,c=0,d=Array.prototype.hasOwnProperty,p=Array.prototype.slice;x.cleanData=(f=x.cleanData,function(t){for(var e,i,n=0;null!=(i=t[n]);n++)(e=x._data(i,"events"))&&e.remove&&x(i).triggerHandler("remove");f(t)}),x.widget=function(t,i,e){var n,o,s,r={},l=t.split(".")[0],a=l+"-"+(t=t.split(".")[1]);return e||(e=i,i=x.Widget),Array.isArray(e)&&(e=x.extend.apply(null,[{}].concat(e))),x.expr.pseudos[a.toLowerCase()]=function(t){return!!x.data(t,a)},x[l]=x[l]||{},n=x[l][t],o=x[l][t]=function(t,e){if(!this||!this._createWidget)return new o(t,e);arguments.length&&this._createWidget(t,e)},x.extend(o,n,{version:e.version,_proto:x.extend({},e),_childConstructors:[]}),(s=new i).options=x.widget.extend({},s.options),x.each(e,function(e,n){function o(){return i.prototype[e].apply(this,arguments)}function s(t){return i.prototype[e].apply(this,t)}r[e]="function"!=typeof n?n:function(){var t,e=this._super,i=this._superApply;return this._super=o,this._superApply=s,t=n.apply(this,arguments),this._super=e,this._superApply=i,t}}),o.prototype=x.widget.extend(s,{widgetEventPrefix:n&&s.widgetEventPrefix||t},r,{constructor:o,namespace:l,widgetName:t,widgetFullName:a}),n?(x.each(n._childConstructors,function(t,e){var i=e.prototype;x.widget(i.namespace+"."+i.widgetName,o,e._proto)}),delete n._childConstructors):i._childConstructors.push(o),x.widget.bridge(t,o),o},x.widget.extend=function(t){for(var e,i,n=p.call(arguments,1),o=0,s=n.length;o<s;o++)for(e in n[o])i=n[o][e],d.call(n[o],e)&&void 0!==i&&(x.isPlainObject(i)?t[e]=x.isPlainObject(t[e])?x.widget.extend({},t[e],i):x.widget.extend({},i):t[e]=i);return t},x.widget.bridge=function(s,e){var r=e.prototype.widgetFullName||s;x.fn[s]=function(i){var t="string"==typeof i,n=p.call(arguments,1),o=this;return t?this.length||"instance"!==i?this.each(function(){var t,e=x.data(this,r);return"instance"===i?(o=e,!1):e?"function"!=typeof e[i]||"_"===i.charAt(0)?x.error("no such method '"+i+"' for "+s+" widget instance"):(t=e[i].apply(e,n))!==e&&void 0!==t?(o=t&&t.jquery?o.pushStack(t.get()):t,!1):void 0:x.error("cannot call methods on "+s+" prior to initialization; attempted to call method '"+i+"'")}):o=void 0:(n.length&&(i=x.widget.extend.apply(null,[i].concat(n))),this.each(function(){var t=x.data(this,r);t?(t.option(i||{}),t._init&&t._init()):x.data(this,r,new e(i,this))})),o}},x.Widget=function(){},x.Widget._childConstructors=[],x.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",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<i.length-1;o++)n[i[o]]=n[i[o]]||{},n=n[i[o]];if(t=i.pop(),1===arguments.length)return void 0===n[t]?null:n[t];n[t]=e}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];s[t]=e}return this._setOptions(s),this},_setOptions:function(t){for(var e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(t){var e,i,n;for(e in t)n=this.classesElementLookup[e],t[e]!==this.options.classes[e]&&n&&n.length&&(i=x(n.get()),this._removeClass(n,e),i.addClass(this._classes({element:i,keys:e,classes:t,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(o){var s=[],r=this;function t(t,e){for(var i,n=0;n<t.length;n++)i=r.classesElementLookup[t[n]]||x(),i=o.add?(function(){var i=[];o.element.each(function(t,e){x.map(r.classesElementLookup,function(t){return t}).some(function(t){return t.is(e)})||i.push(e)}),r._on(x(i),{remove:"_untrackClassesElement"})}(),x(x.uniqueSort(i.get().concat(o.element.get())))):x(i.not(o.element).get()),r.classesElementLookup[t[n]]=i,s.push(t[n]),e&&o.classes[t[n]]&&s.push(o.classes[t[n]])}return(o=x.extend({element:this.element,classes:this.options.classes||{}},o)).keys&&t(o.keys.match(/\S+/g)||[],!0),o.extra&&t(o.extra.match(/\S+/g)||[]),s.join(" ")},_untrackClassesElement:function(i){var n=this;x.each(n.classesElementLookup,function(t,e){-1!==x.inArray(i.target,e)&&(n.classesElementLookup[t]=x(e.not(i.target).get()))}),this._off(x(i.target))},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,n){var o="string"==typeof t||null===t,e={extra:o?e:i,keys:o?t:e,element:o?this.element:t,add:n="boolean"==typeof n?n:i};return e.element.toggleClass(this._classes(e),n),this},_on:function(o,s,t){var r,l=this;"boolean"!=typeof o&&(t=s,s=o,o=!1),t?(s=r=x(s),this.bindings=this.bindings.add(s)):(t=s,s=this.element,r=this.widget()),x.each(t,function(t,e){function i(){if(o||!0!==l.options.disabled&&!x(this).hasClass("ui-state-disabled"))return("string"==typeof e?l[e]:e).apply(l,arguments)}"string"!=typeof e&&(i.guid=e.guid=e.guid||i.guid||x.guid++);var t=t.match(/^([\w:-]*)\s*(.*)$/),n=t[1]+l.eventNamespace,t=t[2];t?r.on(n,t,i):s.on(n,i)})},_off:function(t,e){e=(e||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.off(e),this.bindings=x(this.bindings.not(t).get()),this.focusable=x(this.focusable.not(t).get()),this.hoverable=x(this.hoverable.not(t).get())},_delay:function(t,e){var i=this;return setTimeout(function(){return("string"==typeof t?i[t]:t).apply(i,arguments)},e||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){this._addClass(x(t.currentTarget),null,"ui-state-hover")},mouseleave:function(t){this._removeClass(x(t.currentTarget),null,"ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){this._addClass(x(t.currentTarget),null,"ui-state-focus")},focusout:function(t){this._removeClass(x(t.currentTarget),null,"ui-state-focus")}})},_trigger:function(t,e,i){var n,o,s=this.options[t];if(i=i||{},(e=x.Event(e)).type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),e.target=this.element[0],o=e.originalEvent)for(n in o)n in e||(e[n]=o[n]);return this.element.trigger(e,i),!("function"==typeof s&&!1===s.apply(this.element[0],[e].concat(i))||e.isDefaultPrevented())}},x.each({show:"fadeIn",hide:"fadeOut"},function(s,r){x.Widget.prototype["_"+s]=function(e,t,i){var n,o=(t="string"==typeof t?{effect:t}:t)?!0!==t&&"number"!=typeof t&&t.effect||r:s;"number"==typeof(t=t||{})?t={duration:t}:!0===t&&(t={}),n=!x.isEmptyObject(t),t.complete=i,t.delay&&e.delay(t.delay),n&&x.effects&&x.effects.effect[o]?e[s](t):o!==s&&e[o]?e[o](t.duration,t.easing,i):e.queue(function(t){x(this)[s](),i&&i.call(e[0]),t()})}})});; 4100/*! 4101 * jQuery UI Menu 1.13.3 4102 * https://jqueryui.com 4103 * 4104 * Copyright OpenJS Foundation and other contributors 4105 * Released under the MIT license. 4106 * https://jquery.org/license 4107 */ 4108!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery","../keycode","../position","../safe-active-element","../unique-id","../version","../widget"],e):e(jQuery)}(function(a){"use strict";return a.widget("ui.menu",{version:"1.13.3",defaultElement:"<ul>",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("<span>").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<t+e&&this.activeMenu.scrollTop(i+t-s+e))},blur:function(e,t){t||clearTimeout(this.timer),this.active&&(this._removeClass(this.active.children(".ui-menu-item-wrapper"),null,"ui-state-active"),this._trigger("blur",e,{item:this.active}),this.active=null)},_startOpening:function(e){clearTimeout(this.timer),"true"===e.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(e)},this.delay))},_open:function(e){var t=a.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(e.parents(".ui-menu")).hide().attr("aria-hidden","true"),e.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(t)},collapseAll:function(t,i){clearTimeout(this.timer),this.timer=this._delay(function(){var e=i?this.element:a(t&&t.target).closest(this.element.find(".ui-menu"));e.length||(e=this.element),this._close(e),this.blur(t),this._removeClass(e.find(".ui-state-active"),null,"ui-state-active"),this.activeMenu=e},i?0:this.delay)},_close:function(e){(e=e||(this.active?this.active.parent():this.element)).find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","fal
4108se")},_closeOnDocumentClick:function(e){return!a(e.target).closest(".ui-menu").length},_isDivider:function(e){return!/[^\-\u2014\u2013\s]/.test(e.text())},collapse:function(e){var t=this.active&&this.active.parent().closest(".ui-menu-item",this.element);t&&t.length&&(this._close(),this.focus(e,t))},expand:function(e){var t=this.active&&this._menuItems(this.active.children(".ui-menu")).first();t&&t.length&&(this._open(t.parent()),this._delay(function(){this.focus(e,t)}))},next:function(e){this._move("next","first",e)},previous:function(e){this._move("prev","last",e)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_menuItems:function(e){return(e||this.element).find(this.options.items).filter(".ui-menu-item")},_move:function(e,t,i){var s;(s=this.active?"first"===e||"last"===e?this.active["first"===e?"prevAll":"nextAll"](".ui-menu-item").last():this.active[e+"All"](".ui-menu-item").first():s)&&s.length&&this.active||(s=this._menuItems(this.activeMenu)[t]()),this.focus(i,s)},nextPage:function(e){var t,i,s;this.active?this.isLastItem()||(this._hasScroll()?(i=this.active.offset().top,s=this.element.innerHeight(),0===a.fn.jquery.indexOf("3.2.")&&(s+=this.element[0].offsetHeight-this.element.outerHeight()),this.active.nextAll(".ui-menu-item").each(function(){return(t=a(this)).offset().top-i-s<0}),this.focus(e,t)):this.focus(e,this._menuItems(this.activeMenu)[this.active?"last":"first"]())):this.next(e)},previousPage:function(e){var t,i,s;this.active?this.isFirstItem()||(this._hasScroll()?(i=this.active.offset().top,s=this.element.innerHeight(),0===a.fn.jquery.indexOf("3.2.")&&(s+=this.element[0].offsetHeight-this.element.outerHeight()),this.active.prevAll(".ui-menu-item").each(function(){return 0<(t=a(this)).offset().top-i+s}),this.focus(e,t)):this.focus(e,this._menuItems(this.activeMenu).first())):this.next(e)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(e){this.active=this.active||a(e.target).closest(".ui-menu-item");var t={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(e,!0),this._trigger("select",e,t)},_filterMenuItems:function(e){var e=e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),t=new RegExp("^"+e,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return t.test(String.prototype.trim.call(a(this).children(".ui-menu-item-wrapper").text()))})}})});; 4109/*! This file is auto-generated */ 4110(()=>{"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})();;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.