q[a])&&(q[a]=d)):f?!q[a]&&d>e&&(q[a]=d):(!q[a]&&0!==q[a]||d>q[a]&&dA[C][c].edge){A[C][c].passed=!0;var h=a.extend(r.scrollFields,{eventCategory:"ScrollDepth",eventAction:C,eventLabel:c,nonInteraction:!0});m(h)}f+=e}}function k(){var b,c=a.mediaquery("state"),d=u.outerHeight(),e={},f=1/r.scrollStops,g=f,h=0;c.minWidth&&(C="MinWidth:"+c.minWidth+"px");for(var i=1;i<=r.scrollStops;i++)h=parseInt(d*g),b=Math.round(100*g).toString(),e[b]={edge:"100"===b?h-10:h,passsed:!(!A[C]||!A[C][b])&&A[C][b].passed},g+=f;A[C]=e}function l(b){var c=a(this),d=c.attr("href"),e=c.data(y).split(",");r.eventCallback&&b.preventDefault();for(var f in e)e.hasOwnProperty(f)&&(e[f]=a.trim(e[f]));m({eventCategory:e[0],eventAction:e[1],eventLabel:e[2]||d,eventValue:e[3],nonInteraction:e[4]},c)}function m(b,c){var d=(s.location,a.extend({hitType:"event"},b));if("undefined"!==a.type(c)&&!c.attr("data-analytics-stop")){var e="undefined"!==a.type(c[0].href)?c[0].href:"",f=!e.match(/^mailto\:/i)&&!e.match(/^tel\:/i)&&e.indexOf(":")<0?s.location.protocol+"//"+s.location.hostname+"/"+e:e;if(""!==f){var g=c.attr("target");if(g)s.open(f,g);else if(r.eventCallback){var h="hitCallback";d[h]=function(){D&&(v.clearTimer(D),p(f))},D=v.startTimer(D,r.eventTimeout,d[h])}}}o(d)}function n(b){var c=a.extend({hitType:"pageview"},b);o(c)}function o(b){if("function"===a.type(s.ga)&&"function"===a.type(s.ga.getAll))for(var c=s.ga.getAll(),d=0,e=c.length;d ').appendTo(this),b.thisClasses=[C.base,b.customClass],b.visible=!0,b.lazy&&(b.visible=!1,b.thisClasses.push(C.lazy)),this.addClass(b.thisClasses.join(" ")),f(),b.lazy?(x(b),y(b)):i(b)}function h(a){a.$container.remove(),this.removeClass(a.thisClasses.join(" ")).off(D.namespace),f()}function i(a){if(a.visible){var b=a.source;a.source=null,j(a,b,!0)}}function j(b,c,d){if(c!==b.source&&b.visible){if(b.source=c,b.responsive=!1,b.isYouTube=!1,"object"===a.type(c)&&"string"===a.type(c.video)){var e=c.video.match(/(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/ ]{11})/i);e&&e.length>=1&&(b.isYouTube=!0,b.videoId=e[1])}var f=!b.isYouTube&&"object"===a.type(c)&&(c.hasOwnProperty("mp4")||c.hasOwnProperty("ogg")||c.hasOwnProperty("webm"));if(b.video=b.isYouTube||f,b.playing=!1,b.isYouTube)b.playerReady=!1,b.posterLoaded=!1,n(b,c,d);else if("object"===a.type(c)&&c.hasOwnProperty("poster"))m(b,c,d);else{var g=c;if("object"===a.type(c)){var h,i=[],j=[];for(h in c)c.hasOwnProperty(h)&&j.push(h);j.sort(E.sortAsc);for(h in j)j.hasOwnProperty(h)&&i.push({width:parseInt(j[h]),url:c[j[h]],mq:F.matchMedia("(min-width: "+parseInt(j[h])+"px)")});b.responsive=!0,b.sources=i,g=k(b)}l(b,g,!1,d)}}else b.$el.trigger(D.loaded)}function k(a){var c=a.source;if(a.responsive){c=a.sources[0].url;for(var d in a.sources)a.sources.hasOwnProperty(d)&&(b.support.nativeMatchMedia?a.sources[d].mq.matches&&(c=a.sources[d].url):a.sources[d].width '),h=g.find("img"),i=c;h.one(D.load,function(){K&&g.addClass(C.native).css({backgroundImage:"url('"+i+"')"}),g.fsTransition({property:"opacity"},function(){d||o(b)}).css({opacity:1}),w(b),d&&!e||b.$el.trigger(D.loaded)}).one(D.error,b,p).attr("src",i),b.responsive&&g.addClass(C.responsive),b.$container.append(g),(h[0].complete||4===h[0].readyState)&&h.trigger(D.load),b.currentSource=i}function m(c,d,e){if(c.source&&c.source.poster&&(l(c,c.source.poster,!0,!0),e=!1),!b.isMobile){var f=[C.media,C.video,e!==!0?C.animated:""].join(" "),g=' ';g+="",g+="";var h=a(g),i=h.find("video");i.one(D.loadedMetaData,function(a){h.fsTransition({property:"opacity"},function(){o(c)}).css({opacity:1}),w(c),c.$el.trigger(D.loaded),c.autoPlay&&s(c)}),c.$container.append(h)}}function n(c,d,e){if(!c.videoId){var f=d.match(/^.*(?:youtu.be\/|v\/|e\/|u\/\w+\/|embed\/|v=)([^#\&\?]*).*/);c.videoId=f[1]}if(c.posterLoaded||(c.source.poster||(c.source.poster="//img.youtube.com/vi/"+c.videoId+"/0.jpg"),c.posterLoaded=!0,l(c,c.source.poster,!0,e),e=!1),!b.isMobile)if(a("script[src*='youtube.com/iframe_api']").length||a("head").append(''),L){var g=c.guid+"_"+c.youTubeGuid++,h=[C.media,C.embed,e!==!0?C.animated:""].join(" "),i='';i+='',i+="";var j=a(i),k=a.extend(!0,{},{controls:0,rel:0,showinfo:0,wmode:"transparent",enablejsapi:1,version:3,playerapiid:g,loop:c.loop?1:0,autoplay:1,origin:F.location.protocol+"//"+F.location.host},c.youtubeOptions);k.autoplay=1,c.$container.append(j),c.player&&(c.oldPlayer=c.player,c.player=null),c.player=new F.YT.Player(g,{videoId:c.videoId,playerVars:k,events:{onReady:function(a){c.playerReady=!0,c.mute&&c.player.mute(),c.autoPlay||c.player.pauseVideo()},onStateChange:function(a){c.playing||a.data!==F.YT.PlayerState.PLAYING?c.loop&&c.playing&&a.data===F.YT.PlayerState.ENDED&&c.player.playVideo():(c.playing=!0,j.fsTransition({property:"opacity"},function(){o(c)}).css({opacity:1}),w(c),c.$el.trigger(D.loaded)),c.$el.find(B.embed).addClass(C.ready)},onPlaybackQualityChange:function(a){},onPlaybackRateChange:function(a){},onError:function(a){p({data:c})},onApiChange:function(a){}}}),w(c)}else M.push({data:c,source:d})}function o(a){var b=a.$container.find(B.media);b.length>=1&&(b.not(":last").remove(),a.oldPlayer=null)}function p(a){var b=a.data;b.$el.trigger(D.error)}function q(a){var b=a.$container.find(B.media);b.length>=1&&b.fsTransition({property:"opacity"},function(){b.remove(),delete a.source}).css({opacity:0})}function r(a){if(a.video&&a.playing){if(a.isYouTube)a.playerReady?a.player.pauseVideo():a.autoPlay=!1;else{var b=a.$container.find("video");b.length&&b[0].pause()}a.playing=!1}}function s(a){if(a.video&&!a.playing)if(a.isYouTube)a.playerReady?a.player.playVideo():a.autoPlay=!0;else{var b=a.$container.find("video");b.length&&b[0].play(),a.playing=!0}}function t(a){if(a.video)if(a.isYouTube&&a.playerReady)a.player.mute();else{var b=a.$container.find("video");b.length&&(b[0].muted=!0)}a.mute=!0}function u(a){if(a.video){if(a.isYouTube&&a.playerReady)a.player.unMute();else{var b=a.$container.find("video");b.length&&(b[0].muted=!1)}a.playing=!0}a.mute=!1}function v(a){if(a.visible)if(a.responsive){var b=k(a);b!==a.currentSource?l(a,b,!1,!0):w(a)}else w(a)}function w(a){for(var b=a.$container.find(B.media),c=0,d=b.length;c',f+='",f+='",f+=""),c.pagination&&!c.customPagination&&(i+=' ',i+=""),c.autoHeight&&c.carouselClasses.push(R.auto_height),c.contained&&c.carouselClasses.push(R.contained),c.single&&c.carouselClasses.push(R.single),this.addClass(c.carouselClasses.join(" ")).wrapInner('').append(f).wrapInner('').append(i),c.$viewport=this.find(Q.viewport).eq(0),c.$container=this.find(Q.container).eq(0),c.$canister=this.find(Q.canister).eq(0),c.$pagination=this.find(Q.pagination).eq(0),c.$controlPrevious=c.$controlNext=a(""),c.customControls?(c.$controls=a(c.controls.container).addClass([R.controls,R.controls_custom].join(" ")),c.$controlPrevious=a(c.controls.previous).addClass(k),c.$controlNext=a(c.controls.next).addClass(l)):(c.$controls=this.find(Q.controls).eq(0),c.$controlPrevious=c.$controls.find(Q.control_previous),c.$controlNext=c.$controls.find(Q.control_next)),c.$controlItems=c.$controlPrevious.add(c.$controlNext),c.customPagination&&(c.$pagination=a(c.pagination).addClass([R.pagination])),c.$paginationItems=c.$pagination.find(Q.page),c.index=0,c.enabled=!1,c.leftPosition=0,c.autoTimer=null,c.resizeTimer=null;var m=this.data(O+"-linked");c.linked=!!m&&"[data-"+O+'-linked="'+m+'"]',c.linked&&(c.paged=!0);var n=this.data(O+"-controller-for")||"";if(c.$subordinate=a(n),c.$subordinate.length&&(c.controller=!0),"object"===a.type(c.show)){var o=c.show,p=[],q=[];for(e in o)o.hasOwnProperty(e)&&q.push(e);q.sort(T.sortAsc);for(e in q)q.hasOwnProperty(e)&&p.push({width:parseInt(q[e]),count:o[q[e]],mq:window.matchMedia("(min-width: "+parseInt(q[e])+"px)")});c.show=p}j(c),a.fsMediaquery("bind",c.rawGuid,c.mq,{enter:function(){h.call(c.$el,c)},leave:function(){g.call(c.$el,c)}}),d(),c.carouselClasses.push(R.enabled),c.carouselClasses.push(R.animated)}function f(b){T.clearTimer(b.autoTimer),T.clearTimer(b.resizeTimer),g.call(this,b),a.fsMediaquery("unbind",b.rawGuid),b.id!==b.ariaId&&this.removeAttr("id"),b.$controlItems.removeClass([Q.control,R.control_previous,Q.control_next,Q.visible].join(" ")).off(S.namespace),b.$images.off(S.namespace),b.$canister.fsTouch("destroy"),b.$items.removeClass([R.item,R.visible,Q.item_previous,Q.item_next].join(" ")).unwrap().unwrap().unwrap().unwrap(),b.controls&&!b.customControls&&b.$controls.remove(),b.customControls&&b.$controls.removeClass([R.controls,R.controls_custom,R.visible].join(" ")),b.pagination&&!b.customPagination&&b.$pagination.remove(),b.customPagination&&b.$pagination.html("").removeClass([R.pagination,R.visible].join(" ")),this.removeClass(b.carouselClasses.join(" ")),d()}function g(a){a.enabled&&(T.clearTimer(a.autoTimer),a.enabled=!1,a.$subordinate.off(S.update),this.removeClass([R.enabled,R.animated].join(" ")).off(S.namespace),a.$canister.fsTouch("destroy").off(S.namespace).attr("style","").css(W,"none"),a.$items.css({width:"",height:""}).removeClass([R.visible,Q.item_previous,Q.item_next].join(" ")),a.$images.off(S.namespace),a.$controlItems.off(S.namespace),a.$pagination.html("").off(S.namespace),v(a),a.useMargin?a.$canister.css({marginLeft:""}):a.$canister.css(V,""),a.index=0)}function h(a){a.enabled||(a.enabled=!0,this.addClass(R.enabled),a.$controlItems.on(S.click,a,s),a.$pagination.on(S.click,Q.page,a,t),a.$items.on(S.click,a,I),a.$subordinate.on(S.update,a,K),K({data:a},0),a.$canister.fsTouch({axis:"x",pan:!0,swipe:!0}).on(S.panStart,a,z).on(S.pan,a,A).on(S.panEnd,a,B).on(S.swipe,a,F).on(S.focusIn,a,J).css(W,""),j(a),a.$images.on(S.load,a,q),a.autoAdvance&&(a.autoTimer=T.startTimer(a.autoTimer,a.autoTime,function(){r(a)},!0)),i.call(this,a))}function i(a){if(a.enabled){var b,c,d,e,f,g,h,i,j,k;if(a.count=a.$items.length,a.count<1)return v(a),void a.$canister.css({height:""});for(this.removeClass(R.animated),a.containerWidth=a.$container.outerWidth(!1),a.visible=y(a),a.perPage=a.paged?1:a.visible,a.itemMarginLeft=parseInt(a.$items.eq(0).css("marginLeft")),a.itemMarginRight=parseInt(a.$items.eq(0).css("marginRight")),a.itemMargin=a.itemMarginLeft+a.itemMarginRight,isNaN(a.itemMargin)&&(a.itemMargin=0),a.itemWidth=(a.containerWidth-a.itemMargin*(a.visible-1))/a.visible,a.itemHeight=0,a.pageWidth=a.paged?a.itemWidth:a.containerWidth,a.pageCount=Math.ceil(a.count/a.perPage),a.canisterWidth=a.single?a.containerWidth:(a.pageWidth+a.itemMargin)*a.pageCount,a.$canister.css({width:a.matchWidth?a.canisterWidth:1e6,height:""}),a.$items.css({width:a.matchWidth?a.itemWidth:"",height:""}).removeClass([R.visible,R.item_previous,R.item_next].join(" ")),a.pages=[],c=0,d=0;cj&&(j=b);a.pages.push({left:a.rtl?k-(a.canisterWidth-i):k,height:j,width:i,$items:g}),j>a.itemHeight&&(a.itemHeight=j),d++}a.paged&&(a.pageCount-=a.count%a.visible),a.pageCount<=0&&(a.pageCount=1),a.maxMove=-a.pages[a.pageCount-1].left,a.autoHeight?a.$canister.css({height:a.pages[0].height}):a.matchHeight&&a.$items.css({height:a.itemHeight});var l="";for(c=0;c '+(c+1)+"";a.$pagination.html(l),a.pageCount<=1?v(a):w(a),a.$paginationItems=a.$pagination.find(Q.page),u(a,a.index,!1),setTimeout(function(){a.$el.addClass(R.animated)},5)}}function j(a){a.$items=a.$canister.children().not(":hidden").addClass(R.item),a.$images=a.$canister.find("img"),a.totalImages=a.$images.length}function k(a){a.enabled&&l.call(this,a,!1)}function l(a,b){a.$images.off(S.namespace),b!==!1&&a.$canister.html(b),a.index=0,j(a),i.call(this,a)}function m(a,b,c,d,e){a.enabled&&(T.clearTimer(a.autoTimer),"undefined"==typeof e&&(e=!0),u(a,b-1,e,c,d))}function n(a){var b=a.index-1;a.infinite&&b<0&&(b=a.pageCount-1),u(a,b)}function o(a){var b=a.index+1;a.infinite&&b>=a.pageCount&&(b=0),u(a,b)}function p(a,b,c,d,e){if(a.enabled){T.clearTimer(a.autoTimer);var f=a.$items.eq(b-1);"undefined"==typeof e&&(e=!0);for(var g=0;g =a.pageCount&&(b=0),u(a,b)}function s(b){T.killEvent(b);var c=b.data,d=c.index+(a(b.currentTarget).hasClass(R.control_next)?1:-1);T.clearTimer(c.autoTimer),u(c,d)}function t(b){T.killEvent(b);var c=b.data,d=c.$paginationItems.index(a(b.currentTarget));T.clearTimer(c.autoTimer),u(c,d)}function u(b,c,d,e,f){if(c<0&&(c=b.infinite?b.pageCount-1:0),c>=b.pageCount&&(c=b.infinite?0:b.pageCount-1),!(b.count<1)){b.pages[c]&&(b.leftPosition=-b.pages[c].left),b.leftPosition=L(b,b.leftPosition),b.useMargin?b.$canister.css({marginLeft:b.leftPosition}):d===!1?(b.$canister.css(W,"none").css(V,"translateX("+b.leftPosition+"px)"),setTimeout(function(){b.$canister.css(W,"")},5)):b.$canister.css(V,"translateX("+b.leftPosition+"px)"),b.$items.removeClass([R.visible,R.item_previous,R.item_next].join(" "));for(var g=0,h=b.pages.length;g -1&&c =a.pageCount-1||!a.single&&a.leftPosition===a.maxMove)&&a.$controlNext.removeClass(R.visible))}function y(c){var d=1;if(c.single)return d;if("array"===a.type(c.show))for(var e in c.show)c.show.hasOwnProperty(e)&&(b.support.nativeMatchMedia?c.show[e].mq.matches&&(d=c.show[e].count):c.show[e].width Math.abs(k.left)+20&&(g=h+1);else for(h=d.pages.length-1,i=0;h>=i;h--)k=d.pages[h],j a.maxMove&&(b=a.maxMove),b<0&&(b=0)):(b 0&&(b=0)),b}function M(a,b){return a.rtl?"right"===b.directionX?1:-1:"left"===b.directionX?1:-1}var N=b.Plugin("carousel",{widget:!0,defaults:{autoAdvance:!1,autoHeight:!1,autoTime:8e3,contained:!0,controls:!0,customClass:"",fill:!1,infinite:!1,labels:{next:"Next",previous:"Previous"},matchHeight:!1,matchWidth:!0,maxWidth:1/0,minWidth:"0px",paged:!1,pagination:!0,rtl:!1,show:1,single:!1,theme:"fs-light",useMargin:!1},classes:["ltr","rtl","viewport","wrapper","container","canister","item","item_previous","item_next","controls","controls_custom","control","control_previous","control_next","pagination","page","animated","enabled","visible","active","auto_height","contained","single"],events:{itemClick:"itemClick",update:"update"},methods:{_construct:e,_destruct:f,_resize:c,disable:g,enable:h,jump:m,previous:n,next:o,jumpPage:m,previousPage:n,nextPage:o,jumpItem:p,reset:k,resize:i,update:l,panStart:C,pan:D,panEnd:E,swipe:G}}),O=N.namespace,P=N.namespaceClean,Q=N.classes,R=Q.raw,S=N.events,T=N.functions,U=[],V=b.transform,W=b.transition}); /*! formstone v1.3.2 [checkbox.js] 2017-04-18 | GPL-3.0 License | formstone.it */ !function(a){"function"==typeof define&&define.amd?define(["jquery","./core"],a):a(jQuery,Formstone)}(function(a,b){"use strict";function c(b){var c=this.closest("label"),d=c.length?c.eq(0):a("label[for="+this.attr("id")+"]"),e=[p.base,b.theme,b.customClass].join(" "),f="";b.radio="radio"===this.attr("type"),b.group=this.attr("name"),f+=' ',f+='',b.toggle&&(e+=" "+p.toggle,f+=''+b.labels.on+"",f+=''+b.labels.off+""),b.radio&&(e+=" "+p.radio),f+="",b.$placeholder=a(''),this.before(b.$placeholder),d.length?d.addClass(p.label).wrap('').before(f):this.before(''+f+""),b.$checkbox=d.length?d.parents(o.base):this.prev(o.base),b.$marker=b.$checkbox.find(o.marker),b.$states=b.$checkbox.find(o.state),b.$label=d,this.is(":checked")&&b.$checkbox.addClass(p.checked),this.is(":disabled")&&b.$checkbox.addClass(p.disabled),this.appendTo(b.$marker),this.on(q.focus,b,l).on(q.blur,b,m).on(q.change,b,i).on(q.click,b,h).on(q.deselect,b,k),b.$checkbox.on(q.click,b,h)}function d(a){a.$checkbox.off(q.namespace),a.$marker.remove(),a.$states.remove(),a.$label.unwrap().removeClass(p.label),a.$placeholder.before(this),a.$placeholder.remove(),this.off(q.namespace)}function e(a){this.prop("disabled",!1),a.$checkbox.removeClass(p.disabled)}function f(a){this.prop("disabled",!0),a.$checkbox.addClass(p.disabled)}function g(a){var b=a.$el.is(":disabled"),c=a.$el.is(":checked");b||(c?j({data:a}):k({data:a}))}function h(b){b.stopPropagation();var c=b.data;a(b.target).is(c.$el)||(b.preventDefault(),c.$el.trigger("click"))}function i(a){var b=a.data,c=b.$el.is(":disabled"),d=b.$el.is(":checked");c||(b.radio?d&&j(a):d?j(a):k(a))}function j(b){b.data.radio&&a('input[name="'+b.data.group+'"]').not(b.data.$el).trigger("deselect"),b.data.$el.trigger(q.focus),b.data.$checkbox.addClass(p.checked)}function k(a){a.data.$el.trigger(q.focus),a.data.$checkbox.removeClass(p.checked)}function l(a){a.data.$checkbox.addClass(p.focus)}function m(a){a.data.$checkbox.removeClass(p.focus)}var n=b.Plugin("checkbox",{widget:!0,defaults:{customClass:"",toggle:!1,labels:{on:"ON",off:"OFF"},theme:"fs-light"},classes:["element_placeholder","label","marker","flag","radio","focus","checked","disabled","toggle","state","state_on","state_off"],methods:{_construct:c,_destruct:d,enable:e,disable:f,update:g},events:{deselect:"deselect"}}),o=n.classes,p=o.raw,q=n.events;n.functions}); /*! formstone v1.3.2 [cookie.js] 2017-04-18 | GPL-3.0 License | formstone.it */ !function(a){"function"==typeof define&&define.amd?define(["jquery","./core"],a):a(jQuery,Formstone)}(function(a,b){"use strict";function c(b,c,h){if("object"===a.type(b))g=a.extend(g,b);else if(h=a.extend({},g,h||{}),"undefined"!==a.type(b)){if("undefined"===a.type(c))return e(b);null===c?f(b,h):d(b,c,h)}return null}function d(b,c,d){var e=!1,f=new Date;d.expires&&"number"===a.type(d.expires)&&(f.setTime(f.getTime()+d.expires),e=f.toGMTString());var g=d.domain?"; domain="+d.domain:"",i=e?"; expires="+e:"",j=e?"; max-age="+d.expires/1e3:"",k=d.path?"; path="+d.path:"",l=d.secure?"; secure":"";h.cookie=b+"="+c+i+j+g+k+l}function e(a){for(var b=a+"=",c=h.cookie.split(";"),d=0;d'+b.label+""),e=b.label,f=0);var g=this.find("option, optgroup"),h=g.filter("option"),k=a("[for="+this.attr("id")+"]");b.tabIndex=this[0].tabIndex,this[0].tabIndex=-1,k.length&&(k[0].tabIndex=-1);var l=[B.base,b.theme,b.customClass];b.mobile?l.push(B.mobile):b.cover&&l.push(B.cover),b.multiple&&l.push(B.multiple),b.disabled&&l.push(B.disabled),b.id=this.attr("id"),b.id?b.ariaId=b.id:b.ariaId=b.rawGuid,b.ariaId+="-dropdown",b.selectedAriaId=b.ariaId+"-selected";var m="",n="";m+='",b.multiple||(n+='"),n+=' ',n+="",this.wrap(m).after(n),b.$dropdown=this.parent(A.base),b.$label=k,b.$allOptions=g,b.$options=h,b.$selected=b.$dropdown.find(A.selected),b.$wrapper=b.$dropdown.find(A.options),b.$placeholder=b.$dropdown.find(A.placeholder),b.index=-1,b.closed=!0,b.focused=!1,i(b),b.multiple||u(f,b),void 0!==a.fn.fsScrollbar&&b.$wrapper.fsScrollbar({theme:b.theme}).find(".fs-scrollbar-content").attr("tabindex",null),b.$dropdown.on(C.click,b,j),b.$selected.on(C.click,b,j),b.$dropdown.on(C.click,A.item,b,p).on(C.close,b,o),this.on(C.change,b,q),b.mobile||(this.on(C.focusIn,b,function(a){a.data.$dropdown.trigger(C.raw.focus)}),b.$dropdown.on(C.focusIn,b,r).on(C.focusOut,b,s))}function e(b){b.$dropdown.hasClass(B.open)&&b.$selected.trigger(C.click),void 0!==a.fn.fsScrollbar&&b.$wrapper.fsScrollbar("destroy"),b.$el[0].tabIndex=b.tabIndex,b.$label.length&&(b.$label[0].tabIndex=b.tabIndex),b.$dropdown.off(C.namespace),b.$options.off(C.namespace),b.$placeholder.remove(),b.$selected.remove(),b.$wrapper.remove(),b.$el.off(C.namespace).show().unwrap()}function f(a,b){if("undefined"!=typeof b){var c=a.$items.index(a.$items.filter("[data-value="+b+"]"));a.$items.eq(c).addClass(B.item_disabled),a.$options.eq(c).prop("disabled",!0)}else a.$dropdown.hasClass(B.open)&&a.$selected.trigger(C.click),a.$dropdown.addClass(B.disabled),a.$el.prop("disabled",!0),a.disabled=!0}function g(a,b){if("undefined"!=typeof b){var c=a.$items.index(a.$items.filter("[data-value="+b+"]"));a.$items.eq(c).removeClass(B.item_disabled),a.$options.eq(c).prop("disabled",!1)}else a.$dropdown.removeClass(B.disabled),a.$el.prop("disabled",!1),a.disabled=!1}function h(b){void 0!==a.fn.fsScrollbar&&b.$wrapper.fsScrollbar("destroy");var c=b.index;b.$allOptions=b.$el.find("option, optgroup"),b.$options=b.$allOptions.filter("option"),b.index=-1,c=b.$options.index(b.$options.filter(":selected")),i(b),b.multiple||u(c,b),void 0!==a.fn.fsScrollbar&&b.$wrapper.fsScrollbar({theme:b.theme}).find(".fs-scrollbar-content").attr("tabindex",null)}function i(b){for(var c="",d=0,e=0,f=b.$allOptions.length;e'+g.attr("label")+"";else{var i=g.val(),j=g.data("label"),k=b.links?"a":'button type="button"';g.attr("value")||g.attr("value",i),h.push(B.item),g.hasClass(B.item_placeholder)&&(h.push(B.item_placeholder),k="span"),g.prop("selected")&&h.push(B.item_selected),g.prop("disabled")&&h.push(B.item_disabled),c+="<"+k+' class="'+h.join(" ")+'"',b.links?"span"===k?c+=' aria-hidden="true"':(c+=' href="'+i+'"',b.external&&(c+=' target="_blank"')):c+=' data-value="'+i+'"',c+=' role="option"',g.prop("selected")&&(c+=' "aria-selected"="true"'),c+=">",c+=j?j:D.decodeEntities(y(g.text(),b.trim)),c+=""+k+">",d++}}b.$items=b.$wrapper.html(a.parseHTML(c)).find(A.item)}function j(a){D.killEvent(a);var b=a.data;b.disabled||b.mobile||(b.closed?l(b):m(b)),k(b)}function k(b){a(A.base).not(b.$dropdown).trigger(C.close,[b])}function l(a){if(a.closed){var b=F.height(),c=a.$wrapper.outerHeight(!0),d=a.$dropdown[0].getBoundingClientRect();d.bottom+c>b-a.bottomEdge&&a.$dropdown.addClass(B.bottom),G.on(C.click+a.dotGuid,":not("+A.options+")",a,n),a.$dropdown.trigger(C.focusIn),a.$dropdown.addClass(B.open),v(a),a.closed=!1}}function m(a){a&&!a.closed&&(G.off(C.click+a.dotGuid),a.$dropdown.removeClass([B.open,B.bottom].join(" ")),a.closed=!0)}function n(b){D.killEvent(b);var c=b.data;c&&0===a(b.currentTarget).parents(A.base).length&&(m(c),c.$dropdown.trigger(C.focusOut))}function o(a){var b=a.data;b&&(m(b),b.$dropdown.trigger(C.focusOut))}function p(b){var c=a(this),d=b.data;if(D.killEvent(b),!d.disabled){var e=d.$items.index(c);d.focusIndex=e,d.$wrapper.is(":visible")&&(u(e,d,b.shiftKey,b.metaKey||b.ctrlKey),w(d)),d.multiple||m(d),d.$dropdown.trigger(C.focus)}}function q(b,c){var d=(a(this),b.data);if(!c&&!d.multiple){var e=d.$options.index(d.$options.filter(":selected"));d.focusIndex=e,u(e,d),w(d,!0)}}function r(b){D.killEvent(b);var c=(a(b.currentTarget),b.data);c.disabled||c.multiple||c.focused||(k(c),c.focused=!0,c.focusIndex=c.index,c.input="",c.$dropdown.addClass(B.focus).on(C.keyDown+c.dotGuid,c,t))}function s(b){D.killEvent(b);var c=(a(b.currentTarget),b.data);c.focused&&c.closed&&(c.focused=!1,c.$dropdown.removeClass(B.focus).off(C.keyDown+c.dotGuid),c.multiple||(m(c),c.index!==c.focusIndex&&(w(c),c.focusIndex=c.index)))}function t(c){var d=c.data;if(d.keyTimer=D.startTimer(d.keyTimer,1e3,function(){d.input=""}),13===c.keyCode)d.closed||(m(d),u(d.index,d)),w(d);else if(!(9===c.keyCode||c.metaKey||c.altKey||c.ctrlKey||c.shiftKey)){D.killEvent(c);var e=d.$items.length-1,f=d.index<0?0:d.index;if(a.inArray(c.keyCode,b.isFirefox?[38,40,37,39]:[38,40])>-1)f+=38===c.keyCode||b.isFirefox&&37===c.keyCode?-1:1,f<0&&(f=0),f>e&&(f=e);else{var g,h,i=String.fromCharCode(c.keyCode).toUpperCase();for(d.input+=i,h=d.index+1;h<=e;h++)if(g=d.$options.eq(h).text().substr(0,d.input.length).toUpperCase(),g===d.input){f=h;break}if(f<0||f===d.index)for(h=0;h<=e;h++)if(g=d.$options.eq(h).text().substr(0,d.input.length).toUpperCase(),g===d.input){f=h;break}}f>=0&&(u(f,d),v(d))}}function u(a,b,c,d){var e=b.$items.eq(a),f=b.$options.eq(a),g=e.hasClass(B.item_selected),h=e.hasClass(B.item_disabled);if(!h)if(b.multiple)if(b.mobile)g?(f.prop("selected",null).attr("aria-selected",null),e.removeClass(B.item_selected)):(f.prop("selected",!0).attr("aria-selected",!0),e.addClass(B.item_selected));else if(c&&b.lastIndex!==!1){var i=b.lastIndex>a?a:b.lastIndex,j=(b.lastIndex>a?b.lastIndex:a)+1;b.$options.prop("selected",null).attr("aria-selected",null),b.$items.filter(A.item_selected).removeClass(B.item_selected),b.$options.slice(i,j).not("[disabled]").prop("selected",!0),b.$items.slice(i,j).not(A.item_disabled).addClass(B.item_selected)}else d?(g?(f.prop("selected",null).attr("aria-selected",null),e.removeClass(B.item_selected)):(f.prop("selected",!0).attr("aria-selected",!0),e.addClass(B.item_selected)),b.lastIndex=a):(b.$options.prop("selected",null).attr("aria-selected",null),b.$items.filter(A.item_selected).removeClass(B.item_selected),f.prop("selected",!0).attr("aria-selected",!0),e.addClass(B.item_selected),b.lastIndex=a);else if(a>-1&&a =0&&!c.hasClass(B.item_placeholder)?c.position():{left:0,top:0},e=(b.$wrapper.outerHeight()-c.outerHeight())/2;void 0!==a.fn.fsScrollbar?b.$wrapper.fsScrollbar("resize").fsScrollbar("scroll",b.$wrapper.find(".fs-scrollbar-content").scrollTop()+d.top):b.$wrapper.scrollTop(b.$wrapper.scrollTop()+d.top-e)}function w(a,b){a.links?x(a):b||a.$el.trigger(C.raw.change,[!0])}function x(a){var b=a.$el.val();a.external?E.open(b):E.location.href=b}function y(a,b){return 0===b?a:a.length>b?a.substring(0,b)+"...":a}var z=b.Plugin("dropdown",{widget:!0,defaults:{bottomEdge:0,cover:!1,customClass:"",label:"",external:!1,links:!1,mobile:!1,theme:"fs-light",trim:0},methods:{_setup:c,_construct:d,_destruct:e,disable:f,enable:g,update:h,open:l,close:m},classes:["cover","bottom","multiple","mobile","open","disabled","focus","selected","options","group","item","item_disabled","item_selected","item_placeholder"],events:{close:"close"}}),A=z.classes,B=A.raw,C=z.events,D=z.functions,E=b.window,F=b.$window,G=(b.document,null)}); /*! formstone v1.3.2 [equalize.js] 2017-04-18 | GPL-3.0 License | formstone.it */ !function(a){"function"==typeof define&&define.amd?define(["jquery","./core","./mediaquery"],a):a(jQuery,Formstone)}(function(a,b){"use strict";function c(a){n.iterate.call(o,g)}function d(){o=a(l.element)}function e(b){b.maxWidth=b.maxWidth===1/0?"100000px":b.maxWidth,b.mq="(min-width:"+b.minWidth+") and (max-width:"+b.maxWidth+")",b.type="height"===b.property?"outerHeight":"outerWidth",b.target?a.isArray(b.target)||(b.target=[b.target]):b.target=["> *"],d(),a.fsMediaquery("bind",b.rawGuid,b.mq,{enter:function(){i.call(b.$el,b)},leave:function(){h.call(b.$el,b)}})}function f(b){j(b),a.fsMediaquery("unbind",b.rawGuid),d()}function g(a){if(a.data&&(a=a.data),a.enabled)for(var b,c,d,e=0;e b&&(b=c);d.css(a.property,b)}}function h(a){a.enabled&&(a.enabled=!1,j(a))}function i(a){if(!a.enabled){a.enabled=!0;var b=a.$el.find("img");b.length&&b.on(m.load,a,g),g(a)}}function j(a){for(var b=0;b ');var v=[V.base,V.loading,V.animating,ca.theme,ca.customClass];if(ca.fixed&&v.push(V.fixed),ca.isMobile&&v.push(V.mobile),ca.isTouch&&v.push(V.touch),n&&v.push(V.iframed),(p||q)&&v.push(V.inline),ca.thumbnails&&v.push(V.thumbnailed),u+=' ',u+='",u+='',u+='",$.append(u),ca.$overlay=a(U.overlay),ca.$lightbox=a(U.base),ca.$close=a(U.close),ca.$container=a(U.container),ca.$content=a(U.content),ca.$tools=a(U.tools),ca.$meta=a(U.meta),ca.$metaContent=a(U.meta_content),ca.$position=a(U.position),ca.$caption=a(U.caption),ca.$controlBox=a(U.controls),ca.$controls=a(U.control),ca.$thumbnails=a(U.thumbnails),ca.$thumbnailContainer=a(U.thumbnail_container),ca.$thumbnailItems=a(U.thumbnail_item),ca.isMobile?(ca.paddingVertical=ca.$close.outerHeight(),ca.paddingHorizontal=0,ca.mobilePaddingVertical=parseInt(ca.$content.css("paddingTop"),10)+parseInt(ca.$content.css("paddingBottom"),10),ca.mobilePaddingHorizontal=parseInt(ca.$content.css("paddingLeft"),10)+parseInt(ca.$content.css("paddingRight"),10)):(ca.paddingVertical=parseInt(ca.$lightbox.css("paddingTop"),10)+parseInt(ca.$lightbox.css("paddingBottom"),10),ca.paddingHorizontal=parseInt(ca.$lightbox.css("paddingLeft"),10)+parseInt(ca.$lightbox.css("paddingRight"),10),ca.mobilePaddingVertical=0,ca.mobilePaddingHorizontal=0),ca.contentHeight=ca.$lightbox.outerHeight()-ca.paddingVertical,ca.contentWidth=ca.$lightbox.outerWidth()-ca.paddingHorizontal,ca.controlHeight=ca.$controls.outerHeight(),m(),ca.gallery.active&&(ca.$lightbox.addClass(V.has_controls),G()),Z.on(W.keyDown,H),$.on(W.click,[U.overlay,U.close].join(", "),j).on([W.focus,W.focusIn].join(" "),Q),ca.gallery.active&&ca.$lightbox.on(W.click,U.control,B),ca.thumbnails&&ca.$lightbox.on(W.click,U.thumbnail_item,C),ca.isMobile&&ca.isTouch&&ca.$lightbox.on(W.click,U.caption_toggle,o).on(W.click,U.thumbnail_toggle,r),ca.$lightbox.fsTransition({property:"opacity"},function(){k?t(g):l?y(g):n?K(g):p?I(g):q&&L(ca.$object)}).addClass(V.open),ca.$overlay.addClass(V.open)}}function i(a){"object"!=typeof a&&(ca.targetHeight=arguments[0],ca.targetWidth=arguments[1]),"element"===ca.type?M(ca.$content.find("> :first-child")):"image"===ca.type?u():"video"===ca.type&&z(),l()}function j(a){X.killEvent(a),ca&&(ca.$lightbox.fsTransition("destroy"),ca.$content.fsTransition("destroy"),ca.$lightbox.addClass(V.animating).fsTransition({property:"opacity"},function(a){"undefined"!=typeof ca.$inlineTarget&&ca.$inlineTarget.length&&J(),ca.isViewer&&ca.$imageContainer&&ca.$imageContainer.length&&ca.$imageContainer.fsViewer("destroy"),ca.$lightbox.off(W.namespace),ca.$container.off(W.namespace),Z.off(W.keyDown),$.off(W.namespace),$.off(W.namespace),ca.$overlay.remove(),ca.$lightbox.remove(),"undefined"!=typeof ca.$el&&ca.$el&&ca.$el.length&&ca.$el.focus(),ca=null,Z.trigger(W.close)}),ca.$lightbox.removeClass(V.open),ca.$overlay.removeClass(V.open),ca.isMobile&&(_.removeClass(V.lock),X.unlockViewport(S)))}function k(){var a=n();ca.isMobile?0:ca.duration;ca.isMobile?X.lockViewport(S):ca.$controls.css({marginTop:(ca.contentHeight-ca.controlHeight-ca.metaHeight+ca.thumbnailHeight)/2}),""===ca.$caption.html()?(ca.$caption.hide(),ca.$lightbox.removeClass(V.has_caption),ca.gallery.active||ca.$tools.hide()):(ca.$caption.show(),ca.$lightbox.addClass(V.has_caption)),ca.$lightbox.fsTransition({property:ca.contentHeight!==ca.oldContentHeight?"height":"width"},function(){ca.$content.fsTransition({property:"opacity"},function(){ca.$lightbox.removeClass(V.animating),ca.isAnimating=!1}),ca.$lightbox.removeClass(V.loading).addClass(V.ready),ca.visible=!0,Z.trigger(W.open),ca.gallery.active&&(A(),D(),E()),ca.$lightbox.focus()}),ca.isMobile||ca.$lightbox.css({height:ca.contentHeight+ca.paddingVertical,width:ca.contentWidth+ca.paddingHorizontal,top:ca.fixed?0:a.top});var b=ca.oldContentHeight!==ca.contentHeight||ca.oldContentWidth!==ca.contentWidth;!ca.isMobile&&b||ca.$lightbox.fsTransition("resolve"),ca.oldContentHeight=ca.contentHeight,ca.oldContentWidth=ca.contentWidth,ca.isMobile&&_.addClass(V.lock)}function l(){if(ca.visible&&!ca.isMobile){var a=n();ca.$controls.css({marginTop:(ca.contentHeight-ca.controlHeight-ca.metaHeight+ca.thumbnailHeight)/2}),ca.$lightbox.css({height:ca.contentHeight+ca.paddingVertical,width:ca.contentWidth+ca.paddingHorizontal,top:ca.fixed?0:a.top}),ca.oldContentHeight=ca.contentHeight,ca.oldContentWidth=ca.contentWidth}}function m(){var a=n();ca.$lightbox.css({top:ca.fixed?0:a.top})}function n(){if(ca.isMobile)return{left:0,top:0};var a={left:(b.windowWidth-ca.contentWidth-ca.paddingHorizontal)/2,top:ca.top<=0?(b.windowHeight-ca.contentHeight-ca.paddingVertical)/2:ca.top};return ca.fixed!==!0&&(a.top+=Z.scrollTop()),a}function o(a){if(X.killEvent(a),ca.captionOpen)p();else{s();var b=parseInt(ca.$metaContent.outerHeight(!0));b+=parseInt(ca.$meta.css("padding-top")),b+=parseInt(ca.$meta.css("padding-bottom")),ca.$meta.css({height:b}),ca.$lightbox.addClass(V.caption_open).find(U.caption_toggle).text(ca.labels.captionOpen),ca.captionOpen=!0}}function p(){ca.$lightbox.removeClass(V.caption_open).find(U.caption_toggle).text(ca.labels.captionClosed),ca.captionOpen=!1}function q(){var a=this.attr("title"),b=!(void 0===a||!a)&&a.replace(/^\s+|\s+$/g,"");return b?' ":""}function r(a){X.killEvent(a),ca.thumbnailsOpen?s():(p(),ca.$lightbox.addClass(V.thumbnails_open).find(U.thumbnail_toggle).text(ca.labels.thumbnailsOpen),ca.thumbnailsOpen=!0)}function s(){ca.$lightbox.removeClass(V.thumbnails_open).find(U.thumbnail_toggle).text(ca.labels.thumbnailsClosed),ca.thumbnailsOpen=!1}function t(b){ca.isViewer?(ca.$imageContainer=a(''),ca.$image=ca.$imageContainer.find("img"),ca.$image.attr("src",b).addClass(V.image),ca.$content.prepend(ca.$imageContainer),u(),ca.$imageContainer.one("loaded.viewer",function(){k()}).fsViewer({theme:ca.theme})):(ca.$imageContainer=a(''),ca.$image=ca.$imageContainer.find("img"),ca.$image.one(W.load,function(){var a=O(ca.$image);ca.naturalHeight=a.naturalHeight,ca.naturalWidth=a.naturalWidth,ca.retina&&(ca.naturalHeight/=2,ca.naturalWidth/=2),ca.$content.prepend(ca.$imageContainer),u(),k()}).on(W.error,N).attr("src",b).addClass(V.image),(ca.$image[0].complete||4===ca.$image[0].readyState)&&ca.$image.trigger(W.load))}function u(){if(ca.$image){var a=0;for(ca.windowHeight=ca.viewportHeight=b.windowHeight-ca.mobilePaddingVertical-ca.paddingVertical,ca.windowWidth=ca.viewportWidth=b.windowWidth-ca.mobilePaddingHorizontal-ca.paddingHorizontal,ca.contentHeight=1/0,ca.contentWidth=1/0,ca.imageMarginTop=0,ca.imageMarginLeft=0;ca.contentHeight>ca.viewportHeight&&a<2;)ca.imageHeight=0===a?ca.naturalHeight:ca.$image.outerHeight(),ca.imageWidth=0===a?ca.naturalWidth:ca.$image.outerWidth(),ca.metaHeight=0===a?0:ca.metaHeight,ca.spacerHeight=0===a?0:ca.spacerHeight,ca.thumbnailHeight=0===a?0:ca.thumbnailHeight,0===a&&(ca.ratioHorizontal=ca.imageHeight/ca.imageWidth,ca.ratioVertical=ca.imageWidth/ca.imageHeight,ca.isWide=ca.imageWidth>ca.imageHeight),ca.imageHeight',ca.gallery.active&&ca.thumbnails){u+='',u+='"}u+='',(k||l)&&(u+='';for(var w,x,z=0,A=ca.gallery.$items.length;z',u+='',u+="";u+="',u+='"),u+="',ca.gallery.active&&(u+='",u+='"),ca.isMobile&&ca.isTouch&&(u+='",ca.gallery.active&&ca.thumbnails&&(u+='")),u+="",u+='',u+='",u+="',ca.gallery.active&&(u+='",u+=''+(ca.gallery.index+1)+" ",u+=ca.labels.count,u+=' '+(ca.gallery.total+1)+"",u+="
"),u+='a&&(ca.targetImageHeight=a,ca.targetImageWidth=ca.targetImageHeight*ca.ratioVertical)):(ca.targetImageHeight=a,ca.targetImageWidth=ca.targetImageHeight*ca.ratioVertical,ca.targetImageWidth>b&&(ca.targetImageWidth=b,ca.targetImageHeight=ca.targetImageWidth*ca.ratioHorizontal)),(ca.targetImageWidth>ca.imageWidth||ca.targetImageHeight>ca.imageHeight)&&(ca.targetImageHeight=ca.imageHeight,ca.targetImageWidth=ca.imageWidth),(ca.targetImageWidth =2&&(c+="?"+d.slice(1)[0].trim()),ca.$videoWrapper=a(''),ca.$video=a(''),ca.$video.attr("src",c).addClass(V.video).prependTo(ca.$videoWrapper),ca.$content.prepend(ca.$videoWrapper),z(),k()):N()}function z(){ca.windowHeight=ca.viewportHeight=b.windowHeight-ca.mobilePaddingVertical-ca.paddingVertical,ca.windowWidth=ca.viewportWidth=b.windowWidth-ca.mobilePaddingHorizontal-ca.paddingHorizontal,ca.videoMarginTop=0,ca.videoMarginLeft=0,ca.isMobile?(ca.isTouch?(ca.$controlBox.css({width:b.windowWidth}),ca.spacerHeight=ca.$controls.outerHeight(!0)+10):(ca.$tools.css({width:b.windowWidth}),ca.spacerHeight=ca.$tools.outerHeight(!0),ca.spacerHeight+=ca.$thumbnails.outerHeight(!0)+10),ca.viewportHeight-=ca.spacerHeight,ca.targetVideoWidth=ca.viewportWidth,ca.targetVideoHeight=ca.targetVideoWidth*ca.videoRatio,ca.targetVideoHeight>ca.viewportHeight&&(ca.targetVideoHeight=ca.viewportHeight,ca.targetVideoWidth=ca.targetVideoHeight/ca.videoRatio),ca.videoMarginTop=(ca.viewportHeight-ca.targetVideoHeight)/2,ca.videoMarginLeft=(ca.viewportWidth-ca.targetVideoWidth)/2):(ca.viewportHeight=ca.windowHeight-ca.margin,ca.viewportWidth=ca.windowWidth-ca.margin,ca.targetVideoWidth=ca.videoWidth>ca.viewportWidth?ca.viewportWidth:ca.videoWidth,ca.targetVideoWidth 0&&(c=ca.gallery.$items.eq(ca.gallery.index-1).attr("href"),P(c)||a('')),ca.gallery.index '))}function B(b){X.killEvent(b);var c=a(b.currentTarget);ca.isAnimating||c.hasClass(V.control_disabled)||(ca.isAnimating=!0,p(),ca.gallery.index+=c.hasClass(V.control_next)?1:-1,ca.gallery.index>ca.gallery.total&&(ca.gallery.index=ca.infinite?0:ca.gallery.total),ca.gallery.index<0&&(ca.gallery.index=ca.infinite?ca.gallery.total:0),D(),ca.$lightbox.addClass(V.animating),ca.$content.fsTransition({property:"opacity"},F),ca.$lightbox.addClass(V.loading))}function C(b){X.killEvent(b);var c=a(b.currentTarget);ca.isAnimating||c.hasClass(V.active)||(ca.isAnimating=!0,p(),ca.gallery.index=ca.$thumbnailItems.index(c),D(),ca.$lightbox.addClass(V.animating),ca.$content.fsTransition({property:"opacity"},F),ca.$lightbox.addClass(V.loading))}function D(){if(ca.thumbnails){var a=ca.$thumbnailItems.eq(ca.gallery.index);ca.$thumbnailItems.removeClass(V.active),a.addClass(V.active)}}function E(){if(ca.thumbnails){var a=ca.$thumbnailItems.eq(ca.gallery.index),b=a.position().left+a.outerWidth(!1)/2-ca.$thumbnailContainer.outerWidth(!0)/2;ca.$thumbnailContainer.stop().animate({scrollLeft:b},200,"linear")}}function F(){"undefined"!=typeof ca.$imageContainer&&(ca.isViewer&&ca.$imageContainer.fsViewer("destroy"),ca.$imageContainer.remove()),"undefined"!=typeof ca.$videoWrapper&&ca.$videoWrapper.remove(),ca.$el=ca.gallery.$items.eq(ca.gallery.index),ca.$caption.html(ca.formatter.call(ca.$el,ca)),ca.$position.find(U.position_current).html(ca.gallery.index+1);var a=ca.$el.attr("href"),b=P(a);b?(ca.type="video",y(a)):(ca.type="image",t(a)),G()}function G(){ca.$controls.removeClass(V.control_disabled),ca.infinite||(0===ca.gallery.index&&ca.$controls.filter(U.control_previous).addClass(V.control_disabled),ca.gallery.index===ca.gallery.total&&ca.$controls.filter(U.control_next).addClass(V.control_disabled))}function H(a){!ca.gallery.active||37!==a.keyCode&&39!==a.keyCode?27===a.keyCode&&ca.$close.trigger(W.click):(X.killEvent(a),ca.$controls.filter(37===a.keyCode?U.control_previous:U.control_next).trigger(W.click))}function I(b){ca.$inlineTarget=a(b),ca.$inlineContents=ca.$inlineTarget.children().detach(),L(ca.$inlineContents)}function J(){ca.$inlineTarget.append(ca.$inlineContents.detach())}function K(b){b+=b.indexOf("?")>-1?"&"+ca.requestKey+"=true":"?"+ca.requestKey+"=true";var c=a('');L(c)}function L(a){ca.$content.append(a),M(a),k()}function M(a){ca.windowHeight=b.windowHeight-ca.mobilePaddingVertical-ca.paddingVertical,ca.windowWidth=b.windowWidth-ca.mobilePaddingHorizontal-ca.paddingHorizontal,ca.objectHeight=a.outerHeight(!0),ca.objectWidth=a.outerWidth(!0),ca.targetHeight=ca.targetHeight||(ca.$el?ca.$el.data(S+"-height"):null),ca.targetWidth=ca.targetWidth||(ca.$el?ca.$el.data(S+"-width"):null),ca.maxHeight=ca.windowHeight<0?ca.minHeight:ca.windowHeight,ca.isIframe=a.is("iframe"),ca.objectMarginTop=0,ca.objectMarginLeft=0,ca.isMobile||(ca.windowHeight-=ca.margin,ca.windowWidth-=ca.margin),ca.contentHeight=ca.targetHeight?ca.targetHeight:ca.isIframe||ca.isMobile?ca.windowHeight:ca.objectHeight,ca.contentWidth=ca.targetWidth?ca.targetWidth:ca.isIframe||ca.isMobile?ca.windowWidth:ca.objectWidth,(ca.isIframe||ca.isObject)&&ca.isMobile?(ca.contentHeight=ca.windowHeight,ca.contentWidth=ca.windowWidth):ca.isObject&&(ca.contentHeight=ca.contentHeight>ca.windowHeight?ca.windowHeight:ca.contentHeight,ca.contentWidth=ca.contentWidth>ca.windowWidth?ca.windowWidth:ca.contentWidth),ca.isMobile||(ca.contentHeight>ca.maxHeight&&(ca.contentHeight=ca.maxHeight),ca.contentWidth>ca.maxWidth&&(ca.contentWidth=ca.maxWidth))}function N(){var b=a(' ');ca.type="element",ca.$tools.remove(),ca.$image.off(W.namespace),L(b),Z.trigger(W.error)}function O(a){var b=a[0],c=new Image;return"undefined"!=typeof b.naturalHeight?{naturalHeight:b.naturalHeight,naturalWidth:b.naturalWidth}:"img"===b.tagName.toLowerCase()&&(c.src=b.src,{naturalHeight:c.height,naturalWidth:c.width})}function P(a){var b,c=ca.videoFormatter;for(var d in c)if(c.hasOwnProperty(d)&&(b=a.match(c[d].pattern),null!==b))return c[d].format.call(ca,b);return!1}function Q(b){var c=b.target;a.contains(ca.$lightbox[0],c)||c===ca.$lightbox[0]||c===ca.$overlay[0]||(X.killEvent(b),ca.$lightbox.focus())}var R=b.Plugin("lightbox",{widget:!0,defaults:{customClass:"",fileTypes:/\.(jpg|sjpg|jpeg|png|gif)$/i,fixed:!1,formatter:q,infinite:!1,labels:{close:"Close",count:"of",next:"Next",previous:"Previous",captionClosed:"View Caption",captionOpen:"Close Caption",thumbnailsClosed:"View Thumbnails",thumbnailsOpen:"Close Thumbnails"},margin:50,maxHeight:1e4,maxWidth:1e4,minHeight:100,minWidth:100,mobile:!1,retina:!1,requestKey:"fs-lightbox",theme:"fs-light",thumbnails:!1,top:0,videoFormatter:{youtube:{pattern:/(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/ ]{11})/,format:w},vimeo:{pattern:/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|video\/|)(\d+)(?:$|\/|\?)/,format:x}},videoRatio:.5625,videoWidth:800,viewer:!0},classes:["loading","animating","scaling","zooming","fixed","mobile","touch","inline","iframed","open","ready","overlay","close","loading_icon","container","content","image","image_container","video","video_wrapper","tools","meta","meta_content","controls","control","control_previous","control_next","control_disabled","position","position_current","position_total","toggle","caption_toggle","caption","caption_open","thumbnailed","thumbnails_open","thumbnail_toggle","thumbnails","thumbnail_container","thumbnail_item","active","has_controls","has_caption","iframe","error","active","lock"],events:{open:"open",close:"close"},methods:{_setup:c,_construct:e,_destruct:f,_resize:d,resize:i},utilities:{_initialize:g,close:j}}),S=R.namespace,T=R.defaults,U=R.classes,V=U.raw,W=R.events,X=R.functions,Y=b.window,Z=b.$window,$=null,_=null,aa=!1,ba=!1,ca=null}); /*! formstone v1.3.2 [navigation.js] 2017-04-18 | GPL-3.0 License | formstone.it */ !function(a){"function"==typeof define&&define.amd?define(["jquery","./core","./mediaquery","./swap"],a):a(jQuery,Formstone)}(function(a,b){"use strict";function c(){A=a("html, body")}function d(b){b.handleGuid=x.handle+b.guid,b.isToggle="toggle"===b.type,b.open=!1,b.isToggle&&(b.gravity="");var c=x.base,d=[c,b.type].join("-"),e=b.gravity?[d,b.gravity].join("-"):"",f=[b.rawGuid,b.theme,b.customClass].join(" ");b.handle=this.data(v+"-handle"),b.content=this.data(v+"-content"),b.handleClasses=[x.handle,x.handle.replace(c,d),e?x.handle.replace(c,e):"",b.handleGuid,f].join(" "),b.thisClasses=[x.nav.replace(c,d),e?x.nav.replace(c,e):"",f],b.contentClasses=[x.content.replace(c,d),f].join(" "),b.contentClassesOpen=[e?x.content.replace(c,e):"",x.open].join(" "),b.$nav=this.addClass(b.thisClasses.join(" ")).attr("role","navigation"),b.$handle=a(b.handle).addClass(b.handleClasses),b.$content=a(b.content).addClass(b.contentClasses),b.$animate=a().add(b.$nav).add(b.$content),s(b),b.navTabIndex=b.$nav.attr("tabindex"),b.$nav.attr("tabindex",-1),b.id=this.attr("id"),b.id?b.ariaId=b.id:(b.ariaId=b.rawGuid,this.attr("id",b.ariaId)),b.$handle.attr("data-swap-target",b.dotGuid).attr("data-swap-linked",b.handleGuid).attr("data-swap-group",x.base).attr("tabindex",0).on("activate.swap"+b.dotGuid,b,m).on("deactivate.swap"+b.dotGuid,b,n).on("enable.swap"+b.dotGuid,b,o).on("disable.swap"+b.dotGuid,b,p).on(y.focus+b.dotGuid,b,j).on(y.blur+b.dotGuid,b,k).fsSwap({maxWidth:b.maxWidth,classes:{target:b.dotGuid,enabled:w.enabled,active:w.open,raw:{target:b.rawGuid,enabled:x.enabled,active:x.open}}}),b.$handle.is("a, button")||b.$handle.on(y.keyPress+b.dotGuid,b,l)}function e(a){a.$content.removeClass([a.contentClasses,a.contentClassesOpen].join(" ")).off(y.namespace),a.$handle.removeAttr("aria-controls").removeAttr("aria-expanded").removeAttr("data-swap-target").removeData("swap-target").removeAttr("data-swap-linked").removeAttr("data-swap-group").removeData("swap-linked").removeData("tabindex").removeClass(a.handleClasses).off(a.dotGuid).html(a.originalLabel).fsSwap("destroy"),a.$nav.attr("tabindex",a.navTabIndex),t(a),r(a),this.removeAttr("aria-hidden").removeClass(a.thisClasses.join(" ")).off(y.namespace),this.attr("id")===a.rawGuid&&this.removeAttr("id")}function f(a){a.$handle.fsSwap("activate")}function g(a){a.$handle.fsSwap("deactivate")}function h(a){a.$handle.fsSwap("enable")}function i(a){a.$handle.fsSwap("disable")}function j(a){a.data.$handle.addClass(x.focus)}function k(a){a.data.$handle.removeClass(x.focus)}function l(a){var b=a.data;13!==a.keyCode&&32!==a.keyCode||(z.killEvent(a),b.$handle.trigger(y.raw.click))}function m(a){if(!a.originalEvent){var b=a.data;b.open||(b.$el.trigger(y.open).attr("aria-hidden",!1),b.$content.addClass(b.contentClassesOpen).one(y.click,function(){g(b)}),b.$handle.attr("aria-expanded",!0),b.label&&b.$handle.html(b.labels.open),q(b),b.open=!0,b.$nav.focus())}}function n(a){if(!a.originalEvent){var b=a.data;b.open&&(b.$el.trigger(y.close).attr("aria-hidden",!0),b.$content.removeClass(b.contentClassesOpen).off(y.namespace),b.$handle.attr("aria-expanded",!1),b.label&&b.$handle.html(b.labels.closed),r(b),b.open=!1,b.$el.focus())}}function o(a){var b=a.data;b.$el.attr("aria-hidden",!0),b.$handle.attr("aria-controls",b.ariaId).attr("aria-expanded",!1),b.$content.addClass(x.enabled),setTimeout(function(){b.$animate.addClass(x.animated)},0),b.label&&b.$handle.html(b.labels.closed)}function p(a){var b=a.data;b.$el.removeAttr("aria-hidden"),b.$handle.removeAttr("aria-controls").removeAttr("aria-expanded"),b.$content.removeClass(x.enabled,x.animated),b.$animate.removeClass(x.animated),t(b),r(b)}function q(a){a.isToggle||A.addClass(x.lock)}function r(a){a.isToggle||A.removeClass(x.lock)}function s(a){if(a.label)if(a.$handle.length>1){a.originalLabel=[];for(var b=0,c=a.$handle.length;bError Loading Resource
1)for(var b=0,c=a.$handle.length;b '+b.labels.previous+"",c+='",c+=' ',c+='0',c+=" "+b.labels.count+" ",c+='0',c+='',c+="",b.thisClasses=[l.base,b.theme,b.customClass],this.addClass(b.thisClasses.join(" ")).wrapInner('').prepend(c),b.$controls=this.find(k.control),b.$pages=this.find(k.pages),b.$items=b.$pages.children().addClass(l.page),b.$position=this.find(k.position),b.$select=this.find(k.select),b.index=-1,b.total=b.$items.length-1;var d=b.$items.index(b.$items.filter("[data-"+j.namespace+"-active]"));d||(d=b.$items.index(b.$items.filter(k.active))),b.$items.eq(0).addClass(l.first).after('…').end().eq(b.total).addClass(l.last).before('…'),b.$ellipsis=b.$pages.find(k.ellipsis),i(b),this.on(m.click,k.page,b,g).on(m.click,k.control,b,e).on(m.change,k.select,b,f),a.fsMediaquery("bind",b.rawGuid,b.mq,{enter:function(){b.$el.addClass(l.mobile)},leave:function(){b.$el.removeClass(l.mobile)}}),h(b,d)}function d(b){a.fsMediaquery("unbind",b.rawGuid),b.$controls.remove(),b.$ellipsis.remove(),b.$select.remove(),b.$position.remove(),b.$items.removeClass([l.page,l.active,l.visible,l.first,l.last].join(" ")).unwrap(),this.removeClass(b.thisClasses.join(" ")).off(m.namespace)}function e(b){n.killEvent(b);var c=b.data,d=c.index+(a(b.currentTarget).hasClass(l.control_previous)?-1:1);d>=0&&c.$items.eq(d).trigger(m.raw.click)}function f(b){n.killEvent(b);var c=b.data,d=a(b.currentTarget),e=parseInt(d.val(),10);c.$items.eq(e).trigger(m.raw.click)}function g(b){var c=b.data,d=a(b.currentTarget),e=c.$items.index(d);c.ajax?n.killEvent(b):d[0].click(),h(c,e)}function h(a,b){if(b<0&&(b=0),b>a.total&&(b=a.total),b!==a.index){a.index=b;var c=a.index-a.visible,d=a.index+(a.visible+1);c<0&&(c=0),d>a.total&&(d=a.total),a.$items.removeClass(l.visible).removeClass(l.hidden).filter(k.active).removeClass(l.active).end().eq(a.index).addClass(l.active).end().slice(c,d).addClass(l.visible),a.$items.not(k.visible).addClass(l.hidden),a.$position.find(k.current).text(a.index+1).end().find(k.total).text(a.total+1),a.$select.val(a.index),a.$controls.removeClass(l.visible),b>0&&a.$controls.filter(k.control_previous).addClass(l.visible),ba.visible+1&&a.$ellipsis.eq(0).addClass(l.visible),b Page "+(c+1)+"";a.$select.html(b)}var j=b.Plugin("pagination",{widget:!0,defaults:{ajax:!1,customClass:"",labels:{count:"of",next:"Next",previous:"Previous"},maxWidth:"740px",theme:"fs-light",visible:2},classes:["pages","page","active","first","last","ellipsis","visible","hidden","control","control_previous","control_next","position","select","mobile","current","total"],events:{update:"update"},methods:{_construct:c,_destruct:d}}),k=j.classes,l=k.raw,m=j.events,n=j.functions}); /*! formstone v1.3.2 [swap.js] 2017-04-18 | GPL-3.0 License | formstone.it */ !function(a){"function"==typeof define&&define.amd?define(["jquery","./core","./mediaquery"],a):a(jQuery,Formstone)}(function(a,b){"use strict";function c(b){b.enabled=!1,b.active=!1,b.classes=a.extend(!0,{},m,b.classes),b.target=this.data(l+"-target"),b.$target=a(b.target).addClass(b.classes.raw.target),b.mq="(max-width:"+(b.maxWidth===1/0?"100000px":b.maxWidth)+")";var c=this.data(l+"-linked");b.linked=!!c&&"[data-"+l+'-linked="'+c+'"]';var d=this.data(l+"-group");b.group=!!d&&"[data-"+l+'-group="'+d+'"]',b.$swaps=a().add(this).add(b.$target),this.on(n.click+b.dotGuid,b,j)}function d(b){b.collapse||!b.group||a(b.group).filter("[data-"+l+"-active]").length||a(b.group).eq(0).attr("data-"+l+"-active","true"),b.onEnable=this.data(l+"-active")||!1,a.fsMediaquery("bind",b.rawGuid,b.mq,{enter:function(){h.call(b.$el,b,!0)},leave:function(){i.call(b.$el,b,!0)}})}function e(b){a.fsMediaquery("unbind",b.rawGuid),b.$swaps.removeClass([b.classes.raw.enabled,b.classes.raw.active].join(" ")).off(n.namespace)}function f(b,c){if(b.enabled&&!b.active){b.group&&!c&&a(b.group).not(b.$el).not(b.linked)[k.namespaceClean]("deactivate",!0);var d=b.group?a(b.group).index(b.$el):null;b.$swaps.addClass(b.classes.raw.active),c||b.linked&&a(b.linked).not(b.$el)[k.namespaceClean]("activate",!0),this.trigger(n.activate,[d]),b.active=!0}}function g(b,c){b.enabled&&b.active&&(b.$swaps.removeClass(b.classes.raw.active),c||b.linked&&a(b.linked).not(b.$el)[k.namespaceClean]("deactivate",!0),this.trigger(n.deactivate),b.active=!1)}function h(b,c){b.enabled||(b.enabled=!0,b.$swaps.addClass(b.classes.raw.enabled),c||a(b.linked).not(b.$el)[k.namespaceClean]("enable"),this.trigger(n.enable),b.onEnable?(b.active=!1,f.call(this,b)):(b.active=!0,g.call(this,b)))}function i(b,c){b.enabled&&(b.enabled=!1,b.$swaps.removeClass([b.classes.raw.enabled,b.classes.raw.active].join(" ")),c||a(b.linked).not(b.$el)[k.namespaceClean]("disable"),this.trigger(n.disable))}function j(a){o.killEvent(a);var b=a.data;b.active&&b.collapse?g.call(b.$el,b):f.call(b.$el,b)}var k=b.Plugin("swap",{widget:!0,defaults:{collapse:!0,maxWidth:1/0},classes:["target","enabled","active"],events:{activate:"activate",deactivate:"deactivate",enable:"enable",disable:"disable"},methods:{_construct:c,_postConstruct:d,_destruct:e,activate:f,deactivate:g,enable:h,disable:i}}),l=k.namespace,m=k.classes,n=k.events,o=k.functions}); /*! formstone v1.3.2 [touch.js] 2017-04-18 | GPL-3.0 License | formstone.it */ !function(a){"function"==typeof define&&define.amd?define(["jquery","./core"],a):a(jQuery,Formstone)}(function(a,b){"use strict";function c(a){if(a.touches=[],a.touching=!1,this.on(q.dragStart,r.killEvent),a.swipe&&(a.pan=!0),a.scale&&(a.axis=!1),a.axisX="x"===a.axis,a.axisY="y"===a.axis,b.support.pointer){var c="";!a.axis||a.axisX&&a.axisY?c="none":(a.axisX&&(c+=" pan-y"),a.axisY&&(c+=" pan-x")),n(this,c),this.on(q.pointerDown,a,e)}else this.on(q.touchStart,a,e).on(q.mouseDown,a,f)}function d(a){this.off(q.namespace),n(this,"")}function e(a){a.preventManipulation&&a.preventManipulation();var b=a.data,c=a.originalEvent;if(c.type.match(/(up|end|cancel)$/i))return void h(a);if(c.pointerId){var d=!1;for(var e in b.touches)b.touches[e].id===c.pointerId&&(d=!0,b.touches[e].pageX=c.pageX,b.touches[e].pageY=c.pageY);d||b.touches.push({id:c.pointerId,pageX:c.pageX,pageY:c.pageY})}else b.touches=c.touches;c.type.match(/(down|start)$/i)?f(a):c.type.match(/move$/i)&&g(a)}function f(c){var d=c.data,f="undefined"!==a.type(d.touches)&&d.touches.length?d.touches[0]:null;f&&d.$el.off(q.mouseDown),d.touching||(d.startE=c.originalEvent,d.startX=f?f.pageX:c.pageX,d.startY=f?f.pageY:c.pageY,d.startT=(new Date).getTime(),d.scaleD=1,d.passed=!1),d.$links&&d.$links.off(q.click);var i=k(d.scale?q.scaleStart:q.panStart,c,d.startX,d.startY,d.scaleD,0,0,"","");if(d.scale&&d.touches&&d.touches.length>=2){var j=d.touches;d.pinch={startX:l(j[0].pageX,j[1].pageX),startY:l(j[0].pageY,j[1].pageY),startD:m(j[1].pageX-j[0].pageX,j[1].pageY-j[0].pageY)},i.pageX=d.startX=d.pinch.startX,i.pageY=d.startY=d.pinch.startY}d.touching||(d.touching=!0,d.pan&&!f&&s.on(q.mouseMove,d,g).on(q.mouseUp,d,h),b.support.pointer?s.on([q.pointerMove,q.pointerUp,q.pointerCancel].join(" "),d,e):s.on([q.touchMove,q.touchEnd,q.touchCancel].join(" "),d,e),d.$el.trigger(i))}function g(b){var c=b.data,d="undefined"!==a.type(c.touches)&&c.touches.length?c.touches[0]:null,e=d?d.pageX:b.pageX,f=d?d.pageY:b.pageY,g=e-c.startX,i=f-c.startY,j=g>0?"right":"left",n=i>0?"down":"up",o=Math.abs(g)>t,p=Math.abs(i)>t;if(!c.passed&&c.axis&&(c.axisX&&p||c.axisY&&o))h(b);else{!c.passed&&(!c.axis||c.axis&&c.axisX&&o||c.axisY&&p)&&(c.passed=!0),c.passed&&(r.killEvent(b),r.killEvent(c.startE));var s=!0,u=k(c.scale?q.scale:q.pan,b,e,f,c.scaleD,g,i,j,n);if(c.scale)if(c.touches&&c.touches.length>=2){var v=c.touches;c.pinch.endX=l(v[0].pageX,v[1].pageX),c.pinch.endY=l(v[0].pageY,v[1].pageY),c.pinch.endD=m(v[1].pageX-v[0].pageX,v[1].pageY-v[0].pageY),c.scaleD=c.pinch.endD/c.pinch.startD,u.pageX=c.pinch.endX,u.pageY=c.pinch.endY,u.scale=c.scaleD,u.deltaX=c.pinch.endX-c.pinch.startX,u.deltaY=c.pinch.endY-c.pinch.startY}else c.pan||(s=!1);s&&c.$el.trigger(u)}}function h(b){var c=b.data,d="undefined"!==a.type(c.touches)&&c.touches.length?c.touches[0]:null,e=d?d.pageX:b.pageX,g=d?d.pageY:b.pageY,h=e-c.startX,j=g-c.startY,l=(new Date).getTime(),m=c.scale?q.scaleEnd:q.panEnd,n=h>0?"right":"left",o=j>0?"down":"up",p=Math.abs(h)>1,v=Math.abs(j)>1;if(c.swipe&&Math.abs(h)>t&&l-c.startT1&&(b.gallery=!0,b.thisClasses.push(U.gallery),!b.customControls||b.controls.previous&&b.controls.next||(b.customControls=!1));for(var j=0;j ',d+='',d+='',d+="",b.controls&&!b.customControls&&(d+=' ',d+='",d+='",d+='",d+='",d+=""),this.addClass(b.thisClasses.join(" ")).prepend(d),b.$wrapper=this.find(T.wrapper),b.$viewport=this.find(T.viewport),b.customControls?(b.$controls=a(b.controls.container).addClass([U.controls,U.controls_custom].join(" ")),b.$controlPrevious=a(b.controls.previous).addClass(e),b.$controlNext=a(b.controls.next).addClass(f),b.$controlZoomIn=a(b.controls.zoom_in).addClass(h),b.$controlZoomOut=a(b.controls.zoom_out).addClass(i)):(b.$controls=this.find(T.controls),b.$controlPrevious=this.find(T.control_previous),b.$controlNext=this.find(T.control_next),b.$controlZoomIn=this.find(T.control_zoom_in),b.$controlZoomOut=this.find(T.control_zoom_out)),b.$controlItems=b.$controlPrevious.add(b.$controlNext),b.$controlZooms=b.$controlZoomIn.add(b.$controlZoomOut),g(),b.$controlItems.on(V.click,b,L),b.$controlZooms.on([V.touchStart,V.mouseDown].join(" "),b,E).on([V.touchEnd,V.mouseUp].join(" "),b,H),k(b,b.images[b.index],!0),M(b)}function i(a){a.$wrapper.remove(),a.$image.removeClass(U.source),a.controls&&!a.customControls&&a.$controls.remove(),a.customControls&&(a.$controls.removeClass([U.controls,U.controls_custom].join(" ")),a.$controlItems.off(V.click).removeClass([U.control,U.control_previous,U.control_next].join(" ")),a.$controlZooms.off([V.touchStart,V.mouseDown].join(" ")).off([V.touchStart,V.mouseDown].join(" ")).off([V.touchEnd,V.mouseUp].join(" ")).removeClass([U.control,U.control_zoom_in,U.control_zoom_out].join(" "))),this.removeClass(a.thisClasses.join(" ")).off(V.namespace),g()}function j(a,b){a.index=0,"string"==typeof b?(a.total=0,a.images=[b],a.gallery=!1,a.$el.removeClass(U.gallery)):(a.total=b.length-1,a.images=b,b.length>1&&(a.gallery=!0,a.$el.addClass(U.gallery)),b=a.images[a.index]),K(a,function(){k(a,b)})}function k(b,c,d){b.isAnimating||(b.isAnimating=!0,b.$container=a(''),b.$image=b.$container.find("img"),b.$viewport.append(b.$container),b.$image.one(V.load,function(){m(b),b.isAnimating=!1,b.$container.fsTransition({property:"opacity"},function(){}),b.$el.removeClass(U.loading),b.$container.fsTouch({pan:!0,scale:!0}).on(V.scaleStart,b,A).on(V.scaleEnd,b,C).on(V.scale,b,B),b.$el.trigger(V.loaded)}).one(V.error,b,l).attr("src",c).addClass(U.image),(b.$image[0].complete||4===b.$image[0].readyState)&&b.$image.trigger(V.load),b.source=c)}function l(a){var b=a.data;b.$el.trigger(V.error)}function m(a){n(a),o(a),a.containerTop=a.viewportHeight/2,a.containerLeft=a.viewportWidth/2,q(a),a.imageHeight=a.naturalHeight,a.imageWidth=a.naturalWidth,u(a),p(a),r(a),s(a),t(a);var b={containerTop:a.containerTop,containerLeft:a.containerLeft,imageHeight:a.imageHeight,imageWidth:a.imageWidth,imageTop:a.imageTop,imageLeft:a.imageLeft};z(a,b),a.isRendering=!0}function n(a){var b=P(a.$image);a.naturalHeight=b.naturalHeight,a.naturalWidth=b.naturalWidth,a.ratioHorizontal=a.naturalHeight/a.naturalWidth,a.ratioVertical=a.naturalWidth/a.naturalHeight,a.isWide=a.naturalWidth>a.naturalHeight}function o(a){a.viewportHeight=a.$viewport.outerHeight(),a.viewportWidth=a.$viewport.outerWidth()}function p(a){a.imageHeight<=a.viewportHeight?(a.containerMinTop=a.viewportHeight/2,a.containerMaxTop=a.viewportHeight/2):(a.containerMinTop=a.viewportHeight-a.imageHeight/2,a.containerMaxTop=a.imageHeight/2),a.imageWidth<=a.viewportWidth?(a.containerMinLeft=a.viewportWidth/2,a.containerMaxLeft=a.viewportWidth/2):(a.containerMinLeft=a.viewportWidth-a.imageWidth/2,a.containerMaxLeft=a.imageWidth/2)}function q(a){a.isWide?(a.imageMinWidth=a.viewportWidth,a.imageMinHeight=a.imageMinWidth*a.ratioHorizontal,a.imageMinHeight>a.viewportHeight&&(a.imageMinHeight=a.viewportHeight,a.imageMinWidth=a.imageMinHeight*a.ratioVertical)):(a.imageMinHeight=a.viewportHeight,a.imageMinWidth=a.imageMinHeight*a.ratioVertical,a.imageMinWidth>a.viewportWidth&&(a.imageMinWidth=a.viewportWidth,a.imageMinHeight=a.imageMinWidth*a.ratioHorizontal)),(a.imageMinWidth>a.naturalWidth||a.imageMinHeight>a.naturalHeight)&&(a.imageMinHeight=a.naturalHeight,a.imageMinWidth=a.naturalWidth),a.imageMaxHeight=a.naturalHeight,a.imageMaxWidth=a.naturalWidth}function r(a){a.imageTop=-(a.imageHeight/2),a.imageLeft=-(a.imageWidth/2)}function s(a){a.lastContainerTop=a.containerTop,a.lastContainerLeft=a.containerLeft,a.lastImageHeight=a.imageHeight,a.lastImageWidth=a.imageWidth,a.lastImageTop=a.imageTop,a.lastImageLeft=a.imageLeft}function t(a){a.renderContainerTop=a.lastContainerTop,a.renderContainerLeft=a.lastContainerLeft,a.renderImageTop=a.lastImageTop,a.renderImageLeft=a.lastImageLeft,a.renderImageHeight=a.lastImageHeight,a.renderImageWidth=a.lastImageWidth}function u(a){a.imageHeight=a.imageMinHeight,a.imageWidth=a.imageMinWidth}function v(a){a.imageHeighta.imageMaxHeight&&(a.imageHeight=a.imageMaxHeight),a.imageWidth a.imageMaxWidth&&(a.imageWidth=a.imageMaxWidth)}function w(a){a.containerTop a.containerMaxTop&&(a.containerTop=a.containerMaxTop),a.containerLeft a.containerMaxLeft&&(a.containerLeft=a.containerMaxLeft)}function x(a){null===a.tapTimer?a.tapTimer=W.startTimer(a.tapTimer,500,function(){y(a)}):(y(a),D(a))}function y(a){W.clearTimer(a.tapTimer),a.tapTimer=null}function z(a,c){if(b.transform){var d=c.imageWidth/a.naturalWidth,e=c.imageHeight/a.naturalHeight;a.$container.css(b.transform,"translate3d("+c.containerLeft+"px, "+c.containerTop+"px, 0)"),a.$image.css(b.transform,"translate3d(-50%, -50%, 0) scale("+d+","+e+")")}else a.$container.css({top:c.containerTop,left:c.containerLeft}),a.$image.css({height:c.imageHeight,width:c.imageWidth,top:c.imageTop,left:c.imageLeft})}function A(a){var b=a.data;x(b),s(b)}function B(a){var b=a.data;y(b),b.isRendering=!1,b.isZooming=!1;b.imageHeight>b.imageMinHeight+1;b.containerTop=b.lastContainerTop+a.deltaY,b.containerLeft=b.lastContainerLeft+a.deltaX,b.imageHeight=b.lastImageHeight*a.scale,b.imageWidth=b.lastImageWidth*a.scale,p(b),w(b),v(b),r(b);var c={containerTop:b.containerTop,containerLeft:b.containerLeft,imageHeight:b.imageHeight,imageWidth:b.imageWidth,imageTop:b.imageTop,imageLeft:b.imageLeft};z(b,c)}function C(a){var b=a.data;b.isZooming||(s(b),t(b),b.isRendering=!0)}function D(a){var b=a.imageHeight>a.imageMinHeight+1;a.isZooming=!0,s(a),t(a),b?(a.imageHeight=a.imageMinHeight,a.imageWidth=a.imageMinWidth):(a.imageHeight=a.imageMaxHeight,a.imageWidth=a.imageMaxWidth),p(a),w(a),r(a),a.isRendering=!0}function E(b){W.killEvent(b);var c=a(b.currentTarget),d=b.data,e=c.hasClass(U.control_zoom_out)?"out":"in";"out"===e?G(d):F(d)}function F(a){a.keyDownTime=1,a.action="zoom_in"}function G(a){a.keyDownTime=1,a.action="zoom_out"}function H(a){var b=a.data;b.action=!1}function I(a){if(a.isRendering){if(a.action){a.keyDownTime+=a.zoomIncrement;var b=("zoom_out"===a.action?-1:1)*Math.round(a.imageWidth*a.keyDownTime-a.imageWidth);b>a.zoomDelta&&(b=a.zoomDelta),a.isWide?(a.imageWidth+=b,a.imageHeight=Math.round(a.imageWidth/a.ratioVertical)):(a.imageHeight+=b,a.imageWidth=Math.round(a.imageHeight/a.ratioHorizontal)),v(a),r(a),p(a),w(a)}a.renderContainerTop+=Math.round((a.containerTop-a.renderContainerTop)*a.zoomEnertia),a.renderContainerLeft+=Math.round((a.containerLeft-a.renderContainerLeft)*a.zoomEnertia),a.renderImageTop+=Math.round((a.imageTop-a.renderImageTop)*a.zoomEnertia),a.renderImageLeft+=Math.round((a.imageLeft-a.renderImageLeft)*a.zoomEnertia),a.renderImageHeight+=Math.round((a.imageHeight-a.renderImageHeight)*a.zoomEnertia),a.renderImageWidth+=Math.round((a.imageWidth-a.renderImageWidth)*a.zoomEnertia);var c={containerTop:a.renderContainerTop,containerLeft:a.renderContainerLeft,imageHeight:a.renderImageHeight,imageWidth:a.renderImageWidth,imageTop:a.renderImageTop,imageLeft:a.renderImageLeft};z(a,c)}}function J(a){K(a)}function K(a,b){a.isAnimating||(y(a),a.isAnimating=!0,a.isRendering=!1,a.isZooming=!1,O(a),a.$container.fsTransition({property:"opacity"},function(){a.isAnimating=!1,a.$container.remove(),"function"==typeof b&&b.call(window,a)}),a.$el.addClass(U.loading))}function L(b){W.killEvent(b);var c=a(b.currentTarget),d=b.data,e=d.index+(c.hasClass(U.control_next)?1:-1);d.isAnimating||(e<0&&(e=0),e>d.total&&(e=d.total),e!==d.index&&(d.index=e,K(d,function(){k(d,d.images[d.index])})),M(d))}function M(a){a.$controlItems.removeClass(U.control_disabled),0===a.index&&a.$controlPrevious.addClass(U.control_disabled),a.index===a.images.length-1&&a.$controlNext.addClass(U.control_disabled)}function N(a){o(a),p(a),q(a),r(a),p(a),w(a),v(a)}function O(a){a.$container&&a.$container.length&&a.$container.fsTouch("destroy").off(V.scaleStart,A).off(V.scaleEnd,C).off(V.scale,B)}function P(a){var b=a[0],c=new Image;return"undefined"!=typeof b.naturalHeight?{naturalHeight:b.naturalHeight,naturalWidth:b.naturalWidth}:"img"===b.tagName.toLowerCase()&&(c.src=b.src,{naturalHeight:c.height,naturalWidth:c.width})}var Q,R=b.Plugin("viewer",{widget:!0,defaults:{controls:!0,customClass:"",labels:{count:"of",next:"Next",previous:"Previous",zoom_in:"Zoom In",zoom_out:"Zoom Out"},theme:"fs-light",zoomDelta:100,zoomEnertia:.2,zoomIncrement:.01},classes:["source","wrapper","viewport","container","image","gallery","loading_icon","controls","controls_custom","control","control_previous","control_next","control_zoom_in","control_zoom_out","control_disabled","loading"],events:{loaded:"loaded",ready:"ready"},methods:{_setup:c,_construct:h,_destruct:i,_resize:d,_raf:f,resize:N,load:j,unload:J}}),S=R.namespace,T=R.classes,U=T.raw,V=R.events,W=R.functions,X=(b.window,b.$window),Y=0,Z=[]}); /*! picturefill - v3.0.2 - 2016-02-12 * https://scottjehl.github.io/picturefill/ * Copyright (c) 2016 https://github.com/scottjehl/picturefill/blob/master/Authors.txt; Licensed MIT */ /*! Gecko-Picture - v1.0 * https://github.com/scottjehl/picturefill/tree/3.0/src/plugins/gecko-picture * Firefox's early picture implementation (prior to FF41) is static and does * not react to viewport changes. This tiny module fixes this. */ (function(window) { /*jshint eqnull:true */ var ua = navigator.userAgent; if ( window.HTMLPictureElement && ((/ecko/).test(ua) && ua.match(/rv\:(\d+)/) && RegExp.$1 < 45) ) { addEventListener("resize", (function() { var timer; var dummySrc = document.createElement("source"); var fixRespimg = function(img) { var source, sizes; var picture = img.parentNode; if (picture.nodeName.toUpperCase() === "PICTURE") { source = dummySrc.cloneNode(); picture.insertBefore(source, picture.firstElementChild); setTimeout(function() { picture.removeChild(source); }); } else if (!img._pfLastSize || img.offsetWidth > img._pfLastSize) { img._pfLastSize = img.offsetWidth; sizes = img.sizes; img.sizes += ",100vw"; setTimeout(function() { img.sizes = sizes; }); } }; var findPictureImgs = function() { var i; var imgs = document.querySelectorAll("picture > img, img[srcset][sizes]"); for (i = 0; i < imgs.length; i++) { fixRespimg(imgs[i]); } }; var onResize = function() { clearTimeout(timer); timer = setTimeout(findPictureImgs, 99); }; var mq = window.matchMedia && matchMedia("(orientation: landscape)"); var init = function() { onResize(); if (mq && mq.addListener) { mq.addListener(onResize); } }; dummySrc.srcset = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="; if (/^[c|i]|d$/.test(document.readyState || "")) { init(); } else { document.addEventListener("DOMContentLoaded", init); } return onResize; })()); } })(window); /*! Picturefill - v3.0.2 * http://scottjehl.github.io/picturefill * Copyright (c) 2015 https://github.com/scottjehl/picturefill/blob/master/Authors.txt; * License: MIT */ (function( window, document, undefined ) { // Enable strict mode "use strict"; // HTML shim|v it for old IE (IE9 will still need the HTML video tag workaround) document.createElement( "picture" ); var warn, eminpx, alwaysCheckWDescriptor, evalId; // local object for method references and testing exposure var pf = {}; var isSupportTestReady = false; var noop = function() {}; var image = document.createElement( "img" ); var getImgAttr = image.getAttribute; var setImgAttr = image.setAttribute; var removeImgAttr = image.removeAttribute; var docElem = document.documentElement; var types = {}; var cfg = { //resource selection: algorithm: "" }; var srcAttr = "data-pfsrc"; var srcsetAttr = srcAttr + "set"; // ua sniffing is done for undetectable img loading features, // to do some non crucial perf optimizations var ua = navigator.userAgent; var supportAbort = (/rident/).test(ua) || ((/ecko/).test(ua) && ua.match(/rv\:(\d+)/) && RegExp.$1 > 35 ); var curSrcProp = "currentSrc"; var regWDesc = /\s+\+?\d+(e\d+)?w/; var regSize = /(\([^)]+\))?\s*(.+)/; var setOptions = window.picturefillCFG; /** * Shortcut property for https://w3c.github.io/webappsec/specs/mixedcontent/#restricts-mixed-content ( for easy overriding in tests ) */ // baseStyle also used by getEmValue (i.e.: width: 1em is important) var baseStyle = "position:absolute;left:0;visibility:hidden;display:block;padding:0;border:none;font-size:1em;width:1em;overflow:hidden;clip:rect(0px, 0px, 0px, 0px)"; var fsCss = "font-size:100%!important;"; var isVwDirty = true; var cssCache = {}; var sizeLengthCache = {}; var DPR = window.devicePixelRatio; var units = { px: 1, "in": 96 }; var anchor = document.createElement( "a" ); /** * alreadyRun flag used for setOptions. is it true setOptions will reevaluate * @type {boolean} */ var alreadyRun = false; // Reusable, non-"g" Regexes // (Don't use \s, to avoid matching non-breaking space.) var regexLeadingSpaces = /^[ \t\n\r\u000c]+/, regexLeadingCommasOrSpaces = /^[, \t\n\r\u000c]+/, regexLeadingNotSpaces = /^[^ \t\n\r\u000c]+/, regexTrailingCommas = /[,]+$/, regexNonNegativeInteger = /^\d+$/, // ( Positive or negative or unsigned integers or decimals, without or without exponents. // Must include at least one digit. // According to spec tests any decimal point must be followed by a digit. // No leading plus sign is allowed.) // https://html.spec.whatwg.org/multipage/infrastructure.html#valid-floating-point-number regexFloatingPoint = /^-?(?:[0-9]+|[0-9]*\.[0-9]+)(?:[eE][+-]?[0-9]+)?$/; var on = function(obj, evt, fn, capture) { if ( obj.addEventListener ) { obj.addEventListener(evt, fn, capture || false); } else if ( obj.attachEvent ) { obj.attachEvent( "on" + evt, fn); } }; /** * simple memoize function: */ var memoize = function(fn) { var cache = {}; return function(input) { if ( !(input in cache) ) { cache[ input ] = fn(input); } return cache[ input ]; }; }; // UTILITY FUNCTIONS // Manual is faster than RegEx // http://jsperf.com/whitespace-character/5 function isSpace(c) { return (c === "\u0020" || // space c === "\u0009" || // horizontal tab c === "\u000A" || // new line c === "\u000C" || // form feed c === "\u000D"); // carriage return } /** * gets a mediaquery and returns a boolean or gets a css length and returns a number * @param css mediaqueries or css length * @returns {boolean|number} * * based on: https://gist.github.com/jonathantneal/db4f77009b155f083738 */ var evalCSS = (function() { var regLength = /^([\d\.]+)(em|vw|px)$/; var replace = function() { var args = arguments, index = 0, string = args[0]; while (++index in args) { string = string.replace(args[index], args[++index]); } return string; }; var buildStr = memoize(function(css) { return "return " + replace((css || "").toLowerCase(), // interpret `and` /\band\b/g, "&&", // interpret `,` /,/g, "||", // interpret `min-` as >= /min-([a-z-\s]+):/g, "e.$1>=", // interpret `max-` as <= /max-([a-z-\s]+):/g, "e.$1<=", //calc value /calc([^)]+)/g, "($1)", // interpret css values /(\d+[\.]*[\d]*)([a-z]+)/g, "($1 * e.$2)", //make eval less evil /^(?!(e.[a-z]|[0-9\.&=|><\+\-\*\(\)\/])).*/ig, "" ) + ";"; }); return function(css, length) { var parsedLength; if (!(css in cssCache)) { cssCache[css] = false; if (length && (parsedLength = css.match( regLength ))) { cssCache[css] = parsedLength[ 1 ] * units[parsedLength[ 2 ]]; } else { /*jshint evil:true */ try{ cssCache[css] = new Function("e", buildStr(css))(units); } catch(e) {} /*jshint evil:false */ } } return cssCache[css]; }; })(); var setResolution = function( candidate, sizesattr ) { if ( candidate.w ) { // h = means height: || descriptor.type === 'h' do not handle yet... candidate.cWidth = pf.calcListLength( sizesattr || "100vw" ); candidate.res = candidate.w / candidate.cWidth ; } else { candidate.res = candidate.d; } return candidate; }; /** * * @param opt */ var picturefill = function( opt ) { if (!isSupportTestReady) {return;} var elements, i, plen; var options = opt || {}; if ( options.elements && options.elements.nodeType === 1 ) { if ( options.elements.nodeName.toUpperCase() === "IMG" ) { options.elements = [ options.elements ]; } else { options.context = options.elements; options.elements = null; } } elements = options.elements || pf.qsa( (options.context || document), ( options.reevaluate || options.reselect ) ? pf.sel : pf.selShort ); if ( (plen = elements.length) ) { pf.setupRun( options ); alreadyRun = true; // Loop through all elements for ( i = 0; i < plen; i++ ) { pf.fillImg(elements[ i ], options); } pf.teardownRun( options ); } }; /** * outputs a warning for the developer * @param {message} * @type {Function} */ warn = ( window.console && console.warn ) ? function( message ) { console.warn( message ); } : noop ; if ( !(curSrcProp in image) ) { curSrcProp = "src"; } // Add support for standard mime types. types[ "image/jpeg" ] = true; types[ "image/gif" ] = true; types[ "image/png" ] = true; function detectTypeSupport( type, typeUri ) { // based on Modernizr's lossless img-webp test // note: asynchronous var image = new window.Image(); image.onerror = function() { types[ type ] = false; picturefill(); }; image.onload = function() { types[ type ] = image.width === 1; picturefill(); }; image.src = typeUri; return "pending"; } // test svg support types[ "image/svg+xml" ] = document.implementation.hasFeature( "http://www.w3.org/TR/SVG11/feature#Image", "1.1" ); /** * updates the internal vW property with the current viewport width in px */ function updateMetrics() { isVwDirty = false; DPR = window.devicePixelRatio; cssCache = {}; sizeLengthCache = {}; pf.DPR = DPR || 1; units.width = Math.max(window.innerWidth || 0, docElem.clientWidth); units.height = Math.max(window.innerHeight || 0, docElem.clientHeight); units.vw = units.width / 100; units.vh = units.height / 100; evalId = [ units.height, units.width, DPR ].join("-"); units.em = pf.getEmValue(); units.rem = units.em; } function chooseLowRes( lowerValue, higherValue, dprValue, isCached ) { var bonusFactor, tooMuch, bonus, meanDensity; //experimental if (cfg.algorithm === "saveData" ){ if ( lowerValue > 2.7 ) { meanDensity = dprValue + 1; } else { tooMuch = higherValue - dprValue; bonusFactor = Math.pow(lowerValue - 0.6, 1.5); bonus = tooMuch * bonusFactor; if (isCached) { bonus += 0.1 * bonusFactor; } meanDensity = lowerValue + bonus; } } else { meanDensity = (dprValue > 1) ? Math.sqrt(lowerValue * higherValue) : lowerValue; } return meanDensity > dprValue; } function applyBestCandidate( img ) { var srcSetCandidates; var matchingSet = pf.getSet( img ); var evaluated = false; if ( matchingSet !== "pending" ) { evaluated = evalId; if ( matchingSet ) { srcSetCandidates = pf.setRes( matchingSet ); pf.applySetCandidate( srcSetCandidates, img ); } } img[ pf.ns ].evaled = evaluated; } function ascendingSort( a, b ) { return a.res - b.res; } function setSrcToCur( img, src, set ) { var candidate; if ( !set && src ) { set = img[ pf.ns ].sets; set = set && set[set.length - 1]; } candidate = getCandidateForSrc(src, set); if ( candidate ) { src = pf.makeUrl(src); img[ pf.ns ].curSrc = src; img[ pf.ns ].curCan = candidate; if ( !candidate.res ) { setResolution( candidate, candidate.set.sizes ); } } return candidate; } function getCandidateForSrc( src, set ) { var i, candidate, candidates; if ( src && set ) { candidates = pf.parseSet( set ); src = pf.makeUrl(src); for ( i = 0; i < candidates.length; i++ ) { if ( src === pf.makeUrl(candidates[ i ].url) ) { candidate = candidates[ i ]; break; } } } return candidate; } function getAllSourceElements( picture, candidates ) { var i, len, source, srcset; // SPEC mismatch intended for size and perf: // actually only source elements preceding the img should be used // also note: don't use qsa here, because IE8 sometimes doesn't like source as the key part in a selector var sources = picture.getElementsByTagName( "source" ); for ( i = 0, len = sources.length; i < len; i++ ) { source = sources[ i ]; source[ pf.ns ] = true; srcset = source.getAttribute( "srcset" ); // if source does not have a srcset attribute, skip if ( srcset ) { candidates.push( { srcset: srcset, media: source.getAttribute( "media" ), type: source.getAttribute( "type" ), sizes: source.getAttribute( "sizes" ) } ); } } } /** * Srcset Parser * By Alex Bell | MIT License * * @returns Array [{url: _, d: _, w: _, h:_, set:_(????)}, ...] * * Based super duper closely on the reference algorithm at: * https://html.spec.whatwg.org/multipage/embedded-content.html#parse-a-srcset-attribute */ // 1. Let input be the value passed to this algorithm. // (TO-DO : Explain what "set" argument is here. Maybe choose a more // descriptive & more searchable name. Since passing the "set" in really has // nothing to do with parsing proper, I would prefer this assignment eventually // go in an external fn.) function parseSrcset(input, set) { function collectCharacters(regEx) { var chars, match = regEx.exec(input.substring(pos)); if (match) { chars = match[ 0 ]; pos += chars.length; return chars; } } var inputLength = input.length, url, descriptors, currentDescriptor, state, c, // 2. Let position be a pointer into input, initially pointing at the start // of the string. pos = 0, // 3. Let candidates be an initially empty source set. candidates = []; /** * Adds descriptor properties to a candidate, pushes to the candidates array * @return undefined */ // (Declared outside of the while loop so that it's only created once. // (This fn is defined before it is used, in order to pass JSHINT. // Unfortunately this breaks the sequencing of the spec comments. :/ ) function parseDescriptors() { // 9. Descriptor parser: Let error be no. var pError = false, // 10. Let width be absent. // 11. Let density be absent. // 12. Let future-compat-h be absent. (We're implementing it now as h) w, d, h, i, candidate = {}, desc, lastChar, value, intVal, floatVal; // 13. For each descriptor in descriptors, run the appropriate set of steps // from the following list: for (i = 0 ; i < descriptors.length; i++) { desc = descriptors[ i ]; lastChar = desc[ desc.length - 1 ]; value = desc.substring(0, desc.length - 1); intVal = parseInt(value, 10); floatVal = parseFloat(value); // If the descriptor consists of a valid non-negative integer followed by // a U+0077 LATIN SMALL LETTER W character if (regexNonNegativeInteger.test(value) && (lastChar === "w")) { // If width and density are not both absent, then let error be yes. if (w || d) {pError = true;} // Apply the rules for parsing non-negative integers to the descriptor. // If the result is zero, let error be yes. // Otherwise, let width be the result. if (intVal === 0) {pError = true;} else {w = intVal;} // If the descriptor consists of a valid floating-point number followed by // a U+0078 LATIN SMALL LETTER X character } else if (regexFloatingPoint.test(value) && (lastChar === "x")) { // If width, density and future-compat-h are not all absent, then let error // be yes. if (w || d || h) {pError = true;} // Apply the rules for parsing floating-point number values to the descriptor. // If the result is less than zero, let error be yes. Otherwise, let density // be the result. if (floatVal < 0) {pError = true;} else {d = floatVal;} // If the descriptor consists of a valid non-negative integer followed by // a U+0068 LATIN SMALL LETTER H character } else if (regexNonNegativeInteger.test(value) && (lastChar === "h")) { // If height and density are not both absent, then let error be yes. if (h || d) {pError = true;} // Apply the rules for parsing non-negative integers to the descriptor. // If the result is zero, let error be yes. Otherwise, let future-compat-h // be the result. if (intVal === 0) {pError = true;} else {h = intVal;} // Anything else, Let error be yes. } else {pError = true;} } // (close step 13 for loop) // 15. If error is still no, then append a new image source to candidates whose // URL is url, associated with a width width if not absent and a pixel // density density if not absent. Otherwise, there is a parse error. if (!pError) { candidate.url = url; if (w) { candidate.w = w;} if (d) { candidate.d = d;} if (h) { candidate.h = h;} if (!h && !d && !w) {candidate.d = 1;} if (candidate.d === 1) {set.has1x = true;} candidate.set = set; candidates.push(candidate); } } // (close parseDescriptors fn) /** * Tokenizes descriptor properties prior to parsing * Returns undefined. * (Again, this fn is defined before it is used, in order to pass JSHINT. * Unfortunately this breaks the logical sequencing of the spec comments. :/ ) */ function tokenize() { // 8.1. Descriptor tokeniser: Skip whitespace collectCharacters(regexLeadingSpaces); // 8.2. Let current descriptor be the empty string. currentDescriptor = ""; // 8.3. Let state be in descriptor. state = "in descriptor"; while (true) { // 8.4. Let c be the character at position. c = input.charAt(pos); // Do the following depending on the value of state. // For the purpose of this step, "EOF" is a special character representing // that position is past the end of input. // In descriptor if (state === "in descriptor") { // Do the following, depending on the value of c: // Space character // If current descriptor is not empty, append current descriptor to // descriptors and let current descriptor be the empty string. // Set state to after descriptor. if (isSpace(c)) { if (currentDescriptor) { descriptors.push(currentDescriptor); currentDescriptor = ""; state = "after descriptor"; } // U+002C COMMA (,) // Advance position to the next character in input. If current descriptor // is not empty, append current descriptor to descriptors. Jump to the step // labeled descriptor parser. } else if (c === ",") { pos += 1; if (currentDescriptor) { descriptors.push(currentDescriptor); } parseDescriptors(); return; // U+0028 LEFT PARENTHESIS (() // Append c to current descriptor. Set state to in parens. } else if (c === "\u0028") { currentDescriptor = currentDescriptor + c; state = "in parens"; // EOF // If current descriptor is not empty, append current descriptor to // descriptors. Jump to the step labeled descriptor parser. } else if (c === "") { if (currentDescriptor) { descriptors.push(currentDescriptor); } parseDescriptors(); return; // Anything else // Append c to current descriptor. } else { currentDescriptor = currentDescriptor + c; } // (end "in descriptor" // In parens } else if (state === "in parens") { // U+0029 RIGHT PARENTHESIS ()) // Append c to current descriptor. Set state to in descriptor. if (c === ")") { currentDescriptor = currentDescriptor + c; state = "in descriptor"; // EOF // Append current descriptor to descriptors. Jump to the step labeled // descriptor parser. } else if (c === "") { descriptors.push(currentDescriptor); parseDescriptors(); return; // Anything else // Append c to current descriptor. } else { currentDescriptor = currentDescriptor + c; } // After descriptor } else if (state === "after descriptor") { // Do the following, depending on the value of c: // Space character: Stay in this state. if (isSpace(c)) { // EOF: Jump to the step labeled descriptor parser. } else if (c === "") { parseDescriptors(); return; // Anything else // Set state to in descriptor. Set position to the previous character in input. } else { state = "in descriptor"; pos -= 1; } } // Advance position to the next character in input. pos += 1; // Repeat this step. } // (close while true loop) } // 4. Splitting loop: Collect a sequence of characters that are space // characters or U+002C COMMA characters. If any U+002C COMMA characters // were collected, that is a parse error. while (true) { collectCharacters(regexLeadingCommasOrSpaces); // 5. If position is past the end of input, return candidates and abort these steps. if (pos >= inputLength) { return candidates; // (we're done, this is the sole return path) } // 6. Collect a sequence of characters that are not space characters, // and let that be url. url = collectCharacters(regexLeadingNotSpaces); // 7. Let descriptors be a new empty list. descriptors = []; // 8. If url ends with a U+002C COMMA character (,), follow these substeps: // (1). Remove all trailing U+002C COMMA characters from url. If this removed // more than one character, that is a parse error. if (url.slice(-1) === ",") { url = url.replace(regexTrailingCommas, ""); // (Jump ahead to step 9 to skip tokenization and just push the candidate). parseDescriptors(); // Otherwise, follow these substeps: } else { tokenize(); } // (close else of step 8) // 16. Return to the step labeled splitting loop. } // (Close of big while loop.) } /* * Sizes Parser * * By Alex Bell | MIT License * * Non-strict but accurate and lightweight JS Parser for the string value * * Reference algorithm at: * https://html.spec.whatwg.org/multipage/embedded-content.html#parse-a-sizes-attribute * * Most comments are copied in directly from the spec * (except for comments in parens). * * Grammar is: * = # [ , ]? | * = * = * http://www.w3.org/html/wg/drafts/html/master/embedded-content.html#attr-img-sizes * * E.g. "(max-width: 30em) 100vw, (max-width: 50em) 70vw, 100vw" * or "(min-width: 30em), calc(30vw - 15px)" or just "30vw" * * Returns the first valid with a media condition that evaluates to true, * or "100vw" if all valid media conditions evaluate to false. * */ function parseSizes(strValue) { // (Percentage CSS lengths are not allowed in this case, to avoid confusion: // https://html.spec.whatwg.org/multipage/embedded-content.html#valid-source-size-list // CSS allows a single optional plus or minus sign: // http://www.w3.org/TR/CSS2/syndata.html#numbers // CSS is ASCII case-insensitive: // http://www.w3.org/TR/CSS2/syndata.html#characters ) // Spec allows exponential notation for type: // http://dev.w3.org/csswg/css-values/#numbers var regexCssLengthWithUnits = /^(?:[+-]?[0-9]+|[0-9]*\.[0-9]+)(?:[eE][+-]?[0-9]+)?(?:ch|cm|em|ex|in|mm|pc|pt|px|rem|vh|vmin|vmax|vw)$/i; // (This is a quick and lenient test. Because of optional unlimited-depth internal // grouping parens and strict spacing rules, this could get very complicated.) var regexCssCalc = /^calc\((?:[0-9a-z \.\+\-\*\/\(\)]+)\)$/i; var i; var unparsedSizesList; var unparsedSizesListLength; var unparsedSize; var lastComponentValue; var size; // UTILITY FUNCTIONS // (Toy CSS parser. The goals here are: // 1) expansive test coverage without the weight of a full CSS parser. // 2) Avoiding regex wherever convenient. // Quick tests: http://jsfiddle.net/gtntL4gr/3/ // Returns an array of arrays.) function parseComponentValues(str) { var chrctr; var component = ""; var componentArray = []; var listArray = []; var parenDepth = 0; var pos = 0; var inComment = false; function pushComponent() { if (component) { componentArray.push(component); component = ""; } } function pushComponentArray() { if (componentArray[0]) { listArray.push(componentArray); componentArray = []; } } // (Loop forwards from the beginning of the string.) while (true) { chrctr = str.charAt(pos); if (chrctr === "") { // ( End of string reached.) pushComponent(); pushComponentArray(); return listArray; } else if (inComment) { if ((chrctr === "*") && (str[pos + 1] === "/")) { // (At end of a comment.) inComment = false; pos += 2; pushComponent(); continue; } else { pos += 1; // (Skip all characters inside comments.) continue; } } else if (isSpace(chrctr)) { // (If previous character in loop was also a space, or if // at the beginning of the string, do not add space char to // component.) if ( (str.charAt(pos - 1) && isSpace( str.charAt(pos - 1) ) ) || !component ) { pos += 1; continue; } else if (parenDepth === 0) { pushComponent(); pos +=1; continue; } else { // (Replace any space character with a plain space for legibility.) chrctr = " "; } } else if (chrctr === "(") { parenDepth += 1; } else if (chrctr === ")") { parenDepth -= 1; } else if (chrctr === ",") { pushComponent(); pushComponentArray(); pos += 1; continue; } else if ( (chrctr === "/") && (str.charAt(pos + 1) === "*") ) { inComment = true; pos += 2; continue; } component = component + chrctr; pos += 1; } } function isValidNonNegativeSourceSizeValue(s) { if (regexCssLengthWithUnits.test(s) && (parseFloat(s) >= 0)) {return true;} if (regexCssCalc.test(s)) {return true;} // ( http://www.w3.org/TR/CSS2/syndata.html#numbers says: // "-0 is equivalent to 0 and is not a negative number." which means that // unitless zero and unitless negative zero must be accepted as special cases.) if ((s === "0") || (s === "-0") || (s === "+0")) {return true;} return false; } // When asked to parse a sizes attribute from an element, parse a // comma-separated list of component values from the value of the element's // sizes attribute (or the empty string, if the attribute is absent), and let // unparsed sizes list be the result. // http://dev.w3.org/csswg/css-syntax/#parse-comma-separated-list-of-component-values unparsedSizesList = parseComponentValues(strValue); unparsedSizesListLength = unparsedSizesList.length; // For each unparsed size in unparsed sizes list: for (i = 0; i < unparsedSizesListLength; i++) { unparsedSize = unparsedSizesList[i]; // 1. Remove all consecutive s from the end of unparsed size. // ( parseComponentValues() already omits spaces outside of parens. ) // If unparsed size is now empty, that is a parse error; continue to the next // iteration of this algorithm. // ( parseComponentValues() won't push an empty array. ) // 2. If the last component value in unparsed size is a valid non-negative // , let size be its value and remove the component value // from unparsed size. Any CSS function other than the calc() function is // invalid. Otherwise, there is a parse error; continue to the next iteration // of this algorithm. // http://dev.w3.org/csswg/css-syntax/#parse-component-value lastComponentValue = unparsedSize[unparsedSize.length - 1]; if (isValidNonNegativeSourceSizeValue(lastComponentValue)) { size = lastComponentValue; unparsedSize.pop(); } else { continue; } // 3. Remove all consecutive s from the end of unparsed // size. If unparsed size is now empty, return size and exit this algorithm. // If this was not the last item in unparsed sizes list, that is a parse error. if (unparsedSize.length === 0) { return size; } // 4. Parse the remaining component values in unparsed size as a // . If it does not parse correctly, or it does parse // correctly but the evaluates to false, continue to the // next iteration of this algorithm. // (Parsing all possible compound media conditions in JS is heavy, complicated, // and the payoff is unclear. Is there ever an situation where the // media condition parses incorrectly but still somehow evaluates to true? // Can we just rely on the browser/polyfill to do it?) unparsedSize = unparsedSize.join(" "); if (!(pf.matchesMedia( unparsedSize ) ) ) { continue; } // 5. Return size and exit this algorithm. return size; } // If the above algorithm exhausts unparsed sizes list without returning a // size value, return 100vw. return "100vw"; } // namespace pf.ns = ("pf" + new Date().getTime()).substr(0, 9); // srcset support test pf.supSrcset = "srcset" in image; pf.supSizes = "sizes" in image; pf.supPicture = !!window.HTMLPictureElement; // UC browser does claim to support srcset and picture, but not sizes, // this extended test reveals the browser does support nothing if (pf.supSrcset && pf.supPicture && !pf.supSizes) { (function(image2) { image.srcset = "data:,a"; image2.src = "data:,a"; pf.supSrcset = image.complete === image2.complete; pf.supPicture = pf.supSrcset && pf.supPicture; })(document.createElement("img")); } // Safari9 has basic support for sizes, but does't expose the `sizes` idl attribute if (pf.supSrcset && !pf.supSizes) { (function() { var width2 = "data:image/gif;base64,R0lGODlhAgABAPAAAP///wAAACH5BAAAAAAALAAAAAACAAEAAAICBAoAOw=="; var width1 = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="; var img = document.createElement("img"); var test = function() { var width = img.width; if (width === 2) { pf.supSizes = true; } alwaysCheckWDescriptor = pf.supSrcset && !pf.supSizes; isSupportTestReady = true; // force async setTimeout(picturefill); }; img.onload = test; img.onerror = test; img.setAttribute("sizes", "9px"); img.srcset = width1 + " 1w," + width2 + " 9w"; img.src = width1; })(); } else { isSupportTestReady = true; } // using pf.qsa instead of dom traversing does scale much better, // especially on sites mixing responsive and non-responsive images pf.selShort = "picture>img,img[srcset]"; pf.sel = pf.selShort; pf.cfg = cfg; /** * Shortcut property for `devicePixelRatio` ( for easy overriding in tests ) */ pf.DPR = (DPR || 1 ); pf.u = units; // container of supported mime types that one might need to qualify before using pf.types = types; pf.setSize = noop; /** * Gets a string and returns the absolute URL * @param src * @returns {String} absolute URL */ pf.makeUrl = memoize(function(src) { anchor.href = src; return anchor.href; }); /** * Gets a DOM element or document and a selctor and returns the found matches * Can be extended with jQuery/Sizzle for IE7 support * @param context * @param sel * @returns {NodeList|Array} */ pf.qsa = function(context, sel) { return ( "querySelector" in context ) ? context.querySelectorAll(sel) : []; }; /** * Shortcut method for matchMedia ( for easy overriding in tests ) * wether native or pf.mMQ is used will be decided lazy on first call * @returns {boolean} */ pf.matchesMedia = function() { if ( window.matchMedia && (matchMedia( "(min-width: 0.1em)" ) || {}).matches ) { pf.matchesMedia = function( media ) { return !media || ( matchMedia( media ).matches ); }; } else { pf.matchesMedia = pf.mMQ; } return pf.matchesMedia.apply( this, arguments ); }; /** * A simplified matchMedia implementation for IE8 and IE9 * handles only min-width/max-width with px or em values * @param media * @returns {boolean} */ pf.mMQ = function( media ) { return media ? evalCSS(media) : true; }; /** * Returns the calculated length in css pixel from the given sourceSizeValue * http://dev.w3.org/csswg/css-values-3/#length-value * intended Spec mismatches: * * Does not check for invalid use of CSS functions * * Does handle a computed length of 0 the same as a negative and therefore invalid value * @param sourceSizeValue * @returns {Number} */ pf.calcLength = function( sourceSizeValue ) { var value = evalCSS(sourceSizeValue, true) || false; if (value < 0) { value = false; } return value; }; /** * Takes a type string and checks if its supported */ pf.supportsType = function( type ) { return ( type ) ? types[ type ] : true; }; /** * Parses a sourceSize into mediaCondition (media) and sourceSizeValue (length) * @param sourceSizeStr * @returns {*} */ pf.parseSize = memoize(function( sourceSizeStr ) { var match = ( sourceSizeStr || "" ).match(regSize); return { media: match && match[1], length: match && match[2] }; }); pf.parseSet = function( set ) { if ( !set.cands ) { set.cands = parseSrcset(set.srcset, set); } return set.cands; }; /** * returns 1em in css px for html/body default size * function taken from respondjs * @returns {*|number} */ pf.getEmValue = function() { var body; if ( !eminpx && (body = document.body) ) { var div = document.createElement( "div" ), originalHTMLCSS = docElem.style.cssText, originalBodyCSS = body.style.cssText; div.style.cssText = baseStyle; // 1em in a media query is the value of the default font size of the browser // reset docElem and body to ensure the correct value is returned docElem.style.cssText = fsCss; body.style.cssText = fsCss; body.appendChild( div ); eminpx = div.offsetWidth; body.removeChild( div ); //also update eminpx before returning eminpx = parseFloat( eminpx, 10 ); // restore the original values docElem.style.cssText = originalHTMLCSS; body.style.cssText = originalBodyCSS; } return eminpx || 16; }; /** * Takes a string of sizes and returns the width in pixels as a number */ pf.calcListLength = function( sourceSizeListStr ) { // Split up source size list, ie ( max-width: 30em ) 100%, ( max-width: 50em ) 50%, 33% // // or (min-width:30em) calc(30% - 15px) if ( !(sourceSizeListStr in sizeLengthCache) || cfg.uT ) { var winningLength = pf.calcLength( parseSizes( sourceSizeListStr ) ); sizeLengthCache[ sourceSizeListStr ] = !winningLength ? units.width : winningLength; } return sizeLengthCache[ sourceSizeListStr ]; }; /** * Takes a candidate object with a srcset property in the form of url/ * ex. "images/pic-medium.png 1x, images/pic-medium-2x.png 2x" or * "images/pic-medium.png 400w, images/pic-medium-2x.png 800w" or * "images/pic-small.png" * Get an array of image candidates in the form of * {url: "/foo/bar.png", resolution: 1} * where resolution is http://dev.w3.org/csswg/css-values-3/#resolution-value * If sizes is specified, res is calculated */ pf.setRes = function( set ) { var candidates; if ( set ) { candidates = pf.parseSet( set ); for ( var i = 0, len = candidates.length; i < len; i++ ) { setResolution( candidates[ i ], set.sizes ); } } return candidates; }; pf.setRes.res = setResolution; pf.applySetCandidate = function( candidates, img ) { if ( !candidates.length ) {return;} var candidate, i, j, length, bestCandidate, curSrc, curCan, candidateSrc, abortCurSrc; var imageData = img[ pf.ns ]; var dpr = pf.DPR; curSrc = imageData.curSrc || img[curSrcProp]; curCan = imageData.curCan || setSrcToCur(img, curSrc, candidates[0].set); // if we have a current source, we might either become lazy or give this source some advantage if ( curCan && curCan.set === candidates[ 0 ].set ) { // if browser can abort image request and the image has a higher pixel density than needed // and this image isn't downloaded yet, we skip next part and try to save bandwidth abortCurSrc = (supportAbort && !img.complete && curCan.res - 0.1 > dpr); if ( !abortCurSrc ) { curCan.cached = true; // if current candidate is "best", "better" or "okay", // set it to bestCandidate if ( curCan.res >= dpr ) { bestCandidate = curCan; } } } if ( !bestCandidate ) { candidates.sort( ascendingSort ); length = candidates.length; bestCandidate = candidates[ length - 1 ]; for ( i = 0; i < length; i++ ) { candidate = candidates[ i ]; if ( candidate.res >= dpr ) { j = i - 1; // we have found the perfect candidate, // but let's improve this a little bit with some assumptions ;-) if (candidates[ j ] && (abortCurSrc || curSrc !== pf.makeUrl( candidate.url )) && chooseLowRes(candidates[ j ].res, candidate.res, dpr, candidates[ j ].cached)) { bestCandidate = candidates[ j ]; } else { bestCandidate = candidate; } break; } } } if ( bestCandidate ) { candidateSrc = pf.makeUrl( bestCandidate.url ); imageData.curSrc = candidateSrc; imageData.curCan = bestCandidate; if ( candidateSrc !== curSrc ) { pf.setSrc( img, bestCandidate ); } pf.setSize( img ); } }; pf.setSrc = function( img, bestCandidate ) { var origWidth; img.src = bestCandidate.url; // although this is a specific Safari issue, we don't want to take too much different code paths if ( bestCandidate.set.type === "image/svg+xml" ) { origWidth = img.style.width; img.style.width = (img.offsetWidth + 1) + "px"; // next line only should trigger a repaint // if... is only done to trick dead code removal if ( img.offsetWidth + 1 ) { img.style.width = origWidth; } } }; pf.getSet = function( img ) { var i, set, supportsType; var match = false; var sets = img [ pf.ns ].sets; for ( i = 0; i < sets.length && !match; i++ ) { set = sets[i]; if ( !set.srcset || !pf.matchesMedia( set.media ) || !(supportsType = pf.supportsType( set.type )) ) { continue; } if ( supportsType === "pending" ) { set = supportsType; } match = set; break; } return match; }; pf.parseSets = function( element, parent, options ) { var srcsetAttribute, imageSet, isWDescripor, srcsetParsed; var hasPicture = parent && parent.nodeName.toUpperCase() === "PICTURE"; var imageData = element[ pf.ns ]; if ( imageData.src === undefined || options.src ) { imageData.src = getImgAttr.call( element, "src" ); if ( imageData.src ) { setImgAttr.call( element, srcAttr, imageData.src ); } else { removeImgAttr.call( element, srcAttr ); } } if ( imageData.srcset === undefined || options.srcset || !pf.supSrcset || element.srcset ) { srcsetAttribute = getImgAttr.call( element, "srcset" ); imageData.srcset = srcsetAttribute; srcsetParsed = true; } imageData.sets = []; if ( hasPicture ) { imageData.pic = true; getAllSourceElements( parent, imageData.sets ); } if ( imageData.srcset ) { imageSet = { srcset: imageData.srcset, sizes: getImgAttr.call( element, "sizes" ) }; imageData.sets.push( imageSet ); isWDescripor = (alwaysCheckWDescriptor || imageData.src) && regWDesc.test(imageData.srcset || ""); // add normal src as candidate, if source has no w descriptor if ( !isWDescripor && imageData.src && !getCandidateForSrc(imageData.src, imageSet) && !imageSet.has1x ) { imageSet.srcset += ", " + imageData.src; imageSet.cands.push({ url: imageData.src, d: 1, set: imageSet }); } } else if ( imageData.src ) { imageData.sets.push( { srcset: imageData.src, sizes: null } ); } imageData.curCan = null; imageData.curSrc = undefined; // if img has picture or the srcset was removed or has a srcset and does not support srcset at all // or has a w descriptor (and does not support sizes) set support to false to evaluate imageData.supported = !( hasPicture || ( imageSet && !pf.supSrcset ) || (isWDescripor && !pf.supSizes) ); if ( srcsetParsed && pf.supSrcset && !imageData.supported ) { if ( srcsetAttribute ) { setImgAttr.call( element, srcsetAttr, srcsetAttribute ); element.srcset = ""; } else { removeImgAttr.call( element, srcsetAttr ); } } if (imageData.supported && !imageData.srcset && ((!imageData.src && element.src) || element.src !== pf.makeUrl(imageData.src))) { if (imageData.src === null) { element.removeAttribute("src"); } else { element.src = imageData.src; } } imageData.parsed = true; }; pf.fillImg = function(element, options) { var imageData; var extreme = options.reselect || options.reevaluate; // expando for caching data on the img if ( !element[ pf.ns ] ) { element[ pf.ns ] = {}; } imageData = element[ pf.ns ]; // if the element has already been evaluated, skip it // unless `options.reevaluate` is set to true ( this, for example, // is set to true when running `picturefill` on `resize` ). if ( !extreme && imageData.evaled === evalId ) { return; } if ( !imageData.parsed || options.reevaluate ) { pf.parseSets( element, element.parentNode, options ); } if ( !imageData.supported ) { applyBestCandidate( element ); } else { imageData.evaled = evalId; } }; pf.setupRun = function() { if ( !alreadyRun || isVwDirty || (DPR !== window.devicePixelRatio) ) { updateMetrics(); } }; // If picture is supported, well, that's awesome. if ( pf.supPicture ) { picturefill = noop; pf.fillImg = noop; } else { // Set up picture polyfill by polling the document (function() { var isDomReady; var regReady = window.attachEvent ? /d$|^c/ : /d$|^c|^i/; var run = function() { var readyState = document.readyState || ""; timerId = setTimeout(run, readyState === "loading" ? 200 : 999); if ( document.body ) { pf.fillImgs(); isDomReady = isDomReady || regReady.test(readyState); if ( isDomReady ) { clearTimeout( timerId ); } } }; var timerId = setTimeout(run, document.body ? 9 : 99); // Also attach picturefill on resize and readystatechange // http://modernjavascript.blogspot.com/2013/08/building-better-debounce.html var debounce = function(func, wait) { var timeout, timestamp; var later = function() { var last = (new Date()) - timestamp; if (last < wait) { timeout = setTimeout(later, wait - last); } else { timeout = null; func(); } }; return function() { timestamp = new Date(); if (!timeout) { timeout = setTimeout(later, wait); } }; }; var lastClientWidth = docElem.clientHeight; var onResize = function() { isVwDirty = Math.max(window.innerWidth || 0, docElem.clientWidth) !== units.width || docElem.clientHeight !== lastClientWidth; lastClientWidth = docElem.clientHeight; if ( isVwDirty ) { pf.fillImgs(); } }; on( window, "resize", debounce(onResize, 99 ) ); on( document, "readystatechange", run ); })(); } pf.picturefill = picturefill; //use this internally for easy monkey patching/performance testing pf.fillImgs = picturefill; pf.teardownRun = noop; /* expose methods for testing */ picturefill._ = pf; window.picturefillCFG = { pf: pf, push: function(args) { var name = args.shift(); if (typeof pf[name] === "function") { pf[name].apply(pf, args); } else { cfg[name] = args[0]; if (alreadyRun) { pf.fillImgs( { reselect: true } ); } } } }; while (setOptions && setOptions.length) { window.picturefillCFG.push(setOptions.shift()); } /* expose picturefill */ window.picturefill = picturefill; /* expose picturefill */ if ( typeof module === "object" && typeof module.exports === "object" ) { // CommonJS, just export module.exports = picturefill; } else if ( typeof define === "function" && define.amd ) { // AMD support define( "picturefill", function() { return picturefill; } ); } // IE8 evals this sync, so it must be the last thing we do if ( !pf.supPicture ) { types[ "image/webp" ] = detectTypeSupport("image/webp", "data:image/webp;base64,UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAABBxAR/Q9ERP8DAABWUDggGAAAADABAJ0BKgEAAQADADQlpAADcAD++/1QAA==" ); } } )( window, document ); /** * what-input - A global utility for tracking the current input method (mouse, keyboard or touch). * @version v5.0.2 * @link https://github.com/ten1seven/what-input * @license MIT */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if(typeof define === 'function' && define.amd) define("whatInput", [], factory); else if(typeof exports === 'object') exports["whatInput"] = factory(); else root["whatInput"] = factory(); })(this, function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ // Flag the module as loaded /******/ module.loaded = true; /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports) { 'use strict'; module.exports = function () { /* * variables */ // cache document.documentElement var docElem = document.documentElement; // currently focused dom element var currentElement = null; // last used input type var currentInput = 'initial'; // last used input intent var currentIntent = currentInput; // form input types var formInputs = ['input', 'select', 'textarea']; // empty array for holding callback functions var functionList = []; // list of modifier keys commonly used with the mouse and // can be safely ignored to prevent false keyboard detection var ignoreMap = [16, // shift 17, // control 18, // alt 91, // Windows key / left Apple cmd 93 // Windows menu / right Apple cmd ]; // mapping of events to input types var inputMap = { keydown: 'keyboard', keyup: 'keyboard', mousedown: 'mouse', mousemove: 'mouse', MSPointerDown: 'pointer', MSPointerMove: 'pointer', pointerdown: 'pointer', pointermove: 'pointer', touchstart: 'touch' // boolean: true if touch buffer is active };var isBuffering = false; // boolean: true if the page is being scrolled var isScrolling = false; // store current mouse position var mousePos = { x: null, y: null // map of IE 10 pointer events };var pointerMap = { 2: 'touch', 3: 'touch', // treat pen like touch 4: 'mouse' // check support for passive event listeners };var supportsPassive = false; try { var opts = Object.defineProperty({}, 'passive', { get: function get() { supportsPassive = true; } }); window.addEventListener('test', null, opts); } catch (e) {} /* * set up */ var setUp = function setUp() { // add correct mouse wheel event mapping to `inputMap` inputMap[detectWheel()] = 'mouse'; addListeners(); doUpdate('input'); doUpdate('intent'); }; /* * events */ var addListeners = function addListeners() { // `pointermove`, `MSPointerMove`, `mousemove` and mouse wheel event binding // can only demonstrate potential, but not actual, interaction // and are treated separately var options = supportsPassive ? { passive: true } : false; // pointer events (mouse, pen, touch) if (window.PointerEvent) { window.addEventListener('pointerdown', updateInput); window.addEventListener('pointermove', setIntent); } else if (window.MSPointerEvent) { window.addEventListener('MSPointerDown', updateInput); window.addEventListener('MSPointerMove', setIntent); } else { // mouse events window.addEventListener('mousedown', updateInput); window.addEventListener('mousemove', setIntent); // touch events if ('ontouchstart' in window) { window.addEventListener('touchstart', touchBuffer, options); window.addEventListener('touchend', touchBuffer); } } // mouse wheel window.addEventListener(detectWheel(), setIntent, options); // keyboard events window.addEventListener('keydown', updateInput); window.addEventListener('keyup', updateInput); // focus events window.addEventListener('focusin', setElement); window.addEventListener('focusout', clearElement); }; // checks conditions before updating new input var updateInput = function updateInput(event) { // only execute if the touch buffer timer isn't running if (!isBuffering) { var eventKey = event.which; var value = inputMap[event.type]; if (value === 'pointer') { value = pointerType(event); } var shouldUpdate = value === 'keyboard' && eventKey && ignoreMap.indexOf(eventKey) === -1 || value === 'mouse' || value === 'touch'; if (currentInput !== value && shouldUpdate) { currentInput = value; doUpdate('input'); } if (currentIntent !== value && shouldUpdate) { // preserve intent for keyboard typing in form fields var activeElem = document.activeElement; var notFormInput = activeElem && activeElem.nodeName && formInputs.indexOf(activeElem.nodeName.toLowerCase()) === -1; if (notFormInput) { currentIntent = value; doUpdate('intent'); } } } }; // updates the doc and `inputTypes` array with new input var doUpdate = function doUpdate(which) { docElem.setAttribute('data-what' + which, which === 'input' ? currentInput : currentIntent); fireFunctions(which); }; // updates input intent for `mousemove` and `pointermove` var setIntent = function setIntent(event) { // test to see if `mousemove` happened relative to the screen to detect scrolling versus mousemove detectScrolling(event); // only execute if the touch buffer timer isn't running // or scrolling isn't happening if (!isBuffering && !isScrolling) { var value = inputMap[event.type]; if (value === 'pointer') { value = pointerType(event); } if (currentIntent !== value) { currentIntent = value; doUpdate('intent'); } } }; var setElement = function setElement(event) { currentElement = event.target.nodeName.toLowerCase(); docElem.setAttribute('data-whatelement', currentElement); if (event.target.classList && event.target.classList.length) { docElem.setAttribute('data-whatclasses', event.target.classList.toString().replace(' ', ',')); } }; var clearElement = function clearElement() { currentElement = null; docElem.removeAttribute('data-whatelement'); docElem.removeAttribute('data-whatclasses'); }; // buffers touch events because they frequently also fire mouse events var touchBuffer = function touchBuffer(event) { if (event.type === 'touchstart') { isBuffering = false; // set the current input updateInput(event); } else { isBuffering = true; } }; /* * utilities */ var pointerType = function pointerType(event) { if (typeof event.pointerType === 'number') { return pointerMap[event.pointerType]; } else { // treat pen like touch return event.pointerType === 'pen' ? 'touch' : event.pointerType; } }; // detect version of mouse wheel event to use // via https://developer.mozilla.org/en-US/docs/Web/Events/wheel var detectWheel = function detectWheel() { var wheelType = void 0; // Modern browsers support "wheel" if ('onwheel' in document.createElement('div')) { wheelType = 'wheel'; } else { // Webkit and IE support at least "mousewheel" // or assume that remaining browsers are older Firefox wheelType = document.onmousewheel !== undefined ? 'mousewheel' : 'DOMMouseScroll'; } return wheelType; }; // runs callback functions var fireFunctions = function fireFunctions(type) { for (var i = 0, len = functionList.length; i < len; i++) { if (functionList[i].type === type) { functionList[i].fn.call(undefined, type === 'input' ? currentInput : currentIntent); } } }; // finds matching element in an object var objPos = function objPos(match) { for (var i = 0, len = functionList.length; i < len; i++) { if (functionList[i].fn === match) { return i; } } }; var detectScrolling = function detectScrolling(event) { if (mousePos['x'] !== event.screenX || mousePos['y'] !== event.screenY) { isScrolling = false; mousePos['x'] = event.screenX; mousePos['y'] = event.screenY; } else { isScrolling = true; } }; /* * init */ // don't start script unless browser cuts the mustard // (also passes if polyfills are used) if ('addEventListener' in window && Array.prototype.indexOf) { setUp(); } /* * api */ return { // returns string: the current input type // opt: 'intent'|'input' // 'input' (default): returns the same value as the `data-whatinput` attribute // 'intent': includes `data-whatintent` value if it's different than `data-whatinput` ask: function ask(opt) { return opt === 'intent' ? currentIntent : currentInput; }, // returns string: the currently focused element or null element: function element() { return currentElement; }, // overwrites ignored keys with provided array ignoreKeys: function ignoreKeys(arr) { ignoreMap = arr; }, // attach functions to input and intent "events" // funct: function to fire on change // eventType: 'input'|'intent' registerOnChange: function registerOnChange(fn, eventType) { functionList.push({ fn: fn, type: eventType || 'input' }); }, unRegisterOnChange: function unRegisterOnChange(fn) { var position = objPos(fn); if (position) { functionList.splice(position, 1); } } }; }(); /***/ }) /******/ ]) }); ; !function(a,b){"function"==typeof define&&define.amd?define([],function(){return a.svg4everybody=b()}):"object"==typeof module&&module.exports?module.exports=b():a.svg4everybody=b()}(this,function(){function a(a,b,c){if(c){var d=document.createDocumentFragment(),e=!b.hasAttribute("viewBox")&&c.getAttribute("viewBox");e&&b.setAttribute("viewBox",e);for(var f=c.cloneNode(!0);f.childNodes.length;)d.appendChild(f.firstChild);a.appendChild(d)}}function b(b){b.onreadystatechange=function(){if(4===b.readyState){var c=b._cachedDocument;c||(c=b._cachedDocument=document.implementation.createHTMLDocument(""),c.body.innerHTML=b.responseText,b._cachedTarget={}),b._embeds.splice(0).map(function(d){var e=b._cachedTarget[d.id];e||(e=b._cachedTarget[d.id]=c.getElementById(d.id)),a(d.parent,d.svg,e)})}},b.onreadystatechange()}function c(c){function e(){for(var c=0;c 0)&&n(e,67)}var f,g=Object(c),h=/\bTrident\/[567]\b|\bMSIE (?:9|10)\.0\b/,i=/\bAppleWebKit\/(\d+)\b/,j=/\bEdge\/12\.(\d+)\b/,k=/\bEdge\/.(\d+)\b/,l=window.top!==window.self;f="polyfill"in g?g.polyfill:h.test(navigator.userAgent)||(navigator.userAgent.match(j)||[])[1]<10547||(navigator.userAgent.match(i)||[])[1]<537||k.test(navigator.userAgent)&&l;var m={},n=window.requestAnimationFrame||setTimeout,o=document.getElementsByTagName("use"),p=0;f&&e()}function d(a){for(var b=a;"svg"!==b.nodeName.toLowerCase()&&(b=b.parentNode););return b}return c}); /*------------------------------------------- Site -------------------------------------------*/ // !Site var Site = (function($, window) { // !BaseController var BaseController = function() { this.namespace = ""; this.minWidth = 320; this.maxWidth = Infinity; this.scrollTop = 0; this.windowHeight = 0; this.windowWidth = 0; this.window = null; this.doc = null; this.$window = null; this.$doc = null; this.$body = null; // Public modules this.modules = []; this.onInit = []; this.onRespond = []; this.onResize = []; this.onScroll = []; this.minXS = "320"; this.minSM = "500"; this.minMD = "740"; this.minLG = "980"; this.minXL = "1220"; this.maxXS = this.minXS - 1; this.maxSM = this.minSM - 1; this.maxMD = this.minMD - 1; this.maxLG = this.minLG - 1; this.maxXL = this.minXL - 1; this.minHTsm = parseInt("800", 10); this.minHT = parseInt("800", 10); this.maxHTsm = this.minHTsm - 1; this.maxHT = this.minHT - 1; this.touch = false; }; $.extend(BaseController.prototype, { // Init init: function(namespace) { // Objects this.namespace = namespace; this.window = window; this.doc = document; this.$window = $(window); this.$doc = $(document); this.$body = $("body"); this.touch = $("html").hasClass("touchevents"); if ($.mediaquery) { $.mediaquery({ minWidth: [ this.minXS, this.minSM, this.minMD, this.minLG, this.minXL ], maxWidth: [ this.maxXL, this.maxLG, this.maxMD, this.maxSM, this.maxXS ], minHeight: [ this.minHTsm, this.minHT ] }); } if ($.cookie) { $.cookie({ path: "/" }); } // Init modules before scroll/resize/respond iterate(this.onInit); this.$window .on("mqchange.mediaquery", onRespond) .on(Controller.ns("resize"), onResize) .on(Controller.ns("scroll"), onScroll); this.resize(); }, // Namespace Text ns: function(text) { return text + "." + this.namespace; }, // Resize Trigger resize: function() { this.$window.trigger(Controller.ns("resize")); }, // Scroll Trigger scroll: function() { this.$window.trigger(Controller.ns("scroll")); }, // Kill event killEvent: function(e) { if (e && e.preventDefault) { e.preventDefault(); e.stopPropagation(); } }, // Start timer startTimer: function(timer, time, callback, interval) { this.clearTimer(timer); return (interval) ? setInterval(callback, time) : setTimeout(callback, time); }, // Clear timer clearTimer: function(timer, interval) { if (timer) { if (interval) { clearInterval(timer); } else { clearTimeout(timer); } timer = null; } } }); // Internal Instance var Controller = new BaseController(); // Loop through callbacks function iterate(items) { for (var i in items) { if (items.hasOwnProperty(i)) { items[i].apply(Controller, Array.prototype.slice.call(arguments, 1)); } } } // Media Query Change Handler function onRespond(e, state) { iterate(Controller.onRespond, state); } // Resize Handler function onResize() { iterate(Controller.onResize); } // Scroll Handler function onScroll() { iterate(Controller.onScroll); } // Return Internal Instance return Controller; })(jQuery, window); // !Ready jQuery(document).ready(function() { Site.init("@namespace"); }); /*------------------------------------------- Page -------------------------------------------*/ /* global picturefill */ Site.modules.Page = (function($, Site) { var $mainNav = $(".js-main-nav"); var $subNav = $(".js-sub-nav"); var prev = "arrow_left"; var next = "arrow_right"; function init() { // Plugins picturefill(); /* $.get("../../images/icons.svg", function(data) { var div = document.createElement("div"); $(div).hide(); div.innerHTML = new XMLSerializer().serializeToString(data.documentElement); document.body.insertBefore(div, document.body.childNodes[0]); }); */ Site.$body.find(".js-background").on("loaded.background", function() { $(this).addClass("fs-background-loaded"); }).background(); Site.$body.find(".js-carousel").carousel({ labels: { previous: "", next: "" } }); Site.$body.find(".js-checkbox, .js-radio, input[type=checkbox], input[type=radio]").checkbox(); Site.$body.find(".js-dropdown").dropdown(); Site.$body.find(".js-equalize").equalize(); Site.$body.find(".js-lightbox").lightbox({ mobile: false, theme: "fs-light", labels: { close: "", previous: "", count: " / ", next: "" } }); Site.$body.find(".js-navigation") .navigation({ maxWidth: Site.maxLG + "px" }) .on("open.navigation", function() { trackEvent($(this).data("analytics-open")); Site.$body.find(".js-navigation").attr("aria-hidden", "false").removeAttr("hidden"); }) .on("close.navigation", function() { trackEvent($(this).data("analytics-close")); Site.$body.find(".js-navigation").attr("aria-hidden", "true").attr("hidden", ""); }); Site.$body.find(".js-swap").swap(); $.mediaquery("bind", "mq-key", "(min-width: " + Site.minLG + "px)", { enter: function() { $subNav.attr("aria-hidden", "false").removeAttr("hidden"); }, leave: function() { $subNav.attr("aria-hidden", "true").attr("hidden", ""); } }); $(window).on("open.lightbox", function() { $(".js-lightbox").lightbox("resize"); }) // Display children of focused nav items $mainNav.find("a") .focus(function() { $(this).closest(".main_nav_item").addClass("focused"); }) .blur(function() { $(this).closest(".main_nav_item").removeClass("focused"); }); // Analytics $.analytics({ scrollDepth: true }); // Select all links with hashes $('a[href*="#"]') // Remove links that don't actually link to anything .not('[href="#"]') .not('[href="#0"]') .not('[href*="#trello"]') .click(function(event) { // On-page links if ( location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname ) { // Figure out element to scroll to var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) + ']'); // Does a scroll target exist? if (target.length) { // Only prevent default if animation is actually gonna happen event.preventDefault(); $('html, body').animate({ scrollTop: target.offset().top }, 1000, function() { // Callback after animation // Must change focus! var $target = $(target); $target.focus(); if ($target.is(":focus")) { // Checking if the target was focused return false; } else { $target.attr('tabindex','-1'); // Adding tabindex for elements not focusable $target.focus(); // Set focus again }; }); } } }); // Theming if($(".sub_nav").length) { $("body").addClass("theme_sub_nav"); } if($(".filter, .site_search_results").length) { $("body").addClass("theme_centered"); } if($(".cover_image_block").length) { $("body").addClass("theme_image"); } if($(".cover_detail_image_block").length) { $("body").addClass("theme_detail_image"); } if($(".news_feature").length) { $("body").addClass("theme_news"); } // Generic Toggles Site.$body.find(".js-toggle") .not(".js-bound") .on("click", ".js-toggle-handle", onToggleClick) .addClass("js-bound"); // Scroll Nav Site.$body.find(".js-scroll-to") .not(".js-bound") .on("click", onScrollTo) .addClass("js-bound"); // Wrapper for Tables Site.$body.find(".typography table") .wrap(' '); tableOverflow(); // Responsive Video $("iframe[src*='vimeo.com'], iframe[src*='youtube.com']", ".typography").each(function() { $(this).wrap(''); }); $("img").each(function() { if($(this).parent().is("a")) { $(this).parent().addClass("image_link"); } }); // Scrolling Site.onScroll.push(scroll); Site.onResize.push(resize); Site.onRespond.push(respond); Site.scroll(); } function scroll() {} function resize() { tableOverflow(); assessSlides(); resizeStats(); resizePageOffset(); } function respond() {} function resizeStats() { if($(".stats").length) { if($(".stats_spot_title").css("text-align") == "left") { $(".stats_spot_title").css("margin-top", ($(".stats_spot_title").outerHeight() / 1 * -1 + 45)); } else { $(".stats_spot_title").css("margin-top", ""); } } } function resizePageOffset() { if($(".cover_image_block").length) { if($(".logo_header").css("position") == "absolute") { $(".subnav_cell").css("margin-top", ""); $(".content_cell").css("margin-top", ($(".page_header").innerHeight() - $(".page_intro").outerHeight() + parseInt($(".page_content").css("padding-top").replace("px", "")) - 20) * -1); } else { $(".subnav_cell").css("margin-top", $(".subnav_cell").height() * -1); $(".content_cell").css("margin-top", ""); } } if($(".cover_detail_image_block").length) { if($(".logo_header").css("position") == "absolute") { $(".page").css("padding-top", $(".header").height() + 50); $(".content_cell").css("margin-top", parseInt($(".page_content").css("padding-top").replace("px", "")) * -1 - 60); } else { $(".page").css("padding-top", ""); $(".content_cell").css("margin-top", ""); } } } function assessSlides() { $(".js-carousel").each(function() { if($(this).css("text-align") == "left") { $(this).carousel("disable"); } else { $(this).carousel("enable"); } }); } function onScrollTo(e) { Site.killEvent(e); var $target = $(e.delegateTarget), id = $target.attr("href"); scrollToElement(id); } function scrollToElement(id) { var $to = $(id); if ($to.length) { var offset = $to.offset(); scrollToPosition(offset.top); } } function scrollToPosition(top) { $("html, body").animate({ scrollTop: top }); } function onToggleClick(e) { Site.killEvent(e); var $target = $(e.delegateTarget), activeClass = "js-toggle-active"; if ($target.hasClass(activeClass)) { $target.removeClass(activeClass); } else { $target.addClass(activeClass); } } function trackEvent(data) { if ($.type(data) === "string") { data = data.split(","); $.analytics.apply(this, data); } } function tableOverflow() { $(".table_wrapper").each(function() { $(this).removeClass("table_wrapper_overflow"); if ($(this).prop("scrollWidth") > $(this).width() + 1) { $(this).addClass("table_wrapper_overflow"); } else { $(this).removeClass("table_wrapper_overflow"); } }); } // Hook Into Main init Routine Site.onInit.push(init); return {}; })(jQuery, Site); /*------------------------------------------- Stories -------------------------------------------*/ Site.modules.Stories = (function($, Site) { var $select; var $options; var $carousel; var $items; var $holders; var itemsAmount; var itemsLimit; var selectionTimeout; var animationTimeout; function init() { if($(".stories").length) { $select = $(".js-dropdown"); $options = $(".stories_option"); $carousel = $(".stories_group"); $items = $(".story_item"); $holders = $(".story_holder"); itemsAmount = $items.length; itemsLimit = 6; selectionTimeout; animationTimeout; if ($items.length < itemsLimit) { itemsLimit = $items.length; } shuffle(); initDropdown(); pullAllRandom(); bindUI(); updateSelection(); resizeItems(); } } function shuffle() { for(var i = 0; i < itemsAmount; i++) { $items.parent().append($items.eq(randomItem())); } } function initDropdown() { $select.val("All Stories").trigger("change"); } function bindUI() { $options.on("click", function() { updateOptions($(this)); resetItems(); if($(this).data("id") == "All Stories") { pullAllRandom(); } else { pullSelection($(this).data("id")); } updateSelection(); }); $select.on("change", function() { var value = $(this).val(); resetItems(); if(value == "All Stories") { pullAllRandom(); } else { pullSelection(value); } updateSelection(); }); Site.onResize.push(resizeItems); } function updateOptions($option) { $options.removeClass("active"); $option.addClass("active"); } function resetItems() { $items.removeClass("chosen"); } function randomItem() { return Math.round(Math.random() * (itemsAmount - 0) + 0); } function pullAllRandom() { while ($(".story_item.chosen").length < itemsLimit) { $items.eq(randomItem()).addClass("chosen"); } } function pullSelection(selection) { var $currentSelection = $(".story_item[data-id=" + selection + "]"); if($currentSelection.length <= itemsLimit) { $currentSelection.addClass("chosen"); } else { while($(".story_item.chosen[data-id=" + selection + "]").length < itemsLimit) { var random = randomItem(); if($items.eq(random).data("id") == selection) { $items.eq(random).addClass("chosen"); } } } } function resizeItems() {} function updateSelection() { animateSelection(); var selectionTimeout = setTimeout(function() { replaceSelection(); }, 1150); } function replaceSelection() { $holders.html(""); $(".story_item.chosen").each(function(index) { $holders.eq(index).append($(this).clone().find(".story_link")); }); $carousel.carousel("reset"); } function animateSelection() { $(".stories").addClass("animating"); animationTimeout = setTimeout(function() { resetAnimation(); }, 2000); $carousel.carousel("reset"); } function resetAnimation() { $(".stories").removeClass("animating"); clearTimeout(animationTimeout); $carousel.carousel("reset"); } Site.onInit.push(init); return {}; })(jQuery, Site); Site.modules.Cover = (function($, Site) { function init() { if($(".cover").length) { adjustSize(); Site.onResize.push(adjustSize); } } function adjustSize() { var size; if(!($(".cover").hasClass("theme_sm"))) { size = parseInt($(".page").css("padding-top").replace("px", "")) + parseInt($(".page_content").css("padding-top").replace("px", "")) + $(".page_header_wrapper").outerHeight(true); if($(".sidebar > *").length) { $(".subnav_cell").css("padding-top", $(".page_header_wrapper").outerHeight(true) + 60); } if($(".in_content_callouts .filter").length) { $("body").addClass("theme_covered_filter"); } } else { size = $(".header").outerHeight() + $(".sub_nav").outerHeight(true); } if($(".full_width_callouts .filter").length || $(".site_search_results").length) { size = size + 70; } $(".cover").css("height", size); }; Site.onInit.push(init); return {}; })(jQuery, Site); /*------------------------------------------- Maps -------------------------------------------*/ Site.modules.Maps = (function($, Site) { function init() { bindUI(); } function bindUI() { $(".mini_map_points .mini_map_button_open").on("click", function() { $(this).closest(".mini_map").addClass("visible-marker"); }); $(".mini_map_points .mini_map_button_close").on("click", function() { $(this).closest(".mini_map").removeClass("visible-marker"); }); $(".big_map_points .mini_map_button_open, .big_map_list_item").on("click", function() { $(this).closest(".big_map").addClass("visible-marker"); }); $(".big_map_points .mini_map_button_close").on("click", function() { $(this).closest(".big_map").removeClass("visible-marker"); }); $(".big_map_dropdown").on("change", function() { var value = $(this).val(); console.log(value) $("[data-id='" + value + "']").swap("activate"); }); } Site.onInit.push(init); return {}; })(jQuery, Site); Site.modules.Circles = (function($, Site) { function init() { var canvasCircles = document.getElementById("circles-canvas"); if (typeof(canvasCircles) != 'undefined' && canvasCircles != null) { var ctx = canvasCircles.getContext("2d"); var cw = canvasCircles.width = window.innerWidth, cx = cw / 2; var ch = canvasCircles.height = window.innerHeight, cy = ch / 2; ctx.fillStyle = "#fff"; var circlesRy = []; var circlesNum = 15; var requestId = null; function Circle() { this.r = randomIntFromInterval(25, 170); this.x = randomIntFromInterval(this.r, cw - this.r); this.y = randomIntFromInterval(this.r, ch - this.r); this.vx = randomIntFromInterval(25, 100)/100; this.vy = randomIntFromInterval(25, 100)/100; this.update = function() { this.edges(); this.x += this.vx; this.y += this.vy; } this.edges = function() { if (this.x < this.r || this.x > cw - this.r) { this.vx *= -1; } if (this.y < this.r || this.y > ch - this.r) { this.vy *= -1; } } this.draw = function() { ctx.strokeStyle = "#353535"; ctx.beginPath(); ctx.arc(this.x, this.y, this.r, 0, 2 * Math.PI); ctx.stroke(); } } for (var i = 0; i < circlesNum; i++) { var circle = new Circle(); circlesRy.push(circle); } function Draw() { requestId = window.requestAnimationFrame(Draw); ctx.clearRect(0, 0, cw, ch); for (var i = 0; i < circlesRy.length; i++) { var c = circlesRy[i]; c.update(); c.draw(); } for (var i = 0; i < circlesRy.length; i++) { var c = circlesRy[i]; for (var j = i + 1; j < circlesRy.length; j++) { var c1 = circlesRy[j]; var d = dist(c, c1); if ((d < c.r + c1.r) && (d > Math.abs(c.r - c1.r))) { getIntersection(c, c1, d); } } } } function Init() { circlesRy.length = 0; for (var i = 0; i < circlesNum; i++) { var circle = new Circle(); circlesRy.push(circle); } if (requestId) { window.cancelAnimationFrame(requestId); requestId = null; } cw = canvasCircles.width = window.innerWidth, cx = cw / 2; ch = canvasCircles.height = window.innerHeight, cy = ch / 2; Draw(); }; setTimeout(function() { Init(); // addEventListener('resize', Init, false); }, 15); function getIntersection(p1, p2, d) { var p3 = {}; // middle point var p4 = {}; // intersection 1 var p5 = {}; // intersection 2 var a = (Math.pow(p1.r, 2) - Math.pow(p2.r, 2) + Math.pow(d, 2)) / (2 * d) var h = Math.sqrt(Math.pow(p1.r, 2) - Math.pow(a, 2)); p3.x = p1.x + a * (p2.x - p1.x) / d; p3.y = p1.y + a * (p2.y - p1.y) / d; p4.x = p3.x + h * (p2.y - p1.y) / d; p4.y = p3.y - h * (p2.x - p1.x) / d; p5.x = p3.x - h * (p2.y - p1.y) / d; p5.y = p3.y + h * (p2.x - p1.x) / d; markPoint(p4); markPoint(p5); } function dist(p1, p2) { var dx = p2.x - p1.x; var dy = p2.y - p1.y; return Math.sqrt(dx * dx + dy * dy); } function randomIntFromInterval(mn, mx) { return ~~(Math.random() * (mx - mn + 1) + mn) } function markPoint(p) { ctx.fillStyle = "#fff"; ctx.beginPath(); ctx.arc(p.x, p.y, 2, 0, 2 * Math.PI); ctx.fill(); } } } Site.onInit.push(init); return {}; })(jQuery, Site); Site.modules.Lines = (function($, Site) { function init() { var canvasLines = document.getElementById("lines-canvas"); if (typeof(canvasLines) != 'undefined' && canvasLines != null) { var ctx = canvasLines.getContext("2d"); var cw = canvasLines.width = window.innerWidth, cx = cw / 2; var ch = canvasLines.height = window.innerHeight, cy = ch / 2; ctx.fillStyle = "#F7F7F7"; var linesNum = 8; var linesRy = []; var requestId = null; function Line(flag) { this.flag = flag; this.a = {}; this.b = {}; if (flag == "v") { this.a.y = 0; this.b.y = ch; this.a.x = randomIntFromInterval(0, ch); this.b.x = randomIntFromInterval(0, ch); } else if (flag == "h") { this.a.x = 0; this.b.x = cw; this.a.y = randomIntFromInterval(0, cw); this.b.y = randomIntFromInterval(0, cw); } this.va = randomIntFromInterval(25, 100) / 100; this.vb = randomIntFromInterval(25, 100) / 100; this.draw = function() { ctx.strokeStyle = "#E3E3E3"; ctx.beginPath(); ctx.moveTo(this.a.x, this.a.y); ctx.lineTo(this.b.x, this.b.y); ctx.stroke(); } this.update = function() { if (this.flag == "v") { this.a.x += this.va; this.b.x += this.vb; } else if (flag == "h") { this.a.y += this.va; this.b.y += this.vb; } this.edges(); } this.edges = function() { if (this.flag == "v") { if (this.a.x < 0 || this.a.x > cw) { this.va *= -1; } if (this.b.x < 0 || this.b.x > cw) { this.vb *= -1; } } else if (this.flag == "h") { if (this.a.y < 0 || this.a.y > ch) { this.va *= -1; } if (this.b.y < 0 || this.b.y > ch) { this.vb *= -1; } } } } for (var i = 0; i < linesNum; i++) { var flag = i % 2 == 0 ? "h" : "v"; var l = new Line(flag); linesRy.push(l); } function Draw() { requestId = window.requestAnimationFrame(Draw); ctx.clearRect(0, 0, cw, ch); for (var i = 0; i < linesRy.length; i++) { var l = linesRy[i]; l.draw(); l.update(); } for (var i = 0; i < linesRy.length; i++) { var l = linesRy[i]; for (var j = i + 1; j < linesRy.length; j++) { var l1 = linesRy[j] Intersect2lines(l, l1); } } } function Init() { for (var i = 0; i < linesNum; i++) { var flag = i % 2 == 0 ? "h" : "v"; var l = new Line(flag); linesRy.push(l); } if (requestId) { window.cancelAnimationFrame(requestId); requestId = null; } cw = canvasLines.width = window.innerWidth, cx = cw / 2; ch = canvasLines.height = window.innerHeight, cy = ch / 2; Draw(); }; setTimeout(function() { Init(); //addEventListener('resize', Init, false); }, 15); function Intersect2lines(l1, l2) { var p1 = l1.a, p2 = l1.b, p3 = l2.a, p4 = l2.b; var denominator = (p4.y - p3.y) * (p2.x - p1.x) - (p4.x - p3.x) * (p2.y - p1.y); var ua = ((p4.x - p3.x) * (p1.y - p3.y) - (p4.y - p3.y) * (p1.x - p3.x)) / denominator; var ub = ((p2.x - p1.x) * (p1.y - p3.y) - (p2.y - p1.y) * (p1.x - p3.x)) / denominator; var x = p1.x + ua * (p2.x - p1.x); var y = p1.y + ua * (p2.y - p1.y); if (ua > 0 && ub > 0) { markPoint({ x: x, y: y }) } } function markPoint(p) { ctx.fillStyle = "#838383"; ctx.beginPath(); ctx.arc(p.x, p.y, 2, 0, 2 * Math.PI); ctx.fill(); } function randomIntFromInterval(mn, mx) { return ~~(Math.random() * (mx - mn + 1) + mn); } } } Site.onInit.push(init); return {}; })(jQuery, Site);