1 2/* 3 * jQuery UI Effects 1.8.7 4 * 5 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) 6 * Dual licensed under the MIT or GPL Version 2 licenses. 7 * http://jquery.org/license 8 * 9 * http://docs.jquery.com/UI/Effects/ 10 */ 11jQuery.effects||function(f,j){function n(c){var a;if(c&&c.constructor==Array&&c.length==3)return c;if(a=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c))return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10)];if(a=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c))return[parseFloat(a[1])*2.55,parseFloat(a[2])*2.55,parseFloat(a[3])*2.55];if(a=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c))return[parseInt(a[1], 1216),parseInt(a[2],16),parseInt(a[3],16)];if(a=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c))return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)];if(/rgba\(0, 0, 0, 0\)/.exec(c))return o.transparent;return o[f.trim(c).toLowerCase()]}function s(c,a){var b;do{b=f.curCSS(c,a);if(b!=""&&b!="transparent"||f.nodeName(c,"body"))break;a="backgroundColor"}while(c=c.parentNode);return n(b)}function p(){var c=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle, 13a={},b,d;if(c&&c.length&&c[0]&&c[c[0]])for(var e=c.length;e--;){b=c[e];if(typeof c[b]=="string"){d=b.replace(/\-(\w)/g,function(g,h){return h.toUpperCase()});a[d]=c[b]}}else for(b in c)if(typeof c[b]==="string")a[b]=c[b];return a}function q(c){var a,b;for(a in c){b=c[a];if(b==null||f.isFunction(b)||a in t||/scrollbar/.test(a)||!/color/i.test(a)&&isNaN(parseFloat(b)))delete c[a]}return c}function u(c,a){var b={_:0},d;for(d in a)if(c[d]!=a[d])b[d]=a[d];return b}function k(c,a,b,d){if(typeof c=="object"){d= 14a;b=null;a=c;c=a.effect}if(f.isFunction(a)){d=a;b=null;a={}}if(typeof a=="number"||f.fx.speeds[a]){d=b;b=a;a={}}if(f.isFunction(b)){d=b;b=null}a=a||{};b=b||a.duration;b=f.fx.off?0:typeof b=="number"?b:b in f.fx.speeds?f.fx.speeds[b]:f.fx.speeds._default;d=d||a.complete;return[c,a,b,d]}function m(c){if(!c||typeof c==="number"||f.fx.speeds[c])return true;
14if(typeof c==="string"&&!f.effects[c])return true;return false}f.effects={};f.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor", 15"borderTopColor","borderColor","color","outlineColor"],function(c,a){f.fx.step[a]=function(b){if(!b.colorInit){b.start=s(b.elem,a);b.end=n(b.end);b.colorInit=true}b.elem.style[a]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],10),255),0)+")"}});var o={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0, 160,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211, 17211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},r=["add","remove","toggle"],t={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};f.effects.animateClass=function(c,a,b, 18d){if(f.isFunction(b)){d=b;b=null}return this.each(function(){f.queue(this,"fx",function(){var e=f(this),g=e.attr("style")||" ",h=q(p.call(this)),l,v=e.attr("className");f.each(r,function(w,i){c[i]&&e[i+"Class"](c[i])});l=q(p.call(this));e.attr("className",v);e.animate(u(h,l),a,b,function(){f.each(r,function(w,i){c[i]&&e[i+"Class"](c[i])});if(typeof e.attr("style")=="object"){e.attr("style").cssText="";e.attr("style").cssText=g}else e.attr("style",g);d&&d.apply(this,arguments)});h=f.queue(this);l= 19h.splice(h.length-1,1)[0];h.splice(1,0,l);f.dequeue(this)})})};f.fn.extend({_addClass:f.fn.addClass,addClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{add:c},a,b,d]):this._addClass(c)},_removeClass:f.fn.removeClass,removeClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{remove:c},a,b,d]):this._removeClass(c)},_toggleClass:f.fn.toggleClass,toggleClass:function(c,a,b,d,e){return typeof a=="boolean"||a===j?b?f.effects.animateClass.apply(this,[a?{add:c}:{remove:c}, 20b,d,e]):this._toggleClass(c,a):f.effects.animateClass.apply(this,[{toggle:c},a,b,d])},switchClass:function(c,a,b,d,e){return f.effects.animateClass.apply(this,[{add:a,remove:c},b,d,e])}});f.extend(f.effects,{version:"1.8.7",save:function(c,a){for(var b=0;b<a.length;b++)a[b]!==null&&c.data("ec.storage."+a[b],c[0].style[a[b]])},restore:function(c,a){for(var b=0;b<a.length;b++)a[b]!==null&&c.css(a[b],c.data("ec.storage."+a[b]))},setMode:function(c,a){if(a=="toggle")a=c.is(":hidden")?"show":"hide"; 21return a},getBaseline:function(c,a){var b;switch(c[0]){case "top":b=0;break;case "middle":b=0.5;break;case "bottom":b=1;break;default:b=c[0]/a.height}switch(c[1]){case "left":c=0;break;case "center":c=0.5;break;case "right":c=1;break;default:c=c[1]/a.width}return{x:c,y:b}},createWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent();var a={width:c.outerWidth(true),height:c.outerHeight(true),"float":c.css("float")},b=f("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%", 22background:"transparent",border:"none",margin:0,padding:0});c.wrap(b);b=c.parent();if(c.css("position")=="static"){b.css({position:"relative"});c.css({position:"relative"})}else{f.extend(a,{position:c.css("position"),zIndex:c.css("z-index")});f.each(["top","left","bottom","right"],function(d,e){a[e]=c.css(e);if(isNaN(parseInt(a[e],10)))a[e]="auto"});c.css({position:"relative",top:0,left:0})}return b.css(a).show()},removeWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent().replaceWith(c); 23return c},setTransition:function(c,a,b,d){d=d||{};f.each(a,function(e,g){unit=c.cssUnit(g);if(unit[0]>0)d[g]=unit[0]*b+unit[1]});return d}});f.fn.extend({effect:function(c){var a=k.apply(this,arguments),b={options:a[1],duration:a[2],callback:a[3]};
23a=b.options.mode;var d=f.effects[c];if(f.fx.off||!d)return a?this[a](b.duration,b.callback):this.each(function(){b.callback&&b.callback.call(this)});return d.call(this,b)},_show:f.fn.show,show:function(c){if(m(c))return this._show.apply(this,arguments); 24else{var a=k.apply(this,arguments);a[1].mode="show";return this.effect.apply(this,a)}},_hide:f.fn.hide,hide:function(c){if(m(c))return this._hide.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="hide";return this.effect.apply(this,a)}},__toggle:f.fn.toggle,toggle:function(c){if(m(c)||typeof c==="boolean"||f.isFunction(c))return this.__toggle.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="toggle";return this.effect.apply(this,a)}},cssUnit:function(c){var a=this.css(c), 25b=[];f.each(["em","px","%","pt"],function(d,e){if(a.indexOf(e)>0)b=[parseFloat(a),e]});return b}});f.easing.jswing=f.easing.swing;f.extend(f.easing,{def:"easeOutQuad",swing:function(c,a,b,d,e){return f.easing[f.easing.def](c,a,b,d,e)},easeInQuad:function(c,a,b,d,e){return d*(a/=e)*a+b},easeOutQuad:function(c,a,b,d,e){return-d*(a/=e)*(a-2)+b},easeInOutQuad:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a+b;return-d/2*(--a*(a-2)-1)+b},easeInCubic:function(c,a,b,d,e){return d*(a/=e)*a*a+b},easeOutCubic:function(c, 26a,b,d,e){return d*((a=a/e-1)*a*a+1)+b},easeInOutCubic:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a+b;return d/2*((a-=2)*a*a+2)+b},easeInQuart:function(c,a,b,d,e){return d*(a/=e)*a*a*a+b},easeOutQuart:function(c,a,b,d,e){return-d*((a=a/e-1)*a*a*a-1)+b},easeInOutQuart:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a+b;return-d/2*((a-=2)*a*a*a-2)+b},easeInQuint:function(c,a,b,d,e){return d*(a/=e)*a*a*a*a+b},easeOutQuint:function(c,a,b,d,e){return d*((a=a/e-1)*a*a*a*a+1)+b},easeInOutQuint:function(c, 27a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a*a+b;return d/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(c,a,b,d,e){return-d*Math.cos(a/e*(Math.PI/2))+d+b},easeOutSine:function(c,a,b,d,e){return d*Math.sin(a/e*(Math.PI/2))+b},easeInOutSine:function(c,a,b,d,e){return-d/2*(Math.cos(Math.PI*a/e)-1)+b},easeInExpo:function(c,a,b,d,e){return a==0?b:d*Math.pow(2,10*(a/e-1))+b},easeOutExpo:function(c,a,b,d,e){return a==e?b+d:d*(-Math.pow(2,-10*a/e)+1)+b},easeInOutExpo:function(c,a,b,d,e){if(a==0)return b;if(a== 28e)return b+d;if((a/=e/2)<1)return d/2*Math.pow(2,10*(a-1))+b;return d/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(c,a,b,d,e){return-d*(Math.sqrt(1-(a/=e)*a)-1)+b},easeOutCirc:function(c,a,b,d,e){return d*Math.sqrt(1-(a=a/e-1)*a)+b},easeInOutCirc:function(c,a,b,d,e){if((a/=e/2)<1)return-d/2*(Math.sqrt(1-a*a)-1)+b;return d/2*(Math.sqrt(1-(a-=2)*a)+1)+b},easeInElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h<Math.abs(d)){h=d;c=g/4}else c= 29g/(2*Math.PI)*Math.asin(d/h);return-(h*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g))+b},easeOutElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);return h*Math.pow(2,-10*a)*Math.sin((a*e-c)*2*Math.PI/g)+d+b},easeInOutElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e/2)==2)return b+d;g||(g=e*0.3*1.5);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/ 30h);if(a<1)return-0.5*h*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g)+b;return h*Math.pow(2,-10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g)*0.5+d+b},easeInBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;return d*(a/=e)*a*((g+1)*a-g)+b},easeOutBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;return d*((a=a/e-1)*a*((g+1)*a+g)+1)+b},easeInOutBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;if((a/=e/2)<1)return d/2*a*a*(((g*=1.525)+1)*a-g)+b;return d/2*((a-=2)*a*(((g*=1.525)+1)*a+g)+2)+b},easeInBounce:function(c, 31a,b,d,e){return d-f.easing.easeOutBounce(c,e-a,0,d,e)+b},easeOutBounce:function(c,a,b,d,e){return(a/=e)<1/2.75?d*7.5625*a*a+b:a<2/2.75?d*(7.5625*(a-=1.5/2.75)*a+0.75)+b:a<2.5/2.75?d*(7.5625*(a-=2.25/2.75)*a+0.9375)+b:d*(7.5625*(a-=2.625/2.75)*a+0.984375)+b},easeInOutBounce:function(c,a,b,d,e){if(a<e/2)return f.easing.easeInBounce(c,a*2,0,d,e)*0.5+b;return f.easing.easeOutBounce(c,a*2-e,0,d,e)*0.5+d*0.5+b}})}(jQuery); 32; 33(function ($) { 34 Drupal.viewsSlideshow = Drupal.viewsSlideshow || {}; 35 36 /** 37 * Views Slideshow Controls 38 */ 39 Drupal.viewsSlideshowControls = Drupal.viewsSlideshowControls || {}; 40 41 /**
42 * Implement the play hook for controls. 43 */ 44 Drupal.viewsSlideshowControls.play = function (options) { 45 // Route the control call to the correct control type. 46 // Need to use try catch so we don't have to check to make sure every part 47 // of the object is defined. 48 try { 49 if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].play == 'function') { 50 Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].play(options); 51 } 52 } 53 catch(err) { 54 // Don't need to do anything on error. 55 } 56 57 try { 58 if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].play == 'function') { 59 Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].play(options); 60 } 61 } 62 catch(err) { 63 // Don't need to do anything on error. 64 } 65 }; 66 67 /** 68 * Implement the pause hook for controls. 69 */ 70 Drupal.viewsSlideshowControls.pause = function (options) { 71 // Route the control call to the correct control type. 72 // Need to use try catch so we don't have to check to make sure every part 73 // of the object is defined. 74 try { 75 if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].pause == 'function') { 76 Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].pause(options); 77 } 78 } 79 catch(err) { 80 // Don't need to do anything on error. 81 } 82 83 try { 84 if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].pause == 'function') { 85 Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].pause(options); 86 } 87 } 88 catch(err) { 89 // Don't need to do anything on error. 90 } 91 }; 92 93 94 /** 95 * Views Slideshow Text Controls 96 */ 97 98 // Add views slideshow api calls for views slideshow text controls. 99 Drupal.behaviors.viewsSlideshowControlsText = { 100 attach: function (context) { 101 102 // Process previous link 103 $('.views_slideshow_controls_text_previous:not(.views-slideshow-controls-text-previous-processed)', context).addClass('views-slideshow-controls-text-previous-processed').each(function() { 104 var uniqueID = $(this).attr('id').replace('views_slideshow_controls_text_previous_', ''); 105 $(this).click(function() { 106 Drupal.viewsSlideshow.action({ "action": 'previousSlide', "slideshowID": uniqueID }); 107 return false; 108 }); 109 }); 110 111 // Process next link 112 $('.views_slideshow_controls_text_next:not(.views-slideshow-controls-text-next-processed)', context).addClass('views-slideshow-controls-text-next-processed').each(function() { 113 var uniqueID = $(this).attr('id').replace('views_slideshow_controls_text_next_', ''); 114 $(this).click(function() { 115 Drupal.viewsSlideshow.action({ "action": 'nextSlide', "slideshowID": uniqueID }); 116 return false; 117 }); 118 }); 119 120 // Process pause link 121 $('.views_slideshow_controls_text_pause:not(.views-slideshow-controls-text-pause-processed)', context).addClass('views-slideshow-controls-text-pause-processed').each(function() { 122 var uniqueID = $(this).attr('id').replace('views_slideshow_controls_text_pause_', ''); 123 $(this).click(function() { 124 if (Drupal.settings.viewsSlideshow[uniqueID].paused) { 125 Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": uniqueID, "force": true }); 126 } 127 else { 128 Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": uniqueID, "force": true }); 129 } 130 return false; 131 }); 132 }); 133 } 134 }; 135 136 Drupal.viewsSlideshowControlsText = Drupal.viewsSlideshowControlsText || {}; 137 138 /** 139 * Implement the pause hook for text controls. 140 */ 141 Drupal.viewsSlideshowControlsText.pause = function (options) { 142 var pauseText = Drupal.theme.prototype['viewsSlideshowControlsPause'] ? Drupal.theme('viewsSlideshowControlsPause') : ''; 143 $('#views_slideshow_controls_text_pause_' + options.slideshowID + ' a').text(pauseText); 144 $('#views_slideshow_controls_text_pause_' + options.slideshowID).removeClass('views-sli
144deshow-controls-text-status-play'); 145 $('#views_slideshow_controls_text_pause_' + options.slideshowID).addClass('views-slideshow-controls-text-status-pause'); 146 }; 147 148 /** 149 * Implement the play hook for text controls. 150 */ 151 Drupal.viewsSlideshowControlsText.play = function (options) { 152 var playText = Drupal.theme.prototype['viewsSlideshowControlsPlay'] ? Drupal.theme('viewsSlideshowControlsPlay') : ''; 153 $('#views_slideshow_controls_text_pause_' + options.slideshowID + ' a').text(playText); 154 $('#views_slideshow_controls_text_pause_' + options.slideshowID).removeClass('views-slideshow-controls-text-status-pause'); 155 $('#views_slideshow_controls_text_pause_' + options.slideshowID).addClass('views-slideshow-controls-text-status-play'); 156 }; 157 158 // Theme the resume control. 159 Drupal.theme.prototype.viewsSlideshowControlsPause = function () { 160 return Drupal.t('Resume'); 161 }; 162 163 // Theme the pause control. 164 Drupal.theme.prototype.viewsSlideshowControlsPlay = function () { 165 return Drupal.t('Pause'); 166 }; 167 168 /** 169 * Views Slideshow Pager 170 */ 171 Drupal.viewsSlideshowPager = Drupal.viewsSlideshowPager || {}; 172 173 /** 174 * Implement the transitionBegin hook for pagers. 175 */ 176 Drupal.viewsSlideshowPager.transitionBegin = function (options) { 177 // Route the pager call to the correct pager type. 178 // Need to use try catch so we don't have to check to make sure every part 179 // of the object is defined. 180 try { 181 if (typeof Drupal.settings.viewsSlideshowPager != "undefined" && typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].transitionBegin == 'function') { 182 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].transitionBegin(options); 183 if (Drupal.settings.viewsSlideshowPager[options.slideshowID].top.master_pager === 1) { 184 $.each(Drupal.settings.viewsSlideshow, function(i, obj) { 185 if (i != options.slideshowID) { 186 options.slideshowID = i; 187 options.action = 'goToSlide'; 188 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].goToSlide(options); 189 } 190 }); 191 } 192 } 193 } 194 catch(err) { 195 // Don't need to do anything on error. 196 } 197 198 try { 199 if (typeof Drupal.settings.viewsSlideshowPager != "undefined" && typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].transitionBegin == 'function') { 200 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].transitionBegin(options); 201 if (Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.master_pager === 1) { 202 $.each(Drupal.settings.viewsSlideshow, function(i, obj) { 203 if (i != options.slideshowID) { 204 options.slideshowID = i; 205 options.action = 'goToSlide'; 206 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].goToSlide(options); 207 } 208 }); 209 } 210 } 211 } 212 catch(err) { 213 // Don't need to do anything on error. 214 } 215 }; 216 217 /** 218 * Implement the goToSlide hook for pagers. 219 */ 220 Drupal.viewsSlideshowPager.goToSlide = function (options) { 221 // Route the pager call to the correct pager type. 222 // Need to use try catch so we don't have to check to make sure every part 223 // of the object is defined. 224 try { 225 if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].goToSlide == 'function') { 226 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].goToSlide(options); 227 } 228 } 229 catch(err) { 230 // Don't need to do anything on error. 231 } 232 233 try { 234 if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].goToSlide == 'function') { 235 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].goToSlide(options); 236 } 237 } 238 catch(err) { 239 // Don't need to do anything on error. 240 } 241 }; 242 243 /** 244 * Implement the previousSlide hook for pagers. 245 */ 246 Drupal.viewsSlideshowPager.previousSlide = function (options) { 247 // Route the pager call to the correct pager type. 248 // Need to use try catch so we don't have to check to make sure every part 249 // of the object is defined. 250 try { 251 if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].previousSlide == 'function') { 252 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].previousSlide(options); 253 } 254 } 255 catch(err) { 256 // Don't need to do anything on error. 257 } 258 259 try { 260 if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].previousSlide == 'function') { 261 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].previousSlide(options); 262 } 263 } 264 catch(err) { 265 // Don't need to do anything on error. 266 } 267 }; 268 269 /** 270 * Implement the nextSlide hook for pagers. 271 */ 272 Drupal.viewsSlideshowPager.nextSlide = function (options) { 273 // Route the pager call to the correct pager type. 274 // Need to use try catch so we don't have to check to make sure every part 275 // of the object is defined. 276 try { 277 if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].nextSlide == 'function') { 278 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].nextSlide(options); 279 } 280 } 281 catch(err) { 282 // Don't need to do anything on error. 283 } 284 285 try { 286 if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].nextSlide == 'function') { 287 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].nextSlide(options); 288 } 289 } 290 catch(err) { 291 // Don't need to do anything on error. 292 } 293 }; 294 295 296 /** 297 * Views Slideshow Pager Fields 298 */ 299 300 // Add views slideshow api calls for views slideshow pager fields. 301 Drupal.behaviors.viewsSlideshowPagerFields = { 302 attach: function (context) { 303 // Process pause on hover.
304 $('.views_slideshow_pager_field:not(.views-slideshow-pager-field-processed)', context).addClass('views-slideshow-pager-field-processed').each(function() { 305 // Parse out the location and unique id from the full id. 306 var pagerInfo = $(this).attr('id').split('_'); 307 var location = pagerInfo[2]; 308 pagerInfo.splice(0, 3); 309 var uniqueID = pagerInfo.join('_'); 310 311 // Add the activate and pause on pager hover event to each pager item. 312 if (Drupal.settings.viewsSlideshowPagerFields[uniqueID][location].activatePauseOnHover) { 313 $(this).children().each(function(index, pagerItem) { 314 var mouseIn = function() { 315 Drupal.viewsSlideshow.action({ "action": 'goToSlide', "slideshowID": uniqueID, "slideNum": index }); 316 Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": uniqueID }); 317 }; 318 319 var mouseOut = function() { 320 Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": uniqueID }); 321 }; 322 323 if (jQuery.fn.hoverIntent) { 324 $(pagerItem).hoverIntent(mouseIn, mouseOut); 325 } 326 else { 327 $(pagerItem).hover(mouseIn, mouseOut); 328 } 329 }); 330 } 331 else { 332 $(this).children().each(function(index, pagerItem) { 333 $(pagerItem).click(function() { 334 Drupal.viewsSlideshow.action({ "action": 'goToSlide', "slideshowID": uniqueID, "slideNum": index }); 335 }); 336 }); 337 } 338 }); 339 } 340 }; 341 342 Drupal.viewsSlideshowPagerFields = Drupal.viewsSlideshowPagerFields || {}; 343 344 /** 345 * Implement the transitionBegin hook for pager fields pager. 346 */ 347 Drupal.viewsSlideshowPagerFields.transitionBegin = function (options) {
348 for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) { 349 // Remove active class from pagers 350 $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active'); 351 352 // Add active class to active pager. 353 $('#views_slideshow_pager_field_item_'+ pagerLocation + '_' + options.slideshowID + '_' + options.slideNum).addClass('active'); 354 } 355 }; 356 357 /** 358 * Implement the goToSlide hook for pager fields pager. 359 */ 360 Drupal.viewsSlideshowPagerFields.goToSlide = function (options) { 361 for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) { 362 // Remove active class from pagers 363 $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active'); 364 365 // Add active class to active pager. 366 $('#views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_' + options.slideNum).addClass('active'); 367 } 368 }; 369 370 /** 371 * Implement the previousSlide hook for pager fields pager. 372 */ 373 Drupal.viewsSlideshowPagerFields.previousSlide = function (options) {
374 for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) { 375 // Get the current active pager. 376 var pagerNum = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"].active').attr('id').replace('views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_', ''); 377 378 // If we are on the first pager then activate the last pager. 379 // Otherwise activate the previous pager. 380 if (pagerNum == 0) { 381 pagerNum = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').length() - 1; 382 } 383 else { 384 pagerNum--; 385 } 386 387 // Remove active class from pagers 388 $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active'); 389 390 // Add active class to active pager. 391 $('#views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_' + pagerNum).addClass('active'); 392 } 393 }; 394 395 /** 396 * Implement the nextSlide hook for pager fields pager. 397 */ 398 Drupal.viewsSlideshowPagerFields.nextSlide = function (options) {
399 for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) { 400 // Get the current active pager. 401 var pagerNum = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"].active').attr('id').replace('views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_', ''); 402 var totalPagers = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').length(); 403 404 // If we are on the last pager then activate the first pager. 405 // Otherwise activate the next pager. 406 pagerNum++; 407 if (pagerNum == totalPagers) { 408 pagerNum = 0; 409 } 410 411 // Remove active class from pagers 412 $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active'); 413 414 // Add active class to active pager. 415 $('#views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_' + slideNum).addClass('active'); 416 } 417 }; 418 419 420 /** 421 * Views Slideshow Slide Counter 422 */ 423 424 Drupal.viewsSlideshowSlideCounter = Drupal.viewsSlideshowSlideCounter || {}; 425 426 /** 427 * Implement the transitionBegin for the slide counter. 428 */ 429 Drupal.viewsSlideshowSlideCounter.transitionBegin = function (options) { 430 $('#views_slideshow_slide_counter_' + options.slideshowID + ' .num').text(options.slideNum + 1); 431 }; 432 433 /** 434 * This is used as a router to process actions for the slideshow. 435 */ 436 Drupal.viewsSlideshow.action = function (options) { 437 // Set default values for our return status. 438 var status = { 439 'value': true, 440 'text': '' 441 }; 442 443 // If an action isn't specified return false. 444 if (typeof options.action == 'undefined' || options.action == '') { 445 status.value = false; 446 status.text = Drupal.t('There was no action specified.'); 447 return error; 448 } 449 450 // If we are using pause or play switch paused state accordingly. 451 if (options.action == 'pause') { 452 Drupal.settings.viewsSlideshow[options.slideshowID].paused = 1; 453 // If the calling method is forcing a pause then mark it as such. 454 if (options.force) { 455 Drupal.settings.viewsSlideshow[options.slideshowID].pausedForce = 1; 456 } 457 } 458 else if (options.action == 'play') { 459 // If the slideshow isn't forced pause or we are forcing a play then play 460 // the slideshow. 461 // Otherwise return telling the calling method that it was forced paused. 462 if (!Drupal.settings.viewsSlideshow[options.slideshowID].pausedForce || options.force) { 463 Drupal.settings.viewsSlideshow[options.slideshowID].paused = 0; 464 Drupal.settings.viewsSlideshow[options.slideshowID].pausedForce = 0; 465 } 466 else { 467 status.value = false; 468 status.text += ' ' + Drupal.t('This slideshow is forced paused.'); 469 return status; 470 } 471 } 472 473 // We use a switch statement here mainly just to limit the type of actions 474 // that are available. 475 switch (options.action) { 476 case "goToSlide": 477 case "transitionBegin": 478 case "transitionEnd": 479 // The three methods above require a slide number. Checking if it is 480 // defined and it is a number that is an integer. 481 if (typeof options.slideNum == 'undefined' || typeof options.slideNum !== 'number' || parseInt(options.slideNum) != (options.slideNum - 0)) { 482 status.value = false; 483 status.text = Drupal.t('An invalid integer was specified for slideNum.'); 484 } 485 case "pause": 486 case "play": 487 case "nextSlide": 488 case "previousSlide": 489 // Grab our list of methods. 490 var methods = Drupal.settings.viewsSlideshow[options.slideshowID]['methods']; 491 492 // if the calling method specified methods that shouldn't be called then 493 // exclude calling them. 494 var excludeMethodsObj = {}; 495 if (typeof options.excludeMethods !== 'undefined') { 496 // We need to turn the excludeMethods array into an object so we can use the in 497 // function. 498 for (var i=0; i < excludeMethods.length; i++) { 499 excludeMethodsObj[excludeMethods[i]] = ''; 500 } 501 } 502 503 // Call every registered method and don't call excluded ones. 504 for (i = 0; i < methods[options.action].length; i++) { 505 if (Drupal[methods[options.action][i]] != undefined && typeof Drupal[methods[options.action][i]][options.action] == 'function' && !(methods[options.action][i] in excludeMethodsObj)) { 506 Drupal[methods[options.action][i]][options.action](options); 507 } 508 } 509 break; 510
511 // If it gets here it's because it's an invalid action. 512 default: 513 status.value = false; 514 status.text = Drupal.t('An invalid action "!action" was specified.', { "!action": options.action }); 515 } 516 return status; 517 }; 518})(jQuery); 519; 520 521/** 522 * Cookie plugin 1.0 523 * 524 * Copyright (c) 2006 Klaus Hartl (stilbuero.de) 525 * Dual licensed under the MIT and GPL licenses: 526 * http://www.opensource.org/licenses/mit-license.php 527 * http://www.gnu.org/licenses/gpl.html 528 * 529 */ 530jQuery.cookie=function(b,j,m){if(typeof j!="undefined"){m=m||{};if(j===null){j="";m.expires=-1}var e="";if(m.expires&&(typeof m.expires=="number"||m.expires.toUTCString)){var f;if(typeof m.expires=="number"){f=new Date();f.setTime(f.getTime()+(m.expires*24*60*60*1000))}else{f=m.expires}e="; expires="+f.toUTCString()}var l=m.path?"; path="+(m.path):"";var g=m.domain?"; domain="+(m.domain):"";var a=m.secure?"; secure":"";document.cookie=[b,"=",encodeURIComponent(j),e,l,g,a].join("")}else{var d=null;if(document.cookie&&document.cookie!=""){var k=document.cookie.split(";");for(var h=0;h<k.length;h++){var c=jQuery.trim(k[h]);if(c.substring(0,b.length+1)==(b+"=")){d=decodeURIComponent(c.substring(b.length+1));break}}}return d}}; 531; 532 533/*! 534 * jQuery Form Plugin 535 * version: 2.52 (07-DEC-2010) 536 * @requires jQuery v1.3.2 or later 537 * 538 * Examples and documentation at: http://malsup.com/jquery/form/ 539 * Dual licensed under the MIT and GPL licenses: 540 * http://www.opensource.org/licenses/mit-license.php 541 * http://www.gnu.org/licenses/gpl.html 542 */ 543;(function(b){function q(){if(b.fn.ajaxSubmit.debug){var a="[jquery.form] "+Array.prototype.join.call(arguments,"");if(window.console&&window.console.log)window.console.log(a);else window.opera&&window.opera.postError&&window.opera.postError(a)}}b.fn.ajaxSubmit=function(a){function f(){function t(){var o=i.attr("target"),m=i.attr("action");l.setAttribute("target",u);l.getAttribute("method")!="POST"&&l.setAttribute("method","POST");l.getAttribute("action")!=e.url&&l.setAttribute("action",e.url);e.skipEncodingOverride|| i.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"});e.timeout&&setTimeout(function(){F=true;s()},e.timeout);var v=[];try{if(e.extraData)for(var w in e.extraData)v.push(b('<input type="hidden" name="'+w+'" value="'+e.extraData[w]+'" />').appendTo(l)[0]);r.appendTo("body");r.data("form-plugin-onload",s);l.submit()}finally{l.setAttribute("action",m);o?l.setAttribute("target",o):i.removeAttr("target");b(v).remove()}}function s(){if(!G){r.removeData("form-plugin-onload");var o=true; try{if(F)throw"timeout";p=x.contentWindow?x.contentWindow.document:x.contentDocument?x.contentDocument:x.document;var m=e.dataType=="xml"||p.XMLDocument||b.isXMLDoc(p);q("isXml="+m);if(!m&&window.opera&&(p.body==null||p.body.innerHTML==""))if(--K){q("requeing onLoad callback, DOM not available");setTimeout(s,250);return}G=true;j.responseText=p.documentElement?p.documentElement.innerHTML:null;j.responseXML=p.XMLDocument?p.XMLDocument:p;j.getResponseHeader=function(L){return{"content-type":e.dataType}[L]}; var v=/(json|script)/.test(e.dataType);if(v||e.textarea){var w=p.getElementsByTagName("textarea")[0];if(w)j.responseText=w.value;else if(v){var H=p.getElementsByTagName("pre")[0],I=p.getElementsByTagName("body")[0];if(H)j.responseText=H.textContent;else if(I)j.responseText=I.innerHTML}}else if(e.dataType=="xml"&&!j.responseXML&&j.responseText!=null)j.responseXML=C(j.responseText);J=b.httpData(j,e.dataType)}catch(D){q("error caught:",D);o=false;j.error=D;b.handleError(e,j,"error",D)}if(j.aborted){q("upload aborted"); o=false}if(o){e.success.call(e.context,J,"success",j);y&&b.event.trigger("ajaxSuccess",[j,e])}y&&b.event.trigger("ajaxComplete",[j,e]);y&&!--b.active&&b.event.trigger("ajaxStop");if(e.complete)e.complete.call(e.context,j,o?"success":"error");setTimeout(function(){r.removeData("form-plugin-onload");r.remove();j.responseXML=null},100)}}function C(o,m){if(window.ActiveXObject){m=new ActiveXObject("Microsoft.XMLDOM");m.async="false";m.loadXML(o)}else m=(new DOMParser).parseFromString(o,"text/xml");return m&& m.documentElement&&m.documentElement.tagName!="parsererror"?m:null}var l=i[0];if(b(":input[name=submit],:input[id=submit]",l).length)alert('Error: Form elements must not have name or id of "submit".');else{var e=b.extend(true,{},b.ajaxSettings,a);e.context=e.context||e;var u="jqFormIO"+(new Date).getTime(),E="_"+u;window[E]=function(){var o=r.data("form-plugin-onload");if(o){o();window[E]=undefined;try{delete window[E]}catch(m){}}};var r=b('<iframe id="'+u+'" name="'+u+'" src="'+e.iframeSrc+'" onload="window[\'_\'+this.id]()" />'), x=r[0];r.css({position:"absolute",top:"-1000px",left:"-1000px"});var j={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(){this.aborted=1;r.attr("src",e.iframeSrc)}},y=e.global;y&&!b.active++&&b.event.trigger("ajaxStart");y&&b.event.trigger("ajaxSend",[j,e]);
543if(e.beforeSend&&e.beforeSend.call(e.context,j,e)===false)e.global&&b.active--;else if(!j.aborted){var G=false, F=0,z=l.clk;if(z){var A=z.name;if(A&&!z.disabled){e.extraData=e.extraData||{};e.extraData[A]=z.value;if(z.type=="image"){e.extraData[A+".x"]=l.clk_x;e.extraData[A+".y"]=l.clk_y}}}e.forceSync?t():setTimeout(t,10);var J,p,K=50}}}if(!this.length){q("ajaxSubmit: skipping submit process - no element selected");return this}if(typeof a=="function")a={success:a};var d=this.attr("action");if(d=typeof d==="string"?b.trim(d):"")d=(d.match(/^([^#]+)/)||[])[1];d=d||window.location.href||"";a=b.extend(true,{url:d, type:this.attr("method")||"GET",iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},a);d={};this.trigger("form-pre-serialize",[this,a,d]);if(d.veto){q("ajaxSubmit: submit vetoed via form-pre-serialize trigger");return this}if(a.beforeSerialize&&a.beforeSerialize(this,a)===false){q("ajaxSubmit: submit aborted via beforeSerialize callback");return this}var c,h,g=this.formToArray(a.semantic);if(a.data){a.extraData=a.data;for(c in a.data)if(a.data[c]instanceof Array)for(var k in a.data[c])g.push({name:c, value:a.data[c][k]});else{h=a.data[c];h=b.isFunction(h)?h():h;g.push({name:c,value:h})}}if(a.beforeSubmit&&a.beforeSubmit(g,this,a)===false){q("ajaxSubmit: submit aborted via beforeSubmit callback");return this}this.trigger("form-submit-validate",[g,this,a,d]);if(d.veto){q("ajaxSubmit: submit vetoed via form-submit-validate trigger");return this}c=b.param(g);if(a.type.toUpperCase()=="GET"){a.url+=(a.url.indexOf("?")>=0?"&":"?")+c;a.data=null}else a.data=c;var i=this,n=[];a.resetForm&&n.push(function(){i.resetForm()}); a.clearForm&&n.push(function(){i.clearForm()});if(!a.dataType&&a.target){var B=a.success||function(){};n.push(function(t){var s=a.replaceTarget?"replaceWith":"html";b(a.target)[s](t).each(B,arguments)})}else a.success&&n.push(a.success);a.success=function(t,s,C){for(var l=a.context||a,e=0,u=n.length;e<u;e++)n[e].apply(l,[t,s,C||i,i])};c=b("input:file",this).length>0;k=i.attr("enctype")=="multipart/form-data"||i.attr("encoding")=="multipart/form-data";if(a.iframe!==false&&(c||a.iframe||k))a.closeKeepAlive? b.get(a.closeKeepAlive,f):f();else b.ajax(a);this.trigger("form-submit-notify",[this,a]);return this};b.fn.ajaxForm=function(a){if(this.length===0){var f={s:this.selector,c:this.context};if(!b.isReady&&f.s){q("DOM not ready, queuing ajaxForm");b(function(){b(f.s,f.c).ajaxForm(a)});return this}q("terminating; zero elements found by selector"+(b.isReady?"":" (DOM not ready)"));return this}return this.ajaxFormUnbind().bind("submit.form-plugin",function(d){if(!d.isDefaultPrevented()){d.preventDefault(); b(this).ajaxSubmit(a)}}).bind("click.form-plugin",function(d){var c=d.target,h=b(c);if(!h.is(":submit,input:image")){c=h.closest(":submit");if(c.length==0)return;c=c[0]}var g=this;g.clk=c;if(c.type=="image")if(d.offsetX!=undefined){g.clk_x=d.offsetX;g.clk_y=d.offsetY}else if(typeof b.fn.offset=="function"){h=h.offset();g.clk_x=d.pageX-h.left;g.clk_y=d.pageY-h.top}else{g.clk_x=d.pageX-c.offsetLeft;g.clk_y=d.pageY-c.offsetTop}setTimeout(function(){g.clk=g.clk_x=g.clk_y=null},100)})};b.fn.ajaxFormUnbind= function(){return this.unbind("submit.form-plugin click.form-plugin")};b.fn.formToArray=function(a){var f=[];if(this.length===0)return f;var d=this[0],c=a?d.getElementsByTagName("*"):d.elements;if(!c)return f;var h,g,k,i,n,B;h=0;for(n=c.length;h<n;h++){g=c[h];if(k=g.name)if(a&&d.clk&&g.type=="image"){if(!g.disabled&&d.clk==g){f.push({name:k,value:b(g).val()});f.push({name:k+".x",value:d.clk_x},{name:k+".y",value:d.clk_y})}}else if((i=b.fieldValue(g,true))&&i.constructor==Array){g=0;for(B=i.length;g< B;g++)f.push({name:k,value:i[g]})}else i!==null&&typeof i!="undefined"&&f.push({name:k,value:i})}if(!a&&d.clk){a=b(d.clk);c=a[0];if((k=c.name)&&!c.disabled&&c.type=="image"){f.push({name:k,value:a.val()});f.push({name:k+".x",value:d.clk_x},{name:k+".y",value:d.clk_y})}}return f};b.fn.formSerialize=function(a){return b.param(this.formToArray(a))};b.fn.fieldSerialize=function(a){var f=[];this.each(function(){var d=this.name;if(d){var c=b.fieldValue(this,a);if(c&&c.constructor==Array)for(var h=0,g=c.length;h< g;h++)f.push({name:d,value:c[h]});
543else c!==null&&typeof c!="undefined"&&f.push({name:this.name,value:c})}});return b.param(f)};b.fn.fieldValue=function(a){for(var f=[],d=0,c=this.length;d<c;d++){var h=b.fieldValue(this[d],a);h===null||typeof h=="undefined"||h.constructor==Array&&!h.length||(h.constructor==Array?b.merge(f,h):f.push(h))}return f};b.fieldValue=function(a,f){var d=a.name,c=a.type,h=a.tagName.toLowerCase();if(f===undefined)f=true;if(f&&(!d||a.disabled||c=="reset"||c=="button"||(c=="checkbox"|| c=="radio")&&!a.checked||(c=="submit"||c=="image")&&a.form&&a.form.clk!=a||h=="select"&&a.selectedIndex==-1))return null;if(h=="select"){var g=a.selectedIndex;if(g<0)return null;d=[];h=a.options;var k=(c=c=="select-one")?g+1:h.length;for(g=c?g:0;g<k;g++){var i=h[g];if(i.selected){var n=i.value;n||(n=i.attributes&&i.attributes.value&&!i.attributes.value.specified?i.text:i.value);if(c)return n;d.push(n)}}return d}return b(a).val()};b.fn.clearForm=function(){return this.each(function(){b("input,select,textarea", this).clearFields()})};b.fn.clearFields=b.fn.clearInputs=function(){return this.each(function(){var a=this.type,f=this.tagName.toLowerCase();if(a=="text"||a=="password"||f=="textarea")this.value="";else if(a=="checkbox"||a=="radio")this.checked=false;else if(f=="select")this.selectedIndex=-1})};b.fn.resetForm=function(){return this.each(function(){if(typeof this.reset=="function"||typeof this.reset=="object"&&!this.reset.nodeType)this.reset()})};b.fn.enable=function(a){if(a===undefined)a=true;return this.each(function(){this.disabled= !a})};b.fn.selected=function(a){if(a===undefined)a=true;
543return this.each(function(){var f=this.type;if(f=="checkbox"||f=="radio")this.checked=a;else if(this.tagName.toLowerCase()=="option"){f=b(this).parent("select");a&&f[0]&&f[0].type=="select-one"&&f.find("option").selected(false);this.selected=a}})}})(jQuery);; 544(function ($) { 545 546/** 547 * Prevents consecutive form submissions of identical form values. 548 * 549 * Repetitive form submissions that would submit the identical form values are 550 * prevented, unless the form values are different from the previously 551 * submitted values. 552 * 553 * This is a simplified re-implementation of a user-agent behavior that should 554 * be natively supported by major web browsers, but at this time, only Firefox 555 * has a built-in protection. 556 * 557 * A form value-based approach ensures that the constraint is triggered for 558 * consecutive, identical form submissions only. Compared to that, a form 559 * button-based approach would (1) rely on [visible] buttons to exist where 560 * technically not required and (2) require more complex state management if 561 * there are multiple buttons in a form. 562 * 563 * This implementation is based on form-level submit events only and relies on 564 * jQuery's serialize() method to determine submitted form values. As such, the 565 * following limitations exist: 566 * 567 * - Event handlers on form buttons that preventDefault() do not receive a 568 * double-submit protection. That is deemed to be fine, since such button 569 * events typically trigger reversible client-side or server-side operations 570 * that are local to the context of a form only. 571 * - Changed values in advanced form controls, such as file inputs, are not part 572 * of the form values being compared between consecutive form submits (due to 573 * limitations of jQuery.serialize()). That is deemed to be acceptable, 574 * because if the user forgot to attach a file, then the size of HTTP payload 575 * will most likely be small enough to be fully passed to the server endpoint 576 * within (milli)seconds. If a user mistakenly attached a wrong file and is 577 * technically versed enough to cancel the form submission (and HTTP payload) 578 * in order to attach a different file, then that edge-case is not supported 579 * here. 580 * 581 * Lastly, all forms submitted via HTTP GET are idempotent by definition of HTTP 582 * standards, so excluded in this implementation. 583 */ 584Drupal.behaviors.formSingleSubmit = { 585 attach: function () { 586 function onFormSubmit (e) { 587 var $form = $(e.currentTarget); 588 var formValues = $form.serialize(); 589 var previousValues = $form.attr('data-drupal-form-submit-last'); 590 if (previousValues === formValues) { 591 e.preventDefault(); 592 } 593 else { 594 $form.attr('data-drupal-form-submit-last', formValues); 595 } 596 } 597 598 $('body').once('form-single-submit') 599 .delegate('form:not([method~="GET"])', 'submit.singleSubmit', onFormSubmit); 600 } 601}; 602 603})(jQuery); 604; 605(function ($) { 606 607/** 608 * Provides Ajax page updating via jQuery $.ajax (Asynchronous JavaScript and XML). 609 * 610 * Ajax is a method of making a request via JavaScript while viewing an HTML 611 * page. The request returns an array of commands encoded in JSON, which is 612 * then executed to make any changes that are necessary to the page. 613 * 614 * Drupal uses this file to enhance form elements with #ajax['path'] and 615 * #ajax['wrapper'] properties. If set, this file will automatically be included 616 * to provide Ajax capabilities. 617 */ 618 619Drupal.ajax = Drupal.ajax || {}; 620 621Drupal.settings.urlIsAjaxTrusted = Drupal.settings.urlIsAjaxTrusted || {}; 622 623/** 624 * Attaches the Ajax behavior to each Ajax form element. 625 */ 626Drupal.behaviors.AJAX = { 627 attach: function (context, settings) { 628 // Load all Ajax behaviors specified in the settings. 629 for (var base in settings.ajax) { 630 if (!$('#' + base + '.ajax-processed').length) { 631 var element_settings = settings.ajax[base]; 632 633 if (typeof element_settings.selector == 'undefined') { 634 element_settings.selector = '#' + base; 635 } 636 $(element_settings.selector).each(function () { 637 element_settings.element = this; 638 Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings); 639 }); 640 641 $('#' + base).addClass('ajax-processed'); 642 } 643 } 644 645 // Bind Ajax behaviors to all items showing the class.
646 $('.use-ajax:not(.ajax-processed)').addClass('ajax-processed').each(function () { 647 var element_settings = {}; 648 // Clicked links look better with the throbber than the progress bar. 649 element_settings.progress = { 'type': 'throbber' }; 650 651 // For anchor tags, these will go to the target of the anchor rather 652 // than the usual location. 653 if ($(this).attr('href')) { 654 element_settings.url = $(this).attr('href'); 655 element_settings.event = 'click'; 656 } 657 var base = $(this).attr('id'); 658 Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings); 659 }); 660 661 // This class means to submit the form to the action using Ajax. 662 $('.use-ajax-submit:not(.ajax-processed)').addClass('ajax-processed').each(function () { 663 var element_settings = {}; 664 665 // Ajax submits specified in this manner automatically submit to the 666 // normal form action. 667 element_settings.url = $(this.form).attr('action'); 668 // Form submit button clicks need to tell the form what was clicked so 669 // it gets passed in the POST request. 670 element_settings.setClick = true; 671 // Form buttons use the 'click' event rather than mousedown. 672 element_settings.event = 'click'; 673 // Clicked form buttons look better with the throbber than the progress bar. 674 element_settings.progress = { 'type': 'throbber' }; 675 676 var base = $(this).attr('id'); 677 Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings); 678 }); 679 } 680}; 681 682/** 683 * Ajax object. 684 * 685 * All Ajax objects on a page are accessible through the global Drupal.ajax 686 * object and are keyed by the submit button's ID. You can access them from 687 * your module's JavaScript file to override properties or functions. 688 * 689 * For example, if your Ajax enabled button has the ID 'edit-submit', you can 690 * redefine the function that is called to insert the new content like this 691 * (inside a Drupal.behaviors attach block): 692 * @code 693 * Drupal.behaviors.myCustomAJAXStuff = { 694 * attach: function (context, settings) { 695 * Drupal.ajax['edit-submit'].commands.insert = function (ajax, response, status) { 696 * new_content = $(response.data); 697 * $('#my-wrapper').append(new_content); 698 * alert('New content was appended to #my-wrapper'); 699 * } 700 * } 701 * }; 702 * @endcode 703 */ 704Drupal.ajax = function (base, element, element_settings) { 705 var defaults = { 706 url: 'system/ajax', 707 event: 'mousedown', 708 keypress: true, 709 selector: '#' + base, 710 effect: 'none', 711 speed: 'none', 712 method: 'replaceWith', 713 progress: { 714 type: 'throbber', 715 message: Drupal.t('Please wait...') 716 }, 717 submit: { 718 'js': true 719 } 720 }; 721 722 $.extend(this, defaults, element_settings); 723 724 this.element = element; 725 this.element_settings = element_settings; 726 727 // Replacing 'nojs' with 'ajax' in the URL allows for an easy method to let 728 // the server detect when it needs to degrade gracefully. 729 // There are five scenarios to check for: 730 // 1. /nojs/ 731 // 2. /nojs$ - The end of a URL string. 732 // 3. /nojs? - Followed by a query (with clean URLs enabled). 733 // E.g.: path/nojs?destination=foobar 734 // 4. /nojs& - Followed by a query (without clean URLs enabled). 735 // E.g.: ?q=path/nojs&destination=foobar 736 // 5. /nojs# - Followed by a fragment. 737 // E.g.: path/nojs#myfragment 738 this.url = element_settings.url.replace(/\/nojs(\/|$|\?|&|#)/g, '/ajax$1'); 739 // If the 'nojs' version of the URL is trusted, also trust the 'ajax' version. 740 if (Drupal.settings.urlIsAjaxTrusted[element_settings.url]) { 741 Drupal.settings.urlIsAjaxTrusted[this.url] = true; 742 } 743 744 this.wrapper = '#' + element_settings.wrapper; 745 746 // If there isn't a form, jQuery.ajax() will be used instead, allowing us to 747 // bind Ajax to links as well. 748 if (this.element.form) { 749 this.form = $(this.element.form); 750 } 751 752 // Set the options for the ajaxSubmit function. 753 // The 'this' variable will not persist inside of the options object. 754 var ajax = this; 755 ajax.options = { 756 url: Drupal.sanitizeAjaxUrl(ajax.url), 757 data: ajax.submit, 758 beforeSerialize: function (element_settings, options) { 759 return ajax.beforeSerialize(element_settings, options); 760 }, 761 beforeSubmit: function (form_values, element_settings, options) { 762 ajax.ajaxing = true; 763 return ajax.beforeSubmit(form_values, element_settings, options); 764 }, 765 beforeSend: function (xmlhttprequest, options) { 766 ajax.ajaxing = true; 767 return ajax.beforeSend(xmlhttprequest, options); 768 }, 769 success: function (response, status, xmlhttprequest) { 770 // Sanity check for browser support (object expected). 771 // When using iFrame uploads, responses must be returned as a string. 772 if (typeof response == 'string') { 773 response = $.parseJSON(response); 774 } 775 776 // Prior to invoking the response's commands, verify that they can be 777 // trusted by checking for a response header. See 778 // ajax_set_verification_header() for details. 779 // - Empty responses are harmless so can bypass verification. This avoids 780 // an alert message for server-generated no-op responses that skip Ajax 781 // rendering. 782 // - Ajax objects with trusted URLs (e.g., ones defined server-side via 783 // #ajax) can bypass header verification. This is especially useful for 784 // Ajax with multipart forms. Because IFRAME transport is used, the 785 // response headers cannot be accessed for verification. 786 if (response !== null && !Drupal.settings.urlIsAjaxTrusted[ajax.url]) { 787 if (xmlhttprequest.getResponseHeader('X-Drupal-Ajax-Token') !== '1') { 788 var customMessage = Drupal.t("The response failed verification so will not be processed."); 789 return ajax.error(xmlhttprequest, ajax.url, customMessage); 790 } 791 } 792 793 return ajax.success(response, status); 794 }, 795 complete: function (xmlhttprequest, status) { 796 ajax.ajaxing = false;
797 if (status == 'error' || status == 'parsererror') { 798 return ajax.error(xmlhttprequest, ajax.url); 799 } 800 }, 801 dataType: 'json', 802 jsonp: false, 803 type: 'POST' 804 }; 805 806 // For multipart forms (e.g., file uploads), jQuery Form targets the form 807 // submission to an iframe instead of using an XHR object. The initial "src" 808 // of the iframe, prior to the form submission, is set to options.iframeSrc. 809 // "about:blank" is the semantically correct, standards-compliant, way to 810 // initialize a blank iframe; however, some old IE versions (possibly only 6) 811 // incorrectly report a mixed content warning when iframes with an 812 // "about:blank" src are added to a parent document with an https:// origin. 813 // jQuery Form works around this by defaulting to "javascript:false" instead, 814 // but that breaks on Chrome 83, so here we force the semantically correct 815 // behavior for all browsers except old IE. 816 // @see https://www.drupal.org/project/drupal/issues/3143016 817 // @see https://github.com/jquery-form/form/blob/df9cb101b9c9c085c8d75ad980c7ff1cf62063a1/jquery.form.js#L68 818 // @see https://bugs.chromium.org/p/chromium/issues/detail?id=1084874 819 // @see https://html.spec.whatwg.org/multipage/browsers.html#creating-browsing-contexts 820 // @see https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy 821 if (navigator.userAgent.indexOf("MSIE") === -1) { 822 ajax.options.iframeSrc = 'about:blank'; 823 } 824 825 // Bind the ajaxSubmit function to the element event. 826 $(ajax.element).bind(element_settings.event, function (event) { 827 if (!Drupal.settings.urlIsAjaxTrusted[ajax.url] && !Drupal.urlIsLocal(ajax.url)) { 828 throw new Error(Drupal.t('The callback URL is not local and not trusted: !url', {'!url': ajax.url})); 829 } 830 return ajax.eventResponse(this, event); 831 }); 832 833 // If necessary, enable keyboard submission so that Ajax behaviors 834 // can be triggered through keyboard input as well as e.g. a mousedown 835 // action. 836 if (element_settings.keypress) { 837 $(ajax.element).keypress(function (event) { 838 return ajax.keypressResponse(this, event); 839 }); 840 } 841 842 // If necessary, prevent the browser default action of an additional event. 843 // For example, prevent the browser default action of a click, even if the 844 // AJAX behavior binds to mousedown. 845 if (element_settings.prevent) { 846 $(ajax.element).bind(element_settings.prevent, false); 847 } 848}; 849 850/** 851 * Handle a key press. 852 * 853 * The Ajax object will, if instructed, bind to a key press response. This 854 * will test to see if the key press is valid to trigger this event and 855 * if it is, trigger it for us and prevent other keypresses from triggering. 856 * In this case we're handling RETURN and SPACEBAR keypresses (event codes 13 857 * and 32. RETURN is often used to submit a form when in a textfield, and 858 * SPACE is often used to activate an element without submitting. 859 */ 860Drupal.ajax.prototype.keypressResponse = function (element, event) { 861 // Create a synonym for this to reduce code confusion. 862 var ajax = this; 863 864 // Detect enter key and space bar and allow the standard response for them, 865 // except for form elements of type 'text' and 'textarea', where the 866 // spacebar activation causes inappropriate activation if #ajax['keypress'] is 867 // TRUE. On a text-type widget a space should always be a space. 868 if (event.which == 13 || (event.which == 32 && element.type != 'text' && element.type != 'textarea')) { 869 $(ajax.element_settings.element).trigger(ajax.element_settings.event); 870 return false; 871 } 872}; 873 874/** 875 * Handle an event that triggers an Ajax response. 876 * 877 * When an event that triggers an Ajax response happens, this method will 878 * perform the actual Ajax call. It is bound to the event using 879 * bind() in the constructor, and it uses the options specified on the 880 * ajax object. 881 */ 882Drupal.ajax.prototype.eventResponse = function (element, event) { 883 // Create a synonym for this to reduce code confusion. 884 var ajax = this; 885 886 // Do not perform another ajax command if one is already in progress. 887 if (ajax.ajaxing) { 888 return false; 889 } 890 891 try { 892 if (ajax.form) { 893 // If setClick is set, we must set this to ensure that the button's 894 // value is passed. 895 if (ajax.setClick) { 896 // Mark the clicked button. 'form.clk' is a special variable for 897 // ajaxSubmit that tells the system which element got clicked to 898 // trigger the submit. Without it there would be no 'op' or
899 // equivalent. 900 element.form.clk = element; 901 } 902 903 ajax.form.ajaxSubmit(ajax.options); 904 } 905 else { 906 ajax.beforeSerialize(ajax.element, ajax.options); 907 $.ajax(ajax.options); 908 } 909 } 910 catch (e) { 911 // Unset the ajax.ajaxing flag here because it won't be unset during 912 // the complete response. 913 ajax.ajaxing = false; 914 alert("An error occurred while attempting to process " + ajax.options.url + ": " + e.message); 915 } 916 917 // For radio/checkbox, allow the default event. On IE, this means letting 918 // it actually check the box. 919 if (typeof element.type != 'undefined' && (element.type == 'checkbox' || element.type == 'radio')) { 920 return true; 921 } 922 else { 923 return false; 924 } 925 926}; 927 928/** 929 * Handler for the form serialization. 930 * 931 * Runs before the beforeSend() handler (see below), and unlike that one, runs 932 * before field data is collected. 933 */ 934Drupal.ajax.prototype.beforeSerialize = function (element, options) { 935 // Allow detaching behaviors to update field values before collecting them. 936 // This is only needed when field values are added to the POST data, so only 937 // when there is a form such that this.form.ajaxSubmit() is used instead of 938 // $.ajax(). When there is no form and $.ajax() is used, beforeSerialize() 939 // isn't called, but don't rely on that: explicitly check this.form. 940 if (this.form) { 941 var settings = this.settings || Drupal.settings; 942 Drupal.detachBehaviors(this.form, settings, 'serialize'); 943 } 944 945 // Prevent duplicate HTML ids in the returned markup. 946 // @see drupal_html_id() 947 options.data['ajax_html_ids[]'] = []; 948 $('[id]').each(function () { 949 options.data['ajax_html_ids[]'].push(this.id); 950 }); 951 952 // Allow Drupal to return new JavaScript and CSS files to load without 953 // returning the ones already loaded. 954 // @see ajax_base_page_theme() 955 // @see drupal_get_css() 956 // @see drupal_get_js() 957 options.data['ajax_page_state[theme]'] = Drupal.settings.ajaxPageState.theme; 958 options.data['ajax_page_state[theme_token]'] = Drupal.settings.ajaxPageState.theme_token; 959 for (var key in Drupal.settings.ajaxPageState.css) { 960 options.data['ajax_page_state[css][' + key + ']'] = 1; 961 } 962 for (var key in Drupal.settings.ajaxPageState.js) { 963 options.data['ajax_page_state[js][' + key + ']'] = 1; 964 } 965}; 966 967/** 968 * Modify form values prior to form submission. 969 */ 970Drupal.ajax.prototype.beforeSubmit = function (form_values, element, options) { 971 // This function is left empty to make it simple to override for modules 972 // that wish to add functionality here. 973}; 974 975/** 976 * Prepare the Ajax request before it is sent. 977 */ 978Drupal.ajax.prototype.beforeSend = function (xmlhttprequest, options) { 979 // For forms without file inputs, the jQuery Form plugin serializes the form 980 // values, and then calls jQuery's $.ajax() function, which invokes this 981 // handler. In this circumstance, options.extraData is never used. For forms 982 // with file inputs, the jQuery Form plugin uses the browser's normal form 983 // submission mechanism, but captures the response in a hidden IFRAME. In this 984 // circumstance, it calls this handler first, and then appends hidden fields 985 // to the form to submit the values in options.extraData. There is no simple 986 // way to know which submission mechanism will be used, so we add to extraData 987 // regardless, and allow it to be ignored in the former case. 988 if (this.form) { 989 options.extraData = options.extraData || {}; 990 991 // Let the server know when the IFRAME submission mechanism is used. The 992 // server can use this information to wrap the JSON response in a TEXTAREA, 993 // as per http://jquery.malsup.com/form/#file-upload. 994 options.extraData.ajax_iframe_upload = '1'; 995 996 // The triggering element is about to be disabled (see below), but if it 997 // contains a value (e.g., a checkbox, textfield, select, etc.), ensure that 998 // value is included in the submission. As per above, submissions that use 999 // $.ajax() are already serialized prior to the element being disabled, so 1000 // this is only needed for IFRAME submissions. 1001 var v = $.fieldValue(this.element); 1002 if (v !== null) { 1003 options.extraData[this.element.name] = Drupal.checkPlain(v); 1004 } 1005 } 1006 1007 // Disable the element that received the change to prevent user interface 1008 // interaction while the Ajax request is in progress. ajax.ajaxing prevents 1009 // the element from triggering a new request, but does not prevent the user 1010 // from changing its value. 1011 $(this.element).addClass('progress-disabled').attr('disabled', true); 1012 1013 // Insert progressbar or throbber. 1014 if (this.progress.type == 'bar') { 1015 var progressBar = new Drupal.progressBar('ajax-progress-' + this.element.i
1015d, $.noop, this.progress.method, $.noop); 1016 if (this.progress.message) { 1017 progressBar.setProgress(-1, this.progress.message); 1018 } 1019 if (this.progress.url) { 1020 progressBar.startMonitoring(this.progress.url, this.progress.interval || 1500); 1021 } 1022 this.progress.element = $(progressBar.element).addClass('ajax-progress ajax-progress-bar'); 1023 this.progress.object = progressBar; 1024 $(this.element).after(this.progress.element); 1025 } 1026 else if (this.progress.type == 'throbber') { 1027 this.progress.element = $('<div class="ajax-progress ajax-progress-throbber"><div class="throbber"> </div></div>'); 1028 if (this.progress.message) { 1029 $('.throbber', this.progress.element).after('<div class="message">' + this.progress.message + '</div>'); 1030 } 1031 $(this.element).after(this.progress.element); 1032 } 1033}; 1034 1035/** 1036 * Handler for the form redirection completion. 1037 */ 1038Drupal.ajax.prototype.success = function (response, status) { 1039 // Remove the progress element. 1040 if (this.progress.element) { 1041 $(this.progress.element).remove(); 1042 } 1043 if (this.progress.object) { 1044 this.progress.object.stopMonitoring(); 1045 } 1046 $(this.element).removeClass('progress-disabled').removeAttr('disabled'); 1047 1048 Drupal.freezeHeight(); 1049 1050 for (var i in response) { 1051 if (response.hasOwnProperty(i) && response[i]['command'] && this.commands[response[i]['command']]) { 1052 this.commands[response[i]['command']](this, response[i], status); 1053 } 1054 } 1055 1056 // Reattach behaviors, if they were detached in beforeSerialize(). The 1057 // attachBehaviors() called on the new content from processing the response 1058 // commands is not sufficient, because behaviors from the entire form need 1059 // to be reattached. 1060 if (this.form) { 1061 var settings = this.settings || Drupal.settings; 1062 Drupal.attachBehaviors(this.form, settings); 1063 } 1064 1065 Drupal.unfreezeHeight(); 1066 1067 // Remove any response-specific settings so they don't get used on the next 1068 // call by mistake. 1069 this.settings = null; 1070}; 1071 1072/** 1073 * Build an effect object which tells us how to apply the effect when adding new HTML. 1074 */ 1075Drupal.ajax.prototype.getEffect = function (response) { 1076 var type = response.effect || this.effect; 1077 var speed = response.speed || this.speed; 1078 1079 var effect = {}; 1080 if (type == 'none') { 1081 effect.showEffect = 'show'; 1082 effect.hideEffect = 'hide'; 1083 effect.showSpeed = ''; 1084 } 1085 else if (type == 'fade') { 1086 effect.showEffect = 'fadeIn'; 1087 effect.hideEffect = 'fadeOut'; 1088 effect.showSpeed = speed; 1089 } 1090 else { 1091 effect.showEffect = type + 'Toggle'; 1092 effect.hideEffect = type + 'Toggle'; 1093 effect.showSpeed = speed; 1094 } 1095 1096 return effect; 1097}; 1098 1099/** 1100 * Handler for the form redirection error. 1101 */ 1102Drupal.ajax.prototype.error = function (xmlhttprequest, uri, customMessage) { 1103 Drupal.displayAjaxError(Drupal.ajaxError(xmlhttprequest, uri, customMessage)); 1104 // Remove the progress element. 1105 if (this.progress.element) { 1106 $(this.progress.element).remove(); 1107 } 1108 if (this.progress.object) { 1109 this.progress.object.stopMonitoring(); 1110 } 1111 // Undo hide. 1112 $(this.wrapper).show(); 1113 // Re-enable the element. 1114 $(this.element).removeClass('progress-disabled').removeAttr('disabled'); 1115 // Reattach behaviors, if they were detached in beforeSerialize(). 1116 if (this.form) { 1117 var settings = this.settings || Drupal.settings; 1118 Drupal.attachBehaviors(this.form, settings); 1119 } 1120}; 1121 1122/** 1123 * Provide a series of commands that the server can request the client perform. 1124 */ 1125Drupal.ajax.prototype.commands = { 1126 /** 1127 * Command to insert new content into the DOM. 1128 */ 1129 insert: function (ajax, response, status) { 1130 // Get information from the response. If it is not there, default to 1131 // our presets. 1132 var wrapper = response.selector ? $(response.selector) : $(ajax.wrapper); 1133 var method = response.method || ajax.method; 1134 var effect = ajax.getEffect(response); 1135 1136 // We don't know what response.data contains: it might be a string of text 1137 // without HTML, so don't rely on jQuery correctly iterpreting 1138 // $(response.data) as new HTML rather than a CSS selector. Also, if 1139 // response.data contains top-level text nodes, they get lost with either 1140 // $(response.data) or $('<div></div>').replaceWith(response.data). 1141 var new_content_wrapped = $('<div></div>').html(response.data); 1142 var new_content = new_content_wrapped.contents(); 1143 1144 // For legacy reasons, the effects processing code assumes that new_content 1145 // consists of a single top-level element. Also, it has not been 1146 // sufficiently tested whether attachBehaviors() can be successfully called 1147 // with a context object that includes top-level text nodes. However, to 1148 // give developers full control of the HTML appearing in the page, and to 1149 // enable Ajax content to be inserted in places where DIV elements are not 1150 // allowed (e.g., within TABLE, TR, and SPAN parents), we check if the new 1151 // content satisfies the requirement of a single top-level element, and 1152 // only use the container DIV created above when it doesn't. For more 1153 // information, please see http://drupal.org/node/736066. 1154 if (new_content.length != 1 || new_content.get(0).nodeType != 1) { 1155 new_content = new_content_wrapped; 1156 } 1157 1158 // If removing content from the wrapper, detach behaviors first. 1159 switch (method) { 1160 case 'html': 1161 case 'replaceWith': 1162 case 'replaceAll': 1163 case 'empty': 1164 case 'remove': 1165 var settings = response.settings || ajax.settings || Drupal.settings; 1166 Drupal.detachBehaviors(wrapper, settings); 1167 } 1168 1169 // Add the new content to the page. 1170 wrapper[method](new_content); 1171 1172 // Immediately hide the new content if we're using any effects. 1173 if (effect.showEffect != 'show') { 1174 new_content.hide(); 1175 } 1176 1177 // Determine which effect to use and what content will receive the 1178 // effect, then show the new content. 1179 if ($('.ajax-new-content', new_content).length > 0) { 1180 $('.ajax-new-content', new_content).hide(); 1181 new_content.show(); 1182 $('.ajax-new-content', new_content)[effect.showEffect](effect.showSpeed); 1183 } 1184 else if (effect.showEffect != 'show') { 1185 new_content[effect.showEffect](effect.showSpeed); 1186 } 1187 1188 // Attach all JavaScript behaviors to the new content, if it was successfully 1189 // added to the page, this if statement allows #ajax['wrapper'] to be 1190 // optional. 1191 if (new_content.parents('html').length > 0) { 1192 // Apply any settings from the returned JSON if available. 1193 var settings = response.settings || ajax.settings || Drupal.settings; 1194 Drupal.attachBehaviors(new_content, settings); 1195 } 1196 }, 1197 1198 /** 1199 * Command to remove a chunk from the page. 1200 */ 1201 remove: function (ajax, response, status) { 1202 var settings = response.settings || ajax.settings || Drupal.settings; 1203 Drupal.detachBehaviors($(response.selector), settings); 1204 $(response.selector).remove(); 1205 }, 1206 1207 /** 1208 * Command to mark a chunk changed. 1209 */ 1210 changed: function (ajax, response, status) { 1211 if (!$(response.selector).hasClass('ajax-changed')) { 1212 $(response.selector).addClass('ajax-changed'); 1213 if (response.asterisk) { 1214 $(response.selector).find(response.asterisk).append(' <span class="ajax-changed">*</span> '); 1215 } 1216 } 1217 }, 1218 1219 /** 1220 * Command to provide an alert. 1221 */ 1222 alert: function (ajax, response, status) { 1223 alert(response.text, response.title); 1224 }, 1225 1226 /** 1227 * Command to provide the jQuery css() function. 1228 */ 1229 css: function (ajax, response, status) { 1230 $(response.selector).css(response.argument); 1231 }, 1232 1233 /** 1234 * Command to set the settings that will be used for other commands in this response. 1235 */ 1236 settings: function (ajax, response, status) { 1237 if (response.merge) { 1238 $.extend(true, Drupal.settings, response.settings); 1239 } 1240 else { 1241 ajax.settings = response.settings; 1242 } 1243 }, 1244 1245 /** 1246 * Command to attach data using jQuery's data API. 1247 */ 1248 data: function (ajax, response, status) { 1249 $(response.selector).data(response.name, response.value); 1250 }, 1251 1252 /** 1253 * Command to apply a jQuery method. 1254 */ 1255 invoke: function (ajax, response, status) { 1256 var $element = $(response.selector); 1257 $element[response.method].apply($element, response.arguments); 1258 }, 1259 1260 /** 1261 * Command to restripe a table. 1262 */ 1263 restripe: function (ajax, response, status) { 1264 // :even and :odd are reversed because jQuery counts from 0 and 1265 // we count from 1, so we're out of sync. 1266 // Match immediate children of the parent element to allow nesting. 1267 $('> tbody > tr:visible, > tr:visible', $(response.selector)) 1268 .removeClass('odd even') 1269 .filter(':even').addClass('odd').end() 1270 .filter(':odd').addClass('even'); 1271 }, 1272 1273 /** 1274 * Command to add css. 1275 * 1276 * Uses the proprietary addImport method if available as browsers which 1277 * support that method ignore @import statements in dynamically added 1278 * stylesheets. 1279 */ 1280 add_css: function (ajax, response, status) { 1281 // Add the styles in the normal way. 1282 $('head').prepend(response.data); 1283 // Add imports in the styles using the addImport method if available. 1284 var match, importMatch = /^@import url\("(.*)"\);$/igm; 1285 if (document.styleSheets[0].addImport && importMatch.test(response.data)) { 1286 importMatch.lastIndex = 0; 1287 while (match = importMatch.exec(response.data)) { 1288 document.styleSheets[0].addImport(match[1]); 1289 } 1290 } 1291 }, 1292 1293 /** 1294 * Command to update a form's build ID. 1295 */ 1296 updateBuildId: function(ajax, response, status) { 1297 $('input[name="form_build_id"][value="' + response['old'] + '"]').val(response['new']); 1298 } 1299}; 1300 1301})(jQuery); 1302; 1303(function (D) { 1304 var beforeSerialize = D.ajax.prototype.beforeSerialize;
1305 D.ajax.prototype.beforeSerialize = function (element, options) { 1306 beforeSerialize.call(this, element, options); 1307 options.data['ajax_page_state[jquery_version]'] = D.settings.ajaxPageState.jquery_version; 1308 options.data['ajax_page_state[jquery_version_token]'] = D.settings.ajaxPageState.jquery_version_token; 1309 } 1310})(Drupal); 1311;
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.