https://bicycleretailer.com/sites/default/files/js/js_OWJVqQdI1J0Bu4TUO_oVoUZ2zWYQZG30AopmxSYvHig.js
vendor: 4,720 bytes, lines 1-6
1/*! 2 Colorbox 1.6.1 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 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("className")),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("
6createImg"),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",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(){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
vendor: 4,466 bytes, lines 6-69
6: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.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($){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);; 7/** 8 * @file 9 * Colorbox module init js. 10 */ 11 12(function ($) { 13 14Drupal.behaviors.initColorbox = { 15 attach: function (context, settings) { 16 if (!$.isFunction($.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') 40 .colorbox(settings.colorbox); 41 42 $(context).bind('cbox_complete', function () { 43 Drupal.attachBehaviors('#cboxLoadedContent'); 44 }); 45 } 46}; 47 48})(jQuery); 49; 50/** 51 * @file 52 * Colorbox module load js. 53 */ 54(function ($) { 55 56Drupal.behaviors.initColorboxLoad = { 57 attach: function (context, settings) { 58 if (!$.isFunction($.colorbox) || typeof settings.colorbox === 'undefined') { 59 return; 60 } 61 62 if (settings.colorbox.mobiledetect && window.matchMedia) { 63 // Disable Colorbox for small screens. 64 var mq = window.matchMedia("(max-device-width: " + settings.colorbox.mobiledevicewidth + ")"); 65 if (mq.matches) { 66 return; 67 } 68 } 69
70 $.urlParams = function (url) { 71 var p = {}, 72 e, 73 a = /\+/g, // Regex for replacing addition symbol with a space. 74 r = /([^&=]+)=?([^&]*)/g, 75 d = function (s) { return decodeURIComponent(s.replace(a, ' ')); }, 76 q = url.split('?'); 77 while (e = r.exec(q[1])) { 78 e[1] = d(e[1]); 79 e[2] = d(e[2]); 80 switch (e[2].toLowerCase()) { 81 case 'true': 82 case 'yes': 83 e[2] = true; 84 break; 85 case 'false': 86 case 'no': 87 e[2] = false; 88 break; 89 } 90 if (e[1] == 'width') { e[1] = 'innerWidth'; } 91 if (e[1] == 'height') { e[1] = 'innerHeight'; } 92 p[e[1]] = e[2]; 93 } 94 return p; 95 }; 96 $('.colorbox-load', context) 97 .once('init-colorbox-load', function () { 98 var params = $.urlParams($(this).attr('href')); 99 $(this).colorbox($.extend({}, settings.colorbox, params)); 100 }); 101 } 102}; 103 104})(jQuery); 105; 106/** 107 * @file 108 * Colorbox module inline js. 109 */ 110 111(function ($) { 112 113Drupal.behaviors.initColorboxInline = { 114 attach: function (context, settings) { 115 if (!$.isFunction($.colorbox) || typeof settings.colorbox === 'undefined') { 116 return; 117 } 118 119 if (settings.colorbox.mobiledetect && window.matchMedia) { 120 // Disable Colorbox for small screens. 121 var mq = window.matchMedia("(max-device-width: " + settings.colorbox.mobiledevicewidth + ")"); 122 if (mq.matches) { 123 return; 124 } 125 } 126 127 $.urlParam = function(name, url){ 128 if (name == 'fragment') { 129 var results = new RegExp('(#[^&#]*)').exec(url); 130 } 131 else { 132 var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(url); 133 } 134 if (!results) { return ''; } 135 return results[1] || ''; 136 }; 137 $('.colorbox-inline', context).once('init-colorbox-inline').colorbox({ 138 transition:settings.colorbox.transition, 139 speed:settings.colorbox.speed, 140 opacity:settings.colorbox.opacity, 141 slideshow:settings.colorbox.slideshow, 142 slideshowAuto:settings.colorbox.slideshowAuto, 143 slideshowSpeed:settings.colorbox.slideshowSpeed, 144 slideshowStart:settings.colorbox.slideshowStart, 145 slideshowStop:settings.colorbox.slideshowStop, 146 current:settings.colorbox.current, 147 previous:settings.colorbox.previous, 148 next:settings.colorbox.next, 149 close:settings.colorbox.close, 150 overlayClose:settings.colorbox.overlayClose, 151 maxWidth:settings.colorbox.maxWidth, 152 maxHeight:settings.colorbox.maxHeight, 153 innerWidth:function(){ 154 return $.urlParam('width', $(this).attr('href')); 155 }, 156 innerHeight:function(){ 157 return $.urlParam('height', $(this).attr('href')); 158 }, 159 title:function(){ 160 return decodeURIComponent($.urlParam('title', $(this).attr('href'))); 161 }, 162 iframe:function(){ 163 return $.urlParam('iframe', $(this).attr('href')); 164 }, 165 inline:function(){ 166 return $.urlParam('inline', $(this).attr('href')); 167 }, 168 href:function(){ 169 return $.urlParam('fragment', $(this).attr('href')); 170 } 171 }); 172 } 173}; 174 175})(jQuery); 176; 177/** 178 * @file 179 * Some basic behaviors and utility functions for Views. 180 */ 181(function ($) { 182 183 Drupal.Views = {}; 184 185 /** 186 * JQuery UI tabs, Views integration component. 187 */ 188 Drupal.behaviors.viewsTabs = { 189 attach: function (context) { 190 if ($.viewsUi && $.viewsUi.tabs) { 191 $('#views-tabset').once('views-processed').viewsTabs({ 192 selectedClass: 'active' 193 }); 194 } 195 196 $('a.views-remove-link').once('views-processed').click(function(event) { 197 var id = $(this).attr('id').replace('views-remove-link-', ''); 198 $('#views-row-' + id).hide(); 199 $('#views-removed-' + id).attr('checked', true); 200 event.preventDefault(); 201 }); 202 /** 203 * Here is to handle display deletion 204 * (checking in the hidden checkbox and hiding out the row). 205 */ 206 $('a.display-remove-link') 207 .addClass('display-processed') 208 .click(function() { 209 var id = $(this).attr('id').replace('display-remove-link-', ''); 210 $('#display-row-' + id).hide(); 211 $('#display-removed-' + id).attr('checked', true); 212 return false;
213 }); 214 } 215 }; 216 217 /** 218 * Helper function to parse a querystring. 219 */ 220 Drupal.Views.parseQueryString = function (query) { 221 var args = {}; 222 var pos = query.indexOf('?'); 223 if (pos != -1) { 224 query = query.substring(pos + 1); 225 } 226 var pairs = query.split('&'); 227 for (var i in pairs) { 228 if (typeof(pairs[i]) == 'string') { 229 var pair = pairs[i].split('='); 230 // Ignore the 'q' path argument, if present. 231 if (pair[0] != 'q' && pair[1]) { 232 args[decodeURIComponent(pair[0].replace(/\+/g, ' '))] = decodeURIComponent(pair[1].replace(/\+/g, ' ')); 233 } 234 } 235 } 236 return args; 237 }; 238 239 /** 240 * Helper function to return a view's arguments based on a path. 241 */ 242 Drupal.Views.parseViewArgs = function (href, viewPath) { 243 244 // Provide language prefix. 245 if (Drupal.settings.pathPrefix) { 246 var viewPath = Drupal.settings.pathPrefix + viewPath; 247 } 248 var returnObj = {}; 249 var path = Drupal.Views.getPath(href); 250 // Ensure we have a correct path. 251 if (viewPath && path.substring(0, viewPath.length + 1) == viewPath + '/') { 252 var args = decodeURIComponent(path.substring(viewPath.length + 1, path.length)); 253 returnObj.view_args = args; 254 returnObj.view_path = path; 255 } 256 return returnObj; 257 }; 258 259 /** 260 * Strip off the protocol plus domain from an href. 261 */ 262 Drupal.Views.pathPortion = function (href) { 263 // Remove e.g. http://example.com if present. 264 var protocol = window.location.protocol; 265 if (href.substring(0, protocol.length) == protocol) { 266 // 2 is the length of the '//' that normally follows the protocol. 267 href = href.substring(href.indexOf('/', protocol.length + 2)); 268 } 269 return href; 270 }; 271 272 /** 273 * Return the Drupal path portion of an href. 274 */ 275 Drupal.Views.getPath = function (href) { 276 href = Drupal.Views.pathPortion(href); 277 href = href.substring(Drupal.settings.basePath.length, href.length); 278 // 3 is the length of the '?q=' added to the url without clean urls. 279 if (href.substring(0, 3) == '?q=') { 280 href = href.substring(3, href.length); 281 } 282 var chars = ['#', '?', '&']; 283 for (var i in chars) { 284 if (href.indexOf(chars[i]) > -1) { 285 href = href.substr(0, href.indexOf(chars[i])); 286 } 287 } 288 return href; 289 }; 290 291})(jQuery); 292; 293(function ($) { 294 295/** 296 * A progressbar object. Initialized with the given id. Must be inserted into 297 * the DOM afterwards through progressBar.element. 298 * 299 * method is the function which will perform the HTTP request to get the 300 * progress bar state. Either "GET" or "POST". 301 * 302 * e.g. pb = new progressBar('myProgressBar'); 303 * some_element.appendChild(pb.element); 304 */ 305Drupal.progressBar = function (id, updateCallback, method, errorCallback) { 306 var pb = this; 307 this.id = id; 308 this.method = method || 'GET'; 309 this.updateCallback = updateCallback; 310 this.errorCallback = errorCallback; 311 312 // The WAI-ARIA setting aria-live="polite" will announce changes after users 313 // have completed their current activity and not interrupt the screen reader. 314 this.element = $('<div class="progress" aria-live="polite"></div>').attr('id', id); 315 this.element.html('<div class="bar"><div class="filled"></div></div>' + 316 '<div class="percentage"></div>' + 317 '<div class="message"> </div>'); 318}; 319 320/** 321 * Set the percentage and status message for the progressbar. 322 */ 323Drupal.progressBar.prototype.setProgress = function (percentage, message) { 324 if (percentage >= 0 && percentage <= 100) { 325 $('div.filled', this.element).css('width', percentage + '%'); 326 $('div.percentage', this.element).html(percentage + '%'); 327 } 328 $('div.message', this.element).html(message); 329 if (this.updateCallback) { 330 this.updateCallback(percentage, message, this); 331 } 332}; 333 334/** 335 * Start monitoring progress via Ajax. 336 */ 337Drupal.progressBar.prototype.startMonitoring = function (uri, delay) { 338 this.delay = delay; 339 this.uri = uri; 340 this.sendPing(); 341}; 342 343/** 344 * Stop monitoring progress via Ajax. 345 */ 346Drupal.progressBar.prototype.stopMonitoring = function () { 347 clearTimeout(this.timer); 348 // This allows monitoring to be stopped from within the callback. 349 this.uri = null; 350}; 351 352/** 353 * Request progress data from server. 354 */ 355Drupal.progressBar.prototype.sendPing = function () { 356 if (this.timer) { 357 clearTimeout(this.timer); 358 } 359 if (this.uri) { 360 var pb = this; 361 // When doing a post request, you need non-null data. Otherwise a 362 // HTTP 411 or HTTP 406 (with Apache mod_security) error may result. 363 $.ajax({ 364 type: this.method, 365 url: this.uri, 366 data: '', 367 dataType: 'json', 368 success: function (progress) { 369 // Display errors. 370 if (progress.status == 0) { 371 pb.displayError(progress.data); 372 return; 373 } 374 // Update display. 375 pb.setProgress(progress.percentage, progress.message); 376 // Schedule next timer.
377 pb.timer = setTimeout(function () { pb.sendPing(); }, pb.delay); 378 }, 379 error: function (xmlhttp) { 380 pb.displayError(Drupal.ajaxError(xmlhttp, pb.uri)); 381 } 382 }); 383 } 384}; 385 386/** 387 * Display errors on the page. 388 */ 389Drupal.progressBar.prototype.displayError = function (string) { 390 var error = $('<div class="messages error"></div>').html(string); 391 $(this.element).before(error).hide(); 392 393 if (this.errorCallback) { 394 this.errorCallback(this); 395 } 396}; 397 398})(jQuery); 399; 400/** 401 * @file 402 * Handles AJAX fetching of views, including filter submission and response. 403 */ 404(function ($) { 405 406 /** 407 * Attaches the AJAX behavior to exposed filter forms and key views links. 408 */ 409 Drupal.behaviors.ViewsAjaxView = {}; 410 Drupal.behaviors.ViewsAjaxView.attach = function() { 411 if (Drupal.settings && Drupal.settings.views && Drupal.settings.views.ajaxViews) { 412 $.each(Drupal.settings.views.ajaxViews, function(i, settings) { 413 Drupal.views.instances[i] = new Drupal.views.ajaxView(settings); 414 }); 415 } 416 }; 417 418 Drupal.views = {}; 419 Drupal.views.instances = {}; 420 421 /** 422 * JavaScript object for a certain view. 423 */ 424 Drupal.views.ajaxView = function(settings) { 425 var selector = '.view-dom-id-' + settings.view_dom_id; 426 this.$view = $(selector); 427 428 // Retrieve the path to use for views' ajax. 429 var ajax_path = Drupal.settings.views.ajax_path; 430 431 // If there are multiple views this might've ended up showing up multiple 432 // times. 433 if (ajax_path.constructor.toString().indexOf("Array") != -1) { 434 ajax_path = ajax_path[0]; 435 } 436 437 // Check if there are any GET parameters to send to views. 438 var queryString = window.location.search || ''; 439 if (queryString !== '') { 440 // Remove the question mark and Drupal path component if any. 441 var queryString = queryString.slice(1).replace(/q=[^&]+&?|&?render=[^&]+/, ''); 442 if (queryString !== '') { 443 // If there is a '?' in ajax_path, clean url are on and & should be 444 // used to add parameters. 445 queryString = ((/\?/.test(ajax_path)) ? '&' : '?') + queryString; 446 } 447 } 448 449 this.element_settings = { 450 url: ajax_path + queryString, 451 submit: settings, 452 setClick: true, 453 event: 'click', 454 selector: selector, 455 progress: { 456 type: 'throbber' 457 } 458 }; 459 460 this.settings = settings; 461 462 // Add the ajax to exposed forms. 463 this.$exposed_form = $('#views-exposed-form-' + settings.view_name.replace(/_/g, '-') + '-' + settings.view_display_id.replace(/_/g, '-')); 464 this.$exposed_form.once(jQuery.proxy(this.attachExposedFormAjax, this)); 465 466 // Store Drupal.ajax objects here for all pager links. 467 this.links = []; 468 469 // Add the ajax to pagers. 470 this.$view 471 .once(jQuery.proxy(this.attachPagerAjax, this)); 472 473 // Add a trigger to update this view specifically. In order to trigger a 474 // refresh use the following code. 475 // 476 // @code 477 // jQuery('.view-name').trigger('RefreshView'); 478 // @endcode 479 // Add a trigger to update this view specifically. 480 var self_settings = this.element_settings; 481 self_settings.event = 'RefreshView'; 482 this.refreshViewAjax = new Drupal.ajax(this.selector, this.$view, self_settings); 483 }; 484 485 Drupal.views.ajaxView.prototype.attachExposedFormAjax = function() { 486 var button = $('input[type=submit], button[type=submit], input[type=image]', this.$exposed_form); 487 button = button[0]; 488 489 // Call the autocomplete submit before doing AJAX. 490 $(button).click(function () { 491 if (Drupal.autocompleteSubmit) { 492 Drupal.autocompleteSubmit(); 493 } 494 }); 495 496 this.exposedFormAjax = new Drupal.ajax($(button).attr('id'), button, this.element_settings); 497 }; 498 499 /** 500 * Attach the ajax behavior to each link. 501 */ 502 Drupal.views.ajaxView.prototype.attachPagerAjax = function() { 503 this.$view.find('ul.pager > li > a, th.views-field a, .attachment .views-summary a') 504 .each(jQuery.proxy(this.attachPagerLinkAjax, this)); 505 }; 506 507 /** 508 * Attach the ajax behavior to a singe link. 509 */ 510 Drupal.views.ajaxView.prototype.attachPagerLinkAjax = function(id, link) { 511 var $link = $(link); 512 // Don't attach to pagers inside nested views. 513 if ($link.closest('.view')[0] !== this.$view[0]) { 514 return; 515 } 516 var viewData = {}; 517 var href = $link.attr('href'); 518 519 // Provide a default page if none has been set. This must be done 520 // prior to merging with settings to avoid accidentally using the 521 // page landed on instead of page 1. 522 if (typeof(viewData.page) === 'undefined') { 523 viewData.page = 0; 524 } 525 526 // Construct an object using the settings defaults and then overriding 527 // with data specific to the link. 528 $.extend( 529 viewData, 530 this.settings, 531 Drupal.Views.parseQueryString(href), 532 // Extract argument data from the URL. 533 Drupal.Views.parseViewArgs(href, this.settings.view_base_path) 534 ); 535
536 // For anchor tags, these will go to the target of the anchor rather 537 // than the usual location. 538 $.extend(viewData, Drupal.Views.parseViewArgs(href, this.settings.view_base_path)); 539 540 this.element_settings.submit = viewData; 541 this.pagerAjax = new Drupal.ajax(false, $link, this.element_settings); 542 this.links.push(this.pagerAjax); 543 }; 544 545 Drupal.ajax.prototype.commands.viewsScrollTop = function (ajax, response, status) { 546 // Scroll to the top of the view. This will allow users 547 // to browse newly loaded content after e.g. clicking a pager 548 // link. 549 var offset = $(response.selector).offset(); 550 // We can't guarantee that the scrollable object should be 551 // the body, as the view could be embedded in something 552 // more complex such as a modal popup. Recurse up the DOM 553 // and scroll the first element that has a non-zero top. 554 var scrollTarget = response.selector; 555 while ($(scrollTarget).scrollTop() == 0 && $(scrollTarget).parent()) { 556 scrollTarget = $(scrollTarget).parent(); 557 } 558 // Only scroll upward. 559 if (offset.top - 10 < $(scrollTarget).scrollTop()) { 560 $(scrollTarget).animate({scrollTop: (offset.top - 10)}, 500); 561 } 562 }; 563 564})(jQuery); 565;
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.