1(function ($) { 2 3/** 4 * A progressbar object. Initialized with the given id. Must be inserted into 5 * the DOM afterwards through progressBar.element. 6 * 7 * method is the function which will perform the HTTP request to get the 8 * progress bar state. Either "GET" or "POST". 9 * 10 * e.g. pb = new progressBar('myProgressBar'); 11 * some_element.appendChild(pb.element); 12 */ 13Drupal.progressBar = function (id, updateCallback, method, errorCallback) { 14 var pb = this; 15 this.id = id; 16 this.method = method || 'GET'; 17 this.updateCallback = updateCallback; 18 this.errorCallback = errorCallback; 19 20 // The WAI-ARIA setting aria-live="polite" will announce changes after users 21 // have completed their current activity and not interrupt the screen reader. 22 this.element = $('<div class="progress" aria-live="polite"></div>').attr('id', id); 23 this.element.html('<div class="bar"><div class="filled"></div></div>' + 24 '<div class="percentage"></div>' + 25 '<div class="message"> </div>'); 26}; 27 28/** 29 * Set the percentage and status message for the progressbar. 30 */ 31Drupal.progressBar.prototype.setProgress = function (percentage, message) { 32 if (percentage >= 0 && percentage <= 100) { 33 $('div.filled', this.element).css('width', percentage + '%'); 34 $('div.percentage', this.element).html(percentage + '%'); 35 } 36 $('div.message', this.element).html(message); 37 if (this.updateCallback) { 38 this.updateCallback(percentage, message, this); 39 } 40}; 41 42/** 43 * Start monitoring progress via Ajax. 44 */ 45Drupal.progressBar.prototype.startMonitoring = function (uri, delay) { 46 this.delay = delay; 47 this.uri = uri; 48 this.sendPing(); 49}; 50 51/** 52 * Stop monitoring progress via Ajax. 53 */ 54Drupal.progressBar.prototype.stopMonitoring = function () { 55 clearTimeout(this.timer); 56 // This allows monitoring to be stopped from within the callback. 57 this.uri = null; 58}; 59 60/** 61 * Request progress data from server. 62 */ 63Drupal.progressBar.prototype.sendPing = function () { 64 if (this.timer) { 65 clearTimeout(this.timer); 66 } 67 if (this.uri) { 68 var pb = this; 69 // When doing a post request, you need non-null data. Otherwise a 70 // HTTP 411 or HTTP 406 (with Apache mod_security) error may result. 71 $.ajax({ 72 type: this.method, 73 url: this.uri, 74 data: '', 75 dataType: 'json', 76 success: function (progress) { 77 // Display errors. 78 if (progress.status == 0) { 79 pb.displayError(progress.data); 80 return; 81 } 82 // Update display. 83 pb.setProgress(progress.percentage, progress.message); 84 // Schedule next timer. 85 pb.timer = setTimeout(function () { pb.sendPing(); }, pb.delay); 86 }, 87 error: function (xmlhttp) { 88 pb.displayError(Drupal.ajaxError(xmlhttp, pb.uri)); 89 } 90 }); 91 } 92}; 93 94/** 95 * Display errors on the page. 96 */ 97Drupal.progressBar.prototype.displayError = function (string) { 98 var error = $('<div class="messages error"></div>').html(string); 99 $(this.element).before(error).hide(); 100 101 if (this.errorCallback) { 102 this.errorCallback(this); 103 } 104}; 105 106})(jQuery); 107; 108/*! 109 Colorbox 1.6.1 110 license: MIT 111 http://www.jacklmoore.com/colorbox 112*/ 113(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 y[0]&&!y[0].contains(t.target)&&t.target!==v[0]&&(t.stopPropagation(),y.focus())}function c(t){c.str!==t&&(y.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")),!$){$=q=!0,c(_.get("
113className")),y.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=(l!==!1?Math.min(h,a(l,"x")):h)-z-D,_.h=(f!==!1?Math.min(s,a(f,"y")):s)-N-j,I.css({width:"",height:_.h}),J.position(),u(ee),_.get("onOpen"),O.add(S).hide(),y.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(){y||(V=!1,E=t(i),y=n(se).attr({id:Y,"class":t.support.opacity===!1?Z+"IE":"",role:"dialog",tabindex:"-1"}).hide(),v=n(se,"Overlay").hide(),M=t([n(se,"LoadingOverlay")[0],n(se,"LoadingGraphic")[0]]),x=n(se,"Wrapper"),b=n(se,"Content").append(S=n(se,"Title"),F=n(se,"Current"),P=t('<button type="button"/>').attr({id:Z+"Previous"}),K=t('<button type="button"/>').attr({id:Z+"Next"}),R=n("button","Slideshow"),M),B=t('<button type="button"/>').attr({id:Z+"Close"}),x.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"}),L=n(se,!1,"position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;"),O=K.add(P).add(F).add(R)),e.body&&!y.parent().length&&t(e.body).append(v,y.append(x,L))}function m(){function i(t){t.which>1||t.shiftKey||t.altKey||t.metaKey||t.ctrlKey||(t.preventDefault(),f(this))}return y?(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;$&&_.get("escKey")&&27===e&&(t.preventDefault(),J.close()),$&&_.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(q=!0,U=!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(){M.show()},100),_.get("inline")){var c=t(e);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),U=_.get("createImg"),t(U).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&&(U.height=U.height/i.devicePixelRatio,U.width=U.width/i.devicePixelRatio),_.get("scalePhotos")&&(o=function(){U.height-=U.height*e,U.width-=U.width*e},_.mw&&U.width>_.mw&&(e=(U.width-_.mw)/U.width,o()),_.mh&&U.height>_.mh&&(e=(U.height-_.mh)/U.height,o())),_.h&&(U.style.marginTop=Math.max(_.mh-U.height,0)/2+"px"),W[1]&&(_.get("loop")||W[A+1])&&(U.style.cursor="pointer",t(U).bind("click."+Z,function(){J.next()})),U.style.width=U.width+"px",U.style.height=U.height+"px",h(U)},1)}),U.src=e):e&&L.load(e,_.get("data"),function(e,i){d===le&&h("error"===i?n(se,"Error").html(_.get("xhrError")):t(this).contents())})}var v,y,x,b,T,C,H,k,W,E,I,L,M,S,F,R,K,P,B,O,_,j,D,N,z,A,U,$,q,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",innerHe
vendor: 3,812 bytes, line 113
113ight:!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(){R.html(_.get("slideshowStop")).unbind(s).one(s,n),ae.bind(ne,e).bind(ie,t),y.removeClass(a+"off").addClass(a+"on")}function n(){t(),ae.unbind(ne,e).unbind(ie,t),R.html(_.get("slideshowStart")).unbind(s).one(s,function(){J.next(),i()}),y.removeClass(a+"on").addClass(a+"off")}function o(){r=!1,R.hide(),t(),ae.unbind(ne,e).unbind(ie,t),y.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(),R.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(y[0].style.width,10)-D+"px",b[0].style.height=C[0].style.height=H[0].style.height=parseInt(y[0].style.height,10)-j+"px"}var r,h,s,l=0,d=0,c=y.offset();if(E.unbind("resize."+Z),y.css({top:-9e4,left:-9e4}),h=E.scrollTop(),s=E.scrollLeft(),_.get("fixed")?(c.top-=h,c.left-=s,y.css({position:"fixed"})):(l=h,d=s,y.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),y.css({top:c.top,left:c.left,visibility:"visible"}),x[0].style.width=x[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||y.css(r),y.dequeue().animate(r,{duration:e||0,complete:function(){n(),q=!1,x[0].style.width=_.w+z+D+"px",x[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;$&&(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.innerHe
113ight,"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($){var d,g="none"===_.get("transition")?0:_.get("speed");I.remove(),I=n(se,"LoadedContent").append(i),I.hide().appendTo(L.show()).css({width:o(),overflow:_.get("scrolling")?"auto":"hidden"}).css({height:a()}).prependTo(b),L.hide(),t(U).css({"float":"none"}),c(_.get("className")),d=function(){function i(){t.support.opacity===!1&&y[0].style.removeAttribute("filter")}var n,o,a=W.length;$&&(o=function(){clearTimeout(Q),M.hide(),u(ne),_.get("onComplete")},S.html(_.get("title")).show(),I.show(),a>1?("string"==typeof _.get("current")&&F.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")?y.fadeTo(g,1,i):i())},"fade"===_.get("transition")?y.fadeTo(g,0,function(){J.position(0,d)}):J.position(g,d)}},J.next=function(){!q&&W[1]&&(_.get("loop")||W[A+1])&&(A=h(1),f(W[A]))},J.prev=function(){!q&&W[1]&&(_.get("loop")||A)&&(A=h(-1),f(W[A]))},J.close=function(){$&&!G&&(G=!0,$=!1,u(oe),_.get("onCleanup"),E.unbind("."+Z),v.fadeTo(_.get("fadeOut")||0,0),y.stop().fadeTo(_.get("fadeOut")||0,0,function(){y.hide(),v.hide(),u(he),I.remove(),setTimeout(function(){G=!1,u(re),_.get("onClosed")},1)}))},J.remove=function(){y&&(y.stop(),t[Y].close(),y.stop(!1,!0).remove(),v.remove(),G=!1,y=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);; 114(function ($) { 115 116Drupal.behaviors.initColorbox = { 117 attach: function (context, settings) { 118 if (!$.isFunction($.colorbox) || typeof settings.colorbox === 'undefined') { 119 return; 120 } 121 122 if (settings.colorbox.mobiledetect && window.matchMedia) { 123 // Disable Colorbox for small screens. 124 var mq = window.matchMedia("(max-device-width: " + settings.colorbox.mobiledevicewidth + ")"); 125 if (mq.matches) { 126 return; 127 } 128 } 129 130 $('.colorbox', context) 131 .once('init-colorbox') 132 .colorbox(settings.colorbox); 133 134 $(context).bind('cbox_complete', function () { 135 Drupal.attachBehaviors('#cboxLoadedContent'); 136 }); 137 } 138}; 139 140})(jQuery); 141; 142(function ($) { 143 144Drupal.behaviors.initColorboxDefaultStyle = { 145 attach: function (context, settings) { 146 $(context).bind('cbox_complete', function () { 147 // Only run if there is a title. 148 if ($('#cboxTitle:empty', context).length == false) { 149 $('#cboxLoadedContent img', context).bind('mouseover', function () { 150 $('#cboxTitle', context).slideDown(); 151 }); 152 $('#cboxOverlay', context).bind('mouseover', function () { 153 $('#cboxTitle', context).slideUp(); 154 }); 155 } 156 else { 157 $('#cboxTitle', context).hide(); 158 } 159 }); 160 } 161}; 162 163})(jQuery); 164; 165(function ($) { 166 167Drupal.behaviors.initColorboxInline = { 168 attach: function (context, settings) { 169 if (!$.isFunction($.colorbox) || typeof settings.colorbox === 'undefined') { 170 return; 171 } 172 $.urlParam = function(name, url){ 173 if (name == 'fragment') { 174 var results = new RegExp('(#[^&#]*)').exec(url); 175 } 176 else { 177 var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(url); 178 } 179 if (!results) { return ''; } 180 return results[1] || ''; 181 }; 182 $('.colorbox-inline', context).once('init-colorbox-inline').colorbox({ 183 transition:settings.colorbox.transition, 184 speed:settings.colorbox.speed, 185 opacity:settings.colorbox.opacity, 186 slideshow:settings.colorbox.slideshow, 187 slideshowAuto:settings.colorbox.slideshowAuto, 188 slideshowSpeed:settings.colorbox.slideshowSpeed,
189 slideshowStart:settings.colorbox.slideshowStart, 190 slideshowStop:settings.colorbox.slideshowStop, 191 current:settings.colorbox.current, 192 previous:settings.colorbox.previous, 193 next:settings.colorbox.next, 194 close:settings.colorbox.close, 195 overlayClose:settings.colorbox.overlayClose, 196 maxWidth:settings.colorbox.maxWidth, 197 maxHeight:settings.colorbox.maxHeight, 198 innerWidth:function(){ 199 return $.urlParam('width', $(this).attr('href')); 200 }, 201 innerHeight:function(){ 202 return $.urlParam('height', $(this).attr('href')); 203 }, 204 title:function(){ 205 return decodeURIComponent($.urlParam('title', $(this).attr('href'))); 206 }, 207 iframe:function(){ 208 return $.urlParam('iframe', $(this).attr('href')); 209 }, 210 inline:function(){ 211 return $.urlParam('inline', $(this).attr('href')); 212 }, 213 href:function(){ 214 return $.urlParam('fragment', $(this).attr('href')); 215 } 216 }); 217 } 218}; 219 220})(jQuery); 221; 222(function ($) { 223 224 Drupal.behaviors.captcha = { 225 attach: function (context) { 226 227 // Turn off autocompletion for the CAPTCHA response field. 228 // We do it here with JavaScript (instead of directly in the markup) 229 // because this autocomplete attribute is not standard and 230 // it would break (X)HTML compliance. 231 $("#edit-captcha-response").attr("autocomplete", "off"); 232 233 } 234 }; 235 236 Drupal.behaviors.captchaAdmin = { 237 attach: function (context) { 238 // Add onclick handler to checkbox for adding a CAPTCHA description 239 // so that the textfields for the CAPTCHA description are hidden 240 // when no description should be added. 241 // @todo: div.form-item-captcha-description depends on theming, maybe 242 // it's better to add our own wrapper with id (instead of a class). 243 $("#edit-captcha-add-captcha-description").click(function() { 244 if ($("#edit-captcha-add-captcha-description").is(":checked")) { 245 // Show the CAPTCHA description textfield(s). 246 $("div.form-item-captcha-description").show('slow'); 247 } 248 else { 249 // Hide the CAPTCHA description textfield(s). 250 $("div.form-item-captcha-description").hide('slow'); 251 } 252 }); 253 // Hide the CAPTCHA description textfields if option is disabled on page load. 254 if (!$("#edit-captcha-add-captcha-description").is(":checked")) { 255 $("div.form-item-captcha-description").hide(); 256 } 257 } 258 259 }; 260 261})(jQuery); 262; 263(function ($) { 264 265Drupal.behaviors.textarea = { 266 attach: function (context, settings) { 267 $('.form-textarea-wrapper.resizable', context).once('textarea', function () { 268 var staticOffset = null; 269 var textarea = $(this).addClass('resizable-textarea').find('textarea'); 270 var grippie = $('<div class="grippie"></div>').mousedown(startDrag); 271 272 grippie.insertAfter(textarea); 273 274 function startDrag(e) { 275 staticOffset = textarea.height() - e.pageY; 276 textarea.css('opacity', 0.25); 277 $(document).mousemove(performDrag).mouseup(endDrag); 278 return false; 279 } 280 281 function performDrag(e) { 282 textarea.height(Math.max(32, staticOffset + e.pageY) + 'px'); 283 return false; 284 } 285 286 function endDrag(e) { 287 $(document).unbind('mousemove', performDrag).unbind('mouseup', endDrag); 288 textarea.css('opacity', 1); 289 } 290 }); 291 } 292}; 293 294})(jQuery); 295; 296/** 297 * @file 298 * JavaScript behaviors for the front-end display of webforms. 299 */ 300 301(function ($) { 302 303 "use strict"; 304 305 Drupal.behaviors.webform = Drupal.behaviors.webform || {}; 306 307 Drupal.behaviors.webform.attach = function (context) { 308 // Calendar datepicker behavior. 309 Drupal.webform.datepicker(context); 310 311 // Conditional logic. 312 if (Drupal.settings.webform && Drupal.settings.webform.conditionals) { 313 Drupal.webform.conditional(context); 314 } 315 }; 316 317 Drupal.webform = Drupal.webform || {}; 318 319 Drupal.webform.datepicker = function (context) { 320 $('div.webform-datepicker').each(function () { 321 var $webformDatepicker = $(this); 322 var $calendar = $webformDatepicker.find('input.webform-calendar'); 323 324 // Ensure the page we're on actually contains a datepicker. 325 if ($calendar.length == 0) { 326 return; 327 } 328 329 var startDate = $calendar[0].className.replace(/.*webform-calendar-start-(\d{4}-\d{2}-\d{2}).*/, '$1').split('-'); 330 var endDate = $calendar[0].className.replace(/.*webform-calendar-end-(\d{4}-\d{2}-\d{2}).*/, '$1').split('-'); 331 var firstDay = $calendar[0].className.replace(/.*webform-calendar-day-(\d).*/, '$1'); 332 // Convert date strings into actual Date objects. 333 startDate = new Date(startDate[0], startDate[1] - 1, startDate[2]); 334 endDate = new Date(endDate[0], endDate[1] - 1, endDate[2]); 335 336 // Ensure that start comes before end for datepicker. 337 if (startDate >
337 endDate) { 338 var laterDate = startDate; 339 startDate = endDate; 340 endDate = laterDate; 341 } 342 343 var startYear = startDate.getFullYear(); 344 var endYear = endDate.getFullYear(); 345 346 // Set up the jQuery datepicker element. 347 $calendar.datepicker({ 348 dateFormat: 'yy-mm-dd', 349 yearRange: startYear + ':' + endYear, 350 firstDay: parseInt(firstDay), 351 minDate: startDate, 352 maxDate: endDate, 353 onSelect: function (dateText, inst) { 354 var date = dateText.split('-'); 355 $webformDatepicker.find('select.year, input.year').val(+date[0]).trigger('change'); 356 $webformDatepicker.find('select.month').val(+date[1]).trigger('change'); 357 $webformDatepicker.find('select.day').val(+date[2]).trigger('change'); 358 }, 359 beforeShow: function (input, inst) { 360 // Get the select list values. 361 var year = $webformDatepicker.find('select.year, input.year').val(); 362 var month = $webformDatepicker.find('select.month').val(); 363 var day = $webformDatepicker.find('select.day').val(); 364 365 // If empty, default to the current year/month/day in the popup. 366 var today = new Date(); 367 year = year ? year : today.getFullYear(); 368 month = month ? month : today.getMonth() + 1; 369 day = day ? day : today.getDate(); 370 371 // Make sure that the default year fits in the available options. 372 year = (year < startYear || year > endYear) ? startYear : year; 373 374 // jQuery UI Datepicker will read the input field and base its date off 375 // of that, even though in our case the input field is a button. 376 $(input).val(year + '-' + month + '-' + day); 377 } 378 }); 379 380 // Prevent the calendar button from submitting the form. 381 $calendar.click(function (event) { 382 $(this).focus(); 383 event.preventDefault(); 384 }); 385 }); 386 }; 387 388 Drupal.webform.conditional = function (context) { 389 // Add the bindings to each webform on the page. 390 $.each(Drupal.settings.webform.conditionals, function (formKey, settings) { 391 var $form = $('.' + formKey + ':not(.webform-conditional-processed)'); 392 $form.each(function (index, currentForm) { 393 var $currentForm = $(currentForm); 394 $currentForm.addClass('webform-conditional-processed'); 395 $currentForm.bind('change', {'settings': settings}, Drupal.webform.conditionalCheck); 396 397 // Trigger all the elements that cause conditionals on this form. 398 Drupal.webform.doConditions($form, settings); 399 }); 400 }); 401 }; 402 403 /** 404 * Event handler to respond to field changes in a form. 405 * 406 * This event is bound to the entire form, not individual fields. 407 */ 408 Drupal.webform.conditionalCheck = function (e) { 409 var $triggerElement = $(e.target).closest('.webform-component'); 410 var $form = $triggerElement.closest('form'); 411 var triggerElementKey = $triggerElement.attr('class').match(/webform-component--[^ ]+/)[0]; 412 var settings = e.data.settings; 413 if (settings.sourceMap[triggerElementKey]) { 414 Drupal.webform.doConditions($form, settings); 415 } 416 }; 417 418 /** 419 * Processes all conditional. 420 */ 421 Drupal.webform.doConditions = function ($form, settings) { 422 // Track what has be set/shown for each target component. 423 var targetLocked = []; 424 425 $.each(settings.ruleGroups, function (rgid_key, rule_group) { 426 var ruleGroup = settings.ruleGroups[rgid_key]; 427 428 // Perform the comparison callback and build the results for this group. 429 var conditionalResult = true; 430 var conditionalResults = []; 431 $.each(ruleGroup['rules'], function (m, rule) {
432 var elementKey = rule['source']; 433 var element = $form.find('.' + elementKey)[0]; 434 var existingValue = settings.values[elementKey] ? settings.values[elementKey] : null; 435 conditionalResults.push(window['Drupal']['webform'][rule.callback](element, existingValue, rule['value'])); 436 }); 437 438 // Filter out false values. 439 var filteredResults = []; 440 for (var i = 0; i < conditionalResults.length; i++) { 441 if (conditionalResults[i]) { 442 filteredResults.push(conditionalResults[i]); 443 } 444 } 445 446 // Calculate the and/or result. 447 if (ruleGroup['andor'] === 'or') { 448 conditionalResult = filteredResults.length > 0; 449 } 450 else { 451 conditionalResult = filteredResults.length === conditionalResults.length; 452 } 453 454 $.each(ruleGroup['actions'], function (aid, action) { 455 var $target = $form.find('.' + action['target']); 456 var actionResult = action['invert'] ? !conditionalResult : conditionalResult; 457 switch (action['action']) { 458 case 'show': 459 if (actionResult != Drupal.webform.isVisible($target)) { 460 var $targetElements = actionResult 461 ? $target.find('.webform-conditional-disabled').removeClass('webform-conditional-disabled') 462 : $target.find(':input').addClass('webform-conditional-disabled'); 463 $targetElements.webformProp('disabled', !actionResult); 464 $target.toggleClass('webform-conditional-hidden', !actionResult); 465 if (actionResult) { 466 $target.show(); 467 } 468 else { 469 $target.hide(); 470 // Record that the target was hidden. 471 targetLocked[action['target']] = 'hide'; 472 } 473 if ($target.is('tr')) { 474 Drupal.webform.restripeTable($target.closest('table').first()); 475 } 476 } 477 break; 478 case 'require': 479 var $requiredSpan = $target.find('.form-required, .form-optional').first(); 480 if (actionResult != $requiredSpan.hasClass('form-required')) { 481 var $targetInputElements = $target.find("input:text,textarea,input[type='email'],select,input:radio,input:file"); 482 // Rather than hide the required tag, remove it so that other jQuery can respond via Drupal behaviors. 483 Drupal.detachBehaviors($requiredSpan); 484 $targetInputElements 485 .webformProp('required', actionResult) 486 .toggleClass('required', actionResult); 487 if (actionResult) { 488 $requiredSpan.replaceWith('<span class="form-required" title="' + Drupal.t('This field is required.') + '">*</span>'); 489 } 490 else { 491 $requiredSpan.replaceWith('<span class="form-optional"></span>'); 492 } 493 Drupal.attachBehaviors($requiredSpan); 494 } 495 break; 496 case 'set':
497 var isLocked = targetLocked[action['target']]; 498 var $texts = $target.find("input:text,textarea,input[type='email']"); 499 var $selects = $target.find('select,select option,input:radio,input:checkbox'); 500 var $markups = $target.filter('.webform-component-markup'); 501 if (actionResult) { 502 var multiple = $.map(action['argument'].split(','), $.trim); 503 $selects.webformVal(multiple); 504 $texts.val([action['argument']]); 505 // A special case is made for markup. It is sanitized with filter_xss_admin on the server. 506 // otherwise text() should be used to avoid an XSS vulnerability. text() however would 507 // preclude the use of tags like <strong> or <a> 508 $markups.html(action['argument']); 509 } 510 else { 511 // Markup not set? Then restore original markup as provided in 512 // the attribute data-webform-markup. 513 $markups.each(function() { 514 var $this = $(this); 515 var original = $this.data('webform-markup'); 516 if (original !== undefined) { 517 $this.html(original); 518 } 519 }); 520 } 521 if (!isLocked) { 522 // If not previously hidden or set, disable the element readonly or readonly-like behavior. 523 $selects.webformProp('disabled', actionResult); 524 $texts.webformProp('readonly', actionResult); 525 targetLocked[action['target']] = actionResult ? 'set' : false; 526 } 527 break; 528 } 529 }); // End look on each action for one conditional 530 }); // End loop on each conditional 531 }; 532 533 /** 534 * Event handler to prevent propogation of events, typically click for disabling 535 * radio and checkboxes. 536 */ 537 Drupal.webform.stopEvent = function () { 538 return false; 539 }; 540 541 Drupal.webform.conditionalOperatorStringEqual = function (element, existingValue, ruleValue) { 542 var returnValue = false; 543 var currentValue = Drupal.webform.stringValue(element, existingValue); 544 $.each(currentValue, function (n, value) { 545 if (value.toLowerCase() === ruleValue.toLowerCase()) { 546 returnValue = true; 547 return false; // break. 548 } 549 }); 550 return returnValue; 551 }; 552 553 Drupal.webform.conditionalOperatorStringNotEqual = function (element, existingValue, ruleValue) { 554 var found = false; 555 var currentValue = Drupal.webform.stringValue(element, existingValue); 556 $.each(currentValue, function (n, value) { 557 if (value.toLowerCase() === ruleValue.toLowerCase()) { 558 found = true; 559 } 560 }); 561 return !found; 562 }; 563 564 Drupal.webform.conditionalOperatorStringContains = function (element, existingValue, ruleValue) { 565 var returnValue = false; 566 var currentValue = Drupal.webform.stringValue(element, existingValue); 567 $.each(currentValue, function (n, value) { 568 if (value.toLowerCase().indexOf(ruleValue.toLowerCase()) > -1) { 569 returnValue = true; 570 return false; // break. 571 } 572 }); 573 return returnValue; 574 }; 575 576 Drupal.webform.conditionalOperatorStringDoesNotContain = function (element, existingValue, ruleValue) { 577 var found = false; 578 var currentValue = Drupal.webform.stringValue(element, existingValue); 579 $.each(currentValue, function (n, value) { 580 if (value.toLowerCase().indexOf(ruleValue.toLowerCase()) > -1) { 581 found = true; 582 } 583 }); 584 return !found; 585 }; 586 587 Drupal.webform.conditionalOperatorStringBeginsWith = function (element, existingValue, ruleValue) { 588 var returnValue = false; 589 var currentValue = Drupal.webform.stringValue(element, existingValue); 590 $.each(currentValue, function (n, value) { 591 if (value.toLowerCase().indexOf(ruleValue.toLowerCase()) === 0) { 592 returnValue = true; 593 return false; // break. 594 } 595 }); 596 return returnValue; 597 }; 598 599 Drupal.webform.conditionalOperatorStringEndsWith = function (element, existingValue, ruleValue) { 600 var returnValue = false; 601 var currentValue = Drupal.webform.stringValue(element, existingV
601alue); 602 $.each(currentValue, function (n, value) { 603 if (value.toLowerCase().lastIndexOf(ruleValue.toLowerCase()) === value.length - ruleValue.length) { 604 returnValue = true; 605 return false; // break. 606 } 607 }); 608 return returnValue; 609 }; 610 611 Drupal.webform.conditionalOperatorStringEmpty = function (element, existingValue, ruleValue) { 612 var currentValue = Drupal.webform.stringValue(element, existingValue); 613 var returnValue = true; 614 $.each(currentValue, function (n, value) { 615 if (value !== '') { 616 returnValue = false; 617 return false; // break. 618 } 619 }); 620 return returnValue; 621 }; 622 623 Drupal.webform.conditionalOperatorStringNotEmpty = function (element, existingValue, ruleValue) { 624 return !Drupal.webform.conditionalOperatorStringEmpty(element, existingValue, ruleValue); 625 }; 626 627 Drupal.webform.conditionalOperatorSelectGreaterThan = function (element, existingValue, ruleValue) { 628 var currentValue = Drupal.webform.stringValue(element, existingValue); 629 return Drupal.webform.compare_select(currentValue[0], ruleValue, element) > 0; 630 }; 631 632 Drupal.webform.conditionalOperatorSelectGreaterThanEqual = function (element, existingValue, ruleValue) { 633 var currentValue = Drupal.webform.stringValue(element, existingValue); 634 var comparison = Drupal.webform.compare_select(currentValue[0], ruleValue, element); 635 return comparison > 0 || comparison === 0; 636 }; 637 638 Drupal.webform.conditionalOperatorSelectLessThan = function (element, existingValue, ruleValue) { 639 var currentValue = Drupal.webform.stringValue(element, existingValue); 640 return Drupal.webform.compare_select(currentValue[0], ruleValue, element) < 0; 641 }; 642 643 Drupal.webform.conditionalOperatorSelectLessThanEqual = function (element, existingValue, ruleValue) { 644 var currentValue = Drupal.webform.stringValue(element, existingValue); 645 var comparison = Drupal.webform.compare_select(currentValue[0], ruleValue, element); 646 return comparison < 0 || comparison === 0; 647 }; 648 649 Drupal.webform.conditionalOperatorNumericEqual = function (element, existingValue, ruleValue) { 650 // See float comparison: http://php.net/manual/en/language.types.float.php 651 var currentValue = Drupal.webform.stringValue(element, existingValue); 652 var epsilon = 0.000001; 653 // An empty string does not match any number. 654 return currentValue[0] === '' ? false : (Math.abs(parseFloat(currentValue[0]) - parseFloat(ruleValue)) < epsilon); 655 }; 656 657 Drupal.webform.conditionalOperatorNumericNotEqual = function (element, existingValue, ruleValue) { 658 // See float comparison: http://php.net/manual/en/language.types.float.php 659 var currentValue = Drupal.webform.stringValue(element, existingValue); 660 var epsilon = 0.000001; 661 // An empty string does not match any number. 662 return currentValue[0] === '' ? true : (Math.abs(parseFloat(currentValue[0]) - parseFloat(ruleValue)) >= epsilon); 663 }; 664 665 Drupal.webform.conditionalOperatorNumericGreaterThan = function (element, existingValue, ruleValue) { 666 var currentValue = Drupal.webform.stringValue(element, existingValue); 667 return parseFloat(currentValue[0]) > parseFloat(ruleValue); 668 }; 669 670 Drupal.webform.conditionalOperatorNumericGreaterThanEqual = function (element, existingValue, ruleValue) { 671 return Drupal.webform.conditionalOperatorNumericGreaterThan(element, existingValue, ruleValue) || 672 Drupal.webform.conditionalOperatorNumericEqual(element, existingValue, ruleValue); 673 }; 674 675 Drupal.webform.conditionalOperatorNumericLessThan = function (element, existingValue, ruleValue) { 676 var currentValue = Drupal.webform.stringValue(element, existingValue); 677 return parseFloat(currentValue[0]) < parseFloat(ruleValue); 678 }; 679 680 Drupal.webform.conditionalOperatorNumericLessThanEqual = function (element, existingValue, ruleValue) { 681 return Drupal.webform.conditionalOperatorNumericLessThan(element, existingValue, ruleValue) || 682 Drupal.webform.conditionalOperatorNumericEqual(element, existingValue, ruleValue); 683 }; 684 685 Drupal.webform.conditionalOperatorDateEqual = function (element, existingV
685alue, ruleValue) { 686 var currentValue = Drupal.webform.dateValue(element, existingValue); 687 return currentValue === ruleValue; 688 }; 689 690 Drupal.webform.conditionalOperatorDateNotEqual = function (element, existingValue, ruleValue) { 691 return !Drupal.webform.conditionalOperatorDateEqual(element, existingValue, ruleValue); 692 }; 693 694 Drupal.webform.conditionalOperatorDateBefore = function (element, existingValue, ruleValue) { 695 var currentValue = Drupal.webform.dateValue(element, existingValue); 696 return (currentValue !== false) && currentValue < ruleValue; 697 }; 698 699 Drupal.webform.conditionalOperatorDateBeforeEqual = function (element, existingValue, ruleValue) { 700 var currentValue = Drupal.webform.dateValue(element, existingValue); 701 return (currentValue !== false) && (currentValue < ruleValue || currentValue === ruleValue); 702 }; 703 704 Drupal.webform.conditionalOperatorDateAfter = function (element, existingValue, ruleValue) { 705 var currentValue = Drupal.webform.dateValue(element, existingValue); 706 return (currentValue !== false) && currentValue > ruleValue; 707 }; 708 709 Drupal.webform.conditionalOperatorDateAfterEqual = function (element, existingValue, ruleValue) { 710 var currentValue = Drupal.webform.dateValue(element, existingValue); 711 return (currentValue !== false) && (currentValue > ruleValue || currentValue === ruleValue); 712 }; 713 714 Drupal.webform.conditionalOperatorTimeEqual = function (element, existingValue, ruleValue) { 715 var currentValue = Drupal.webform.timeValue(element, existingValue); 716 return currentValue === ruleValue; 717 }; 718 719 Drupal.webform.conditionalOperatorTimeNotEqual = function (element, existingValue, ruleValue) { 720 return !Drupal.webform.conditionalOperatorTimeEqual(element, existingValue, ruleValue); 721 }; 722 723 Drupal.webform.conditionalOperatorTimeBefore = function (element, existingValue, ruleValue) { 724 // Date and time operators intentionally exclusive for "before". 725 var currentValue = Drupal.webform.timeValue(element, existingValue); 726 return (currentValue !== false) && (currentValue < ruleValue); 727 }; 728 729 Drupal.webform.conditionalOperatorTimeBeforeEqual = function (element, existingValue, ruleValue) { 730 // Date and time operators intentionally exclusive for "before". 731 var currentValue = Drupal.webform.timeValue(element, existingValue); 732 return (currentValue !== false) && (currentValue < ruleValue || currentValue === ruleValue); 733 }; 734 735 Drupal.webform.conditionalOperatorTimeAfter = function (element, existingValue, ruleValue) { 736 // Date and time operators intentionally inclusive for "after". 737 var currentValue = Drupal.webform.timeValue(element, existingValue); 738 return (currentValue !== false) && (currentValue > ruleValue); 739 }; 740 741 Drupal.webform.conditionalOperatorTimeAfterEqual = function (element, existingValue, ruleValue) { 742 // Date and time operators intentionally inclusive for "after". 743 var currentValue = Drupal.webform.timeValue(element, existingValue); 744 return (currentValue !== false) && (currentValue > ruleValue || currentValue === ruleValue); 745 }; 746 747 /** 748 * Utility function to compare values of a select component. 749 * @param string a 750 * First select option key to compare 751 * @param string b 752 * Second select option key to compare 753 * @param array options 754 * Associative array where the a and b are within the keys 755 * @return integer based upon position of $a and $b in $options 756 * -N if $a above (<) $b 757 * 0 if $a = $b 758 * +N if $a is below (>) $b 759 */ 760 Drupal.webform.compare_select = function (a, b, element) { 761 var optionList = []; 762 $('option,input:radio,input:checkbox', element).each(function () { 763 optionList.push($(this).val()); 764 }); 765 var a_position = optionList.indexOf(a); 766 var b_position = optionList.indexOf(b); 767 return (a_position < 0 || b_position < 0) ? null : a_position - b_position; 768 }; 769 770 /** 771 * Utility to return current visibility. Uses actual visibility, except for 772 * hidden components which use the applied disabled class. 773 */ 774 Drupal.webform.isVisible = function ($element) { 775 return $element.hasClass('webform-component-hidden') 776 ? !$element.find('input').first().hasClass('webform-conditional-disabled') 777 : $element.closest('.webform-conditional-hidden').length == 0; 778 }; 779 780 /** 781 * Utility function to get a string value from a select/radios/text/etc. field. 782 */
783 Drupal.webform.stringValue = function (element, existingValue) { 784 var value = []; 785 if (element) { 786 var $element = $(element); 787 if (Drupal.webform.isVisible($element)) { 788 // Checkboxes and radios. 789 $element.find('input[type=checkbox]:checked,input[type=radio]:checked').each(function () { 790 value.push(this.value); 791 }); 792 // Select lists. 793 if (!value.length) { 794 var selectValue = $element.find('select').val(); 795 if (selectValue) { 796 if ($.isArray(selectValue)) { 797 value = selectValue; 798 } 799 else { 800 value.push(selectValue); 801 } 802 } 803 } 804 // Simple text fields. This check is done last so that the select list in 805 // select-or-other fields comes before the "other" text field. 806 if (!value.length) { 807 $element.find('input:not([type=checkbox],[type=radio]),textarea').each(function () { 808 value.push(this.value); 809 }); 810 } 811 } 812 } 813 else { 814 switch ($.type(existingValue)) { 815 case 'array':
816 value = existingValue; 817 break; 818 case 'string': 819 value.push(existingValue); 820 break; 821 } 822 } 823 return value; 824 }; 825 826 /** 827 * Utility function to calculate a second-based timestamp from a time field. 828 */ 829 Drupal.webform.dateValue = function (element, existingValue) { 830 var value = false; 831 if (element) { 832 var $element = $(element); 833 if (Drupal.webform.isVisible($element)) { 834 var day = $element.find('[name*=day]').val(); 835 var month = $element.find('[name*=month]').val(); 836 var year = $element.find('[name*=year]').val(); 837 // Months are 0 indexed in JavaScript. 838 if (month) { 839 month--; 840 } 841 if (year !== '' && month !== '' && day !== '') { 842 value = Date.UTC(year, month, day) / 1000; 843 } 844 } 845 } 846 else { 847 if ($.type(existingValue) === 'array' && existingValue.length) { 848 existingValue = existingValue[0]; 849 } 850 if ($.type(existingValue) === 'string') { 851 existingValue = existingV
851alue.split('-'); 852 } 853 if (existingValue.length === 3) { 854 value = Date.UTC(existingValue[0], existingValue[1], existingValue[2]) / 1000; 855 } 856 } 857 return value; 858 }; 859 860 /** 861 * Utility function to calculate a millisecond timestamp from a time field. 862 */ 863 Drupal.webform.timeValue = function (element, existingValue) { 864 var value = false; 865 if (element) { 866 var $element = $(element); 867 if (Drupal.webform.isVisible($element)) { 868 var hour = $element.find('[name*=hour]').val(); 869 var minute = $element.find('[name*=minute]').val(); 870 var ampm = $element.find('[name*=ampm]:checked').val(); 871 872 // Convert to integers if set. 873 hour = (hour === '') ? hour : parseInt(hour); 874 minute = (minute === '') ? minute : parseInt(minute); 875 876 if (hour !== '') { 877 hour = (hour < 12 && ampm == 'pm') ? hour + 12 : hour; 878 hour = (hour === 12 && ampm == 'am') ? 0 : hour; 879 } 880 if (hour !== '' && minute !== '') { 881 value = Date.UTC(1970, 0, 1, hour, minute) / 1000; 882 } 883 } 884 } 885 else { 886 if ($.type(existingValue) === 'array' && existingValue.length) {
887 existingValue = existingValue[0]; 888 } 889 if ($.type(existingValue) === 'string') { 890 existingValue = existingValue.split(':'); 891 } 892 if (existingValue.length >= 2) { 893 value = Date.UTC(1970, 0, 1, existingValue[0], existingValue[1]) / 1000; 894 } 895 } 896 return value; 897 }; 898 899 /** 900 * Make a prop shim for jQuery < 1.9. 901 */ 902 $.fn.webformProp = $.fn.webformProp || function (name, value) { 903 if (value) { 904 return $.fn.prop ? this.prop(name, true) : this.attr(name, true); 905 } 906 else { 907 return $.fn.prop ? this.prop(name, false) : this.removeAttr(name); 908 } 909 }; 910 911 /** 912 * Make a multi-valued val() function for setting checkboxes, radios, and select 913 * elements. 914 */ 915 $.fn.webformVal = function (values) { 916 this.each(function () { 917 var $this = $(this); 918 var value = $this.val(); 919 var on = $.inArray($this.val(), values) != -1; 920 if (this.nodeName == 'OPTION') { 921 $this.webformProp('selected', on ? value : false); 922 } 923 else { 924 $this.val(on ? [value] : false); 925 } 926 }); 927 return this; 928 }; 929 930 /** 931 * Given a table's DOM element, restripe the odd/even classes. 932 */ 933 Drupal.webform.restripeTable = function (table) { 934 // :even and :odd are reversed because jQuery counts from 0 and 935 // we count from 1, so we're out of sync. 936 // Match immediate children of the parent element to allow nesting. 937 $('> tbody > tr, > tr', table) 938 .filter(':visible:odd').filter('.odd') 939 .removeClass('odd').addClass('even') 940 .end().end() 941 .filter(':visible:even').filter('.even') 942 .removeClass('even').addClass('odd'); 943 }; 944 945})(jQuery); 946; 947(function($) { 948 949 Drupal.behaviors.megamenu = { 950 attach:function(context) { 951 952 var $megamenu = $('.megamenu-menu'); 953 var timeout = Drupal.settings.megamenu.timeout; 954 var sizewait = Drupal.settings.megamenu.sizewait; 955 var hoverwait = Drupal.settings.megamenu.hoverwait; 956 var hovertimer = null; 957 var sizetimer = null; 958 var closetimer = null; 959 var hoverParent = null; 960 var hoverBin = null; 961 var hoverSlots = null; 962 var megaSlots = null; 963 var megaParents = null; 964 var hideOffset = -9000; 965 var megaParents = $megamenu.find('.megamenu-parent'); 966 var megaParentTitles = $megamenu.find('.megamenu-parent-title'); 967 var megaBins = $megamenu.find('.megamenu-bin'); 968 var oldParentIdx = -1; 969 var hoverParentIdx = -2; 970 megaBins.css('top', hideOffset); 971 var activeParent = megaParents.index($(megaParents).has('.active')); 972 if (activeParent != -1) { 973 megaParents.eq(activeParent).addClass('active'); 974 } 975 976 function megamenu_open() { 977 megamenu_canceltimer(); 978 979 if ($(this).hasClass('megamenu-parent-title')) { 980 hoverParentIdx = megaParentTitles.index($(this)); 981 } 982 else if ($(this).hasClass('megamenu-bin')) { 983 hoverParentIdx = megaParents.index($(this).parents('.megamenu-parent')); 984 } 985 986 hoverParent = megaParents.eq(hoverParentIdx); 987 988 if (hoverParentIdx != oldParentIdx) { 989 megamenu_close(); 990 megamenu_hovertimer(); 991 } 992 else { 993 megamenu_display(); 994 } 995 } 996 997 function megamenu_display() { 998 if (hoverParent) { 999 // If the display doesn't have hover yet - trigger event. 1000 if (!hoverParent.hasClass('hovering')) { 1001 hoverParent.trigger('megamenu_open'); 1002 } 1003 hoverParent.addClass('hovering'); 1004 hoverBin = hoverParent.find('.megamenu-bin'); 1005 /* display position */ 1006 hoverBin.css('top', 'auto'); 1007 /* display position end */ 1008 } 1009 } 1010 1011 function megamenu_close() { 1012 if (hoverParent) { 1013 oldParentIdx = $('.megamenu-parent').index(hoverParent); 1014 } 1015 for (var i = 0 ; i < megaParents.length ; i++) { 1016 megaParents.trigger('megamenu_close'); 1017 megaParents.eq(i).removeClass('hovering'); 1018 } 1019 if (hoverBin) hoverBin.css('top', hideOffset); 1020 } 1021
1022 function megamenu_closeAll() { 1023 if (hoverBin) hoverBin.css('top', hideOffset); 1024 for (var i = 0 ; i < megaParents.length ; i++) { 1025 megaParents.trigger('megamenu_close'); 1026 megaParents.eq(i).removeClass('hovering'); 1027 } 1028 oldParentIdx = -1; 1029 } 1030 1031 function megamenu_stopPropagation(event) { 1032 event.stopPropagation(); 1033 } 1034 1035 function megamenu_timer() { 1036 megamenu_canceltimer(); 1037 megamenu_cancelhovertimer(); 1038 closetimer = window.setTimeout(megamenu_closeAll, timeout); 1039 } 1040 1041 function megamenu_canceltimer() { 1042 if (closetimer) { 1043 window.clearTimeout(closetimer); 1044 closetimer = null; 1045 } 1046 } 1047 1048 function megamenu_hovertimer() { 1049 megamenu_cancelhovertimer(); 1050 hovertimer = window.setTimeout(megamenu_display, hoverwait); 1051 } 1052 1053 function megamenu_cancelhovertimer() { 1054 if (hovertimer) { 1055 window.clearTimeout(hovertimer); 1056 hovertimer = null; 1057 } 1058 } 1059 1060 function megamenu_sizetimer() { 1061 /* waits to resize on initial call to accommodate browser draw */ 1062 sizetimer = window.setTimeout(megamenu_sizer, sizewait); 1063 } 1064 1065 function megamenu_sizer() { 1066 1067 for (var k=0 ; k < megaBins.length ; k++) { 1068 1069 /* resets to bin sizes and position before sizing */ 1070 megaBins.eq(k).css('left', 0 + 'px'); 1071 megaBins.eq(k).css('width', 0 + 'px'); 1072 1073 var megaSlots = megaBins.eq(k).find('.megamenu-slot'); 1074 1075 /* auto bin width start */ 1076 1077 var i = 0; 1078 1079 if (megaBins.eq(k).hasClass('megamenu-slots-columnar')) { 1080 var slotTotalWidth = 0; 1081 for (i = 0 ; i < megaSlots.length ; i++) { 1082 1083 slotTotalWidth += megaSlots.eq(i).outerWidth(true); 1084 1085 if (slotTotalWidth > $(window).width()) { 1086 slotTotalWidth = 0; 1087 for (var j=0 ; j < i ; j++) { 1088 slotTotalWidth += megaSlots.eq(i).outerWidth(true); 1089 } 1090 break; 1091 } 1092 } 1093 megaBins.eq(k).css('width' , slotTotalWidth); 1094 megaBins.eq(k).width(slotTotalWidth); 1095 } 1096 else { 1097 /* set bin width for vertical slots */ 1098 megaBins.eq(k).css('width' , megaSlots.eq(0).outerWidth(true)); 1099 } 1100 /* auto bin width end */ 1101 1102 /* off-page shift start */ 1103 var edgeOverlap = ($(window).width() - (megaBins.eq(k).offset().left + megaBins.eq(k).outerWidth(true))); 1104 1105 if (edgeOverlap < 0) { 1106 megaBins.eq(k).css('left',(edgeOverlap) + 'px'); 1107 } 1108 /* off-page shift end */ 1109 } 1110 } 1111 1112 // Open Mega Menu Function - bound 1113 function megamenu_open_progress() { 1114 if ($(this).find('ul.megamenu-bin').get(0)) { 1115 $(this).find('h2').addClass('megamenu-active'); 1116 } 1117 } 1118 function megamenu_close_progress() { 1119 $(this).find('h2').removeClass('megamenu-active'); 1120 } 1121 1122 $('.megamenu-parent').bind('megamenu_open', megamenu_open_progress); 1123 $('.megamenu-parent').bind('megamenu_close', megamenu_close_progress); 1124 1125 $('.megamenu-parent-title').bind('mouseover', megamenu_open); 1126 $('.megamenu-parent-title').bind('mouseout', megamenu_timer); 1127 1128 $('.megamenu-bin').bind('mouseover', megamenu_open); 1129 $('.megamenu-bin').bind('mouseout', megamenu_timer); 1130 1131 $("body").bind('click', megamenu_closeAll); 1132 $(".megamenu-menu").bind('click', megamenu_stopPropagation); 1133 1134 $(window).bind('resize', megamenu_sizer); 1135 megamenu_sizetimer(); 1136 } 1137 } 1138})(jQuery); 1139; 1140/*! 1141 * jQuery meanMenu v2.0.6 (Drupal Responsive Menus version) 1142 * @Copyright (C) 2012-2013 Chris Wharton (https://github.com/weare2ndfloor/meanMenu) 1143 * 1144 */ 1145(function(e){"use strict";e.fn.meanmenu=function(t){var n={meanMenuTarget:jQuery(this),meanMenuContainer:"body",meanMenuClose:"X",meanMenuCloseSize:"18px",meanMenuOpen:"<span /><span /><span />",meanRevealPosition:"right",meanRevealPositionDistance:"0",meanRevealColour:"",meanRevealHoverColour:"",meanScreenWidth:"480",meanNavPush:"",meanShowChildren:true,meanExpandableChildren:true,meanExpand:"+",meanContract:"-",meanRemoveAttrs:false,onePage:false,removeElements:""};var t=e.extend(n,t);var r=document.documentElement.clientWidth||document.body.clientWidth;return this.each(function(){function x(){if(a=="center"){var e=document.documentElement.clientWidth||document.body.clientWidth;var t=e/2-22+"px";C="left:"+t+";right:auto;";if(!S){jQuery(".meanmenu-reveal").css("left",t)}else{jQuery(".meanmenu-reveal").animate({left:t})}}}function A(){if(jQuery(L).is(".meanmenu-reveal.meanclose")){L.html(s)}else{L.html(u)}}function O(){jQuery(".mean-bar,.mean-push").remove();jQuery(i).removeClass("mean-container");jQuery(e).show();T=false;N=false;jQuery(E).removeClass("mean-remove")}function M(){if(r<=h){jQuery(E).addClass("mean-remove");N=true;jQuery(i).addClass("mean-container");jQuery(".mean-container").prepend('<div class="mean-bar"><a href="#nav" class="meanmenu-reveal" style="'+k+'">Show Navigation</a><nav class="mean-nav"></nav></div>');var t=jQuery(n).html();jQuery(".mean-nav").html(t);if(b){jQuery("nav.mean-nav ul, nav.mean-nav ul *").each(function(){jQuery(this).removeAttr("class");jQuery(this).removeAttr("id")})}jQuery(e).before('<div class="mean-push" />');jQuery(".mean-push").css("margin-top",p);jQuery(e).hide();jQuery(".meanmenu-reveal").show();jQuery(d).html(u);L=jQuery(d);jQuery(".mean-nav ul").hide();if(v){if(m){jQuery(".mean-nav ul ul").each(function(){if(jQuery(this).children().length){jQuery(this,"li:first").parent().append('<a class="mean-expand" href="#" style="font-size: '+o+'">'+g+"</a>")}});jQuery(".mean-expand").on("click",function(e){e.preventDefault();if(jQuery(this).hasClass("mean-clicked")){jQuery(this).text(g);jQuery(this).prev("ul").slideUp(300,function(){})}else{jQuery(this).text(y);jQuery(this).prev("ul").slideDown(300,function(){})}jQuery(this).toggleClass("mean-clicked")})}else{jQuery(".mean-nav ul ul").show()}}else{jQuery(".mean-nav ul ul").hide()}jQuery(".mean-nav ul li").last().addClass("mean-last");L.removeClass("meanclose");jQuery(L).click(function(e){e.preventDefault();if(T==false){L.css("text-align","center");L.css("text-indent","0");L.css("font-size",o);jQuery(".mean-nav ul:first").slideDown();T=true}else{jQuery(".mean-nav ul:first").slideUp();T=false}L.toggleClass("meanclose");A();jQuery(E).addClass("mean-remove")});if(w){jQuery(".mean-nav ul > li > a:first-child").on("click",function(){jQuery(".mean-nav ul:first").slideUp();T=false;jQuery(L).toggleClass("meanclose").html(u)})}}else{O()}}var e=t.meanMenuTarget;var n=t.meanMenuTarget.clone();n.find(".contextual-links-wrapper").remove().find("ul.contextual-links").remove();var i=t.meanMenuContainer;var s=t.meanMenuClose;var o=t.meanMenuCloseSize;var u=t.meanMenuOpen;var a=t.meanRevealPosition;var f=t.meanRevealPositionDistance;var l=t.meanRevealColour;var c=t.meanRevealHoverColour;var h=t.meanScreenWidth;var p=t.meanNavPush;var d=".meanmenu-reveal";var v=t.meanShowChildren;var m=t.meanExpandableChildren;var g=t.meanExpand;var y=t.meanContract;var b=t.meanRemoveAttrs;var w=t.onePage;var E=t.removeElements;if(navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPod/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/Android/i)||navigator.userAgent.match(/Blackberry/i)||navigator.userAgent.match(/Windows Phone/i)){var S=true}if(navigator.userAgent.match(/MSIE 8/i)||navigator.userAgent.match(/MSIE 7/i)){jQuery("html").css("overflow-y","scroll")}var T=false;var N=false;if(a=="right"){C="right:"+f+";left:auto;"}
1145if(a=="left"){var C="left:"+f+";right:auto;"}x();var k="background:"+l+";color:"+l+";"+C;var L="";if(!S){jQuery(window).resize(function(){r=document.documentElement.clientWidth||document.body.clientWidth;if(r>h){O()}else{O()}if(r<=h){M();x()}else{O()}})}window.onorientationchange=function(){x();r=document.documentElement.clientWidth||document.body.clientWidth;if(r>=h){O()}if(r<=h){if(N==false){M()}}};M()})}})(jQuery) 1146; 1147/** 1148 * @file 1149 * Integrate Mean Menu library with Responsive Menus module. 1150 */ 1151(function ($) { 1152 Drupal.behaviors.responsive_menus_mean_menu = { 1153 attach: function (context, settings) { 1154 settings.responsive_menus = settings.responsive_menus || {}; 1155 $.each(settings.responsive_menus, function(ind, iteration) { 1156 if (iteration.responsive_menus_style != 'mean_menu') { 1157 return true; 1158 } 1159 if (!iteration.selectors.length) { 1160 return; 1161 } 1162 // Set 1/0 to true/false respectively. 1163 $.each(iteration, function(key, value) { 1164 if (value == 0) { 1165 iteration[key] = false; 1166 } 1167 if (value == 1) { 1168 iteration[key] = true; 1169 } 1170 }); 1171 // Call meanmenu() with our custom settings. 1172 $(iteration.selectors).once('responsive-menus-mean-menu', function() { 1173 $(this).meanmenu({ 1174 meanMenuClose: iteration.close_txt || "X", 1175 meanMenuCloseSize: iteration.close_size || "18px", 1176 meanMenuOpen: iteration.trigger_txt || "<span /><span /><span />", 1177 meanRevealPosition: iteration.position || "right", 1178 meanScreenWidth: iteration.media_size || "480", 1179 meanExpand: iteration.expand_txt || "+", 1180 meanContract: iteration.contract_txt || "-", 1181 meanShowChildren: iteration.show_children, 1182 meanExpandableChildren: iteration.expand_children, 1183 meanRemoveAttrs: iteration.remove_attrs 1184 }); 1185 }); 1186 }); 1187 1188 } 1189 }; 1190}(jQuery)); 1191; 1192(function ($) { 1193 1194Drupal.googleanalytics = {}; 1195 1196$(document).ready(function() { 1197 1198 // Attach mousedown, keyup, touchstart events to document only and catch 1199 // clicks on all elements. 1200 $(document.body).bind("mousedown keyup touchstart", function(event) { 1201 1202 // Catch the closest surrounding link of a clicked element. 1203 $(event.target).closest("a,area").each(function() { 1204 1205 // Is the clicked URL internal? 1206 if (Drupal.googleanalytics.isInternal(this.href)) { 1207 // Skip 'click' tracking, if custom tracking events are bound. 1208 if ($(this).is('.colorbox') && (Drupal.settings.googleanalytics.trackColorbox)) { 1209 // Do nothing here. The custom event will handle all tracking. 1210 //console.info("Click on .colorbox item has been detected."); 1211 } 1212 // Is download tracking activated and the file extension configured for download tracking? 1213 else if (Drupal.settings.googleanalytics.trackDownload && Drupal.googleanalytics.isDownload(this.href)) { 1214 // Download link clicked. 1215 ga("send", { 1216 "hitType": "event", 1217 "eventCategory": "Downloads", 1218 "eventAction": Drupal.googleanalytics.getDownloadExtension(this.href).toUpperCase(), 1219 "eventLabel": Drupal.googleanalytics.getPageUrl(this.href), 1220 "transport": "beacon" 1221 }); 1222 } 1223 else if (Drupal.googleanalytics.isInternalSpecial(this.href)) { 1224 // Keep the internal URL for Google Analytics website overlay intact. 1225 ga("send", { 1226 "hitType": "pageview", 1227 "page": Drupal.googleanalytics.getPageUrl(this.href), 1228 "transport": "beacon" 1229 }); 1230 } 1231 } 1232 else { 1233 if (Drupal.settings.googleanalytics.trackMailto && $(this).is("a[href^='mailto:'],area[href^='mailto:']")) { 1234 // Mailto link clicked. 1235 ga("send", { 1236 "hitType": "event", 1237 "eventCategory": "Mails", 1238 "eventAction": "Click", 1239 "eventLabel": this.href.substring(7), 1240 "transport": "beacon" 1241 }); 1242 } 1243 else if (Drupal.settings.googleanalytics.trackOutbound && this.href.match(/^\w+:\/\//i)) { 1244 if (Drupal.settings.googleanalytics.trackDomainMode !== 2 || (Drupal.settings.googleanalytics.trackDomainMode === 2 && !Drupal.googleanalytics.isCrossDomain(this.hostname, Drupal.settings.googleanalytics.trackCrossDomains))) { 1245 // External link clicked / No top-level cross domain clicked. 1246 ga("send", { 1247 "hitType": "event", 1248 "eventCategory": "Outbound links", 1249 "eventAction": "Click", 1250 "eventLabel": this.href, 1251 "transport": "beacon" 1252 }); 1253 } 1254 } 1255 } 1256 }); 1257 }); 1258 1259 // Track hash changes as unique pageviews, if this option has been enabled. 1260 if (Drupal.settings.googleanalytics.trackUrlFragments) { 1261 window.onhashchange = function() { 1262 ga("send", { 1263 "hitType": "pageview", 1264 "page": location.pathname + location.search + location.hash 1265 }); 1266 }; 1267 } 1268 1269 // Colorbox: This event triggers when the transition has completed and the 1270 // newly loaded content has been revealed. 1271 if (Drupal.settings.googleanalytics.trackColorbox) { 1272 $(document).bind("cbox_complete", function () {
1273 var href = $.colorbox.element().attr("href"); 1274 if (href) { 1275 ga("send", { 1276 "hitType": "pageview", 1277 "page": Drupal.googleanalytics.getPageUrl(href) 1278 }); 1279 } 1280 }); 1281 } 1282 1283}); 1284 1285/** 1286 * Check whether the hostname is part of the cross domains or not. 1287 * 1288 * @param string hostname 1289 * The hostname of the clicked URL. 1290 * @param array crossDomains 1291 * All cross domain hostnames as JS array. 1292 * 1293 * @return boolean 1294 */ 1295Drupal.googleanalytics.isCrossDomain = function (hostname, crossDomains) { 1296 /** 1297 * jQuery < 1.6.3 bug: $.inArray crushes IE6 and Chrome if second argument is 1298 * `null` or `undefined`, http://bugs.jquery.com/ticket/10076, 1299 * https://github.com/jquery/jquery/commit/a839af034db2bd934e4d4fa6758a3fed8de74174 1300 * 1301 * @todo: Remove/Refactor in D8 1302 */ 1303 if (!crossDomains) { 1304 return false; 1305 } 1306 else { 1307 return $.inArray(hostname, crossDomains) > -1 ? true : false; 1308 } 1309}; 1310 1311/** 1312 * Check whether this is a download URL or not. 1313 * 1314 * @param string url 1315 * The web url to check. 1316 * 1317 * @return boolean 1318 */ 1319Drupal.googleanalytics.isDownload = function (url) { 1320 var isDownload = new RegExp("\\.(" + Drupal.settings.googleanalytics.trackDownloadExtensions + ")([\?#].*)?$", "i"); 1321 return isDownload.test(url); 1322}; 1323 1324/** 1325 * Check whether this is an absolute internal URL or not. 1326 * 1327 * @param string url 1328 * The web url to check. 1329 * 1330 * @return boolean 1331 */ 1332Drupal.googleanalytics.isInternal = function (url) { 1333 var isInternal = new RegExp("^(https?):\/\/" + window.location.host, "i"); 1334 return isInternal.test(url); 1335}; 1336 1337/** 1338 * Check whether this is a special URL or not. 1339 * 1340 * URL types: 1341 * - gotwo.module /go/* links. 1342 * 1343 * @param string url 1344 * The web url to check. 1345 * 1346 * @return boolean 1347 */ 1348Drupal.googleanalytics.isInternalSpecial = function (url) { 1349 var isInternalSpecial = new RegExp("(\/go\/.*)$", "i"); 1350 return isInternalSpecial.test(url); 1351}; 1352 1353/** 1354 * Extract the relative internal URL from an absolute internal URL. 1355 * 1356 * Examples: 1357 * - http://mydomain.com/node/1 -> /node/1 1358 * - http://example.com/foo/bar -> http://example.com/foo/bar 1359 * 1360 * @param string url 1361 * The web url to check. 1362 * 1363 * @return string 1364 * Internal website URL 1365 */ 1366Drupal.googleanalytics.getPageUrl = function (url) { 1367 var extractInternalUrl = new RegExp("^(https?):\/\/" + window.location.host, "i"); 1368 return url.replace(extractInternalUrl, ''); 1369}; 1370 1371/** 1372 * Extract the download file extension from the URL. 1373 * 1374 * @param string url 1375 * The web url to check. 1376 * 1377 * @return string 1378 * The file extension of the passed url. e.g. "zip", "txt" 1379 */ 1380Drupal.googleanalytics.getDownloadExtension = function (url) { 1381 var extractDownloadextension = new RegExp("\\.(" + Drupal.settings.googleanalytics.trackDownloadExtensions + ")([\?#].*)?$", "i"); 1382 var extension = extractDownloadextension.exec(url); 1383 return (extension === null) ? '' : extension[1]; 1384}; 1385 1386})(jQuery); 1387;
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.