PageSourceSearch

https://350sb.org/wp-content/themes/baseline/js/scripts.js?ver=1780409353

js 350sb.org collected 2026-10-04 08:18:35 UTC 55,791 bytes, 981 lines download raw bytes

vendor: 1,804 bytes, lines 1-6
1/*!
2  hey, [be]Lazy.js - v1.8.2 - 2016.10.25
3  A fast, small and dependency free lazy load script (https://github.com/dinbror/blazy)
4  (c) Bjoern Klinggaard - @bklinggaard - http://dinbror.dk/blazy
5*/
6(function(q,m){"function"===typeof define&&define.amd?define(m):"object"===typeof exports?module.exports=m():q.Blazy=m()})(this,function(){function q(b){var c=b._util;c.elements=E(b.options);c.count=c.elements.length;c.destroyed&&(c.destroyed=!1,b.options.container&&l(b.options.container,function(a){n(a,"scroll",c.validateT)}),n(window,"resize",c.saveViewportOffsetT),n(window,"resize",c.validateT),n(window,"scroll",c.validateT));m(b)}function m(b){for(var c=b._util,a=0;a<c.count;a++){var d=c.elements[a],e;a:{var g=d;e=b.options;var p=g.getBoundingClientRect();if(e.container&&y&&(g=g.closest(e.containerClass))){g=g.getBoundingClientRect();e=r(g,f)?r(p,{top:g.top-e.offset,right:g.right+e.offset,bottom:g.bottom+e.offset,left:g.left-e.offset}):!1;break a}e=r(p,f)}if(e||t(d,b.options.successClass))b.load(d),c.elements.splice(a,1),c.count--,a--}0===c.count&&b.destroy()}function r(b,c){return b.right>=c.left&&b.bottom>=c.top&&b.left<=c.right&&b.top<=c.bottom}function z(b,c,a){if(!t(b,a.successClass)&&(c||a.loadInvisible||0<b.offsetWidth&&0<b.offsetHeight))if(c=b.getAttribute(u)||b.getAttribute(a.src)){c=c.split(a.separator);var d=c[A&&1<c.length?1:0],e=b.getAttribute(a.srcset),g="img"===b.nodeName.toLowerCase(),p=(c=b.parentNode)&&"picture"===c.nodeName.toLowerCase();if(g||void 0===b.src){var h=new Image,w=function(){a.error&&a.error(b,"invalid");v(b,a.errorClass);k(h,"error",w);k(h,"load",f)},f=function(){g?p||B(b,d,e):b.style.backgroundImage='url("'+d+'")';x(b,a);k(h,"load",f);k(h,"error",w)};p&&(h=b,l(c.getElementsByTagName("source"),function(b){var c=a.srcset,e=b.getAttribute(c);
6e&&(b.setAttribute("srcset",e),b.removeAttribute(c))}));n(h,"error",w);n(h,"load",f);B(h,d,e)}else b.src=d,x(b,a)}else"video"===b.nodeName.toLowerCase()?(l(b.getElementsByTagName("source"),function(b){var c=a.src,e=b.getAttribute(c);e&&(b.setAttribute("src",e),b.removeAttribute(c))}),b.load(),x(b,a)):(a.error&&a.error(b,"missing"),v(b,a.errorClass))}function x(b,c){v(b,c.successClass);c.success&&c.success(b);b.removeAttribute(c.src);b.removeAttribute(c.srcset);l(c.breakpoints,function(a){b.removeAttribute(a.src)})}function B(b,c,a){a&&b.setAttribute("srcset",a);b.src=c}function t(b,c){return-1!==(" "+b.className+" ").indexOf(" "+c+" ")}function v(b,c){t(b,c)||(b.className+=" "+c)}function E(b){var c=[];b=b.root.querySelectorAll(b.selector);for(var a=b.length;a--;c.unshift(b[a]));return c}function C(b){f.bottom=(window.innerHeight||document.documentElement.clientHeight)+b;f.right=(window.innerWidth||document.documentElement.clientWidth)+b}function n(b,c,a){b.attachEvent?b.attachEvent&&b.attachEvent("on"+c,a):b.addEventListener(c,a,{capture:!1,passive:!0})}function k(b,c,a){b.detachEvent?b.detachEvent&&b.detachEvent("on"+c,a):b.removeEventListener(c,a,{capture:!1,passive:!0})}function l(b,c){if(b&&c)for(var a=b.length,d=0;d<a&&!1!==c(b[d],d);d++);}function D(b,c,a){var d=0;return function(){var e=+new Date;e-d<c||(d=e,b.apply(a,arguments))}}var u,f,A,y;return function(b){if(!document.querySelectorAll){var c=document.createStyleSheet();document.querySelectorAll=function(a,b,d,h,f){f=document.all;b=[];a=a.replace(/\[for\b/gi,"[htmlFor").split(",");for(d=a.length;d--;){c.addRule(a[d],"k:v");for(h=f.length;h--;)f[h].currentStyle.k&&b.push(f[h]);c.removeRule(0)}return b}}var a=this,d=a._util={};d.elements=[];d.destroyed=!0;a.options=b||{};a.options.error=a.options.error||!1;a.options.offset=a.options.offset||100;a.options.root=a.options.root||document;a.options.success=a.options.success||!1;a.options.selector=a.options.selector||".b-lazy";a.options.separator=a.options.separator||"|";a.options.containerClass=a.options.container;a.options.container=a.options.containerClass?document.querySelectorAll(a.options.containerClass):!1;a.options.errorClass=a.options.errorClass||"b-error";a.options.breakpoints=a.options.breakpoints||!1;a.options.loadInvisible=a.options.loadInvisible||!1;a.options.successClass=a.options.successClass||"b-loaded";a.options.validateDelay=a.options.validateDelay||25;a.options.saveViewportOffsetDelay=a.options.saveViewportOffsetDelay||50;a.options.srcset=a.options.srcset||"data-srcset";a.options.src=u=a.options.src||"data-src";y=Element.prototype.closest;A=1<window.devicePixelRatio;f={};f.top=0-a.options.offset;f.left=0-a.options.offset;a.revalidate=function(){q(a)};a.load=function(a,b){var c=this.options;void 0===a.length?z(a,b,c):l(a,function(a){z(a,b,c)})};a.destroy=function(){var a=this._util;this.options.container&&l(this.options.container,function(b){k(b,"scroll",a.validateT)});k(window,"scroll",a.validateT);k(window,"resize",a.validateT);k(window,"resize",a.saveViewportOffsetT);a.count=0;a.elements.length=0;a.destroyed=!0};d.validateT=D(function(){m(a)},a.options.validateDelay,a);d.saveViewportOffsetT=D(function(){C(a.options.offset)},a.options.saveViewportOffsetDelay,a);C(a.options.offset);l(a.options.breakpoints,function(a){if(a.width>=window.screen.width)return u=a.src,!1});setTimeout(function(){q(a)})}});
7
8/* spin.js - ajax loading animation */
9(function(t,e){if(typeof exports=="object")module.exports=e();else if(typeof define=="function"&&define.amd)define(e);else t.Spinner=e()})(this,function(){"use strict";var t=["webkit","Moz","ms","O"],e={},i;function o(t,e){var i=document.createElement(t||"div"),o;for(o in e)i[o]=e[o];return i}function n(t){for(var e=1,i=arguments.length;e<i;e++)t.appendChild(arguments[e]);return t}var r=function(){var t=o("style",{type:"text/css"});n(document.getElementsByTagName("head")[0],t);return t.sheet||t.styleSheet}();function s(t,o,n,s){var a=["opacity",o,~~(t*100),n,s].join("-"),f=.01+n/s*100,l=Math.max(1-(1-t)/o*(100-f),t),u=i.substring(0,i.indexOf("Animation")).toLowerCase(),d=u&&"-"+u+"-"||"";if(!e[a]){r.insertRule("@"+d+"keyframes "+a+"{"+"0%{opacity:"+l+"}
9"+f+"%{opacity:"+t+"}"+(f+.01)+"%{opacity:1}"+(f+o)%100+"%{opacity:"+t+"}"+"100%{opacity:"+l+"}"+"}",r.cssRules.length);e[a]=1}return a}function a(e,i){var o=e.style,n,r;i=i.charAt(0).toUpperCase()+i.slice(1);for(r=0;r<t.length;r++){n=t[r]+i;if(o[n]!==undefined)return n}if(o[i]!==undefined)return i}function f(t,e){for(var i in e)t.style[a(t,i)||i]=e[i];return t}function l(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var o in i)if(t[o]===undefined)t[o]=i[o]}return t}function u(t){var e={x:t.offsetLeft,y:t.offsetTop};while(t=t.offsetParent)e.x+=t.offsetLeft,e.y+=t.offsetTop;return e}function d(t,e){return typeof t=="string"?t:t[e%t.length]}var p={lines:12,length:7,width:5,radius:10,rotate:0,corners:1,color:"#000",direction:1,speed:1,trail:100,opacity:1/4,fps:20,zIndex:2e9,className:"spinner",top:"auto",left:"auto",position:"relative"};function c(t){if(typeof this=="undefined")return new c(t);this.opts=l(t||{},c.defaults,p)}c.defaults={};l(c.prototype,{spin:function(t){this.stop();var e=this,n=e.opts,r=e.el=f(o(0,{className:n.className}),{position:n.position,width:0,zIndex:n.zIndex}),s=n.radius+n.length+n.width,a,l;if(t){t.insertBefore(r,t.firstChild||null);l=u(t);a=u(r);f(r,{left:(n.left=="auto"?l.x-a.x+(t.offsetWidth>>1):parseInt(n.left,10)+s)+"px",top:(n.top=="auto"?l.y-a.y+(t.offsetHeight>>1):parseInt(n.top,10)+s)+"px"})}r.setAttribute("role","progressbar");e.lines(r,e.opts);if(!i){var d=0,p=(n.lines-1)*(1-n.direction)/2,c,h=n.fps,m=h/n.speed,y=(1-n.opacity)/(m*n.trail/100),g=m/n.lines;(function v(){d++;for(var t=0;t<n.lines;t++){c=Math.max(1-(d+(n.lines-t)*g)%m*y,n.opacity);e.opacity(r,t*n.direction+p,c,n)}e.timeout=e.el&&setTimeout(v,~~(1e3/h))})()}return e},stop:function(){var t=this.el;if(t){clearTimeout(this.timeout);if(t.parentNode)t.parentNode.removeChild(t);this.el=undefined}return this},lines:function(t,e){var r=0,a=(e.lines-1)*(1-e.direction)/2,l;function u(t,i){return f(o(),{position:"absolute",width:e.length+e.width+"px",height:e.width+"px",background:t,boxShadow:i,transformOrigin:"left",transform:"rotate("+~~(360/e.lines*r+e.rotate)+"deg) translate("+e.radius+"px"+",0)",borderRadius:(e.corners*e.width>>1)+"px"})}for(;r<e.lines;r++){l=f(o(),{position:"absolute",top:1+~(e.width/2)+"px",transform:e.hwaccel?"translate3d(0,0,0)":"",opacity:e.opacity,animation:i&&s(e.opacity,e.trail,a+r*e.direction,e.lines)+" "+1/e.speed+"s linear infinite"});if(e.shadow)n(l,f(u("#000","0 0 4px "+"#000"),{top:2+"px"}));n(t,n(l,u(d(e.color,r),"0 0 1px rgba(0,0,0,.1)")))}return t},opacity:function(t,e,i){if(e<t.childNodes.length)t.childNodes[e].style.opacity=i}});function h(){function t(t,e){return o("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">',e)}r.addRule(".spin-vml","behavior:url(#default#VML)");c.prototype.lines=function(e,i){var o=i.length+i.width,r=2*o;function s(){return f(t("group",{coordsize:r+" "+r,coordorigin:-o+" "+-o}),{width:r,height:r})}var a=-(i.width+i.length)*2+"px",l=f(s(),{position:"absolute",top:a,left:a}),u;function p(e,r,a){n(l,n(f(s(),{rotation:360/i.lines*e+"deg",left:~~r}),n(f(t("roundrect",{arcsize:i.corners}),{width:o,height:i.width,left:i.radius,top:-i.width>>1,filter:a}),t("fill",{color:d(i.color,e),opacity:i.opacity}),t("stroke",{opacity:0}))))}if(i.shadow)for(u=1;u<=i.lines;u++)p(u,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(u=1;u<=i.lines;u++)p(u);return n(e,l)};c.prototype.opacity=function(t,e,i,o){var n=t.firstChild;o=o.shadow&&o.lines||0;if(n&&e+o<n.childNodes.length){n=n.childNodes[e+o];n=n&&n.firstChild;n=n&&n.firstChild;if(n)n.opacity=i}}}var m=f(o("group"),{behavior:"url(#default#VML)"});if(!a(m,"transform")&&m.adj)h();else i=a(m,"animation");return c});
10
11/*! gumshoe v3.5.0 | (c) 2017 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/gumshoe */
12!(function(e,t){"function"==typeof define&&define.amd?define([],t(e)):"object"==typeof exports?module.exports=t(e):e.gumshoe=t(e)})("undefined"!=typeof global?global:this.window||this.global,(function(e){"use strict";var t,n,o,r,a,c,i,l={},s="querySelector"in document&&"addEventListener"in e&&"classList"in document.createElement("_"),u=[],f={selector:"[data-gumshoe] a",selectorHeader:"[data-gumshoe-header]",container:e,offset:0,activeClass:"active",scrollDelay:!1,callback:function(){}},d=function(e,t,n){if("[object Object]"===Object.prototype.toString.call(e))for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(n,e[o],o,e);else for(var r=0,a=e.length;r<a;r++)t.call(n,e[r],r,e)},v=function(){var e={},t=!1,n=0,o=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],n++);for(var r=function(n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t&&"[object Object]"===Object.prototype.toString.call(n[o])?e[o]=v(!0,e[o],n[o]):e[o]=n[o])};n<o;n++){var a=arguments[n];r(a)}return e},m=function(e){return Math.max(e.scrollHeight,e.offsetHeight,e.clientHeight)},g=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},h=function(e){var n=0;if(e.offsetParent){do n+=e.offsetTop,e=e.offsetParent;while(e)}else n=e.offsetTop;return n=n-a-t.offset,n>=0?n:0},p=function(t){var n=t.getBoundingClientRect();return n.top>=0&&n.left>
12=0&&n.bottom<=(e.innerHeight||document.documentElement.clientHeight)&&n.right<=(e.innerWidth||document.documentElement.clientWidth)},y=function(){u.sort((function(e,t){return e.distance>t.distance?-1:e.distance<t.distance?1:0}))};l.setDistances=function(){o=g(),a=r?m(r)+h(r):0,d(u,(function(e){e.distance=h(e.target)})),y()};var b=function(){var e=document.querySelectorAll(t.selector);d(e,(function(e){if(e.hash){var t=document.querySelector(e.hash);t&&u.push({nav:e,target:t,parent:"li"===e.parentNode.tagName.toLowerCase()?e.parentNode:null,distance:0})}}))},H=function(){c&&(c.nav.classList.remove(t.activeClass),c.parent&&c.parent.classList.remove(t.activeClass))},C=function(e){H(),e.nav.classList.add(t.activeClass),e.parent&&e.parent.classList.add(t.activeClass),t.callback(e),c={nav:e.nav,parent:e.parent}};l.getCurrentNav=function(){var n=e.pageYOffset;if(e.innerHeight+n>=o&&p(u[0].target))return C(u[0]),u[0];for(var r=0,a=u.length;r<a;r++){var c=u[r];if(c.distance<=n)return C(c),c}H(),t.callback()};var L=function(){d(u,(function(e){e.nav.classList.contains(t.activeClass)&&(c={nav:e.nav,parent:e.parent})}))};l.destroy=function(){t&&(t.container.removeEventListener("resize",j,!1),t.container.removeEventListener("scroll",j,!1),u=[],t=null,n=null,o=null,r=null,a=null,c=null,i=null)};var E=function(e){window.clearTimeout(n),n=setTimeout((function(){l.setDistances(),l.getCurrentNav()}),66)}
12,j=function(e){n||(n=setTimeout((function(){n=null,"scroll"===e.type&&l.getCurrentNav(),"resize"===e.type&&(l.setDistances(),l.getCurrentNav())}),66))};return l.init=function(e){s&&(l.destroy(),t=v(f,e||{}),r=document.querySelector(t.selectorHeader),b(),0!==u.length&&(L(),l.setDistances(),l.getCurrentNav(),t.container.addEventListener("resize",j,!1),t.scrollDelay?t.container.addEventListener("scroll",E,!1):t.container.addEventListener("scroll",j,!1)))},l}));
13
14/*!
15 * headroom.js v0.9.4 - Give your page some headroom. Hide your header until you need it
16 * Copyright (c) 2017 Nick Williams - http://wicky.nillia.ms/headroom.js
17 * License: MIT
18 */
19!function(a,b){"use strict";"function"==typeof define&&define.amd?define([],b):"object"==typeof exports?module.exports=b():a.Headroom=b()}(this,function(){"use strict";function a(a){this.callback=a,this.ticking=!1}function b(a){return a&&"undefined"!=typeof window&&(a===window||a.nodeType)}function c(a){if(arguments.length<=0)throw new Error("Missing arguments in extend function");var d,e,f=a||{};for(e=1;e<arguments.length;e++){var g=arguments[e]||{};for(d in g)"object"!=typeof f[d]||b(f[d])?f[d]=f[d]||g[d]:f[d]=c(f[d],g[d])}return f}function d(a){return a===Object(a)?a:{down:a,up:a}}function e(a,b){b=c(b,e.options),this.lastKnownScrollY=0,this.elem=a,this.tolerance=d(b.tolerance),this.classes=b.classes,this.offset=b.offset,this.scroller=b.scroller,this.initialised=!1,this.onPin=b.onPin,this.onUnpin=b.onUnpin,this.onTop=b.onTop,this.onNotTop=b.onNotTop,this.onBottom=b.onBottom,this.onNotBottom=b.onNotBottom}var f={bind:!!function(){}.bind,classList:"classList"in document.documentElement,rAF:!!(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame)};return window.requestAnimationFrame=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame,a.prototype={constructor:a,update:function(){this.callback&&this.callback(),this.ticking=!1},requestTick:function(){this.ticking||(requestAnimationFrame(this.rafCallback||(this.rafCallback=this.update.bind(this))),this.ticking=!0)},handleEvent:function(){this.requestTick()}},e.prototype={constructor:e,init:function(){if(e.cutsTheMustard)return this.debouncer=new a(this.update.bind(this)),this.elem.classList.add(this.classes.initial),setTimeout(this.attachEvent.bind(this),100),this},destroy:function(){var a=this.classes;this.initialised=!1;for(var b in a)a.hasOwnProperty(b)&&this.elem.classList.remove(a[b]);this.scroller.removeEventListener("scroll",this.debouncer,!1)},attachEvent:function(){this.initialised||(this.lastKnownScrollY=this.getScrollY(),this.initialised=!0,this.scroller.addEventListener("scroll",this.debouncer,!1),this.debouncer.handleEvent())},unpin:function(){var a=this.elem.classList,b=this.classes;!a.contains(b.pinned)&&a.contains(b.unpinned)||(a.add(b.unpinned),a.remove(b.pinned),this.onUnpin&&this.onUnpin.call(this))},pin:function(){var a=this.elem.classList,b=this.classes;a.contains(b.unpinned)&&(a.remove(b.unpinned),a.add(b.pinned),this.onPin&&this.onPin.call(this))},top:function(){var a=this.elem.classList,b=this.classes;a.contains(b.top)||(a.add(b.top),a.remove(b.notTop),this.onTop&&this.onTop.call(this))},notTop:function(){var a=this.elem.classList,b=this.classes;a.contains(b.notTop)||(a.add(b.notTop),a.remove(b.top),this.onNotTop&&this.onNotTop.call(this))},bottom:function(){var a=this.elem.classList,b=this.classes;a.contains(b.bottom)||(a.add(b.bottom),a.remove(b.notBottom),this.onBottom&&this.onBottom.call(this))},notBottom:function(){var a=this.elem.classList,b=this.classes;a.contains(b.notBottom)||(a.add(b.notBottom),a.remove(b.bottom),this.onNotBottom&&this.onNotBottom.call(this))},getScrollY:function(){return void 0!==this.scroller.pageYOffset?this.scroller.pageYOffset:void 0!==this.scroller.scrollTop?this.scroller.scrollTop:(document.documentElement||document.body.parentNode||document.body).scrollTop},getViewportHeight:function(){return window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight},getElementPhysicalHeight:function(a){return Math.max(a.offsetHeight,a.clientHeight)},getScrollerPhysicalHeight:function(){return this.scroller===window||this.scroller===document.body?this.getViewportHe
19ight():this.getElementPhysicalHeight(this.scroller)},getDocumentHeight:function(){var a=document.body,b=document.documentElement;return Math.max(a.scrollHeight,b.scrollHeight,a.offsetHeight,b.offsetHeight,a.clientHeight,b.clientHeight)},getElementHeight:function(a){return Math.max(a.scrollHeight,a.offsetHeight,a.clientHeight)},getScrollerHeight:function(){return this.scroller===window||this.scroller===document.body?this.getDocumentHeight():this.getElementHeight(this.scroller)},isOutOfBounds:function(a){var b=a<0,c=a+this.getScrollerPhysicalHeight()>this.getScrollerHeight();return b||c},toleranceExceeded:function(a,b){return Math.abs(a-this.lastKnownScrollY)>=this.tolerance[b]},shouldUnpin:function(a,b){var c=a>this.lastKnownScrollY,d=a>=this.offset;return c&&d&&b},shouldPin:function(a,b){var c=a<this.lastKnownScrollY,d=a<=this.offset;return c&&b||d},update:function(){var a=this.getScrollY(),b=a>this.lastKnownScrollY?"down":"up",c=this.toleranceExceeded(a,b);this.isOutOfBounds(a)||(a<=this.offset?this.top():this.notTop(),a+this.getViewportHeight()>=this.getScrollerHeight()?this.bottom():this.notBottom(),this.shouldUnpin(a,c)?this.unpin():this.shouldPin(a,c)&&this.pin(),this.lastKnownScrollY=a)}},e.options={tolerance:{up:0,down:0},offset:0,scroller:window,classes:{pinned:"headroom--pinned",unpinned:"headroom--unpinned",top:"headroom--top",notTop:"headroom--not-top",bottom:"headroom--bottom",notBottom:"headroom--not-bottom",initial:"headroom"}},e.cutsTheMustard="undefined"!=typeof f&&f.rAF&&f.bind&&f.classList,e});
20
21
22
23/*global jQuery */
24/*jshint browser:true */
25/*!
26* FitVids 1.1
27*
28* Copyright 2013, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com
29* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/
30* Released under the WTFPL license - http://sam.zoy.org/wtfpl/
31*
32*/
33
34(function( $ ){
35
36  "use strict";
37
38  $.fn.fitVids = function( options ) {
39    var settings = {
40      customSelector: null,
41      ignore: null
42    };
43
44    if(!document.getElementById('fit-vids-style')) {
45      // appendStyles: https://github.com/toddmotto/fluidvids/blob/master/dist/fluidvids.js
46      var head = document.head || document.getElementsByTagName('head')[0];
47      var css = '.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}';
48      var div = document.createElement('div');
49      div.innerHTML = '<p>x</p><style id="fit-vids-style">' + css + '</style>';
50      head.appendChild(div.childNodes[1]);
51    }
52
53    if ( options ) {
54      $.extend( settings, options );
55    }
56
57    return this.each(function(){
58      var selectors = [
59        "iframe[src*='player.vimeo.com']",
60        "iframe[src*='youtube.com']",
61        "iframe[src*='youtube-nocookie.com']",
62        "iframe[src*='facebook.com/plugins/video.php']",
63        "object",
64        "embed"
65      ];
66
67      if (settings.customSelector) {
68        selectors.push(settings.customSelector);
69      }
70
71      var ignoreList = '.fitvidsignore';
72
73      if(settings.ignore) {
74        ignoreList = ignoreList + ', ' + settings.ignore;
75      }
76
77      var $allVideos = $(this).find(selectors.join(','));
78      $allVideos = $allVideos.not("object object"); // SwfObj conflict patch
79      $allVideos = $allVideos.not(ignoreList); // Disable FitVids on this video.
80
81      $allVideos.each(function(){
82        var $this = $(this);
83        if($this.parents(ignoreList).length > 0) {
84          return; // Disable FitVids on this video.
85        }
86        if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; }
87        if ((!$this.css('height') && !$this.css('width')) && (isNaN($this.attr('height')) || isNaN($this.attr('width'))))
88        {
89          $this.attr('height', 9);
90          $this.attr('width', 16);
91        }
92        var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(),
93            width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(),
94            aspectRatio = height / width;
95        if(!$this.attr('id')){
96          var videoID = 'fitvid' + Math.floor(Math.random()*999999);
97          $this.attr('id', videoID);
98        }
99        $this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+"%");
100        $this.removeAttr('height').removeAttr('width');
101      });
102    });
103  };
104// Works with either jQuery or Zepto
105})( window.jQuery );
106
107/* add spinner? */
108(function(factory) {
109  if (typeof exports == 'object') {
110    // CommonJS
111    factory(require('jquery'), require('spin'));
112  }
113  else if (typeof define == 'function' && define.amd) {
114    // AMD, register as anonymous module
115    define(['jquery', 'spin'], factory);
116  }
117  else {
118    // Browser globals
119    if (!window.Spinner) throw new Error('Spin.js not present');
120    factory(window.jQuery, window.Spinner);
121  }
122}(function($, Spinner) {
123  $.fn.spin = function(opts, color) {
124    return this.each(function() {
125      var $this = $(this),
126        data = $this.data();
127
128      if (data.spinner) {
129        data.spinner.stop();
130        delete data.spinner;
131      }
132      if (opts !== false) {
133        opts = $.extend(
134          { color: color || $this.css('color') },
135          $.fn.spin.presets[opts] || opts
136        )
137        data.spinner = new Spinner(opts).spin(this)
138      }
139    })
140  }
141
142  $.fn.spin.presets = {
143    tiny_1: { lines: 8, length: 2, width: 2, radius: 3, hwaccel: true, corners: 1 },
144    tiny: { lines: 9, length: 0, width: 4, radius: 9, hwaccel: true, corners: 1 },
145    large: { lines: 10, length: 8, width: 4, radius: 8, hwaccel: true, corners: 1 }
146  }
147
148}));
149
150// Functions
151
152/* Check current page URL for a specific query parameter and get the value */
153function urlParam(name){
154	var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
155	if (!results) { return 0; }
156	return results[1] || 0;
157}
158
159/* Take an existing URL within the page and add query parameters to it */
160/* options:
161    attrName: 'src',
162    param: 'source' or 'foo',
163    urlEncode: false
164*/
165(function($){
166  $.fn.updateAttrFromParam = function(opts){
167    return this.each(function(){
168      var paramValue = urlParam(opts['param']);
169      // check if necessary options are present
170      if ( opts['attr'] && paramValue ){
171        // get the current value of the chosen attribute
172        var attrValue = $(this).attr(opts['attr']);
173        // check if there's a '?' already in the url
174        var preexistingParams = ~attrValue.indexOf("?");
175        // set the initial separator character to either & or ?, depending
176        // on preexisting params
177        var initialSeparator = preexistingParams ? "&" : "?";
178        var keyValueSeparator = "=";
179        // if url encoding option is true, switch to that
180        if ( opts['urlEncode'] ){
181          initialSeparator = preexistingParams ? "%3F" : "%26";
182          keyValueSeparator = "%3D";
183        }
184        // Regex to detect the presence of the param name preceded by a ? or &
185        var paramNameRegex = new RegExp('([\\?&])' + opts['param']);
186        // Only proceed if the param is NOT already present in attrValue...
187        if ( !paramNameRegex.test(attrValue) ){
188          // assemble the new url
189          var attrValueNew = attrValue + initialSeparator + opts['param'] + keyValueSeparator + paramValue;
190          // replace the existing attribute with the new one
191          $(this).attr(opts['attr'], attrValueNew);
192        }
193      }
194    });
195  };
196}(jQuery));
197
198/*
199  Append a hidden input with a given name and value. Used primarily
200  to include source and referral tracking in forms.
201*/
202(function($){
203  $.fn.appendHiddenInputFromParam = function(paramName, fieldName){
204    // allows the hidden input name to differ from the URL param name (e.g. utm_source → action_utm_source for ActionKit)
205    fieldName = fieldName || paramName;
206  	return this.each(function(){
207      var paramValue = urlParam(paramName);
208      // check that a url parameter exists with this name
209      if ( paramValue ){
210        var hiddenSource = $(this).find('input[type="hidden"][name="' + fieldName + '"]');
211        // check for pre-existing hidden input
212        if ( hiddenSource.length ){
213          hiddenSource.val( paramValue );
214        } else {
215          $(this).append('<input type="hidden" name="' + fieldName + '" value="' +  paramValue + '">');
216        }
217      }
218  	});
219  };
220}(jQuery));
221
222/*
223  Set a link to use AJAX to fetch the content from an element
224  on another page.
225*/
226(function($){
227	$.fn.ajaxLink = function(isSingle, uniqueID){
228		jQuery(this).each(function(){
229			jQuery(this).on('click',function(e){
230				e.preventDefault();
231				var ajaxSourceURL = jQuery(this).href;
232				var ajaxSourceElem = jQuery(this).attr('data-ajax-source');
233				var ajaxDest = jQuery(this).attr('data-ajax-dest');
234				if (!isSingle){
235					jQuery('.ajax-link.active').removeClass('active');
236					jQuery(this).addClass('active');
237				}
238				jQuery(ajaxDest).fadeOut(function(){
239					jQuery(this)
240						.empty()
241						.spin('small')
242						.addClass('loading')
243						.fadeIn('fast')
244						.load(ajaxSourceURL + ' ' + ajaxSourceElem, function(){
245							jQuery(ajaxDest).spin(false).removeClass('loading');
246							jQuery(ajaxDest + " img.lazy").unveil(100);
247							jQuery.localScroll();
248						});
249				});
250			});
251		});
252		return this;
253	}
254}(jQuery));
255
256/* add .focus class to parent when direct child input has focus */
257(function($){
258	$.fn.parentFocus = function(){
259		return this.each(function(){
260      $(this).on({
261        focus: function(){
262          $(this).parent().addClass('focus');
263        },
264        blur: function(){
265          $(this).parent().removeClass('focus');
266        }
267      });
268		});
269	};
270}(jQuery));
271/**
272 * data-read-more-after
273 * Take multiple children, hide all but the first N, and add a "read more" link
274 * option: data-read-more-after-link-position="new-line"
275 * option: data-read-more-after-link-classes="text-caps text-blue" etc.
276 */
277(function($){
278	jQuery.fn.truncateAndReadMore = function(){
279		// Set up translations (uses non-breaking spaces to prevent awkward line breaks)
280		var readMoreTranslations = {
281			ar: "اقرأ&nbsp;أكثر",
282			de: "Weiterlesen",
283			en: "Read&nbsp;More",
284			es: "Leer&nbsp;más",
285			fr: "Lire&nbsp;la&nbsp;Suite",
286			id: "Baca lebih lanjut",
287      ja: "続きを読む",
288      nl: "Lees&nbsp;meer",
289			pl: "Czytaj dalej",
290			pt: "Leia&nbsp;mais",
291			tr: "Daha&nbsp;fazla&nbsp;oku",
292			uk: 'Детальна інформація',
293    };
294		var defaultReadMoreText = readMoreTranslations['en'];
295		// Detect language
296		var htmlLangAttr = $('html').attr('lang');
297		var htmlLangAttr = htmlLangAttr.substring(0,2);
298
299		if ( htmlLangAttr && readMoreTranslations[htmlLangAttr] ){
300			defaultReadMoreText = readMoreTranslations[htmlLangAttr];
301		}
302		// For each element targeted...
303		return this.each(function(){
304      // get number of paragraphs to hide
305      var visElems = $(this).attr('data-read-more-after');
306      // check for alternate display options
307      var display = $(this).attr('data-read-more-after-link-position');
308      var customReadMoreText = $(this).attr('data-read-more-after-link-text');
309      var readMoreText = customReadMoreText ? customReadMoreText : defaultReadMoreText;
310      display = display ? display : '';
311      // check for optional classes to add
312      var readMoreLinkClasses = $(this).attr('data-read-more-after-link-classes');
313      readMoreLinkClasses = readMoreLinkClasses ? readMoreLinkClasses : '';
314      // check if visible elements is a positive number, if not set default to 2
315      var visElems = (visElems > 0) ? visElems : 2 ;
316			// Set up click handler function
317			jQuery(this).on('readMoreEventSetup', function(){
318				var target = jQuery(this);
319				jQuery(this).find('.read-more').on('click', function(e){
320					e.preventDefault();
321					jQuery(this).hide();
322					target.children(':hidden').fadeIn();
323				});
324			});
325			var firstParaSibs = jQuery(this).children();
326			// Make sure there's more than N children element in the container
327			if ( firstParaSibs.length > visElems){
328        if ( display == 'new-line' ){
329          var readMoreBlockLink = '<p class="read-more-wrapper"><a class="read-more arrow-down ' + readMoreLinkClasses +'">' + readMoreText +'</a></p>';
330          var readMoreInlineLink = '';
331        } else {
332          var readMoreBlockLink = '';
333          var readMoreInlineLink = '&nbsp;<a class="read-more read-more-inline arrow-down ' + readMoreLinkClasses +'">' + readMoreText +'</a>';
334        }
335        $(this).append( readMoreBlockLink );
336        // Hide extra para's, add "read more", trigger click handler setup event
337        firstParaSibs
338          .not('.do-not-hide')
339          .hide()
340          .siblings(":lt(" + (visElems-1) + ")") // uses zero-based index counting
341          .addBack(":eq(0)") // .siblings excludes the first element, so add it back
342          .show()
343          .last()
344          .append( readMoreInlineLink )
345          .trigger('readMoreEventSetup');
346			}
347
348		});
349	}
350}(jQuery));
351// Modal
352(function($){
353  $.fn.modal = function(){
354    return this.each(function(index){
355      // switch index to start from 1 instead of 0 for readability in the markup
356      index++;
357      // check for option to disable automatic hiding of source element
358      var showSourceElem = $(this).attr('data-modal-show-source');
359      // get the ID of the element that contains the content for the modal from the "data-modal-source" attribute
360      var modalSourceId = $(this).attr('data-modal-source');
361      var modalSourceElem = $( modalSourceId );
362      var modalLinkId = $(this).attr('id');
363
364      if ( modalSourceId ) {
365        modalIdSlug = modalSourceId.replace( /(#|\.)/, '');
366      } else if (modalLinkId) {
367        modalIdSlug = modalLinkId;
368      } else {
369        modalIdSlug = index;
370      }
371      var modalWrapperId = 'modal-' + modalIdSlug;
372      // if showing the source element...
373      if (showSourceElem){
374        modalSourceElem.removeClass('hidden js-hidden');
375      } else {
376        // Make sure the modal source element is hidden only with inline styles
377        modalSourceElem.hide().removeClass('hidden js-hidden');
378      }
379      // get the optional list of classes to add to the inner content area from the "data-modal-classes-inner" attribute in the HTML tag
380      var modalInnerClassesAttr = $(this).attr('data-modal-classes-inner');
381      // use the default classes to set the inner modal to be a white box with lots of padding
382      var modalInnerClasses = modalInnerClassesAttr ? modalInnerClassesAttr : 'padding-medium bg-white text-color-override';
383      // get the optional list of classes to add to the inner content area from the "data-modal-classes-outer" attribute in the HTML tag
384      var modalOuterClassesAttr = $(this).attr('data-modal-classes-outer');
385      // use the default classes to set the modal container to have a transparent dark gray background and lots of horizontal padding
386      var modalOuterClasses = modalOuterClassesAttr ? modalOuterClassesAttr : 'bg-dkgray-trans width-narrow';
387
388      // set up modal wrappers
389      // assemble the outer and inner modal wrappers around the content
390      var modal = '<div id="' + modalWrapperId + '" class="modal-wrapper section ' + modalOuterClasses + '"><div class="modal-inner section-inner ' + modalInnerClasses + '"><a class="modal-close modal-close-x">X</a><div class="modal-content"></div></div></div>';
391      // append the modal before the closing </body> tag and add the class "open" (which hooks into CSS3 animations)
392      // NOTE: animate() is used just to provide a slight delay before adding the 'open' class, which is necessary to trigger CSS3 animation (for some reason)
393      $(modal).appendTo('body');
394
395      // set up the click event
396      $(this).on('click', function(e){
397        e.preventDefault();
398          var modalWrapper = $('#' + modalWrapperId)
399          var modalContent = modalWrapper.find('.modal-content');
400          // unhide the source element before appending it to the modal window
401          modalSourceElem
402          .clone()
403          .removeClass('nav-desktop-dropdown')
404          .show()
405          .appendTo(modalContent);
406        // Open the modal
407        // check for any lazy loading inside the modal and swap data-src into src and kill any spinners
408        modalWrapper
409          .addClass('open')
410          .find('[data-src]')
411          .each(function(){
412            var modalDataSrc = $(this).attr('data-src');
413            $(this).attr('src',modalDataSrc).removeClass('lazy').parent().spin(false);;
414        });
415				// set up the "close modal" function
416				function modalClose(){
417					modalWrapper.removeClass('open')
418          modalContent.empty();
419					$(document).unbind("keyup", modalClose );
420				}
421				// call modalClose() when the "close" button is clicked
422				$('.modal-close').on('click', function(event){
423					modalClose();
424					event.stopPropagation();
425				});
426				// call modalClose() when the modal background is clicked
427				modalWrapper.on('click', function(){
428					modalClose();
429				});
430				// stop clicks in the modal content from propagating up and triggering a "close" event
431				modalContent.on('click',function(event){
432					event.stopPropagation();
433				});
434				// call modalClose() when the Esc key is pressed
435				$(document).keyup(function(e){
436	     		if (e.keyCode == 27) {
437	     			modalClose();
438	     		}
439	    	});
440			});
441		});
442	}
443}(jQuery));
444(function($){
445	jQuery.fn.newWindowPopup = function(){
446		jQuery(this).on('click', function(e){
447		    e.preventDefault();
448		    var destination = jQuery(this).attr('href');
449			var popupWidthAttr = jQuery(this).attr('data-popup-width');
450			var popupHeightAttr = jQuery(this).attr('data-popup-height');
451			if ( jQuery(this).is('.fb-share, .button-facebook, .button-share-facebook') ){
452				popupWidth = 520;
453				popupHeight = 350;
454			} else if ( jQuery(this).is('.tw-share, .button-twitter, .button-share-twitter') ){
455				popupWidth = 550;
456				popupHeight = 420;
457			} else if ( popupHeightAttr || popupWidthAttr ){
458				if ( popupHeightAttr ){
459					popupHeight = popupHeightAttr;
460				}
461				if ( popupWidthAttr ){
462					popupWidth = popupWidthAttr;
463				}
464			} else {
465				popupWidth = 500;
466				popupHeight = 500;
467			}
468			var winTop = (screen.height / 2) - (popupHeight / 2);
469			var winLeft = (screen.width / 2) - (popupWidth / 2);
470	    	window.open( destination , 'new-window-popup', 'top=' + winTop + ',left=' + winLeft + ',toolbar=0,status=0,resizable=yes,scrollbars=yes,width=' + popupWidth + ',height=' + popupHeight );
471	    });
472	}
473}(jQuery));
474
475// Expandoo
476(function($){
477  $.fn.expando = function(device){
478    var screenSize = device ? device + '-' : '';
479    $(this).each(function(){
480      var expandoText = $(this).attr("title");
481      var expandoText2 = $(this).find('h1,h2,h3,h4,h5,h6').first().addClass(screenSize+'expando-title').text();
482      var expandoText3raw = $(this).children().first().text();
483      var expandoText3 = expandoText3raw.substring(0,60);
484      var expandedOnLoad = $(this).hasClass(screenSize+'expando-expanded');
485
486      if ( expandoText ){
487        $(this).wrapInner('<div class="'+screenSize+'expando-inner" />').prepend('<a class="'+screenSize+'expando-link" href="#">' + expandoText + '</a>');
488        //console.log('expandoText1!');
489      } else if (expandoText2) {
490        $(this).wrapInner('<div class="'+screenSize+'expando-inner" />').prepend('<a class="'+screenSize+'expando-link" href="#">' + expandoText2 + '</a>');
491        //console.log('expandoText2!');
492      } else if (expandoText3) {
493        $(this).wrapInner('<div class="'+screenSize+'expando-inner" />').prepend('<a class="'+screenSize+'expando-link" href="#">' + expandoText3 + '...</a>');
494        //console.log('expandoText3!');
495      } else {
496        $(this).wrapInner('<div class="'+screenSize+'expando-inner" />').prepend('<a class="'+screenSize+'expando-link" href="#">Click to expand</a>');
497      };
498      // if set to pre-expanded, don't add the "collapsed" class
499      if ( !expandedOnLoad ){
500        $(this).addClass( screenSize+'expando-collapsed');
501      }
502
503    });
504    $('a.'+screenSize+'expando-link').unbind().click(function(e){
505      e.preventDefault();
506      $(this)
507        .parent()
508        .toggleClass(screenSize+'expando-expanded')
509        .toggleClass(screenSize+'expando-collapsed');
510    });
511    return this;
512  }
513}(jQuery));
514
515// find adjacent matching siblings and wrap them with a tag
516(function($){
517	$.fn.findAdjacentSibsAndWrap = function( sibFilter, wrapperTag, wrapperClass ){
518    $(this).each(function(){
519      if ( $(this).prev( sibFilter ).length ){ /* if element is preceded by matching sib, create wrapper */
520        $(this)
521          .prev() /* take the previous sibling, which we've already established passes the filter */
522          .addBack() /* add the current element into the set */
523          .wrapAll('<' + wrapperTag + ' class="' + wrapperClass + '"/>'); /* take the results and wrap a tag around them */
524      }
525      if ( $(this).prev('.' + wrapperClass ).length ){
526        $(this)
527          .prev() /* take the prev. sib which we've established is a group wrapper */
528          .append( this ); /* append the current element into the group wrapper */
529      }
530    });
531	}
532}(jQuery));
533
534// use data-preselect to pre-select options within <select> tags
535(function($){
536	$.fn.preselect = function(){
537		return this.each(function(){
538			var preselectOption = $(this).attr('data-preselect');
539			$(this).val( preselectOption ).change();
540		});
541	}
542}(jQuery));
543
544// Retrieve and display the total action count from one or more AK pages
545(function($){
546	jQuery.fn.akGetActionCount = function(){
547		return this.each(function(){
548			var akPages = $(this).attr('data-action-count-pages');
549			var akPagesStart = parseInt( $(this).text() );
550			var akCount = akPagesStart ? akPagesStart : 0;
551			akPages = akPages ? ( (akPages).trim() ).split(' ') : null;
552
553	    if ( akPages ){
554		    for ( var i = 0, akPagesLength = akPages.length; i < akPagesLength; i++ ){
555		    	$.ajax({
556		    		context: this,
557  					url: '//350.actionkit.com/progress/?page=' + akPages[i],
558  					dataType: 'jsonp',
559  					success: function(data) {
560  						var returnCount = parseInt( data.total.actions );
561  						akCount = akCount + returnCount;
562  	    			$(this).html( akCount );
563  					}
564  				});
565		    }
566	    }
567		});
568	}
569}(jQuery));
570
571// Prepends hamburger icon before superpages nav bar
572jQuery(function ($) {
573  var hamburger = `
574  <div class="js-nav-toggle-container">
575    <svg class="inline-svg js-nav-toggle-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 80" style="vertical-align: middle; display: inline">
576      <style>.st0{fill:currentColor}</style>
577      <path class="st0" d="M2 4h76v10H2zM2 35h76v10H2zM2 66h76v10H2z"></path>
578    </svg>
579  </div>
580  `;
581  var screenSizes = ['mobile','tablet','desktop'];
582  $('nav:not(#site-nav)').find('.menu').before(hamburger);
583
584  //Add custom menu label next to hamburger
585  $('nav:not(#site-nav)').each(function (index) {
586    var self = this; //stabilise this
587    if ($(self).has('ul.menu.custom-menu')) {
588      var customMenuLabel = $(self).find('.menu>
588li:first-child.nav-menu-label>a').text()
589      var hamburgerLabel = ' <span class="nav-menu-label text-font-secondary text-caps" style="vertical-align: middle;">' + customMenuLabel + '</span>';
590      if (customMenuLabel) $(self).find('.js-nav-toggle-icon').after(hamburgerLabel);
591
592      if ($(self).hasClass('nav-desktop-dropdown')) {
593        $(self).find('.menu>li:first-child.nav-menu-label').show();
594        // $(self).find('ul.menu.custom-menu').prepend(hamburgerLabel);
595      }
596    }
597
598    //Hides hamburger icon and/or label on screenSizes not using list collapsed feature
599    screenSizes.forEach(function (screenSize) {
600      if (!$(self).hasClass('nav-' + screenSize + '-collapsed')) {
601        $(self).find('.js-nav-toggle-container').addClass(screenSize + '-hide');
602      } else {
603        $(self).find('.menu>li:first-child.nav-menu-label').addClass(screenSize + '-hide');
604      }
605    })
606
607
608  })
609
610// // Toggles display of custom menu label if collapsible list
611//   $('nav:not(#site-nav)')
612//     .find('.js-nav-toggle-container')
613//     .on('click', function (e) {
614//       $(this)
615//         .find('span.nav-menu-label').toggle();
616//     })
617});
618
619// Collapsible WP nav menus
620(function ($) {
621  jQuery.fn.collapseMenu = function (screenSize) {
622    return this.each(function () {
623      $(this)
624        .find('.menu')
625        .addClass('js-nav-menu-' + screenSize + '-collapsed')
626        .children('li:not(.nav-menu-label)')
627        .addClass(screenSize + '-hide')
628
629      $(this)
630        .find('.js-nav-toggle-container')
631        .addClass('js-nav-menu-' + screenSize + '-toggle')
632          .on('click', function (e) {
633            $(this)
634              .parent()
635              .find('.menu > li:not(.nav-menu-label)')
636              .toggleClass(screenSize + '-hide')
637              .parent()
638              .toggleClass('js-nav-menu-' + screenSize + '-collapsed')
639              .toggleClass('js-nav-menu-' + screenSize + '-expanded');
640          })
641    });
642  }
643}(jQuery));
644
645/* Horizontally overflowing sidescrolling section */
646(function($){
647	jQuery.fn.horzScrollControls = function(){
648		return this.each(function(index){
649			// check for data- attribute options, or else use this element and it's first child as the target
650			var horzScrollFrame = this;
651			$(this).wrapInner('<div class="horizontal-scroll-inner"></div>');
652			var horzScrollContent = $(this).children('.horizontal-scroll-inner')[0];
653
654			// duration of scroll animation
655			var scrollDuration = 1000;
656			// Set up controls wrapper
657			var controlsWrapper = $('<div class="horizontal-scroll-nav-controls"></div>').prependTo(this);
658			// Control Labels
659			var controlLabelForward = $(this).attr('data-horizontal-scroll-forward-label') ? $(this).attr('data-horizontal-scroll-forward-label') : 'Forward';
660			var controlLabelBackward = $(this).attr('data-horizontal-scroll-back-label') ? $(this).attr('data-horizontal-scroll-back-label') : 'Back';
661			// Set up control elements, hiding the back control initial
662			var controlForward = $('<div class="horizontal-scroll-nav-control horizontal-scroll-nav-control-forward">' + controlLabelForward + '</div>').prependTo(controlsWrapper);
663			var controlBackward = $('<div class="horizontal-scroll-nav-control horizontal-scroll-nav-control-back">' + controlLabelBackward + '</div>').prependTo(controlsWrapper);
664
665			// get outer container width
666			var getHorzFrameSize = function() {
667				return $(horzScrollFrame).outerWidth();
668			}
669			var horzFrameSize = getHorzFrameSize();
670			// get inner container width
671			var getHorzContentSize = function() {
672				return $(horzScrollContent).outerWidth();
673			}
674			var horzContentSize = getHorzContentSize();
675
676			// re-measure widths when window is resized
677			$(window).on('resize', function() {
678				horzFrameSize = getHorzFrameSize();
679				horzContentSize = getHorzContentSize();
680			});
681
682			// get how much of horz is invisible
683			var horzHiddenSize = Math.abs(horzContentSize - horzFrameSize);
684
685			// get how much have we scrolled to the left
686			var getHorzPosition = function() {
687				return $(horzScrollFrame).scrollLeft();
688			};
689
690			// determine whether scroll controls are active or inactive
691			var setControlState = function(){
692				horzPosition = getHorzPosition();
693				if (horzPosition <= 30) {
694					$(controlBackward).addClass('inactive');
695					$(controlForward).removeClass('inactive');
696				} else if (horzPosition < horzHiddenSize) {
697					// show both controls
698					$(controlBackward).removeClass('inactive');
699					$(controlForward).removeClass('inactive');
700				} else if (horzPosition >= horzHiddenSize) {
701					$(controlBackward).removeClass('inactive');
702					$(controlForward).addClass('inactive');
703				}
704			}
705			setControlState();
706
707			// update variables when scrolled
708			$(horzScrollFrame).on('scroll', function() {
709				horzHiddenSize =  Math.abs(horzContentSize - horzFrameSize);
710				setControlState();
711			});
712
713			// determine whether to scroll one screen width or all the way to the end
714			var calculateScrollIncrement = function(direction){
715				// current window width
716				var horzFrameSizeOffset = 0.8 * horzFrameSize;
717				// current scroll horzPosition
718				var horzPosition = getHorzPosition();
719				// debug console.log('horzHiddenSize: ' + horzHiddenSize + ', horzFrameSize: ' + horzFrameSize + ', currentPosition: ' + currentPosition);
720				if ( direction == 'forward'){
721					if ( horzHiddenSize > horzFrameSizeOffset + horzPosition){
722						// if there's more hidden content than the screen width,
723						// only scroll one screen width over
724						return horzFrameSizeOffset + horzPosition;
725					} else {
726						return horzHiddenSize;
727					}
728				} else {
729					if ( horzHiddenSize < horzFrameSizeOffset + horzPosition){
730						return horzPosition - horzFrameSizeOffset;
731					} else {
732						return 0;
733					}
734				}
735
736			}
737
738			// scroll forward click event
739			$(controlForward).on('click', function() {
740				scrollIncrement = calculateScrollIncrement('forward');
741				$(horzScrollFrame).animate( { scrollLeft: scrollIncrement}, scrollDuration);
742			});
743
744			// scroll backward click event
745			$(controlBackward).on('click', function() {
746				scrollIncrement = calculateScrollIncrement('backward');
747				$(horzScrollFrame).animate( { scrollLeft: (scrollIncrement) }, scrollDuration);
748			});
749		});
750	}
751}(jQuery));
752
753
754
755
756// as the page loads, call these scripts
757jQuery(document).ready(function($) {
758	$('html').removeClass('no-js').addClass('js');
759  /*
760    Scripts that can potentially change the size of elements and the document.
761    Run these first so following scripts don't have to recalculate size/p
761osition, in
762    descending order of how much they're likely to change the document size.
763  */
764	// Truncate and add "Read More" link
765	$('[data-read-more-after], [data-readmore-after]').truncateAndReadMore();
766  // Expandooooo
767  $(".expando, .js-expando").expando();
768  $(".expando-mobile, .mobile-expando").expando('mobile');
769  $(".tablet-expando").expando('tablet');
770  // Collapsed Menus
771  $(".nav-mobile-collapsed").collapseMenu('mobile');
772  $(".nav-tablet-collapsed").collapseMenu('tablet');
773  $(".nav-desktop-collapsed").collapseMenu('desktop');
774  // iframe resizer
775  $(".iframe-wrapper, .video-wrapper, .wp-block-embed.is-type-video").fitVids();
776  // Modals
777	$('.js-modal').modal();
778	$('.js-modal-onload').trigger('click');
779
780  // Add spinner to lazy images
781	$('img.lazy').parent().spin('tiny');
782
783	var bLazy = new Blazy({
784    container: '.page-container',
785		breakpoints: [
786			{
787				width: 650,
788				src: 'data-src-small',
789    		},
790			{
791				width: 1024,
792				src: 'data-src-medium',
793			}
794  	],
795  	success: function(ele){
796  		var parent = ele.parentNode;
797          $(ele).parent().spin(false);
798          $(".video-wrapper, .iframe-wrapper").fitVids();
799      },
800      error: function(ele){
801      	var parent = ele.parentNode;
802          $(ele).parent().spin(false);
803      },
804      offset: 300,
805      selector: '.lazy',
806  });
807  // for AK-style form fields, wrap adjacent sibs in fieldset
808  $('.form-style-labelabove .input-text').findAdjacentSibsAndWrap('.input-text:not(.input-text-nogroup)', 'div', 'input-group');
809
810  /* --- end of scripts likely to change document size */
811
812  // Add a 'focus' class to the parent element when input gets focu
812s
813  $("input, select, textarea").parentFocus();
814  // Set up AJAX links
815	$('.ajax-link').ajaxLink();
816
817  // Headroom - "shy" sticky
818  // grab an element, construct an instance of Headroom and init
819  var headerSticky = document.querySelector("#site-header");
820  var headerYPosition = 50;
821  var headerStickyOptions = {
822    tolerance: {
823      up: 5,
824      down: 5
825    },
826    offset: headerYPosition,
827    onPin: function(){
828      $('body').addClass('has-shySticky-active');
829    },
830    onUnpin: function(){
831      $('body').removeClass('has-shySticky-active');
832    },
833  }
834  if (headerSticky){
835		/* if there's distance between the header and the top of the page (like if there's a pre-header donation
836		banner or an alert or something), add that distance to the offset so the header doesn't vanish prematurely */
837    headerYPosition = (headerSticky.offsetTop) ? (headerSticky.offsetTop + 50) : 50;
838    var shySticky  = new Headroom(headerSticky, headerStickyOptions);
839    shySticky.init();
840  }
841
842  /* Update on-page nav items with .active if they're on screen */
843  gumshoe.init({
844    selector: 'nav a', // Default link selector (must use a valid CSS selector)
845  });
846  // Set up controls for horizontal scroll areas
847  $('.horizontal-scroll').horzScrollControls();
848  // Insert the number of actions taken for a given AK page
849	$(".ak-action-count").akGetActionCount();
850  // Preselect an item in a select tag
851  $('[data-preselect]').preselect();
852  // Pop up share dialogs in a mini new window
853	$(".tw-share, .fb-share, .button-dot.facebook, .button-share-facebook, .button-share-twitter").newWindowPopup();
854  // Reveal the bg image when hovering on the image credit
855	$(".section-img-credit").hover(
856		function(){
857			$(this).stop().prev('.section-inner').animate({opacity:0}
857);
858		}, function(){
859			$(this).stop().prev('.section-inner').animate({opacity:1});
860		}
861	);
862
863  /* FLAGGED: split Actionkit-specific scripts into separate module */
864	// When AK forms have finished loading...
865  $(document).on('actionkit.ready ',function(){
866    // Add URL param "referrer" as hidden input on any AK forms
867    var $forms = $('.actionkit-widget, form[action="https://act.350.org/act/"],  form[action="http://act.350.org/act/"]');
868    $forms
869      .appendHiddenInputFromParam('source') // redundant b/c AK also detects source param
870      .appendHiddenInputFromParam('referrer');
871    // Pass through any utm_* URL params as action_utm_* hidden inputs
872    new URLSearchParams(window.location.search).forEach(function(value, key) {
873      if (key.indexOf('utm_') === 0) {
874        $forms.appendHiddenInputFromParam(key, 'action_' + key);
875      }
876    });
877  });
878
879	// Add URL param "source" to AK map iframe src, then AK can append it to map links
880	$('.ak-event-map, iframe[src^="https://act.350.org/"]')
881    .updateAttrFromParam({attr: 'src', param:'source'});
882
883  /* FLAGGED: split 350-specific scripts into separate module */
884  // Add URL param "source" to megamap (data-src presumes lazyloading)
885  $("iframe[data-src^='https://new-map.350.org/']")
886    .updateAttrFromParam({attr: 'data-src', param: 'source'})
887    .updateAttrFromParam({attr: 'data-src', param: 'referrer'});
888
889  $("iframe[data-src-desktop^='https://new-map.350.org/']")
890    .updateAttrFromParam({attr: 'data-src-desktop', param: 'source'})
891    .updateAttrFromParam({attr: 'data-src-desktop', param: 'referrer'});
892
893
894  /* FLAGGED: split AN scripts off into separate module */
895  /* Action Network scripts to run once their widgets load */
896  $(document).on('can_embed_loaded',function(){
897    // strip all inputs of events, and then re-run parentFocus script
898    $("input, select, textarea").off().parentFocus();
899    // Add source/referrer to any outgoing AN links
900    $('a[href^="https://actionnetwork.org/"], a[href^="http://actionnetwork.org/"]')
901      .updateAttrFromParam({attr: 'href', param: 'source'})
902      .updateAttrFromParam({attr: 'href', param: 'referrer'});
903  	// Add URL param "source" as hidden input on AN forms
904    $('.can_embed form, form[action^="https://actionnetwork.org/"]')
905      .appendHiddenInputFromParam('source')
906      .appendHiddenInputFromParam('referrer');
907  });
908	$(document).trigger('baseline.ready');
909}); /* end of as page load scripts */
910
911/* Add script with currency changer code */
912(function($) {
913  function CurrencyChanger(parentSelector, updateSource = true) {
914      var $parent = $(parentSelector);
915      if ($parent.length === 0) return;
916
917      var urlParams = new URLSearchParams(window.location.search);
918      var regionParam = urlParams.get('r');
919      var continentParam = urlParams.get('c');
920
921      var currencyMap = {
922          'CA': 'cad', 'GB': 'gbp', 'JP': 'jpy', 'US': 'usd',
923          'ZA': 'zar', 'AU': 'aud', 'NZ': 'nzd'
924      };
925
926      var currency = currencyMap[regionParam] || (continentParam === 'EU' ? 'eur' : 'usd');
927
928      $parent.find('.currency-changer').val(currency);
929
930      var currencySymbols = {
931          'usd': '$', 'cad': '$', 'eur': '\u20AC', 'gbp': '\u00A3',
932          'zar': 'R', 'jpy': '\u00A5', 'aud': '$', 'nzd': '$'
933      };
934
935      var currencyAmts = {
936          'usd': ['10', '35', '50', '150', '350'],
937          'cad': ['10', '35', '50', '150', '350'],
938          'eur': ['10', '35', '50', '150', '350'],
939          'gbp': ['10', '35', '50', '150', '350'],
940          'aud': ['10', '35', '50', '150', '350'],
941          'nzd': ['10', '35', '50', '150', '350'],
942          'zar': ['35', '50', '150', '350', '500'],
943          'jpy': ['500', '1000', '5000', '10000', '30000']
944      };
945
946      function updateDonationButtons(selectedCurrency) {
947          var selectedCurrencySymbol = currencySymbols[selectedCurrency];
948          var selectedCurrencyAmounts = currencyAmts[selectedCurrency];
949          var isMobile = window.innerWidth <= 680;
950          var headerSourceCode = isMobile ? 'web_donate_button_main_nav_mobile' : 'web_donate_button_main_nav_desktop';
951
952          $parent.find('.donate-bar-buttons a.donation-btn').each(function(index, button) {
953              var $button = $(button);
954              var buttonUrl = new URL($button.attr('href'));
955              var donateButton = $('.header-button.button.bg-blue');
956              var donateButtonUrl = new URL(donateButton.attr('href'));
957
958              donateButtonUrl.searchParams.set('currency', selectedCurrency.toUpperCase());
959              buttonUrl.searchParams.set('currency', selectedCurrency.toUpperCase());
960
961              if (updateSource) {
962                  donateButtonUrl.searchParams.set('source', headerSourceCode);
963              }
964
965              if (index < selectedCurrencyAmounts.length) {
966                  $button.text(selectedCurrencySymbol + selectedCurrencyAmounts[index]);
967                  buttonUrl.searchParams.set('amount', selectedCurrencyAmounts[index]);
968              }
969
970              $button.attr('href', buttonUrl);
971              donateButton.attr('href', donateButtonUrl);
972          });
973      }
974
975      $parent.find('.currency-changer').on('change', function(e) {
976          updateDonationButtons(e.target.value);
977      }).trigger('change');
978  }
979
980  window.CurrencyChanger = CurrencyChanger;
981})(jQuery);

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.