vendor: 11,960 bytes, lines 1-6
1/*! 2 Colorbox 1.6.4 3 license: MIT 4 http://www.jacklmoore.com/colorbox 5*/ 6(function(t,e,i){function n(i,n,o){var r=e.createElement(i);return n&&(r.id=Z+n),o&&(r.style.cssText=o),t(r)}function o(){return i.innerHeight?i.innerHeight:t(i).height()}function r(e,i){i!==Object(i)&&(i={}),this.cache={},this.el=e,this.value=function(e){var n;return void 0===this.cache[e]&&(n=t(this.el).attr("data-cbox-"+e),void 0!==n?this.cache[e]=n:void 0!==i[e]?this.cache[e]=i[e]:void 0!==X[e]&&(this.cache[e]=X[e])),this.cache[e]},this.get=function(e){var i=this.value(e);return t.isFunction(i)?i.call(this.el,this):i}}function h(t){var e=W.length,i=(A+t)%e;return 0>i?e+i:i}function a(t,e){return Math.round((/%/.test(t)?("x"===e?E.width():o())/100:1)*parseInt(t,10))}function s(t,e){return t.get("photo")||t.get("photoRegex").test(e)}function l(t,e){return t.get("retinaUrl")&&i.devicePixelRatio>1?e.replace(t.get("photoRegex"),t.get("retinaSuffix")):e}function d(t){"contains"in x[0]&&!x[0].contains(t.target)&&t.target!==v[0]&&(t.stopPropagation(),x.focus())}function c(t){c.str!==t&&(x.add(v).removeClass(c.str).addClass(t),c.str=t)}function g(e){A=0,e&&e!==!1&&"nofollow"!==e?(W=t("."+te).filter(function(){var i=t.data(this,Y),n=new r(this,i);return n.get("rel")===e}),A=W.index(_.el),-1===A&&(W=W.add(_.el),A=W.length-1)):W=t(_.el)}function u(i){t(e).trigger(i),ae.triggerHandler(i)}function f(i){var o;if(!G){if(o=t(i).data(Y),_=new r(i,o),g(_.get("rel")),!U){U=$=!0,c(_.get("className")),x.css({visibility:"hidden",display:"block",opacity:""}),I=n(se,"LoadedContent","width:0; height:0; overflow:hidden; visibility:hidden"),b.css({width:"",height:""}).append(I),j=T.height()+k.height()+b.outerHeight(!0)-b.height(),D=C.width()+H.width()+b.outerWidth(!0)-b.width(),N=I.outerHeight(!0),z=I.outerWidth(!0);var h=a(_.get("initialWidth"),"x"),s=a(_.get("initialHeight"),"y"),l=_.get("maxWidth"),f=_.get("maxHeight");_.w=Math.max((l!==!1?Math.min(h,a(l,"x")):h)-z-D,0),_.h=Math.max((f!==!1?Math.min(s,a(f,"y")):s)-N-j,0),I.css({width:"",height:_.h}),J.position(),u(ee),_.get("onOpen"),O.add(F).hide(),x.focus(),_.get("trapFocus")&&e.addEventListener&&(e.addEventListener("focus",d,!0),ae.one(re,function(){e.removeEventListener("focus",d,!0)})),_.get("returnFocus")&&ae.one(re,function(){t(_.el).focus()})}var p=parseFloat(_.get("opacity"));v.css({opacity:p===p?p:"",cursor:_.get("overlayClose")?"pointer":"",visibility:"visible"}).show(),_.get("closeButton")?B.html(_.get("close")).appendTo(b):B.appendTo("<div/>"),w()}}function p(){x||(V=!1,E=t(i),x=n(se).attr({id:Y,"class":t.support.opacity===!1?Z+"IE":"",role:"dialog",tabindex:"-1"}).hide(),v=n(se,"Overlay").hide(),L=t([n(se,"LoadingOverlay")[0],n(se,"LoadingGraphic")[0]]),y=n(se,"Wrapper"),b=n(se,"Content").append(F=n(se,"Title"),R=n(se,"Current"),P=t('<button type="button"/>').attr({id:Z+"Previous"}),K=t('<button type="button"/>').attr({id:Z+"Next"}),S=t('<button type="button"/>').attr({id:Z+"Slideshow"}),L),B=t('<button type="button"/>').attr({id:Z+"Close"}),y.append(n(se).append(n(se,"TopLeft"),T=n(se,"TopCenter"),n(se,"TopRight")),n(se,!1,"clear:left").append(C=n(se,"MiddleLeft"),b,H=n(se,"MiddleRight")),n(se,!1,"clear:left").append(n(se,"BottomLeft"),k=n(se,"BottomCenter"),n(se,"BottomRight"))).find("div div").css({"float":"left"}),M=n(se,!1,"position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;"),O=K.add(P).add(R).add(S)),e.body&&!x.parent().length&&t(e.body).append(v,x.append(y,M))}function m(){function i(t){t.which>1||t.shiftKey||t.altKey||t.metaKey||t.ctrlKey||(t.preventDefault(),f(this))}return x?(V||(V=!0,K.click(function(){J.next()}),P.click(function(){J.prev()}),B.click(function(){J.close()}),v.click(function(){_.get("overlayClose")&&J.close()}),t(e).bind("keydown."+Z,function(t){var e=t.keyCode;U&&_.get("escKey")&&27===e&&(t.preventDefault(),J.close()),U&&_.get("arrowKey")&&W[1]&&!t.altKey&&(37===e?(t.preventDefault(),P.click()):39===e&&(t.preventDefault(),K.click()))}),t.isFunction(t.fn.on)?t(e).on("click."+Z,"."+te,i):t("."+te).live("click."+Z,i)),!0):!1}function w(){var e,o,r,h=J.prep,d=++le;if($=!0,q=!1,u(he),u(ie),_.get("onLoad"),_.h=_.get("height")?a(_.get("height"),"y")-N-j:_.get("innerHeight")&&a(_.get("innerHeight"),"y"),_.w=_.get("width")?a(_.get("width"),"x")-z-D:_.get("innerWidth")&&a(_.get("innerWidth"),"x"),_.mw=_.w,_.mh=_.h,_.get("maxWidth")&&(_.mw=a(_.get("maxWidth"),"x")-z-D,_.mw=_.w&&_.w<_.mw?_.w:_.mw),_.get("maxHeight")&&(_.mh=a(_.get("maxHeight"),"y")-N-j,_.mh=_.h&&_.h<_.mh?_.h:_.mh),e=_.get("href"),Q=setTimeout(function(){L.show()},100),_.get("inline")){var c=t(e).eq(0);r=t("<div>").hide().insertBefore(c),ae.one(he,function(){r.replaceWith(c)}),h(c)}else _.get("iframe")?h(" "):_.get("html")?h(_.get("html")):s(_,e)?(e=l(_,e),q=_.get("createImg"),t(q).addClass(Z+"Photo").bind("error."+Z,function(){h(n(se,"Error").html(_.get("imgError")))}).one("load",function(){d===le&&setTimeout(function(){var e;_.get("retinaImage")&&i.devicePixelRatio>1&&(q.height=q.height/i.devicePixelRatio,q.width=q.width/i.devicePixelRatio),_.get("scalePhotos")&&(o=function(){q.height-=q.height*e,q.width-=q.width*e},_.mw&&q.width>_.mw&&(e=(q.width-_.mw)/q.width,o()),_.mh&&q.height>_.mh&&(e=(q.height-_.mh)/q.height,o())),_.h&&(q.style.marginTop=Math.max(_.mh-q.height,0)/2+"px"),W[1]&&(_.get("loop")||W[A+1])&&(q.style.cursor="pointer",t(q).bind("click."+Z,function(){J.next()})),q.style.width=q.width+"px",q.style.height=q.height+"px",h(q)},1)}),q.src=e):e&&M.load(e,_.get("data"),function(e,i){d===le&&h("error"===i?n(se,"Error").html(_.get("xhrError")):t(this).contents())})}var v,x,y,b,T,C,H,k,W,E,I,M,L,F,R,S,K,P,B,O,_,j,D,N,z,A,q,U,$,G,Q,J,V,X={html:!1,photo:!1,iframe:!1,inline:!1,transition:"elastic",speed:300,fadeOut:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,opacity:.9,preloading:!0,className:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:void 0,closeButton:!0,fastIframe:!0,open:!1,reposition:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",photoRegex:/\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i,retinaImage:!1,retinaUrl:!1,retinaSuffix:"@2x.$1",current:"image {current} of {total}",previous:"previous",next:"next",close:"close",xhrError:"This content failed to load.",imgError:"This image failed to load.",returnFocus:!0,trapFocus:!0,onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,rel:function(){return this.rel},href:function(){return t(this).attr("href")},title:function(){return this.title},createImg:function(){var e=new Image,i=t(this).data("cbox-img-attrs");return"object"==typeof i&&t.each(i,function(t,i){e[t]=i}),e},createIframe:function(){var i=e.createElement("iframe"),n=t(this).data("cbox-iframe-attrs");return"object"==typeof n&&t.each(n,function(t,e){i[t]=e}),"frameBorder"in i&&(i.frameBorder=0),"allowTransparency"in i&&(i.allowTransparency="true"),i.name=(new Date).getTime(),i.allowFullscreen=!0,i}},Y="colorbox",Z="cbox",te=Z+"Element",ee=Z+"_open",ie=Z+"_load",ne=Z+"_complete",oe=Z+"_cleanup",re=Z+"_closed",he=Z+"_purge",ae=t("<a/>"),se="div",le=0,de={},ce=function(){function t(){clearTimeout(h)}function e(){(_.get("loop")||W[A+1])&&(t(),h=setTimeout(J.next,_.get("slideshowSpeed")))}function i(){S.html(_.get("slideshowStop")).unbind(s).one(s,n),ae.bind(ne,e).bind(ie,t),x.removeClass(a+"off").addClass(a+"on")}function n(){t(),ae.unbind(ne,e).unbind(ie,t),S.html(_.get("slideshowStart")).unbind(s).one(s,function(){J.next(),i()}),x.removeClass(a+"on").addClass(a+"off")}function o(){r=!1,S.hide(),t(),ae.unbind(ne,e).unbind(ie,t),x.removeClass(a+"off "+a+"on")}var r,h,a=Z+"Slideshow_",s="click."+Z;return function(){r?_.get("slideshow")||(ae.unbind(oe,o),o()):_.get("slideshow")&&W[1]&&(r=!0,ae.one(oe,o),_.get("slideshowAuto")?i():n(),S.show())}}();t[Y]||(t(p),J=t.fn[Y]=t[Y]=function(e,i){var n,o=this;return e=e||{},t.isFunction(o)&&(o=t("<a/>"),e.open=!0),o[0]?(p(),m()&&(i&&(e.onComplete=i),o.each(function(){var i=t.data(this,Y)||{};t.data(this,Y,t.extend(i,e))}).addClass(te),n=new r(o[0],e),n.get("open")&&f(o[0])),o):o},J.position=function(e,i){function n(){T[0].style.width=k[0].style.width=b[0].style.width=parseInt(x[0].style.width,10)-D+"px",b[0].style.height=C[0].style.height=H[0].style.height=parseInt(x[0].style.height,10)-j+"px"}var r,h,s,l=0,d=0,c=x.offset();if(E.unbind("resize."+Z),x.css({top:-9e4,left:-9e4}),h=E.scrollTop(),s=E.scrollLeft(),_.get("fixed")?(c.top-=h,c.left-=s,x.css({position:"fixed"})):(l=h,d=s,x.css({position:"absolute"})),d+=_.get("right")!==!1?Math.max(E.width()-_.w-z-D-a(_.get("right"),"x"),0):_.get("left")!==!1?a(_.get("left"),"x"):Math.round(Math.max(E.width()-_.w-z-D,0)/2),l+=_.get("bottom")!==!1?Math.max(o()-_.h-N-j-a(_.get("bottom"),"y"),0):_.get("top")!==!1?a(_.get("top"),"y"):Math.round(Math.max(o()-_.h-N-j,0)/2),x.css({top:c.top,left:c.left,visibility:"visible"}),y[0].style.width=y[0].style.height="9999px",r={width:_.w+z+D,height:_.h+N+j,top:l,left:d},e){var g=0;t.each(r,function(t){return r[t]!==de[t]?(g=e,void 0):void 0}),e=g}de=r,e||x.css(r),x.dequeue().animate(r,{duration:e||0,complete:function(){n(),$=!1,y[0].style.width=_.w+z+D+"px",y[0].style.height=_.h+N+j+"px",_.get("reposition")&&setTimeout(function(){E.bind("resize."+Z,J.position)},1),t.isFunction(i)&&i()},step:n})},J.resize=function(t){var e;U&&(t=t||{},t.width&&(_.w=a(t.width,"x")-z-D),t.innerWidth&&(_.w=a(t.innerWidth,"x")),I.css({width:_.w}),t.height&&(_.h=a(t.height,"y")-N-j),t.innerHeight&&(_.h=a(t.innerHeight,"y")),t.innerHeight||t.height||(e=I.scrollTop(),I.css({height:"auto"}),_.h=I.height()),I.css({height:_.h}),e&&I.scrollTop(e),J.position("none"===_.get("transition")?0:_.get("speed")))},J.prep=function(i){function o(){return _.w=_.w||I.width(),_.w=_.mw&&_.mw<_.w?_.mw:_.w,_.w}function a(){return _.h=_.h||I.height(),_.h=_.mh&&_.mh<_.h?_.mh:_.h,_.h}if(U){var d,g="none"===_.get("transition")?0:_.get("speed");I.remove(),I=n(se,"LoadedContent").append(i),I.hide().appendTo(M.show()).css({width:o(),overflow:_.get("scrolling")?"auto":"hidden"}).css({height:a()}).prependTo(b),M.hide(),t(q).css({"float":"none"}),c(_.get("className")),d=function(){function i(){t.support.opacity===!1&&x[0].style.removeAttribute("filter")}var n,o,a=W.length;U&&(o=function(){clearTimeout(Q),L.hide(),u(ne),_.get("onComplete")},F.html(_.get("title")).show(),I.show(),a>1?("string"==typeof _.get("current")&&R.html(_.get("current").replace("{current}",A+1).replace("{total}",a)).show(),K[_.get("loop")||a-1>A?"show":"hide"]().html(_.get("next")),P[_.get("loop")||A?"show":"hide"]().html(_.get("previous")),ce(),_.get("preloading")&&t.each([h(-1),h(1)],function(){var i,n=W[this],o=new r(n,t.data(n,Y)),h=o.get("href");h&&s(o,h)&&(h=l(o,h),i=e.createElement("img"),i.src=h)})):O.hide(),_.get("iframe")?(n=_.get("createIframe"),_.get("scrolling")||(n.scrolling="no"),t(n).attr({src:_.get("href"),"class":Z+"Iframe"}).one("load",o).appendTo(I),ae.one(he,function(){n.src="//about:blank"}),_.get("fastIframe")&&t(n).trigger("load")):o(),"fade"===_.get("transition")?x.fadeTo(g,1,i):i())},"fade"===_.get("transition")?x.fadeTo(g,0,function(){J.position(0,d)}):J.position(g,d)}},J.next=function(){!$&&W[1]&&(_.get("loop")||W[A+1])&&(A=h(1),f(W[A]))},J.prev=function(){!$&&W[1]&&(_.get("loop")||A)&&(A=h(-1),f(W[A]))},J.close=function(){U&&!G&&(G=!0,U=!1,u(oe),_.get("onCleanup"),E.unbind("."+Z),v.fadeTo(_.get("fadeOut")||0,0),x.stop().fadeTo(_.get("fadeOut")||0,0,function(){x.hide(),v.hide(),u(he),I.remove(),setTimeout(function(){G=!1,u(re),_.get("onClosed")},1)}))},J.remove=function(){x&&(x.stop(),t[Y].close(),x.stop(!1,!0).remove(),v.remove(),G=!1,x=null,t("."+te).removeData(Y).removeClass(te),t(e).unbind("click."+Z).unbind("keydown."+Z))},J.element=function(){return t(_.el)},J.settings=X)})(jQuery,document,window);
6; 7/** 8 * @file 9 * Colorbox module init js. 10 */ 11 12(function ($) { 13 14Drupal.behaviors.initColorbox = { 15 attach: function (context, settings) { 16 if (!$.isFunction($('a, area, input', context).colorbox) || typeof settings.colorbox === 'undefined') { 17 return; 18 } 19 20 if (settings.colorbox.mobiledetect && window.matchMedia) { 21 // Disable Colorbox for small screens. 22 var mq = window.matchMedia("(max-device-width: " + settings.colorbox.mobiledevicewidth + ")"); 23 if (mq.matches) { 24 return; 25 } 26 } 27 28 // Use "data-colorbox-gallery" if set otherwise use "rel". 29 settings.colorbox.rel = function () { 30 if ($(this).data('colorbox-gallery')) { 31 return $(this).data('colorbox-gallery'); 32 } 33 else { 34 return $(this).attr('rel'); 35 } 36 }; 37 38 $('.colorbox', context) 39 .once('init-colorbox').each(function(){ 40 // Only images are supported for the "colorbox" class. 41 // The "photo" setting forces the href attribute to be treated as an image. 42 var extendParams = { 43 photo: true 44 }; 45 // If a title attribute is supplied, sanitize it. 46 var title = $(this).attr('title'); 47 if (typeof title === 'undefined') { 48 title = this.dataset.cboxTitle; 49 } 50 if (title) { 51 extendParams.title = Drupal.colorbox.sanitizeMarkup(title); 52 } 53 $(this).colorbox($.extend({}, settings.colorbox, extendParams)); 54 55 // Only allow http or https protocol in hrefs. 56 var href = $(this).attr('href'); 57 var protocolRegex = /^(https?)/; 58 if (href) { 59 var protocol = href.split(':')[0]; 60 // Use a regex to match http or https protocol. 61 if (!protocolRegex.test(protocol)) { 62 $(this).removeAttr('href'); 63 } 64 } 65 var dataHref = this.dataset.cboxHref; 66 if (dataHref) { 67 var dataProtocol = dataHref.split(':')[0]; 68 if (!protocolRegex.test(dataProtocol)) { 69 delete this.dataset.cboxHref; 70 } 71 } 72 73 // Since the sanitized title has been passed to colorbox settings, 74 // delete the unsanitized data-cbox-title attribute. 75 delete this.dataset.cboxTitle; 76 77 // Disallow dangerous data attributes. 78 delete this.dataset.cboxIframeAttrs; 79 80 // Sanitize other data attributes. 81 var sanitizeDataList = ['cboxNext', 'cboxPrevious', 'cboxCurrent', 82 'cboxClose', 'cboxSlideshowstop', 'cboxSlideshowstart', 83 'cboxXhrError', 'cboxImgerror', 'cboxHtml' 84 ]; 85 for (var a of sanitizeDataList) { 86 if (this.dataset.hasOwnProperty(a)) { 87 this.dataset[a] = Drupal.colorbox.sanitizeMarkup(this.dataset[a]); 88 } 89 } 90 }); 91 92 $(context).bind('cbox_complete', function () { 93 Drupal.attachBehaviors($('#cboxLoadedContent')); 94 }); 95 } 96}; 97 98// Create colorbox namespace if it doesn't exist. 99if (!Drupal.hasOwnProperty('colorbox')) { 100 Drupal.colorbox = {}; 101} 102 103/** 104 * Global function to allow sanitizing captions and control strings. 105 * 106 * @param markup 107 * String containing potential markup. 108 * @return @string 109 * Sanitized string with potentially dangerous markup removed. 110 */ 111Drupal.colorbox.sanitizeMarkup = function(markup) { 112 // If DOMPurify installed, allow some HTML. Otherwise, treat as plain text. 113 if (typeof DOMPurify !== 'undefined') { 114 var purifyConfig = { 115 ALLOWED_TAGS: [ 116 'a', 117 'b', 118 'strong', 119 'i', 120 'em', 121 'u', 122 'cite', 123 'code', 124 'br' 125 ], 126 ALLOWED_ATTR: [ 127 'href', 128 'hreflang', 129 'title', 130 'target' 131 ] 132 } 133 if (Drupal.settings.hasOwnProperty('dompurify_custom_config')) { 134 purifyConfig = Drupal.settings.dompurify_custom_config; 135 } 136 return DOMPurify.sanitize(markup, purifyConfig); 137 } 138 else { 139 return Drupal.checkPlain(markup); 140 } 141} 142 143})(jQuery); 144; 145/** 146 * @file 147 * Colorbox module style js. 148 */ 149 150(function ($) { 151 152Drupal.behaviors.initColorboxDefaultStyle = { 153 attach: function (context, settings) { 154 $(context).bind('cbox_complete', function () { 155 // Only run if there is a title. 156 if ($('#cboxTitle:empty', context).length == false) { 157 $('#cboxLoadedContent img', context).bind('mouseover', function () { 158 $('#cboxTitle', context).slideDown(); 159 }); 160 $('#cboxOverlay', context).bind('mouseover', function () {
161 $('#cboxTitle', context).slideUp(); 162 }); 163 } 164 else { 165 $('#cboxTitle', context).hide(); 166 } 167 }); 168 } 169}; 170 171})(jQuery); 172; 173/** 174 * @file 175 * Colorbox module load js. 176 */ 177(function ($) { 178 179Drupal.behaviors.initColorboxLoad = { 180 attach: function (context, settings) { 181 if (!$.isFunction($.colorbox) || typeof settings.colorbox === 'undefined') { 182 return; 183 } 184 185 if (settings.colorbox.mobiledetect && window.matchMedia) { 186 // Disable Colorbox for small screens. 187 var mq = window.matchMedia("(max-device-width: " + settings.colorbox.mobiledevicewidth + ")"); 188 if (mq.matches) { 189 return; 190 } 191 } 192 193 $.urlParams = function (url) { 194 var p = {}, 195 e, 196 a = /\+/g, // Regex for replacing addition symbol with a space. 197 r = /([^&=]+)=?([^&]*)/g, 198 d = function (s) { return decodeURIComponent(s.replace(a, ' ')); }, 199 q = url.split('?'); 200 while (e = r.exec(q[1])) { 201 e[1] = d(e[1]); 202 e[2] = d(e[2]); 203 switch (e[2].toLowerCase()) { 204 case 'true': 205 case 'yes': 206 e[2] = true; 207 break; 208 case 'false': 209 case 'no': 210 e[2] = false; 211 break; 212 } 213 if (e[1] == 'width') { e[1] = 'innerWidth'; } 214 if (e[1] == 'height') { e[1] = 'innerHeight'; } 215 if (e[2]) { 216 e[2] = Drupal.checkPlain(e[2]); 217 } 218 p[e[1]] = e[2]; 219 } 220 return p; 221 }; 222 223 $('.colorbox-load', context) 224 .once('init-colorbox-load', function () { 225 var href = $(this).attr('href'); 226 227 var params = $.urlParams(href); 228 229 // Always load in an iframe. 230 params.iframe = true; 231 232 // Set inner width and height if not already specified. 233 if (!params.hasOwnProperty('innerWidth')) { 234 params.innerWidth = $(window).width() * .8; 235 } 236 if (!params.hasOwnProperty('innerHeight')) { 237 params.innerHeight = $(window).height() * .8; 238 } 239 240 if (!params.hasOwnProperty('title')) { 241 // If a title attribute is supplied, sanitize it. 242 var title = $(this).attr('title'); 243 if (title) { 244 params.title = Drupal.colorbox.sanitizeMarkup(title); 245 } 246 } 247 $(this).colorbox($.extend({}, settings.colorbox, params)); 248 }); 249 } 250}; 251 252})(jQuery); 253; 254/** 255 * @file 256 * Colorbox module inline js. 257 */ 258 259(function ($) { 260 261Drupal.behaviors.initColorboxInline = { 262 attach: function (context, settings) { 263 if (!$.isFunction($.colorbox) || typeof settings.colorbox === 'undefined') { 264 return; 265 } 266 267 if (settings.colorbox.mobiledetect && window.matchMedia) { 268 // Disable Colorbox for small screens. 269 var mq = window.matchMedia("(max-device-width: " + settings.colorbox.mobiledevicewidth + ")"); 270 if (mq.matches) { 271 return; 272 } 273 } 274 275 $.urlParam = function(name, url){ 276 if (name == 'fragment') { 277 var results = new RegExp('(#[^&#]*)').exec(url); 278 } 279 else { 280 var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(url); 281 } 282 if (!results) { return ''; } 283 return results[1] || ''; 284 }; 285 $('.colorbox-inline', context).once('init-colorbox-inline').colorbox({ 286 transition:settings.colorbox.transition, 287 speed:settings.colorbox.speed, 288 opacity:settings.colorbox.opacity, 289 slideshow:settings.colorbox.slideshow, 290 slideshowAuto:settings.colorbox.slideshowAuto, 291 slideshowSpeed:settings.colorbox.slideshowSpeed, 292 slideshowStart:settings.colorbox.slideshowStart, 293 slideshowStop:settings.colorbox.slideshowStop, 294 current:settings.colorbox.current, 295 previous:settings.colorbox.previous, 296 next:settings.colorbox.next, 297 close:settings.colorbox.close, 298 overlayClose:settings.colorbox.overlayClose, 299 maxWidth:settings.colorbox.maxWidth, 300 maxHeight:settings.colorbox.maxHeight, 301 innerWidth:function(){ 302 return $.urlParam('width', $(this).attr('href')); 303 }, 304 innerHeight:function(){ 305 return $.urlParam('height', $(this).attr('href')); 306 }, 307 title:function(){ 308 return Drupal.colorbox.sanitizeMarkup( 309 decodeURIComponent($.urlParam('title', $(this).attr('href')))); 310 }, 311 iframe:function(){ 312 return $.urlParam('iframe', $(this).attr('href')); 313 }, 314 inline:function(){ 315 return $.urlParam('inline', $(this).attr('href')); 316 }, 317 href:function(){ 318 return $.urlParam('fragment', $(this).attr('href')); 319 } 320 }); 321 } 322}; 323 324})(jQuery); 325; 326/** 327 * @file 328 * Some basic behaviors and utility functions for Views. 329 */ 330(function ($) { 331 332 Drupal.Views = {}; 333 334 /** 335 * JQuery UI tabs, Views integration component. 336 */ 337 Drupal.behaviors.viewsTabs = { 338 attach: function (context) { 339 if ($.viewsUi && $.viewsUi.tabs) { 340 $('#views-tabset').once('views-processed').viewsTabs({ 341 selectedClass: 'active' 342 }); 343 } 344 345 $('a.views-remove-link').once('views-processed').click(function(event) { 346 var id = $(this).attr('id').replace('views-remove-link-', ''); 347 $('#views-row-' + id).hide(); 348 $('#views-removed-' + id).get(0).checked = true; 349 event.preventDefault(); 350 }); 351 // Here is to handle display deletion 352 // (checking in the hidden checkbox and hiding out the row). 353 $('a.display-remove-link') 354 .addClass('display-processed') 355 .click(function() { 356 var id = $(this).attr('id').replace('display-remove-link-', ''); 357 $('#display-row-' + id).hide(); 358 $('#display-removed-' + id).get(0).checked = true; 359 return false;
360 }); 361 } 362 }; 363 364 /** 365 * Helper function to parse a querystring. 366 */ 367 Drupal.Views.parseQueryString = function (query) { 368 var args = {}; 369 var pos = query.indexOf('?'); 370 if (pos != -1) { 371 query = query.substring(pos + 1); 372 } 373 var pairs = query.split('&'); 374 for (var i in pairs) { 375 if (typeof(pairs[i]) == 'string') { 376 var pair = pairs[i].split('='); 377 // Ignore the 'q' path argument, if present. 378 if (pair[0] != 'q' && pair[1]) { 379 args[decodeURIComponent(pair[0].replace(/\+/g, ' '))] = decodeURIComponent(pair[1].replace(/\+/g, ' ')); 380 } 381 } 382 } 383 return args; 384 }; 385 386 /** 387 * Helper function to return a view's arguments based on a path. 388 */ 389 Drupal.Views.parseViewArgs = function (href, viewPath) { 390 // Provide language prefix. 391 if (Drupal.settings.pathPrefix) { 392 var viewPath = Drupal.settings.pathPrefix + viewPath; 393 } 394 var returnObj = {}; 395 var path = Drupal.Views.getPath(href); 396 // Ensure there is a correct path. 397 if (viewPath && path.substring(0, viewPath.length + 1) == viewPath + '/') { 398 var args = decodeURIComponent(path.substring(viewPath.length + 1, path.length)); 399 returnObj.view_args = args; 400 returnObj.view_path = path; 401 } 402 return returnObj; 403 }; 404 405 /** 406 * Strip off the protocol plus domain from an href. 407 */ 408 Drupal.Views.pathPortion = function (href) { 409 // Remove e.g. http://example.com if present. 410 var protocol = window.location.protocol; 411 if (href.substring(0, protocol.length) == protocol) { 412 // 2 is the length of the '//' that normally follows the protocol. 413 href = href.substring(href.indexOf('/', protocol.length + 2)); 414 } 415 return href; 416 }; 417 418 /** 419 * Return the Drupal path portion of an href. 420 */ 421 Drupal.Views.getPath = function (href) { 422 href = Drupal.Views.pathPortion(href); 423 href = href.substring(Drupal.settings.basePath.length, href.length); 424 // 3 is the length of the '?q=' added to the URL without clean URLs. 425 if (href.substring(0, 3) == '?q=') { 426 href = href.substring(3, href.length); 427 } 428 var chars = ['#', '?', '&']; 429 for (var i in chars) { 430 if (href.indexOf(chars[i]) > -1) { 431 href = href.substr(0, href.indexOf(chars[i])); 432 } 433 } 434 return href; 435 }; 436 437})(jQuery); 438; 439(function ($) { 440 441/** 442 * A progressbar object. Initialized with the given id. Must be inserted into 443 * the DOM afterwards through progressBar.element. 444 * 445 * method is the function which will perform the HTTP request to get the 446 * progress bar state. Either "GET" or "POST". 447 * 448 * e.g. pb = new progressBar('myProgressBar'); 449 * some_element.appendChild(pb.element); 450 */ 451Drupal.progressBar = function (id, updateCallback, method, errorCallback) { 452 var pb = this; 453 this.id = id; 454 this.method = method || 'GET'; 455 this.updateCallback = updateCallback; 456 this.errorCallback = errorCallback; 457 458 // The WAI-ARIA setting aria-live="polite" will announce changes after users 459 // have completed their current activity and not interrupt the screen reader. 460 this.element = $('<div class="progress" aria-live="polite"></div>').attr('id', id); 461 this.element.html('<div class="bar"><div class="filled"></div></div>' + 462 '<div class="percentage"></div>' + 463 '<div class="message"> </div>'); 464}; 465 466/** 467 * Set the percentage and status message for the progressbar. 468 */ 469Drupal.progressBar.prototype.setProgress = function (percentage, message) { 470 if (percentage >= 0 && percentage <= 100) { 471 $('div.filled', this.element).css('width', percentage + '%'); 472 $('div.percentage', this.element).html(percentage + '%'); 473 } 474 $('div.message', this.element).html(message); 475 if (this.updateCallback) { 476 this.updateCallback(percentage, message, this); 477 } 478}; 479 480/** 481 * Start monitoring progress via Ajax. 482 */ 483Drupal.progressBar.prototype.startMonitoring = function (uri, delay) { 484 this.delay = delay; 485 this.uri = uri; 486 this.sendPing(); 487}; 488 489/** 490 * Stop monitoring progress via Ajax. 491 */ 492Drupal.progressBar.prototype.stopMonitoring = function () { 493 clearTimeout(this.timer); 494 // This allows monitoring to be stopped from within the callback. 495 this.uri = null; 496}; 497 498/** 499 * Request progress data from server. 500 */ 501Drupal.progressBar.prototype.sendPing = function () { 502 if (this.timer) { 503 clearTimeout(this.timer); 504 } 505 if (this.uri) { 506 var pb = this; 507 // When doing a post request, you need non-null data. Otherwise a 508 // HTTP 411 or HTTP 406 (with Apache mod_security) error may result. 509 $.ajax({ 510 type: this.method, 511 url: this.uri, 512 data: '', 513 dataType: 'json', 514 success: function (progress) { 515 // Display errors. 516 if (progress.status == 0) { 517 pb.displayError(progress.data); 518 return; 519 } 520 // Update display. 521 pb.setProgress(progress.percentage, progress.message); 522 // Schedule next timer.
523 pb.timer = setTimeout(function () { pb.sendPing(); }, pb.delay); 524 }, 525 error: function (xmlhttp) { 526 pb.displayError(Drupal.ajaxError(xmlhttp, pb.uri)); 527 } 528 }); 529 } 530}; 531 532/** 533 * Display errors on the page. 534 */ 535Drupal.progressBar.prototype.displayError = function (string) { 536 var error = $('<div class="messages error"></div>').html(string); 537 $(this.element).before(error).hide(); 538 539 if (this.errorCallback) { 540 this.errorCallback(this); 541 } 542}; 543 544})(jQuery); 545; 546Drupal.TBMegaMenu = Drupal.TBMegaMenu || {}; 547 548(function ($) { 549 Drupal.TBMegaMenu.oldWindowWidth = 0; 550 Drupal.TBMegaMenu.displayedMenuMobile = false; 551 Drupal.TBMegaMenu.supportedScreens = [980]; 552 Drupal.TBMegaMenu.menuResponsive = function () { 553 var windowWidth = window.innerWidth ? window.innerWidth : $(window).width(); 554 var navCollapse = $('.tb-megamenu').children('.nav-collapse'); 555 if (windowWidth < Drupal.TBMegaMenu.supportedScreens[0]) { 556 navCollapse.addClass('collapse'); 557 if (Drupal.TBMegaMenu.displayedMenuMobile) { 558 navCollapse.css({height: 'auto', overflow: 'visible'}); 559 } else { 560 navCollapse.css({height: 0, overflow: 'hidden'}); 561 } 562 } else { 563 // If width of window is greater than 980 (supported screen). 564 navCollapse.removeClass('collapse'); 565 if (navCollapse.height() <= 0) { 566 navCollapse.css({height: 'auto', overflow: 'visible'}); 567 } 568 } 569 }; 570 571 Drupal.behaviors.tbMegaMenuAction = { 572 attach: function(context) { 573 $('.tb-megamenu-button', context).once('menuIstance', function () { 574 var This = this; 575 $(This).click(function() { 576 if(parseInt($(this).parent().children('.nav-collapse').height())) { 577 $(this).parent().children('.nav-collapse').css({height: 0, overflow: 'hidden'}); 578 Drupal.TBMegaMenu.displayedMenuMobile = false; 579 } 580 else { 581 $(this).parent().children('.nav-collapse').css({height: 'auto', overflow: 'visible'}); 582 Drupal.TBMegaMenu.displayedMenuMobile = true; 583 } 584 }); 585 }); 586 587 588 var isTouch = 'ontouchstart' in window && !(/hp-tablet/gi).test(navigator.appVersion); 589 if(!isTouch){ 590 $(document).ready(function($){ 591 var mm_duration = 0; 592 $('.tb-megamenu').each (function(){ 593 if ($(this).data('duration')) { 594 mm_duration = $(this).data('duration'); 595 } 596 }); 597 var mm_timeout = mm_duration ? 100 + mm_duration : 500; 598 $('.nav > li, li.mega').hover(function(event) { 599 var $this = $(this); 600 if ($this.hasClass ('mega')) { 601 $this.addClass ('animating'); 602 clearTimeout ($this.data('animatingTimeout')); 603 $this.data('animatingTimeout', setTimeout(function(){$this.removeClass ('animating')}, mm_timeout)); 604 clearTimeout ($this.data('hoverTimeout')); 605 $this.data('hoverTimeout', setTimeout(function(){$this.addClass ('open')}, 100)); 606 } else { 607 clearTimeout ($this.data('hoverTimeout')); 608 $this.data('hoverTimeout', 609 setTimeout(function(){$this.addClass ('open')}, 100)); 610 } 611 }, 612 function(event) { 613 var $this = $(this); 614 if ($this.hasClass ('mega')) { 615 $this.addClass ('animating'); 616 clearTimeout ($this.data('animatingTimeout')); 617 $this.data('animatingTimeout', 618 setTimeout(function(){$this.removeClass ('animating')}, mm_timeout)); 619 clearTimeout ($this.data('hoverTimeout')); 620 $this.data('hoverTimeout', setTimeout(function(){$this.removeClass ('open')}, 100)); 621 } else { 622 clearTimeout ($this.data('hoverTimeout')); 623 $this.data('hoverTimeout', 624 setTimeout(function(){$this.removeClass ('open')}, 100)); 625 } 626 }); 627 }); 628 } 629 630 $(window).resize(function() { 631 var windowWidth = window.innerWidth ? window.innerWidth : $(window).width(); 632 if(windowWidth != Drupal.TBMegaMenu.oldWindowWidth){ 633 Drupal.TBMegaMenu.oldWindowWidth = windowWidth; 634 Drupal.TBMegaMenu.menuResponsive(); 635 } 636 }); 637 }, 638 } 639})(jQuery); 640 641; 642Drupal.TBMegaMenu = Drupal.TBMegaMenu || {}; 643 644(function ($) { 645 Drupal.TBMegaMenu.createTouchMenu = function(items) { 646 items.children('a').each( function() { 647 var $item = $(this); 648 var tbitem = $(this).parent(); 649 $item.click( function(event){ 650 if ($item.hasClass('tb-megamenu-clicked')) { 651 var $uri = $item.attr('href'); 652 window.location.href = $uri; 653 } 654 else { 655 event.preventDefault(); 656 $item.addClass('tb-megamenu-clicked'); 657 if(!tbitem.hasClass('open')){ 658 tbitem.addClass('open'); 659 } 660 } 661 }).closest('li').mouseleave( function(){ 662 $item.removeClass('tb-megamenu-clicked'); 663 tbitem.removeClass('open'); 664 }); 665 }); 666 /* 667 items.children('a').children('span.caret').each( function() { 668 var $item = $(this).parent(); 669 $item.click(function(event){ 670 tbitem = $item.parent(); 671 if ($item.hasClass('tb-megamenu-clicked')) { 672 Drupal.TBMegaMenu.eventStopPropagation(event); 673 if(tbitem.hasClass('open')){ 674 tbitem.removeClass('open'); 675 $item.removeClass('tb-megamenu-clicked'); 676 } 677 } 678 else { 679 Drupal.TBMegaMenu.eventStopPropagation(event); 680 $item.addClass('tb-megamenu-clicked'); 681 if(!tbitem.hasClass('open')){ 682 tbitem.addClass('open'); 683 $item.removeClass('tb-megamenu-clicked'); 684 } 685 } 686 }); 687 }); 688 */ 689 } 690 691 Drupal.TBMegaMenu.eventStopPropagation = function(event) { 692 if (event.stopPropagation) { 693 event.stopPropagation(); 694 } 695 else if (window.event) { 696 window.event.cancelBubble = true; 697 } 698 } 699 Drupal.behaviors.tbMegaMenuTouchAction = { 700 attach: function(context) { 701 var isTouch = 'ontouchstart' in window && !(/hp-tablet/gi).test(navigator.appVersion); 702 if(isTouch){ 703 $('html').addClass('touch'); 704 Drupal.TBMegaMenu.createTouchMenu($('.tb-megamenu ul.nav li.mega').has('.dropdown-menu')); 705 } 706 } 707 } 708})(jQuery); 709; 710/** 711 * @file 712 * Handles AJAX fetching of views, including filter submission and response. 713 */ 714(function ($) { 715 716 /**
717 * Attaches the AJAX behavior to exposed filter forms and key views links. 718 */ 719 Drupal.behaviors.ViewsAjaxView = {}; 720 Drupal.behaviors.ViewsAjaxView.attach = function() { 721 if (Drupal.settings && Drupal.settings.views && Drupal.settings.views.ajaxViews) { 722 $.each(Drupal.settings.views.ajaxViews, function(i, settings) { 723 Drupal.views.instances[i] = new Drupal.views.ajaxView(settings); 724 }); 725 } 726 }; 727 728 Drupal.views = {}; 729 Drupal.views.instances = {}; 730 731 /** 732 * JavaScript object for a certain view. 733 */ 734 Drupal.views.ajaxView = function(settings) { 735 var selector = '.view-dom-id-' + settings.view_dom_id; 736 this.$view = $(selector); 737 738 // If view is not present return to prevent errors. 739 if (!this.$view.length) { 740 return; 741 } 742 743 // Retrieve the path to use for views' ajax. 744 var ajax_path = Drupal.settings.views.ajax_path; 745 746 // If there are multiple views this might've ended up showing up multiple 747 // times. 748 if (ajax_path.constructor.toString().indexOf("Array") != -1) { 749 ajax_path = ajax_path[0]; 750 } 751 752 // Check if there are any GET parameters to send to views. 753 var queryString = window.location.search || ''; 754 if (queryString !== '') { 755 // Remove the question mark and Drupal path component if any. 756 var queryString = queryString.slice(1).replace(/q=[^&]+&?|&?render=[^&]+/, ''); 757 if (queryString !== '') { 758 // If there is a '?' in ajax_path, clean url are on and & should be 759 // used to add parameters. 760 queryString = ((/\?/.test(ajax_path)) ? '&' : '?') + queryString; 761 } 762 } 763 764 this.element_settings = { 765 url: ajax_path + queryString, 766 submit: settings, 767 setClick: true, 768 event: 'click', 769 selector: selector, 770 progress: { 771 type: 'throbber' 772 } 773 }; 774 775 this.settings = settings; 776 777 // Add the ajax to exposed forms. 778 this.$exposed_form = $('#views-exposed-form-' + settings.view_name.replace(/_/g, '-') + '-' + settings.view_display_id.replace(/_/g, '-')); 779 this.$exposed_form.once(jQuery.proxy(this.attachExposedFormAjax, this)); 780 781 // Store Drupal.ajax objects here for all pager links. 782 this.links = []; 783 784 // Add the ajax to pagers. 785 this.$view 786 .once(jQuery.proxy(this.attachPagerAjax, this)); 787 788 // Add a trigger to update this view specifically. In order to trigger a 789 // refresh use the following code. 790 // 791 // @code 792 // jQuery('.view-name').trigger('RefreshView'); 793 // @endcode 794 // Add a trigger to update this view specifically. 795 var self_settings = this.element_settings; 796 self_settings.event = 'RefreshView'; 797 var self = this; 798 this.$view.once('refresh', function () { 799 self.refreshViewAjax = new Drupal.ajax(self.selector, self.$view, self_settings); 800 }); 801 }; 802 803 Drupal.views.ajaxView.prototype.attachExposedFormAjax = function() { 804 var button = $('input[type=submit], button[type=submit], input[type=image]', this.$exposed_form); 805 button = button[0]; 806 807 // Call the autocomplete submit before doing AJAX. 808 $(button).click(function () { 809 if (Drupal.autocompleteSubmit) { 810 Drupal.autocompleteSubmit(); 811 } 812 }); 813 814 this.exposedFormAjax = new Drupal.ajax($(button).attr('id'), button, this.element_settings); 815 }; 816 817 /** 818 * Attach the ajax behavior to each link. 819 */ 820 Drupal.views.ajaxView.prototype.attachPagerAjax = function() { 821 this.$view.find('ul.pager > li > a, ol.pager > li > a, th.views-field a, .attachment .views-summary a') 822 .each(jQuery.proxy(this.attachPagerLinkAjax, this)); 823 }; 824 825 /** 826 * Attach the ajax behavior to a single link. 827 */ 828 Drupal.views.ajaxView.prototype.attachPagerLinkAjax = function(id, link) { 829 var $link = $(link); 830 var viewData = {}; 831 var href = $link.attr('href'); 832 // Don't attach to pagers inside nested views. 833 if ($link.closest('.view')[0] !== this.$view[0] && 834 $link.closest('.view').parent().hasClass('attachment') === false) { 835 return; 836 } 837 838 // Provide a default page if none has been set. This must be done 839 // prior to merging with settings to avoid accidentally using the 840 // page landed on instead of page 1. 841 if (typeof(viewData.page) === 'undefined') { 842 viewData.page = 0; 843 } 844 845 // Construct an object using the settings defaults and then overriding 846 // with data specific to the link. 847 $.extend( 848 viewData, 849 this.settings, 850 Drupal.Views.parseQueryString(href), 851 // Extract argument data from the URL. 852 Drupal.Views.parseViewArgs(href, this.settings.view_base_path) 853 ); 854
855 // For anchor tags, these will go to the target of the anchor rather 856 // than the usual location. 857 $.extend(viewData, Drupal.Views.parseViewArgs(href, this.settings.view_base_path)); 858 859 // Construct an object using the element settings defaults, 860 // then overriding submit with viewData. 861 var pager_settings = $.extend({}, this.element_settings); 862 pager_settings.submit = viewData; 863 this.pagerAjax = new Drupal.ajax(false, $link, pager_settings); 864 this.links.push(this.pagerAjax); 865 }; 866 867 Drupal.ajax.prototype.commands.viewsScrollTop = function (ajax, response, status) { 868 // Scroll to the top of the view. This will allow users 869 // to browse newly loaded content after e.g. clicking a pager 870 // link. 871 var offset = $(response.selector).offset(); 872 // We can't guarantee that the scrollable object should be 873 // the body, as the view could be embedded in something 874 // more complex such as a modal popup. Recurse up the DOM 875 // and scroll the first element that has a non-zero top. 876 var scrollTarget = response.selector; 877 while ($(scrollTarget).scrollTop() == 0 && $(scrollTarget).parent()) { 878 scrollTarget = $(scrollTarget).parent(); 879 } 880 // Only scroll upward. 881 if (offset.top - 10 < $(scrollTarget).scrollTop()) { 882 $(scrollTarget).animate({scrollTop: (offset.top - 10)}, 500); 883 } 884 }; 885 886})(jQuery); 887; 888/** 889 * @file 890 * Configures newly created contextual links to work with quicktabs. 891 */ 892 893(function ($) { 894 Drupal.behaviors.quicktabsContextual = { 895 attach: function (context, settings) { 896 $('a.quicktabs-contextual', context).once('init-quicktabs-contextual-processed').click(function () { 897 var rel = $(this).attr('rel'); 898 $('#' + rel).click(); 899 return false; 900 }); 901 902 $('.block-mbp-defaults').find('ul.quicktabs-tabs').hide(); 903 } 904 } 905})(jQuery); 906;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.