1/*jslint browser: true */ /*global jQuery: true */ 2 3/** 4 * jQuery Cookie plugin 5 * 6 * Copyright (c) 2010 Klaus Hartl (stilbuero.de) 7 * Dual licensed under the MIT and GPL licenses: 8 * http://www.opensource.org/licenses/mit-license.php 9 * http://www.gnu.org/licenses/gpl.html 10 * 11 */ 12 13// TODO JsDoc 14 15/** 16 * Create a cookie with the given key and value and other optional parameters. 17 * 18 * @example $.cookie('the_cookie', 'the_value'); 19 * @desc Set the value of a cookie. 20 * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true }); 21 * @desc Create a cookie with all available options. 22 * @example $.cookie('the_cookie', 'the_value'); 23 * @desc Create a session cookie. 24 * @example $.cookie('the_cookie', null); 25 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain 26 * used when the cookie was set. 27 * 28 * @param String key The key of the cookie. 29 * @param String value The value of the cookie. 30 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes. 31 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object. 32 * If a negative value is specified (e.g. a date in the past), the cookie will be deleted. 33 * If set to null or omitted, the cookie will be a session cookie and will not be retained 34 * when the the browser exits. 35 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie). 36 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie). 37 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will 38 * require a secure protocol (like HTTPS). 39 * @type undefined 40 * 41 * @name $.cookie 42 * @cat Plugins/Cookie 43 * @author Klaus Hartl/[email protected] 44 */ 45 46/** 47 * Get the value of a cookie with the given key. 48 * 49 * @example $.cookie('the_cookie'); 50 * @desc Get the value of a cookie. 51 * 52 * @param String key The key of the cookie. 53 * @return The value of the cookie. 54 * @type String 55 * 56 * @name $.cookie 57 * @cat Plugins/Cookie 58 * @author Klaus Hartl/[email protected] 59 */ 60jQuery.cookie = function (key, value, options) { 61 62 // key and value given, set cookie... 63 if (arguments.length > 1 && (value === null || typeof value !== "object")) { 64 options = jQuery.extend({}, options); 65 66 if (value === null) { 67 options.expires = -1; 68 } 69 70 if (typeof options.expires === 'number') { 71 var days = options.expires, t = options.expires = new Date(); 72 t.setDate(t.getDate() + days); 73 } 74 75 return (document.cookie = [ 76 encodeURIComponent(key), '=', 77 options.raw ? String(value) : encodeURIComponent(String(value)), 78 options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE 79 options.path ? '; path=' + options.path : '', 80 options.domain ? '; domain=' + options.domain : '', 81 options.secure ? '; secure' : '' 82 ].join('')); 83 } 84 85 // key and possibly options given, get cookie... 86 options = value || {}; 87 var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent; 88 return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null; 89}; 90; 91/*! 92 * jQuery Form Plugin 93 * version: 4.2.1 94 * Requires jQuery v1.7 or later 95 * Copyright 2017 Kevin Morris 96 * Copyright 2006 M. Alsup 97 * Project repository: https://github.com/jquery-form/form 98 * Dual licensed under the MIT and LGPLv3 licenses. 99 * https://github.com/jquery-form/form#license 100 */ 101!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=function(b,c){return void 0===c&&(c="undefined"!=typeof window?require("jquery"):require("jquery")(b)),a(c),c}:a(jQuery)}(function(a){"use strict";function b(b){var c=b.data;b.isDefaultPrevented()||(b.preventDefault(),a(b.target).closest("form").ajaxSubmit(c))}function c(b){var c=b.target,d=a(c);if(!d.is("[type=submit],[type=image]")){var e=d.closest("[type=submit]");if(0===e.length)return;c=e[0]}var f=c.form;if(f.clk=c,"image"===c.type)if(void 0!==b.offsetX)f.clk_x=b.offsetX,f.clk_y=b.offsetY;else if("function"==typeof a.fn.offset){var g=d.offset();f.clk_x=b.pageX-g.left,f.clk_y=b.pageY-g.top}else f.clk_x=b.pageX-c.offsetLeft,f.clk_y=b.pageY-c.offsetTop;setTimeout(function(){f.clk=f.clk_x=f.clk_y=null},100)}function d(){if(a.fn.ajaxSubmit.debug){var b="[jquery.form] "+Array.prototype.join.call(arguments,"");window.console&&window.console.log?window.console.log(b):window.opera&&window.opera.postError&&window.opera.postError(b)}}var e={};e.fileapi=void 0!==a('<input type="file">').get(0).files,e.formdata=void 0!==window.FormData;var f=!!a.fn.prop;a.fn.attr2=function(){if(!f)return this.attr.apply(this,arguments);var a=this.prop.apply(this,arguments);return a&&a.jquery||"string"==typeof a?a:this.attr.apply(this,arguments)},a.fn.ajaxSubmit=function(b,c,g,h){function i(c){var d,e,f=a.param(c,b.traditional).split("&"),g=f.length,h=[];for(d=0;d<g;
101d++)f[d]=f[d].replace(/\+/g," "),e=f[d].split("="),h.push([decodeURIComponent(e[0]),decodeURIComponent(e[1])]);return h}function j(c){for(var d=new FormData,e=0;e<c.length;e++)d.append(c[e].name,c[e].value);if(b.extraData){var f=i(b.extraData);for(e=0;e<f.length;e++)f[e]&&d.append(f[e][0],f[e][1])}b.data=null;var g=a.extend(!0,{},a.ajaxSettings,b,{contentType:!1,processData:!1,cache:!1,type:l||"POST"});b.uploadProgress&&(g.xhr=function(){var c=a.ajaxSettings.xhr();return c.upload&&c.upload.addEventListener("progress",function(a){var c=0,d=a.loaded||a.position,e=a.total;a.lengthComputable&&(c=Math.ceil(d/e*100)),b.uploadProgress(a,d,e,c)},!1),c}),g.data=null;var h=g.beforeSend;return g.beforeSend=function(a,c){b.formData?c.data=b.formData:c.data=d,h&&h.call(this,a,c)},a.ajax(g)}function k(c){function e(a){var b=null;try{a.contentWindow&&(b=a.contentWindow.document)}catch(a){d("cannot get iframe.contentWindow document: "+a)}if(b)return b;try{b=a.contentDocument?a.contentDocument:a.document}catch(c){d("cannot get iframe.contentDocument: "+c),b=a.document}return b}function g(){function b(){try{var a=e(q).readyState;d("state = "+a),a&&"uninitialized"===a.toLowerCase()&&setTimeout(b,50)}catch(a){d("Server abort: ",a," (",a.name,")"),h(2),w&&clearTimeout(w),w=void 0}}var c=o.attr2("target"),f=o.attr2("action"),g=o.attr("enctype")||o.attr("encoding")||"multipart/form-data";x.setAttribute("target",n),l&&!/post/i.test(l)||x.setAttribute("method","POST"),f!==k.url&&x.setAttribute("action",k.url),k.skipEncodingOverride||l&&!/post/i.test(l)||o.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"}),k.timeout&&(w=setTimeout(function(){v=!0,h(1)},k.timeout));var i=[];try{if(k.extraData)for(var j in k.extraData)k.extraData.hasOwnProperty(j)&&(a.isPlainObject(k.extraData[j])&&k.extraData[j].hasOwnProperty("name")&&k.extraData[j].hasOwnProperty("value")?i.push(a('<input type="hidden" name="'+k.extraData[j].name+'">',z).val(k.extraData[j].value).appendTo(x)[0]):i.push(a('<input type="hidden" name="'+j+'">',z).val(k.extraData[j]).appendTo(x)[0]));k.iframeTarget||p.appendTo(A),q.attachEvent?q.attachEvent("onload",h):q.addEventListener("load",h,!1),setTimeout(b,15);try{x.submit()}catch(a){var m=document.createElement("form").submit;m.apply(x)}}finally{x.setAttribute("action",f),x.setAttribute("enctype",g),c?x.setAttribute("target",c):o.removeAttr("target"),a(i).remove()}}function h(b){if(!r.aborted&&!F){if(E=e(q),E||(d("cannot access response document"),b=2),1===b&&r)return r.abort("timeout"),void y.reject(r,"timeout");if(2===b&&r)return r.abort("server abort"),void y.reject(r,"error","server abort");if(E&&E.location.href!==k.iframeSrc||v){q.detachEvent?q.detachEvent("onload",h):q.removeEventListener("load",h,!1);var c,f="success";try{if(v)throw"timeout";var g="xml"===k.dataType||E.XMLDocument||a.isXMLDoc(E);if(d("isXml="+g),!g&&window.opera&&(null===E.body||!E.body.innerHTML)&&--G)return d("requeing onLoad callback, DOM not available"),void setTimeout(h,250);var i=E.body?E.body:E.documentElement;r.responseText=i?i.innerHTML:null,r.responseXML=E.XMLDocument?E.XMLDocument:E,g&&(k.dataType="xml"),r.getResponseHeader=function(a){return{"content-type":k.dataType}[a.toLowerCase()]},i&&(r.status=Number(i.getAttribute("status"))||r.status,r.statusText=i.getAttribute("statusText")||r.statusText);var j=(k.dataType||"").toLowerCase(),l=/(json|script|text)/.test(j);if(l||k.textarea){var n=E.getElementsByTagName("textarea")[0];if(n)r.responseText=n.value,r.status=Number(n.getAttribute("status"))||r.status,r.statusText=n.getAttribute("statusText")||r.statusText;else if(l){var o=E.getElementsByTagName("pre")[0],s=E.getElementsByTagName("body")[0];o?r.responseText=o.textContent?o.textContent:o.innerText:s&&(r.responseText=s.textContent?s.textContent:s.innerText)}}else"xml"===j&&!r.responseXML&&r.responseText&&(r.responseXML=H(r.responseText));try{D=J(r,j,k)}catch(a){f="parsererror",r.error=c=a||f}}catch(a){d("error caught: ",a),f="error",r.error=c=a||f}r.aborted&&(d("upload aborted"),f=null),r.status&&(f=r.status>=200&&r.status<300||304===r.status?"success":"error"),"success"===f?(k.success&&k.success.call(k.
101context,D,"success",r),y.resolve(r.responseText,"success",r),m&&a.event.trigger("ajaxSuccess",[r,k])):f&&(void 0===c&&(c=r.statusText),k.error&&k.error.call(k.context,r,f,c),y.reject(r,"error",c),m&&a.event.trigger("ajaxError",[r,k,c])),m&&a.event.trigger("ajaxComplete",[r,k]),m&&!--a.active&&a.event.trigger("ajaxStop"),k.complete&&k.complete.call(k.context,r,f),F=!0,k.timeout&&clearTimeout(w),setTimeout(function(){k.iframeTarget?p.attr("src",k.iframeSrc):p.remove(),r.responseXML=null},100)}}}var i,j,k,m,n,p,q,r,t,u,v,w,x=o[0],y=a.Deferred();if(y.abort=function(a){r.abort(a)},c)for(j=0;j<s.length;j++)i=a(s[j]),f?i.prop("disabled",!1):i.removeAttr("disabled");k=a.extend(!0,{},a.ajaxSettings,b),k.context=k.context||k,n="jqFormIO"+(new Date).getTime();var z=x.ownerDocument,A=o.closest("body");if(k.iframeTarget?(p=a(k.iframeTarget,z),u=p.attr2("name"),u?n=u:p.attr2("name",n)):(p=a('<iframe name="'+n+'" src="'+k.iframeSrc+'" />',z),p.css({position:"absolute",top:"-1000px",left:"-1000px"})),q=p[0],r={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(b){var c="timeout"===b?"timeout":"aborted";d("aborting upload... "+c),this.aborted=1;try{q.contentWindow.document.execCommand&&q.contentWindow.document.execCommand("Stop")}catch(a){}p.attr("src",k.iframeSrc),r.error=c,k.error&&k.error.call(k.context,r,c,b),m&&a.event.trigger("ajaxError",[r,k,c]),k.complete&&k.complete.call(k.context,r,c)}},m=k.global,m&&0==a.active++&&a.event.trigger("ajaxStart"),m&&a.event.trigger("ajaxSend",[r,k]),k.beforeSend&&k.beforeSend.call(k.context,r,k)===!1)return k.global&&a.active--,y.reject(),y;if(r.aborted)return y.reject(),y;(t=x.clk)&&(u=t.name)&&!t.disabled&&(k.extraData=k.extraData||{},k.extraData[u]=t.value,"image"===t.type&&(k.extraData[u+".x"]=x.clk_x,k.extraData[u+".y"]=x.clk_y));var B=a("meta[name=csrf-token]").attr("content"),C=a("meta[name=csrf-param]").attr("content");C&&B&&(k.extraData=k.extraData||{},k.extraData[C]=B),k.forceSync?g():setTimeout(g,10);var D,E,F,G=50,H=a.parseXML||function(a,b){return window.ActiveXObject?(b=new ActiveXObject("Microsoft.XMLDOM"),b.async="false",b.loadXML(a)):b=(new DOMParser).parseFromString(a,"text/xml"),b&&b.documentElement&&"parsererror"!==b.documentElement.nodeName?b:null},I=a.parseJSON||function(a){return window.eval("("+a+")")},J=function(b,c,d){var e=b.getResponseHeader("content-type")||"",f=("xml"===c||!c)&&e.indexOf("xml")>=0,g=f?b.responseXML:b.responseText;return f&&"parsererror"===g.documentElement.nodeName&&a.error&&a.error("parsererror"),d&&d.dataFilter&&(g=d.dataFilter(g,c)),"string"==typeof g&&(("json"===c||!c)&&e.indexOf("json")>=0?g=I(g):("script"===c||!c)&&e.indexOf("javascript")>=0&&a.globalEval(g)),g};return y}if(!this.length)return d("ajaxSubmit: skipping submit process - no element selected"),this;var l,m,n,o=this;"function"==typeof b?b={success:b}:"string"==typeof b||b===!1&&arguments.length>0?(b={url:b,data:c,dataType:g},"function"==typeof h&&(b.success=h)):void 0===b&&(b={}),l=b.method||b.type||this.attr2("method"),m=b.url||this.attr2("action"),n="string"==typeof m?a.trim(m):"",n=n||window.location.href||"",n&&(n=(n.match(/^([^#]+)/)||[])[1]),b=a.extend(!0,{url:n,success:a.ajaxSettings.success,type:l||a.ajaxSettings.type,iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},b);var p={};if(this.trigger("form-pre-serialize",[this,b,p]),p.veto)return d("ajaxSubmit: submit vetoed via form-pre-serialize trigger"),this;if(b.beforeSerialize&&b.beforeSerialize(this,b)===!1)return d("ajaxSubmit: submit aborted via beforeSerialize callback"),this;var q=b.traditional;void 0===q&&(q=a.ajaxSettings.traditional);var r,s=[],t=this.formToArray(b.semantic,s,b.filtering);if(b.data){var u=a.isFunction(b.data)?b.data(t):b.data;b.extraData=u,r=a.param(u,q)}if(b.beforeSubmit&&b.beforeSubmit(t,this,b)===!1)return d("ajaxSubmit: submit aborted via beforeSubmit callback"),this;if(this.trigger("form-submit-validate",[t,this,b,p]),p.veto)return d("ajaxSubmit: submit vetoed via form-submit-validate trigger"),this;var v=a.param(t,q);r&&(v=v?v+"&"+r:r),"GET"===b.type.toUpperCase()?(b.url+=(b.url.indexOf("?")>=0?"&":"?")+v,b.data=null):b.data=v;var w=[];if(b.resetForm&&w.push(function(){o.resetForm()}),b.clearForm&&w.push(function(){o.clearForm(b.includeHidden)}),!b.dataType&&b.target){var x=b.success||function(){};w.push(function(c,d,e){var f=arguments,g=b.replaceTarget?"replaceWith":"html";a(b.target)[g](c).each(function(){x.apply(this,f)})})}
101else b.success&&(a.isArray(b.success)?a.merge(w,b.success):w.push(b.success));if(b.success=function(a,c,d){for(var e=b.context||this,f=0,g=w.length;f<g;f++)w[f].apply(e,[a,c,d||o,o])},b.error){var y=b.error;b.error=function(a,c,d){var e=b.context||this;y.apply(e,[a,c,d,o])}}if(b.complete){var z=b.complete;b.complete=function(a,c){var d=b.context||this;z.apply(d,[a,c,o])}}var A=a("input[type=file]:enabled",this).filter(function(){return""!==a(this).val()}),B=A.length>0,C="multipart/form-data",D=o.attr("enctype")===C||o.attr("encoding")===C,E=e.fileapi&&e.formdata;d("fileAPI :"+E);var F,G=(B||D)&&!E;b.iframe!==!1&&(b.iframe||G)?b.closeKeepAlive?a.get(b.closeKeepAlive,function(){F=k(t)}):F=k(t):F=(B||D)&&E?j(t):a.ajax(b),o.removeData("jqxhr").data("jqxhr",F);for(var H=0;H<s.length;H++)s[H]=null;return this.trigger("form-submit-notify",[this,b]),this},a.fn.ajaxForm=function(e,f,g,h){if(("string"==typeof e||e===!1&&arguments.length>0)&&(e={url:e,data:f,dataType:g},"function"==typeof h&&(e.success=h)),e=e||{},e.delegation=e.delegation&&a.isFunction(a.fn.on),!e.delegation&&0===this.length){var i={s:this.selector,c:this.context};return!a.isReady&&i.s?(d("DOM not ready, queuing ajaxForm"),a(function(){a(i.s,i.c).ajaxForm(e)}),this):(d("terminating; zero elements found by selector"+(a.isReady?"":" (DOM not ready)")),this)}return e.delegation?(a(document).off("submit.form-plugin",this.selector,b).off("click.form-plugin",this.selector,c).on("submit.form-plugin",this.selector,e,b).on("click.form-plugin",this.selector,e,c),this):this.ajaxFormUnbind().on("submit.form-plugin",e,b).on("click.form-plugin",e,c)},a.fn.ajaxFormUnbind=function(){return this.off("submit.form-plugin click.form-plugin")},a.fn.formToArray=function(b,c,d){var f=[];if(0===this.length)return f;var g,h=this[0],i=this.attr("id"),j=b||void 0===h.elements?h.getElementsByTagName("*"):h.elements;if(j&&(j=a.makeArray(j)),i&&(b||/(Edge|Trident)\//.test(navigator.userAgent))&&(g=a(':input[form="'+i+'"]').get(),g.length&&(j=(j||[]).concat(g))),!j||!j.length)return f;a.isFunction(d)&&(j=a.map(j,d));var k,l,m,n,o,p,q;for(k=0,p=j.length;k<p;k++)if(o=j[k],(m=o.name)&&!o.disabled)if(b&&h.clk&&"image"===o.type)h.clk===o&&(f.push({name:m,value:a(o).val(),type:o.type}),f.push({name:m+".x",value:h.clk_x},{name:m+".y",value:h.clk_y}));else if((n=a.fieldValue(o,!0))&&n.constructor===Array)for(c&&c.push(o),l=0,q=n.length;l<q;l++)f.push({name:m,value:n[l]});else if(e.fileapi&&"file"===o.type){c&&c.push(o);var r=o.files;if(r.length)for(l=0;l<r.length;l++)f.push({name:m,value:r[l],type:o.type});else f.push({name:m,value:"",type:o.type})}else null!==n&&void 0!==n&&(c&&c.push(o),f.push({name:m,value:n,type:o.type,required:o.required}));if(!b&&h.clk){var s=a(h.clk),t=s[0];m=t.name,m&&!t.disabled&&"image"===t.type&&(f.push({name:m,value:s.val()}),f.push({name:m+".x",value:h.clk_x},{name:m+".y",value:h.clk_y}))}return f},a.fn.formSerialize=function(b){return a.param(this.formToArray(b))},a.fn.fieldSerialize=function(b){var c=[];return this.each(function(){var d=this.name;if(d){var e=a.fieldValue(this,b);if(e&&e.constructor===Array)for(var f=0,g=e.length;f<g;f++)c.push({name:d,value:e[f]});else null!==e&&void 0!==e&&c.push({name:this.name,value:e})}}),a.param(c)},a.fn.fieldValue=function(b){for(var c=[],d=0,e=this.length;d<e;d++){var f=this[d],g=a.fieldValue(f,b);null===g||void 0===g||g.constructor===Array&&!g.length||(g.constructor===Array?a.merge
101(c,g):c.push(g))}return c},a.fieldValue=function(b,c){var d=b.name,e=b.type,f=b.tagName.toLowerCase();if(void 0===c&&(c=!0),c&&(!d||b.disabled||"reset"===e||"button"===e||("checkbox"===e||"radio"===e)&&!b.checked||("submit"===e||"image"===e)&&b.form&&b.form.clk!==b||"select"===f&&b.selectedIndex===-1))return null;if("select"===f){var g=b.selectedIndex;if(g<0)return null;for(var h=[],i=b.options,j="select-one"===e,k=j?g+1:i.length,l=j?g:0;l<k;l++){var m=i[l];if(m.selected&&!m.disabled){var n=m.value;if(n||(n=m.attributes&&m.attributes.value&&!m.attributes.value.specified?m.text:m.value),j)return n;h.push(n)}}return h}return a(b).val().replace(/\r?\n/g,"\r\n")},a.fn.clearForm=function(b){return this.each(function(){a("input,select,textarea",this).clearFields(b)})},a.fn.clearFields=a.fn.clearInputs=function(b){var c=/^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i;return this.each(function(){var d=this.type,e=this.tagName.toLowerCase();c.test(d)||"textarea"===e?this.value="":"checkbox"===d||"radio"===d?this.checked=!1:"select"===e?this.selectedIndex=-1:"file"===d?/MSIE/.test(navigator.userAgent)?a(this).replaceWith(a(this).clone(!0)):a(this).val(""):b&&(b===!0&&/hidden/.test(d)||"string"==typeof b&&a(this).is(b))&&(this.value="")})},a.fn.resetForm=function(){return this.each(function(){var b=a(this),c=this.tagName.toLowerCase();switch(c){case"input":this.checked=this.defaultChecked;case"textarea":return this.value=this.defaultValue,!0;case"option":case"optgroup":var d=b.parents("select");return d.length&&d[0].multiple?"option"===c?this.selected=this.defaultSelected:b.find("option").resetForm():d.resetForm(),!0;case"select":return b.find("option").each(function(a){if(this.selected=this.defaultSelected,this.defaultSelected&&!b[0].multiple)return b[0].selectedIndex=a,!1}),!0;case"label":var e=a(b.attr("for")),f=b.find("input,select,textarea");return e[0]&&f.unshift(e[0]),f.resetForm(),!0;case"form":return("function"==typeof this.reset||"object"==typeof this.reset&&!this.reset.nodeType)&&this.reset(),!0;default:return b.find("form,input,label,select,textarea").resetForm(),!0}})},a.fn.enable=function(a){return void 0===a&&(a=!0),this.each(function(){this.disabled=!a})},a.fn.selected=function(b){return void 0===b&&(b=!0),this.each(function(){var c=this.type;if("checkbox"===c||"radio"===c)this.checked=b;else if("option"===this.tagName.toLowerCase()){var d=a(this).parent("select");b&&d[0]&&"select-one"===d[0].type&&d.find("option").selected(!1),this.selected=b}})},a.fn.ajaxSubmit.debug=!1}); 102; 103(function ($) { 104 Drupal.viewsSlideshow = Drupal.viewsSlideshow || {}; 105 106 /** 107 * Views Slideshow Controls 108 */ 109 Drupal.viewsSlideshowControls = Drupal.viewsSlideshowControls || {}; 110 111 /** 112 * Implement the play hook for controls. 113 */ 114 Drupal.viewsSlideshowControls.play = function (options) { 115 // Route the control call to the correct control type. 116 // Need to use try catch so we don't have to check to make sure every part 117 // of the object is defined. 118 try { 119 if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].play == 'function') { 120 Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].play(options); 121 } 122 } 123 catch(err) { 124 // Don't need to do anything on error. 125 } 126 127 try { 128 if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].play == 'function') { 129 Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].play(options); 130 } 131 } 132 catch(err) { 133 // Don't need to do anything on error. 134 } 135 }; 136 137 /** 138 * Implement the pause hook for controls. 139 */ 140 Drupal.viewsSlideshowControls.pause = function (options) { 141 // Route the control call to the correct control type. 142 // Need to use try catch so we don't have to check to make sure every part 143 // of the object is defined. 144 try { 145 if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].pause == 'function') { 146 Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].pause(options); 147 } 148 } 149 catch(err) { 150 // Don't need to do anything on error. 151 } 152 153 try { 154 if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].pause == 'function') { 155 Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].pause(options); 156 } 157 } 158 catch(err) { 159 // Don't need to do anything on error. 160 } 161 }; 162 163 164 /** 165 * Views Slideshow Text Controls 166 */ 167 168 // Add views slideshow api calls for views slideshow text controls. 169 Drupal.behaviors.viewsSlideshowControlsText = { 170 attach: function (context) { 171 172 // Process previous link
173 $('.views_slideshow_controls_text_previous:not(.views-slideshow-controls-text-previous-processed)', context).addClass('views-slideshow-controls-text-previous-processed').each(function() { 174 var uniqueID = $(this).attr('id').replace('views_slideshow_controls_text_previous_', ''); 175 $(this).click(function() { 176 Drupal.viewsSlideshow.action({ "action": 'previousSlide', "slideshowID": uniqueID }); 177 return false; 178 }); 179 }); 180 181 // Process next link 182 $('.views_slideshow_controls_text_next:not(.views-slideshow-controls-text-next-processed)', context).addClass('views-slideshow-controls-text-next-processed').each(function() { 183 var uniqueID = $(this).attr('id').replace('views_slideshow_controls_text_next_', ''); 184 $(this).click(function() { 185 Drupal.viewsSlideshow.action({ "action": 'nextSlide', "slideshowID": uniqueID }); 186 return false; 187 }); 188 }); 189 190 // Process pause link 191 $('.views_slideshow_controls_text_pause:not(.views-slideshow-controls-text-pause-processed)', context).addClass('views-slideshow-controls-text-pause-processed').each(function() { 192 var uniqueID = $(this).attr('id').replace('views_slideshow_controls_text_pause_', ''); 193 $(this).click(function() { 194 if (Drupal.settings.viewsSlideshow[uniqueID].paused) { 195 Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": uniqueID, "force": true }); 196 } 197 else { 198 Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": uniqueID, "force": true }); 199 } 200 return false; 201 }); 202 }); 203 } 204 }; 205 206 Drupal.viewsSlideshowControlsText = Drupal.viewsSlideshowControlsText || {}; 207 208 /** 209 * Implement the pause hook for text controls. 210 */ 211 Drupal.viewsSlideshowControlsText.pause = function (options) { 212 var pauseText = Drupal.theme.prototype['viewsSlideshowControlsPause'] ? Drupal.theme('viewsSlideshowControlsPause') : ''; 213 $('#views_slideshow_controls_text_pause_' + options.slideshowID + ' a').text(pauseText); 214 $('#views_slideshow_controls_text_pause_' + options.slideshowID).removeClass('views-slideshow-controls-text-status-play'); 215 $('#views_slideshow_controls_text_pause_' + options.slideshowID).addClass('views-slideshow-controls-text-status-pause'); 216 }; 217 218 /** 219 * Implement the play hook for text controls. 220 */ 221 Drupal.viewsSlideshowControlsText.play = function (options) { 222 var playText = Drupal.theme.prototype['viewsSlideshowControlsPlay'] ? Drupal.theme('viewsSlideshowControlsPlay') : ''; 223 $('#views_slideshow_controls_text_pause_' + options.slideshowID + ' a').text(playText); 224 $('#views_slideshow_controls_text_pause_' + options.slideshowID).removeClass('views-slideshow-controls-text-status-pause'); 225 $('#views_slideshow_controls_text_pause_' + options.slideshowID).addClass('views-slideshow-controls-text-status-play'); 226 }; 227 228 // Theme the resume control. 229 Drupal.theme.prototype.viewsSlideshowControlsPause = function () { 230 return Drupal.t('Resume'); 231 }; 232 233 // Theme the pause control. 234 Drupal.theme.prototype.viewsSlideshowControlsPlay = function () { 235 return Drupal.t('Pause'); 236 }; 237 238 /** 239 * Views Slideshow Pager 240 */ 241 Drupal.viewsSlideshowPager = Drupal.viewsSlideshowPager || {}; 242 243 /** 244 * Implement the transitionBegin hook for pagers. 245 */ 246 Drupal.viewsSlideshowPager.transitionBegin = 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 != "undefined" && typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].transitionBegin == 'function') { 252 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].transitionBegin(options); 253 if (Drupal.settings.viewsSlideshowPager[options.slideshowID].top.master_pager === 1) { 254 $.each(Drupal.settings.viewsSlideshow, function(i, obj) { 255 if (i != options.slideshowID) { 256 options.slideshowID = i; 257 options.action = 'goToSlide'; 258 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].goToSlide(options); 259 } 260 }); 261 } 262 } 263 } 264 catch(err) { 265 // Don't need to do anything on error. 266 } 267 268 try { 269 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') { 270 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].transitionBegin(options); 271 if (Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.master_pager === 1) { 272 $.each(Drupal.settings.viewsSlideshow, function(i, obj) { 273 if (i != options.slideshowID) { 274 options.slideshowID = i; 275 options.action = 'goToSlide'; 276 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].goToSlide(options); 277 } 278 }); 279 } 280 } 281 } 282 catch(err) { 283 // Don't need to do anything on error. 284 } 285 }; 286 287 /** 288 * Implement the goToSlide hook for pagers. 289 */ 290 Drupal.viewsSlideshowPager.goToSlide = function (options) { 291 // Route the pager call to the correct pager type. 292 // Need to use try catch so we don't have to check to make sure every part 293 // of the object is defined. 294 try { 295 if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].goToSlide == 'function') { 296 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].goToSlide(options); 297 } 298 } 299 catch(err) { 300 // Don't need to do anything on error. 301 } 302 303 try { 304 if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].goToSlide == 'function') { 305 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].goToSlide(options); 306 } 307 } 308 catch(err) { 309 // Don't need to do anything on error. 310 } 311 }; 312 313 /** 314 * Implement the previousSlide hook for pagers. 315 */ 316 Drupal.viewsSlideshowPager.previousSlide = function (options) { 317 // Route the pager call to the correct pager type. 318 // Need to use try catch so we don't have to check to make sure every part 319 // of the object is defined. 320 try { 321 if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].previousSlide == 'function') { 322 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].previousSlide(options); 323 } 324 } 325 catch(err) { 326 // Don't need to do anything on error. 327 } 328 329 try { 330 if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].previousSlide == 'function') { 331 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].previousSlide(options); 332 } 333 } 334 catch(err) { 335 // Don't need to do anything on error. 336 } 337 }; 338 339 /** 340 * Implement the nextSlide hook for pagers. 341 */ 342 Drupal.viewsSlideshowPager.nextSlide = function (options) { 343 // Route the pager call to the correct pager type. 344 // Need to use try catch so we don't have to check to make sure every part 345 // of the object is defined. 346 try { 347 if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].nextSlide == 'function') { 348 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].nextSlide(options); 349 } 350 } 351 catch(err) { 352 // Don't need to do anything on error. 353 } 354 355 try { 356 if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].nextSlide == 'function') { 357 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].nextSlide(options); 358 } 359 } 360 catch(err) { 361 // Don't need to do anything on error. 362 } 363 }; 364 365 366 /** 367 * Views Slideshow Pager Fields 368 */ 369 370 // Add views slideshow api calls for views slideshow pager fields. 371 Drupal.behaviors.viewsSlideshowPagerFields = { 372 attach: function (context) { 373 // Process pause on hover.
374 $('.views_slideshow_pager_field:not(.views-slideshow-pager-field-processed)', context).addClass('views-slideshow-pager-field-processed').each(function() { 375 // Parse out the location and unique id from the full id. 376 var pagerInfo = $(this).attr('id').split('_'); 377 var location = pagerInfo[2]; 378 pagerInfo.splice(0, 3); 379 var uniqueID = pagerInfo.join('_'); 380 381 // Add the activate and pause on pager hover event to each pager item. 382 if (Drupal.settings.viewsSlideshowPagerFields[uniqueID][location].activatePauseOnHover) { 383 $(this).children().each(function(index, pagerItem) { 384 var mouseIn = function() { 385 Drupal.viewsSlideshow.action({ "action": 'goToSlide', "slideshowID": uniqueID, "slideNum": index }); 386 Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": uniqueID }); 387 }; 388 389 var mouseOut = function() { 390 Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": uniqueID }); 391 }; 392 393 if (jQuery.fn.hoverIntent) { 394 $(pagerItem).hoverIntent(mouseIn, mouseOut); 395 } 396 else { 397 $(pagerItem).hover(mouseIn, mouseOut); 398 } 399 }); 400 } 401 else { 402 $(this).children().each(function(index, pagerItem) { 403 $(pagerItem).click(function() { 404 Drupal.viewsSlideshow.action({ "action": 'goToSlide', "slideshowID": uniqueID, "slideNum": index }); 405 }); 406 }); 407 } 408 }); 409 } 410 }; 411 412 Drupal.viewsSlideshowPagerFields = Drupal.viewsSlideshowPagerFields || {}; 413 414 /** 415 * Implement the transitionBegin hook for pager fields pager. 416 */ 417 Drupal.viewsSlideshowPagerFields.transitionBegin = function (options) {
418 for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) { 419 // Remove active class from pagers 420 $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active'); 421 422 // Add active class to active pager. 423 $('#views_slideshow_pager_field_item_'+ pagerLocation + '_' + options.slideshowID + '_' + options.slideNum).addClass('active'); 424 } 425 }; 426 427 /** 428 * Implement the goToSlide hook for pager fields pager. 429 */ 430 Drupal.viewsSlideshowPagerFields.goToSlide = function (options) { 431 for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) { 432 // Remove active class from pagers 433 $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active'); 434 435 // Add active class to active pager. 436 $('#views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_' + options.slideNum).addClass('active'); 437 } 438 }; 439 440 /** 441 * Implement the previousSlide hook for pager fields pager. 442 */ 443 Drupal.viewsSlideshowPagerFields.previousSlide = function (options) {
444 for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) { 445 // Get the current active pager. 446 var pagerNum = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"].active').attr('id').replace('views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_', ''); 447 448 // If we are on the first pager then activate the last pager. 449 // Otherwise activate the previous pager. 450 if (pagerNum == 0) { 451 pagerNum = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').length() - 1; 452 } 453 else { 454 pagerNum--; 455 } 456 457 // Remove active class from pagers 458 $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active'); 459 460 // Add active class to active pager. 461 $('#views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_' + pagerNum).addClass('active'); 462 } 463 }; 464 465 /** 466 * Implement the nextSlide hook for pager fields pager. 467 */ 468 Drupal.viewsSlideshowPagerFields.nextSlide = function (options) {
469 for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) { 470 // Get the current active pager. 471 var pagerNum = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"].active').attr('id').replace('views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_', ''); 472 var totalPagers = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').length(); 473 474 // If we are on the last pager then activate the first pager. 475 // Otherwise activate the next pager. 476 pagerNum++; 477 if (pagerNum == totalPagers) { 478 pagerNum = 0; 479 } 480 481 // Remove active class from pagers 482 $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active'); 483 484 // Add active class to active pager. 485 $('#views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_' + slideNum).addClass('active'); 486 } 487 }; 488 489 490 /** 491 * Views Slideshow Slide Counter 492 */ 493 494 Drupal.viewsSlideshowSlideCounter = Drupal.viewsSlideshowSlideCounter || {}; 495 496 /** 497 * Implement the transitionBegin for the slide counter. 498 */ 499 Drupal.viewsSlideshowSlideCounter.transitionBegin = function (options) { 500 $('#views_slideshow_slide_counter_' + options.slideshowID + ' .num').text(options.slideNum + 1); 501 }; 502 503 /** 504 * This is used as a router to process actions for the slideshow. 505 */ 506 Drupal.viewsSlideshow.action = function (options) { 507 // Set default values for our return status. 508 var status = { 509 'value': true, 510 'text': '' 511 }; 512 513 // If an action isn't specified return false. 514 if (typeof options.action == 'undefined' || options.action == '') { 515 status.value = false; 516 status.text = Drupal.t('There was no action specified.'); 517 return error; 518 } 519 520 // If we are using pause or play switch paused state accordingly. 521 if (options.action == 'pause') { 522 Drupal.settings.viewsSlideshow[options.slideshowID].paused = 1; 523 // If the calling method is forcing a pause then mark it as such. 524 if (options.force) { 525 Drupal.settings.viewsSlideshow[options.slideshowID].pausedForce = 1; 526 } 527 } 528 else if (options.action == 'play') { 529 // If the slideshow isn't forced pause or we are forcing a play then play 530 // the slideshow. 531 // Otherwise return telling the calling method that it was forced paused. 532 if (!Drupal.settings.viewsSlideshow[options.slideshowID].pausedForce || options.force) { 533 Drupal.settings.viewsSlideshow[options.slideshowID].paused = 0; 534 Drupal.settings.viewsSlideshow[options.slideshowID].pausedForce = 0; 535 } 536 else { 537 status.value = false; 538 status.text += ' ' + Drupal.t('This slideshow is forced paused.'); 539 return status; 540 } 541 } 542 543 // We use a switch statement here mainly just to limit the type of actions 544 // that are available. 545 switch (options.action) { 546 case "goToSlide": 547 case "transitionBegin": 548 case "transitionEnd": 549 // The three methods above require a slide number. Checking if it is 550 // defined and it is a number that is an integer. 551 if (typeof options.slideNum == 'undefined' || typeof options.slideNum !== 'number' || parseInt(options.slideNum) != (options.slideNum - 0)) { 552 status.value = false; 553 status.text = Drupal.t('An invalid integer was specified for slideNum.'); 554 } 555 case "pause": 556 case "play": 557 case "nextSlide": 558 case "previousSlide": 559 // Grab our list of methods. 560 var methods = Drupal.settings.viewsSlideshow[options.slideshowID]['methods']; 561 562 // if the calling method specified methods that shouldn't be called then 563 // exclude calling them. 564 var excludeMethodsObj = {}; 565 if (typeof options.excludeMethods !== 'undefined') { 566 // We need to turn the excludeMethods array into an object so we can use the in 567 // function. 568 for (var i=0; i < excludeMethods.length; i++) { 569 excludeMethodsObj[excludeMethods[i]] = ''; 570 } 571 } 572 573 // Call every registered method and don't call excluded ones. 574 for (i = 0; i < methods[options.action].length; i++) { 575 if (Drupal[methods[options.action][i]] != undefined && typeof Drupal[methods[options.action][i]][options.action] == 'function' && !(methods[options.action][i] in excludeMethodsObj)) { 576 Drupal[methods[options.action][i]][options.action](options); 577 } 578 } 579 break; 580
581 // If it gets here it's because it's an invalid action. 582 default: 583 status.value = false; 584 status.text = Drupal.t('An invalid action "!action" was specified.', { "!action": options.action }); 585 } 586 return status; 587 }; 588})(jQuery); 589; 590/*! 591 * Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net) 592 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php). 593 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. 594 * 595 * $LastChangedDate: 2007-06-19 20:25:28 -0500 (Tue, 19 Jun 2007) $ 596 * $Rev: 2111 $ 597 * 598 * Version 2.1 599 */ 600(function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie&&parseInt($.browser.version)<=6){s=$.extend({top:'auto',left:'auto',width:'auto',height:'auto',opacity:true,src:'javascript:false;'},s||{});var prop=function(n){return n&&n.constructor==Number?n+'px':n;},html='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+'style="display:block;position:absolute;z-index:-1;'+(s.opacity!==false?'filter:Alpha(Opacity=\'0\');':'')+'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+'"/>';return this.each(function(){if($('> iframe.bgiframe',this).length==0)this.insertBefore(document.createElement(html),this.firstChild);});}return this;};if(!$.browser.version)$.browser.version=navigator.userAgent.toLowerCase().match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)[1];})(jQuery);; 601/*! 602* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+ 603* <http://cherne.net/brian/resources/jquery.hoverIntent.html> 604* 605* @param f onMouseOver function || An object with configuration options 606* @param g onMouseOut function || Nothing (use configuration options object) 607* @author Brian Cherne <[email protected]> 608*/ 609(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);; 610; 611/*! 612 * Superfish v1.4.8 - jQuery menu widget 613 * Copyright (c) 2008 Joel Birch 614 * 615 * Dual licensed under the MIT and GPL licenses: 616 * http://www.opensource.org/licenses/mit-license.php 617 * http://www.gnu.org/licenses/gpl.html 618 * 619 * CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt 620 */ 621(function($){ 622 $.fn.superfish = function(op){ 623 624 var sf = $.fn.superfish, 625 c = sf.c, 626 $arrow = $(['<span class="',c.arrowClass,'"> »</span>'].join('')), 627 over = function(){ 628 var $$ = $(this), menu = getMenu($$); 629 clearTimeout(menu.sfTimer); 630 $$.showSuperfishUl().siblings().hideSuperfishUl(); 631 }, 632 out = function(){ 633 var $$ = $(this), menu = getMenu($$), o = sf.op; 634 clearTimeout(menu.sfTimer); 635 menu.sfTimer = setTimeout(function(){ 636 o.retainPath = ($.inArray($$[0],o.$path) > -1);
637 $$.hideSuperfishUl(); 638 if (o.$path.length && $$.parents(['li.', o.hoverClass].join('')).length < 1){ 639 over.call(o.$path); 640 } 641 }, o.delay); 642 }, 643 getMenu = function($menu){ 644 var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0]; 645 sf.op = sf.o[menu.serial]; 646 return menu; 647 }, 648 addArrow = function($a){ 649 $a.addClass(c.anchorClass).append($arrow.clone()); 650 }; 651 652 return this.each(function() { 653 var s = this.serial = sf.o.length; 654 var o = $.extend({},sf.defaults,op); 655 o.$path = $('li.' + o.pathClass,this).slice(0, o.pathLevels).each(function(){ 656 $(this).addClass([o.hoverClass,c.bcClass].join(' ')) 657 .filter('li:has(ul)').removeClass(o.pathClass); 658 }); 659 sf.o[s] = sf.op = o; 660 661 $('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() { 662 if (o.autoArrows) { 663 addArrow($('>a:first-child',this)); 664 } 665 }) 666 .not('.' + c.bcClass) 667 .hideSuperfishUl(); 668 669 var $a = $('a',this); 670 $a.each(function(i){ 671 var $li = $a.eq(i).parents('li'); 672 $a.eq(i).focus(function(){ 673 over.call($li); 674 }).blur(function(){ 675 out.call($li); 676 }); 677 }); 678 o.onInit.call(this); 679 680 }).each(function() { 681 var menuClasses = [c.menuClass]; 682 if (sf.op.dropShadows && !($.browser.msie && $.browser.version < 7)) { 683 menuClasses.push(c.shadowClass); 684 } 685 $(this).addClass(menuClasses.join(' ')); 686 }); 687 }; 688 689 var sf = $.fn.superfish; 690 sf.o = []; 691 sf.op = {}; 692 sf.IE7fix = function(){ 693 var o = sf.op; 694 if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity != undefined) { 695 this.toggleClass(sf.c.shadowClass + '-off'); 696 } 697 }; 698 sf.c = { 699 bcClass : 'sf-breadcrumb', 700 menuClass : 'sf-js-enabled', 701 anchorClass : 'sf-with-ul', 702 arrowClass : 'sf-sub-indicator', 703 shadowClass : 'sf-shadow' 704 }; 705 sf.defaults = { 706 hoverClass : 'sfHover', 707 pathClass : 'overideThisToUse', 708 pathLevels : 1, 709 delay : 800, 710 animation : { 711 opacity:'show' 712 }, 713 speed : 'normal', 714 autoArrows : true, 715 dropShadows : true, 716 // true disables hoverIntent detection. 717 disableHI : false, 718 onInit : function(){}, // callback functions 719 onBeforeShow: function(){}, 720 onShow : function(){}, 721 onHide : function(){} 722 }; 723 $.fn.extend({ 724 hideSuperfishUl : function() { 725 var o = sf.op, 726 not = (o.retainPath === true) ? o.$path : ''; 727 o.retainPath = false; 728 var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass) 729 .find('>ul').hide().css('visibility','hidden'); 730 o.onHide.call($ul); 731 return this; 732 }, 733 showSuperfishUl : function(){ 734 var o = sf.op, 735 sh = sf.c.shadowClass + '-off', 736 $ul = this.addClass(o.hoverClass) 737 .find('>ul:hidden').css('visibility','visible'); 738 sf.IE7fix.call($ul); 739 o.onBeforeShow.call($ul); 740 $ul.animate(o.animation,o.speed,function(){ 741 sf.IE7fix.call($ul); 742 o.onShow.call($ul); 743 }); 744 return this; 745 } 746 }); 747 748})(jQuery); 749; 750/** 751 * @file 752 * Behaviours for the Nice Menus module. This uses Superfish 1.4.8. 753 * 754 * @link http://users.tpg.com.au/j_birch/plugins/superfish 755 */ 756 757(function ($) { 758 759 /** 760 * Add Superfish to all Nice Menus with some basic options. 761 */ 762 Drupal.behaviors.niceMenus = { 763 attach: function (context, settings) { 764 $('ul.nice-menu:not(.nice-menus-processed)').addClass('nice-menus-processed').each(function () { 765 $(this).superfish({ 766 // Apply a generic hover class. 767 hoverClass: 'over', 768 // Disable generation of arrow mark-up.
769 autoArrows: false, 770 // Disable drop shadows. 771 dropShadows: false, 772 // Mouse delay. 773 delay: Drupal.settings.nice_menus_options.delay, 774 // Animation speed. 775 speed: Drupal.settings.nice_menus_options.speed 776 }); 777 778 // Add in Brandon Aaron’s bgIframe plugin for IE select issues. 779 // http://plugins.jquery.com/node/46/release 780 $(this).find('ul').bgIframe({opacity:false}); 781 782 $('ul.nice-menu ul').css('display', 'none'); 783 }); 784 } 785 }; 786 787})(jQuery); 788; 789(function ($) { 790 791 Drupal.accordion = Drupal.accordion || {}; 792 793 /** 794 * Toggle the visibility of an individual accordion using smooth animations. 795 */ 796 Drupal.accordion.toggle = function (accordion, context, accordion_type_info) { 797 var $accordion = $(accordion); 798 if ($accordion.is('.collapsed')) { 799 // Collapse all items in the accordion group. 800 $('.accordion[data-accordions-group="' + $accordion.attr('data-accordions-group') + '"]', context).each(function () { 801 Drupal.accordion.collapse.call(this, accordion_type_info); 802 }); 803 // Then expand this item. 804 Drupal.accordion.expand.call(accordion, accordion_type_info); 805 } 806 else { 807 Drupal.accordion.collapse.call(accordion, accordion_type_info); 808 } 809 }; 810 811 Drupal.accordion.expand = function (accordion_type_info) { 812 var accordion = this; 813 var $accordion = $(accordion); 814 var $content = $accordion.closestDescendant(accordion_type_info.content).hide(); 815 $accordion 816 .removeClass('collapsed') 817 .trigger({ type: 'collapsed', value: false }); 818 $('span.accordions-label-prefix', $accordion.closestDescendant(accordion_type_info.label)).html(Drupal.t('Hide')); 819 $content.slideDown({ 820 duration: 100, 821 easing: 'linear', 822 complete: function () { 823 Drupal.collapseScrollIntoView(accordion); 824 accordion.animating = false; 825 }, 826 step: function () { 827 // Scroll the accordion into view. 828 Drupal.collapseScrollIntoView(accordion); 829 } 830 }); 831 }; 832 833 Drupal.accordion.collapse = function (accordion_type_info) { 834 var accordion = this; 835 var $accordion = $(accordion); 836 $accordion.trigger({ type: 'collapsed', value: true }); 837 $accordion.closestDescendant(accordion_type_info.content).slideUp({ 838 duration: 100, 839 easing: 'linear', 840 complete: function () { 841 $accordion.addClass('collapsed'); 842 $('span.accordions-label-prefix', $accordion.closestDescendant(accordion_type_info.label)).html(Drupal.t('Show')); 843 accordion.animating = false; 844 } 845 }); 846 }; 847 848 /** 849 * Based on Drupal.behaviors.collapse 850 */ 851 Drupal.behaviors.accordions = { 852 attach: function (context, settings) { 853 if (settings.accordions != 'undefined' && typeof settings.accordions != 'undefined') { 854 $('.accordion', context).once('collapse', function () { 855 var accordion = this; 856 var $accordion = $(accordion); 857 var accordion_type = $accordion.attr('data-accordions-type'); 858 if (settings.accordions.hasOwnProperty(accordion_type)) { 859 // Turn the title into a clickable link. 860 var $title = $accordion.closestDescendant(settings.accordions[accordion_type].label); // @todo currently only works for accordion items with titles. 861 if ($title.length > 0) { 862 // Expand accordion if it contains an element that is targeted by the 863 // URI fragment identifier. 864 var anchor = location.hash && location.hash != '#' ? location.hash : ''; 865 if ('#' + $accordion.attr('id') == anchor || $accordion.find(anchor).length) { 866 $accordion.removeClass('collapsed'); 867 } 868 // Collapse accordion initially unless specified as initially expanded. 869 else if (!$accordion.attr('data-accordions-initial')) { 870 Drupal.accordion.collapse.call(accordion, settings.accordions[accordion_type]); 871 } 872 873 $('<span class="accordions-label-prefix element-invisible"></span>') 874 .append($accordion.hasClass('collapsed') ? Drupal.t('Show') : Drupal.t('Hide')) 875 .prependTo($title) 876 .after(' '); 877 878 // .wrapInner() does not retain bound events. 879 var $link = $('<a class="accordions-label" href="#"></a>') 880 .prepend($title.contents()) 881 .appendTo($title) 882 .click(function () { 883 // Don't animate multiple times. 884 if (!accordion.animating) { 885 accordion.animating = true; 886 Drupal.accordion.toggle(accordion, context, settings.accordions[accordion_type]); 887 } 888 return false;
889 }); 890 } 891 else { 892 // @todo Remove this code that removes accordion items without 893 // titles from the accordion group once we support those. 894 $accordion.removeAttr('data-accordions-group'); 895 } 896 } 897 }); 898 } 899 } 900 }; 901 902 // THIS PART COPIED FROM https://github.com/tlindig/jquery-closest-descendant 903 /** 904 * closestDescendant - 0.1.1 - 2013-04-09 905 * https://github.com/tlindig/jquery-closest-descendant 906 * 907 * Copyright (c) 2013 Tobias Lindig 908 * http://tlindig.de/ 909 * 910 * Licensed MIT 911 */ 912 /** 913 * Get the first element(s) that matches the selector by traversing down 914 * through descendants in the DOM tree level by level. It use a breadth 915 * first search (BFS), that mean it will stop search and not going deeper in 916 * the current subtree if the first matching descendant was found. 917 * 918 * @param {selectors} selector -required- a jQuery selector 919 * @param {boolean} findAll -optional- default is false, if true, every 920 * subtree will be visited until first match 921 * @return {jQuery} matched element(s) 922 */ 923 $.fn.closestDescendant = $.fn.closestDescendant || function(selector, findAll) { 924 925 if (!selector || selector === '') { 926 return $(); 927 } 928 929 findAll = findAll ? true : false; 930 931 var resultSet = $(); 932 933 this.each(function() { 934 935 var $this = $(this); 936 937 // breadth first search for every matched node, 938 // go deeper, until a child was found in the current subtree or the leave was reached. 939 var queue = []; 940 queue.push( $this ); 941 while ( queue.length > 0 ) { 942 var node = queue.shift(); 943 var children = node.children(); 944 for ( var i = 0; i < children.length; ++i ) { 945 var $child = $(children[i]); 946 if ( $child.is( selector ) ) { 947 resultSet.push( $child[0] ); //well, we found one 948 if ( ! findAll ) { 949 return false;//stop processing 950 } 951 } else { 952 queue.push( $child ); //go deeper 953 } 954 } 955 } 956 }); 957 958 return resultSet; 959 }; 960 961})(jQuery); 962; 963(function ($) { 964 965/** 966 * Prevents consecutive form submissions of identical form values. 967 * 968 * Repetitive form submissions that would submit the identical form values are 969 * prevented, unless the form values are different from the previously 970 * submitted values. 971 * 972 * This is a simplified re-implementation of a user-agent behavior that should 973 * be natively supported by major web browsers, but at this time, only Firefox 974 * has a built-in protection. 975 * 976 * A form value-based approach ensures that the constraint is triggered for 977 * consecutive, identical form submissions only. Compared to that, a form 978 * button-based approach would (1) rely on [visible] buttons to exist where 979 * technically not required and (2) require more complex state management if 980 * there are multiple buttons in a form. 981 * 982 * This implementation is based on form-level submit events only and relies on 983 * jQuery's serialize() method to determine submitted form values. As such, the 984 * following limitations exist: 985 * 986 * - Event handlers on form buttons that preventDefault() do not receive a 987 * double-submit protection. That is deemed to be fine, since such button 988 * events typically trigger reversible client-side or server-side operations 989 * that are local to the context of a form only. 990 * - Changed values in advanced form controls, such as file inputs, are not part 991 * of the form values being compared between consecutive form submits (due to 992 * limitations of jQuery.serialize()). That is deemed to be acceptable, 993 * because if the user forgot to attach a file, then the size of HTTP payload 994 * will most likely be small enough to be fully passed to the server endpoint 995 * within (milli)seconds. If a user mistakenly attached a wrong file and is 996 * technically versed enough to cancel the form submission (and HTTP payload) 997 * in order to attach a different file, then that edge-case is not supported 998 * here. 999 * 1000 * Lastly, all forms submitted via HTTP GET are idempotent by definition of HTTP 1001 * standards, so excluded in this implementation. 1002 */ 1003Drupal.behaviors.formSingleSubmit = { 1004 attach: function () { 1005 function onFormSubmit (e) { 1006 var $form = $(e.currentTarget); 1007 var formValues = $form.serialize(); 1008 var previousValues = $form.attr('data-drupal-form-submit-last'); 1009 if (previousValues === formValues) { 1010 e.preventDefault(); 1011 } 1012 else { 1013 $form.attr('data-drupal-form-submit-last', formValues); 1014 } 1015 } 1016 1017 $('body').once('form-single-submit') 1018 .delegate('form:not([method~="GET"])', 'submit.singleSubmit', onFormSubmit); 1019 } 1020}; 1021 1022})(jQuery); 1023; 1024(function ($) { 1025 1026/** 1027 * Retrieves the summary for the first element. 1028 */ 1029$.fn.drupalGetSummary = function () { 1030 var callback = this.data('summaryCallback'); 1031 return (this[0] && callback) ? $.trim(callback(this[0])) : ''; 1032}; 1033 1034/** 1035 * Sets the summary for all matched elements. 1036 * 1037 * @param callback 1038 * Either a function that will be called each time the summary is 1039 * retrieved or a string (which is returned each time). 1040 */ 1041$.fn.drupalSetSummary = function (callback) { 1042 var self = this; 1043 1044 // To facilitate things, the callback should always be a function. If it's 1045 // not, we wrap it into an anonymous function which just returns the value. 1046 if (typeof callback != 'function') { 1047 var val = callback; 1048 callback = function () { return val; }; 1049 } 1050 1051 return this 1052 .data('summaryCallback', callback) 1053 // To prevent duplicate events, the handlers are first removed and then 1054 // (re-)added. 1055 .unbind('formUpdated.summary') 1056 .bind('formUpdated.summary', function () { 1057 self.trigger('summaryUpdated'); 1058 }) 1059 // The actual summaryUpdated handler doesn't fire when the callback is 1060 // changed, so we have to do this manually. 1061 .trigger('summaryUpdated'); 1062}; 1063 1064/** 1065 * Sends a 'formUpdated' event each time a form element is modified. 1066 */ 1067Drupal.behaviors.formUpdated = { 1068 attach: function (context) { 1069 // These events are namespaced so that we can remove them later. 1070 var events = 'change.formUpdated click.formUpdated blur.formUpdated keyup.formUpdated'; 1071 $(context) 1072 // Since context could be an input element itself, it's added back to 1073 // the jQuery object and filtered again. 1074 .find(':input').andSelf().filter(':input') 1075 // To prevent duplicate events, the handlers are first removed and then 1076 // (re-)added. 1077 .unbind(events).bind(events, function () { 1078 $(this).trigger('formUpdated'); 1079 }); 1080 } 1081}; 1082 1083/** 1084 * Prepopulate form fields with information from the visitor cookie. 1085 */ 1086Drupal.behaviors.fillUserInfoFromCookie = { 1087 attach: function (context, settings) { 1088 $('form.user-info-from-cookie').once('user-info-from-cookie', function () { 1089 var formContext = this; 1090 $.each(['name', 'mail', 'homepage'], function () { 1091 var $element = $('[name=' + this + ']', formContext); 1092 var cookie = $.cookie('Drupal.visitor.' + this); 1093 if ($element.length && cookie) { 1094 $element.val(cookie); 1095 } 1096 }); 1097 }); 1098 } 1099}; 1100 1101})(jQuery); 1102; 1103(function ($) { 1104 1105/** 1106 * Provides Ajax page updating via jQuery $.ajax (Asynchronous JavaScript and XML). 1107 * 1108 * Ajax is a method of making a request via JavaScript while viewing an HTML 1109 * page. The request returns an array of commands encoded in JSON, which is 1110 * then executed to make any changes that are necessary to the page. 1111 * 1112 * Drupal uses this file to enhance form elements with #ajax['path'] and 1113 * #ajax['wrapper'] properties. If set, this file will automatically be included 1114 * to provide Ajax capabilities. 1115 */ 1116 1117Drupal.ajax = Drupal.ajax || {}; 1118 1119Drupal.settings.urlIsAjaxTrusted = Drupal.settings.urlIsAjaxTrusted || {}; 1120 1121/** 1122 * Attaches the Ajax behavior to each Ajax form element. 1123 */ 1124Drupal.behaviors.AJAX = { 1125 attach: function (context, settings) { 1126 // Load all Ajax behaviors specified in the settings. 1127 for (var base in settings.ajax) { 1128 if (!$('#' + base + '.ajax-processed').length) { 1129 var element_settings = settings.ajax[base]; 1130 1131 if (typeof element_settings.selector == 'undefined') { 1132 element_settings.selector = '#' + base; 1133 } 1134 $(element_settings.selector).each(function () { 1135 element_settings.element = this; 1136 Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings); 1137 }); 1138 1139 $('#' + base).addClass('ajax-processed'); 1140 } 1141 } 1142 1143 // Bind Ajax behaviors to all items showing the class.
1144 $('.use-ajax:not(.ajax-processed)').addClass('ajax-processed').each(function () { 1145 var element_settings = {}; 1146 // Clicked links look better with the throbber than the progress bar. 1147 element_settings.progress = { 'type': 'throbber' }; 1148 1149 // For anchor tags, these will go to the target of the anchor rather 1150 // than the usual location. 1151 if ($(this).attr('href')) { 1152 element_settings.url = $(this).attr('href'); 1153 element_settings.event = 'click'; 1154 } 1155 var base = $(this).attr('id'); 1156 Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings); 1157 }); 1158 1159 // This class means to submit the form to the action using Ajax. 1160 $('.use-ajax-submit:not(.ajax-processed)').addClass('ajax-processed').each(function () { 1161 var element_settings = {}; 1162 1163 // Ajax submits specified in this manner automatically submit to the 1164 // normal form action. 1165 element_settings.url = $(this.form).attr('action'); 1166 // Form submit button clicks need to tell the form what was clicked so 1167 // it gets passed in the POST request. 1168 element_settings.setClick = true; 1169 // Form buttons use the 'click' event rather than mousedown. 1170 element_settings.event = 'click'; 1171 // Clicked form buttons look better with the throbber than the progress bar. 1172 element_settings.progress = { 'type': 'throbber' }; 1173 1174 var base = $(this).attr('id'); 1175 Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings); 1176 }); 1177 } 1178}; 1179 1180/** 1181 * Ajax object. 1182 * 1183 * All Ajax objects on a page are accessible through the global Drupal.ajax 1184 * object and are keyed by the submit button's ID. You can access them from 1185 * your module's JavaScript file to override properties or functions. 1186 * 1187 * For example, if your Ajax enabled button has the ID 'edit-submit', you can 1188 * redefine the function that is called to insert the new content like this 1189 * (inside a Drupal.behaviors attach block): 1190 * @code 1191 * Drupal.behaviors.myCustomAJAXStuff = { 1192 * attach: function (context, settings) { 1193 * Drupal.ajax['edit-submit'].commands.insert = function (ajax, response, status) { 1194 * new_content = $(response.data); 1195 * $('#my-wrapper').append(new_content); 1196 * alert('New content was appended to #my-wrapper'); 1197 * } 1198 * } 1199 * }; 1200 * @endcode 1201 */ 1202Drupal.ajax = function (base, element, element_settings) { 1203 var defaults = { 1204 url: 'system/ajax', 1205 event: 'mousedown', 1206 keypress: true, 1207 selector: '#' + base, 1208 effect: 'none', 1209 speed: 'none', 1210 method: 'replaceWith', 1211 progress: { 1212 type: 'throbber', 1213 message: Drupal.t('Please wait...') 1214 }, 1215 submit: { 1216 'js': true 1217 } 1218 }; 1219 1220 $.extend(this, defaults, element_settings); 1221 1222 this.element = element; 1223 this.element_settings = element_settings; 1224 1225 // Replacing 'nojs' with 'ajax' in the URL allows for an easy method to let 1226 // the server detect when it needs to degrade gracefully. 1227 // There are five scenarios to check for: 1228 // 1. /nojs/ 1229 // 2. /nojs$ - The end of a URL string. 1230 // 3. /nojs? - Followed by a query (with clean URLs enabled). 1231 // E.g.: path/nojs?destination=foobar 1232 // 4. /nojs& - Followed by a query (without clean URLs enabled). 1233 // E.g.: ?q=path/nojs&destination=foobar 1234 // 5. /nojs# - Followed by a fragment. 1235 // E.g.: path/nojs#myfragment 1236 this.url = element_settings.url.replace(/\/nojs(\/|$|\?|&|#)/g, '/ajax$1'); 1237 // If the 'nojs' version of the URL is trusted, also trust the 'ajax' version. 1238 if (Drupal.settings.urlIsAjaxTrusted[element_settings.url]) { 1239 Drupal.settings.urlIsAjaxTrusted[this.url] = true; 1240 } 1241 1242 this.wrapper = '#' + element_settings.wrapper; 1243 1244 // If there isn't a form, jQuery.ajax() will be used instead, allowing us to 1245 // bind Ajax to links as well. 1246 if (this.element.form) { 1247 this.form = $(this.element.form); 1248 } 1249 1250 // Set the options for the ajaxSubmit function. 1251 // The 'this' variable will not persist inside of the options object. 1252 var ajax = this; 1253 ajax.options = { 1254 url: Drupal.sanitizeAjaxUrl(ajax.url), 1255 data: ajax.submit, 1256 beforeSerialize: function (element_settings, options) { 1257 return ajax.beforeSerialize(element_settings, options); 1258 }, 1259 beforeSubmit: function (form_values, element_settings, options) { 1260 ajax.ajaxing = true; 1261 return ajax.beforeSubmit(form_values, element_settings, options); 1262 }, 1263 beforeSend: function (xmlhttprequest, options) { 1264 ajax.ajaxing = true; 1265 return ajax.beforeSend(xmlhttprequest, options); 1266 }, 1267 success: function (response, status, xmlhttprequest) { 1268 // Sanity check for browser support (object expected). 1269 // When using iFrame uploads, responses must be returned as a string. 1270 if (typeof response == 'string') { 1271 response = $.parseJSON(response); 1272 } 1273 1274 // Prior to invoking the response's commands, verify that they can be 1275 // trusted by checking for a response header. See 1276 // ajax_set_verification_header() for details. 1277 // - Empty responses are harmless so can bypass verification. This avoids 1278 // an alert message for server-generated no-op responses that skip Ajax 1279 // rendering. 1280 // - Ajax objects with trusted URLs (e.g., ones defined server-side via 1281 // #ajax) can bypass header verification. This is especially useful for 1282 // Ajax with multipart forms. Because IFRAME transport is used, the 1283 // response headers cannot be accessed for verification. 1284 if (response !== null && !Drupal.settings.urlIsAjaxTrusted[ajax.url]) { 1285 if (xmlhttprequest.getResponseHeader('X-Drupal-Ajax-Token') !== '1') { 1286 var customMessage = Drupal.t("The response failed verification so will not be processed."); 1287 return ajax.error(xmlhttprequest, ajax.url, customMessage); 1288 } 1289 } 1290 1291 return ajax.success(response, status); 1292 }, 1293 complete: function (xmlhttprequest, status) { 1294 ajax.ajaxing = false;
1295 if (status == 'error' || status == 'parsererror') { 1296 return ajax.error(xmlhttprequest, ajax.url); 1297 } 1298 }, 1299 dataType: 'json', 1300 jsonp: false, 1301 type: 'POST' 1302 }; 1303 1304 // For multipart forms (e.g., file uploads), jQuery Form targets the form 1305 // submission to an iframe instead of using an XHR object. The initial "src" 1306 // of the iframe, prior to the form submission, is set to options.iframeSrc. 1307 // "about:blank" is the semantically correct, standards-compliant, way to 1308 // initialize a blank iframe; however, some old IE versions (possibly only 6) 1309 // incorrectly report a mixed content warning when iframes with an 1310 // "about:blank" src are added to a parent document with an https:// origin. 1311 // jQuery Form works around this by defaulting to "javascript:false" instead, 1312 // but that breaks on Chrome 83, so here we force the semantically correct 1313 // behavior for all browsers except old IE. 1314 // @see https://www.drupal.org/project/drupal/issues/3143016 1315 // @see https://github.com/jquery-form/form/blob/df9cb101b9c9c085c8d75ad980c7ff1cf62063a1/jquery.form.js#L68 1316 // @see https://bugs.chromium.org/p/chromium/issues/detail?id=1084874 1317 // @see https://html.spec.whatwg.org/multipage/browsers.html#creating-browsing-contexts 1318 // @see https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy 1319 if (navigator.userAgent.indexOf("MSIE") === -1) { 1320 ajax.options.iframeSrc = 'about:blank'; 1321 } 1322 1323 // Bind the ajaxSubmit function to the element event. 1324 $(ajax.element).bind(element_settings.event, function (event) { 1325 if (!Drupal.settings.urlIsAjaxTrusted[ajax.url] && !Drupal.urlIsLocal(ajax.url)) { 1326 throw new Error(Drupal.t('The callback URL is not local and not trusted: !url', {'!url': ajax.url})); 1327 } 1328 return ajax.eventResponse(this, event); 1329 }); 1330 1331 // If necessary, enable keyboard submission so that Ajax behaviors 1332 // can be triggered through keyboard input as well as e.g. a mousedown 1333 // action. 1334 if (element_settings.keypress) { 1335 $(ajax.element).keypress(function (event) { 1336 return ajax.keypressResponse(this, event); 1337 }); 1338 } 1339 1340 // If necessary, prevent the browser default action of an additional event. 1341 // For example, prevent the browser default action of a click, even if the 1342 // AJAX behavior binds to mousedown. 1343 if (element_settings.prevent) { 1344 $(ajax.element).bind(element_settings.prevent, false); 1345 } 1346}; 1347 1348/** 1349 * Handle a key press. 1350 * 1351 * The Ajax object will, if instructed, bind to a key press response. This 1352 * will test to see if the key press is valid to trigger this event and 1353 * if it is, trigger it for us and prevent other keypresses from triggering. 1354 * In this case we're handling RETURN and SPACEBAR keypresses (event codes 13 1355 * and 32. RETURN is often used to submit a form when in a textfield, and 1356 * SPACE is often used to activate an element without submitting. 1357 */ 1358Drupal.ajax.prototype.keypressResponse = function (element, event) { 1359 // Create a synonym for this to reduce code confusion. 1360 var ajax = this; 1361 1362 // Detect enter key and space bar and allow the standard response for them, 1363 // except for form elements of type 'text' and 'textarea', where the 1364 // spacebar activation causes inappropriate activation if #ajax['keypress'] is 1365 // TRUE. On a text-type widget a space should always be a space. 1366 if (event.which == 13 || (event.which == 32 && element.type != 'text' && element.type != 'textarea')) { 1367 $(ajax.element_settings.element).trigger(ajax.element_settings.event); 1368 return false; 1369 } 1370}; 1371 1372/** 1373 * Handle an event that triggers an Ajax response. 1374 * 1375 * When an event that triggers an Ajax response happens, this method will 1376 * perform the actual Ajax call. It is bound to the event using 1377 * bind() in the constructor, and it uses the options specified on the 1378 * ajax object. 1379 */ 1380Drupal.ajax.prototype.eventResponse = function (element, event) { 1381 // Create a synonym for this to reduce code confusion. 1382 var ajax = this; 1383 1384 // Do not perform another ajax command if one is already in progress. 1385 if (ajax.ajaxing) { 1386 return false; 1387 } 1388 1389 try { 1390 if (ajax.form) { 1391 // If setClick is set, we must set this to ensure that the button's 1392 // value is passed. 1393 if (ajax.setClick) { 1394 // Mark the clicked button. 'form.clk' is a special variable for 1395 // ajaxSubmit that tells the system which element got clicked to 1396 // trigger the submit. Without it there would be no 'op' or
1397 // equivalent. 1398 element.form.clk = element; 1399 } 1400 1401 ajax.form.ajaxSubmit(ajax.options); 1402 } 1403 else { 1404 ajax.beforeSerialize(ajax.element, ajax.options); 1405 $.ajax(ajax.options); 1406 } 1407 } 1408 catch (e) { 1409 // Unset the ajax.ajaxing flag here because it won't be unset during 1410 // the complete response. 1411 ajax.ajaxing = false; 1412 alert("An error occurred while attempting to process " + ajax.options.url + ": " + e.message); 1413 } 1414 1415 // For radio/checkbox, allow the default event. On IE, this means letting 1416 // it actually check the box. 1417 if (typeof element.type != 'undefined' && (element.type == 'checkbox' || element.type == 'radio')) { 1418 return true; 1419 } 1420 else { 1421 return false; 1422 } 1423 1424}; 1425 1426/** 1427 * Handler for the form serialization. 1428 * 1429 * Runs before the beforeSend() handler (see below), and unlike that one, runs 1430 * before field data is collected. 1431 */ 1432Drupal.ajax.prototype.beforeSerialize = function (element, options) { 1433 // Allow detaching behaviors to update field values before collecting them. 1434 // This is only needed when field values are added to the POST data, so only 1435 // when there is a form such that this.form.ajaxSubmit() is used instead of 1436 // $.ajax(). When there is no form and $.ajax() is used, beforeSerialize() 1437 // isn't called, but don't rely on that: explicitly check this.form. 1438 if (this.form) { 1439 var settings = this.settings || Drupal.settings; 1440 Drupal.detachBehaviors(this.form, settings, 'serialize'); 1441 } 1442 1443 // Prevent duplicate HTML ids in the returned markup. 1444 // @see drupal_html_id() 1445 options.data['ajax_html_ids[]'] = []; 1446 $('[id]').each(function () { 1447 options.data['ajax_html_ids[]'].push(this.id); 1448 }); 1449 1450 // Allow Drupal to return new JavaScript and CSS files to load without 1451 // returning the ones already loaded. 1452 // @see ajax_base_page_theme() 1453 // @see drupal_get_css() 1454 // @see drupal_get_js() 1455 options.data['ajax_page_state[theme]'] = Drupal.settings.ajaxPageState.theme; 1456 options.data['ajax_page_state[theme_token]'] = Drupal.settings.ajaxPageState.theme_token; 1457 for (var key in Drupal.settings.ajaxPageState.css) { 1458 options.data['ajax_page_state[css][' + key + ']'] = 1; 1459 } 1460 for (var key in Drupal.settings.ajaxPageState.js) { 1461 options.data['ajax_page_state[js][' + key + ']'] = 1; 1462 } 1463}; 1464 1465/** 1466 * Modify form values prior to form submission. 1467 */ 1468Drupal.ajax.prototype.beforeSubmit = function (form_values, element, options) { 1469 // This function is left empty to make it simple to override for modules 1470 // that wish to add functionality here. 1471}; 1472 1473/** 1474 * Prepare the Ajax request before it is sent. 1475 */ 1476Drupal.ajax.prototype.beforeSend = function (xmlhttprequest, options) { 1477 // For forms without file inputs, the jQuery Form plugin serializes the form 1478 // values, and then calls jQuery's $.ajax() function, which invokes this 1479 // handler. In this circumstance, options.extraData is never used. For forms 1480 // with file inputs, the jQuery Form plugin uses the browser's normal form 1481 // submission mechanism, but captures the response in a hidden IFRAME. In this 1482 // circumstance, it calls this handler first, and then appends hidden fields 1483 // to the form to submit the values in options.extraData. There is no simple 1484 // way to know which submission mechanism will be used, so we add to extraData 1485 // regardless, and allow it to be ignored in the former case. 1486 if (this.form) { 1487 options.extraData = options.extraData || {}; 1488 1489 // Let the server know when the IFRAME submission mechanism is used. The 1490 // server can use this information to wrap the JSON response in a TEXTAREA, 1491 // as per http://jquery.malsup.com/form/#file-upload. 1492 options.extraData.ajax_iframe_upload = '1'; 1493 1494 // The triggering element is about to be disabled (see below), but if it 1495 // contains a value (e.g., a checkbox, textfield, select, etc.), ensure that 1496 // value is included in the submission. As per above, submissions that use 1497 // $.ajax() are already serialized prior to the element being disabled, so 1498 // this is only needed for IFRAME submissions. 1499 var v = $.fieldValue(this.element); 1500 if (v !== null) { 1501 options.extraData[this.element.name] = Drupal.checkPlain(v); 1502 } 1503 } 1504 1505 // Disable the element that received the change to prevent user interface 1506 // interaction while the Ajax request is in progress. ajax.ajaxing prevents 1507 // the element from triggering a new request, but does not prevent the user 1508 // from changing its value. 1509 $(this.element).addClass('progress-disabled').attr('disabled', true); 1510 1511 // Insert progressbar or throbber. 1512 if (this.progress.type == 'bar') { 1513 var progressBar = new Drupal.progressBar('ajax-progress-' + this.element.i
1513d, $.noop, this.progress.method, $.noop); 1514 if (this.progress.message) { 1515 progressBar.setProgress(-1, this.progress.message); 1516 } 1517 if (this.progress.url) { 1518 progressBar.startMonitoring(this.progress.url, this.progress.interval || 1500); 1519 } 1520 this.progress.element = $(progressBar.element).addClass('ajax-progress ajax-progress-bar'); 1521 this.progress.object = progressBar; 1522 $(this.element).after(this.progress.element); 1523 } 1524 else if (this.progress.type == 'throbber') { 1525 this.progress.element = $('<div class="ajax-progress ajax-progress-throbber"><div class="throbber"> </div></div>'); 1526 if (this.progress.message) { 1527 $('.throbber', this.progress.element).after('<div class="message">' + this.progress.message + '</div>'); 1528 } 1529 $(this.element).after(this.progress.element); 1530 } 1531}; 1532 1533/** 1534 * Handler for the form redirection completion. 1535 */ 1536Drupal.ajax.prototype.success = function (response, status) { 1537 // Remove the progress element. 1538 if (this.progress.element) { 1539 $(this.progress.element).remove(); 1540 } 1541 if (this.progress.object) { 1542 this.progress.object.stopMonitoring(); 1543 } 1544 $(this.element).removeClass('progress-disabled').removeAttr('disabled'); 1545 1546 Drupal.freezeHeight(); 1547 1548 for (var i in response) { 1549 if (response.hasOwnProperty(i) && response[i]['command'] && this.commands[response[i]['command']]) { 1550 this.commands[response[i]['command']](this, response[i], status); 1551 } 1552 } 1553 1554 // Reattach behaviors, if they were detached in beforeSerialize(). The 1555 // attachBehaviors() called on the new content from processing the response 1556 // commands is not sufficient, because behaviors from the entire form need 1557 // to be reattached. 1558 if (this.form) { 1559 var settings = this.settings || Drupal.settings; 1560 Drupal.attachBehaviors(this.form, settings); 1561 } 1562 1563 Drupal.unfreezeHeight(); 1564 1565 // Remove any response-specific settings so they don't get used on the next 1566 // call by mistake. 1567 this.settings = null; 1568}; 1569 1570/** 1571 * Build an effect object which tells us how to apply the effect when adding new HTML. 1572 */ 1573Drupal.ajax.prototype.getEffect = function (response) { 1574 var type = response.effect || this.effect; 1575 var speed = response.speed || this.speed; 1576 1577 var effect = {}; 1578 if (type == 'none') { 1579 effect.showEffect = 'show'; 1580 effect.hideEffect = 'hide'; 1581 effect.showSpeed = ''; 1582 } 1583 else if (type == 'fade') { 1584 effect.showEffect = 'fadeIn'; 1585 effect.hideEffect = 'fadeOut'; 1586 effect.showSpeed = speed; 1587 } 1588 else { 1589 effect.showEffect = type + 'Toggle'; 1590 effect.hideEffect = type + 'Toggle'; 1591 effect.showSpeed = speed; 1592 } 1593 1594 return effect; 1595}; 1596 1597/** 1598 * Handler for the form redirection error. 1599 */ 1600Drupal.ajax.prototype.error = function (xmlhttprequest, uri, customMessage) { 1601 Drupal.displayAjaxError(Drupal.ajaxError(xmlhttprequest, uri, customMessage)); 1602 // Remove the progress element. 1603 if (this.progress.element) { 1604 $(this.progress.element).remove(); 1605 } 1606 if (this.progress.object) { 1607 this.progress.object.stopMonitoring(); 1608 } 1609 // Undo hide. 1610 $(this.wrapper).show(); 1611 // Re-enable the element. 1612 $(this.element).removeClass('progress-disabled').removeAttr('disabled'); 1613 // Reattach behaviors, if they were detached in beforeSerialize(). 1614 if (this.form) { 1615 var settings = this.settings || Drupal.settings; 1616 Drupal.attachBehaviors(this.form, settings); 1617 } 1618}; 1619 1620/** 1621 * Provide a series of commands that the server can request the client perform. 1622 */ 1623Drupal.ajax.prototype.commands = { 1624 /** 1625 * Command to insert new content into the DOM. 1626 */ 1627 insert: function (ajax, response, status) { 1628 // Get information from the response. If it is not there, default to 1629 // our presets. 1630 var wrapper = response.selector ? $(response.selector) : $(ajax.wrapper); 1631 var method = response.method || ajax.method; 1632 var effect = ajax.getEffect(response); 1633 1634 // We don't know what response.data contains: it might be a string of text 1635 // without HTML, so don't rely on jQuery correctly iterpreting 1636 // $(response.data) as new HTML rather than a CSS selector. Also, if 1637 // response.data contains top-level text nodes, they get lost with either 1638 // $(response.data) or $('<div></div>').replaceWith(response.data). 1639 var new_content_wrapped = $('<div></div>').html(response.data); 1640 var new_content = new_content_wrapped.contents(); 1641 1642 // For legacy reasons, the effects processing code assumes that new_content 1643 // consists of a single top-level element. Also, it has not been 1644 // sufficiently tested whether attachBehaviors() can be successfully called 1645 // with a context object that includes top-level text nodes. However, to 1646 // give developers full control of the HTML appearing in the page, and to 1647 // enable Ajax content to be inserted in places where DIV elements are not 1648 // allowed (e.g., within TABLE, TR, and SPAN parents), we check if the new 1649 // content satisfies the requirement of a single top-level element, and 1650 // only use the container DIV created above when it doesn't. For more 1651 // information, please see http://drupal.org/node/736066. 1652 if (new_content.length != 1 || new_content.get(0).nodeType != 1) { 1653 new_content = new_content_wrapped; 1654 } 1655 1656 // If removing content from the wrapper, detach behaviors first. 1657 switch (method) { 1658 case 'html': 1659 case 'replaceWith': 1660 case 'replaceAll': 1661 case 'empty': 1662 case 'remove': 1663 var settings = response.settings || ajax.settings || Drupal.settings; 1664 Drupal.detachBehaviors(wrapper, settings); 1665 } 1666 1667 // Add the new content to the page. 1668 wrapper[method](new_content); 1669 1670 // Immediately hide the new content if we're using any effects. 1671 if (effect.showEffect != 'show') { 1672 new_content.hide(); 1673 } 1674 1675 // Determine which effect to use and what content will receive the 1676 // effect, then show the new content. 1677 if ($('.ajax-new-content', new_content).length > 0) { 1678 $('.ajax-new-content', new_content).hide(); 1679 new_content.show(); 1680 $('.ajax-new-content', new_content)[effect.showEffect](effect.showSpeed); 1681 } 1682 else if (effect.showEffect != 'show') { 1683 new_content[effect.showEffect](effect.showSpeed); 1684 } 1685 1686 // Attach all JavaScript behaviors to the new content, if it was successfully 1687 // added to the page, this if statement allows #ajax['wrapper'] to be 1688 // optional. 1689 if (new_content.parents('html').length > 0) { 1690 // Apply any settings from the returned JSON if available. 1691 var settings = response.settings || ajax.settings || Drupal.settings; 1692 Drupal.attachBehaviors(new_content, settings); 1693 } 1694 }, 1695 1696 /** 1697 * Command to remove a chunk from the page. 1698 */ 1699 remove: function (ajax, response, status) { 1700 var settings = response.settings || ajax.settings || Drupal.settings; 1701 Drupal.detachBehaviors($(response.selector), settings); 1702 $(response.selector).remove(); 1703 }, 1704 1705 /** 1706 * Command to mark a chunk changed. 1707 */ 1708 changed: function (ajax, response, status) { 1709 if (!$(response.selector).hasClass('ajax-changed')) { 1710 $(response.selector).addClass('ajax-changed'); 1711 if (response.asterisk) { 1712 $(response.selector).find(response.asterisk).append(' <span class="ajax-changed">*</span> '); 1713 } 1714 } 1715 }, 1716 1717 /** 1718 * Command to provide an alert. 1719 */ 1720 alert: function (ajax, response, status) { 1721 alert(response.text, response.title); 1722 }, 1723 1724 /** 1725 * Command to provide the jQuery css() function. 1726 */ 1727 css: function (ajax, response, status) { 1728 $(response.selector).css(response.argument); 1729 }, 1730 1731 /** 1732 * Command to set the settings that will be used for other commands in this response. 1733 */ 1734 settings: function (ajax, response, status) { 1735 if (response.merge) { 1736 $.extend(true, Drupal.settings, response.settings); 1737 } 1738 else { 1739 ajax.settings = response.settings; 1740 } 1741 }, 1742 1743 /** 1744 * Command to attach data using jQuery's data API. 1745 */ 1746 data: function (ajax, response, status) { 1747 $(response.selector).data(response.name, response.value); 1748 }, 1749 1750 /** 1751 * Command to apply a jQuery method. 1752 */ 1753 invoke: function (ajax, response, status) { 1754 var $element = $(response.selector); 1755 $element[response.method].apply($element, response.arguments); 1756 }, 1757 1758 /** 1759 * Command to restripe a table. 1760 */ 1761 restripe: function (ajax, response, status) { 1762 // :even and :odd are reversed because jQuery counts from 0 and 1763 // we count from 1, so we're out of sync. 1764 // Match immediate children of the parent element to allow nesting. 1765 $('> tbody > tr:visible, > tr:visible', $(response.selector)) 1766 .removeClass('odd even') 1767 .filter(':even').addClass('odd').end() 1768 .filter(':odd').addClass('even'); 1769 }, 1770 1771 /** 1772 * Command to add css. 1773 * 1774 * Uses the proprietary addImport method if available as browsers which 1775 * support that method ignore @import statements in dynamically added 1776 * stylesheets. 1777 */ 1778 add_css: function (ajax, response, status) { 1779 // Add the styles in the normal way. 1780 $('head').prepend(response.data); 1781 // Add imports in the styles using the addImport method if available. 1782 var match, importMatch = /^@import url\("(.*)"\);$/igm; 1783 if (document.styleSheets[0].addImport && importMatch.test(response.data)) { 1784 importMatch.lastIndex = 0; 1785 while (match = importMatch.exec(response.data)) { 1786 document.styleSheets[0].addImport(match[1]); 1787 } 1788 } 1789 }, 1790 1791 /** 1792 * Command to update a form's build ID. 1793 */ 1794 updateBuildId: function(ajax, response, status) { 1795 $('input[name="form_build_id"][value="' + response['old'] + '"]').val(response['new']); 1796 } 1797}; 1798 1799})(jQuery); 1800; 1801(function (D) { 1802 var beforeSerialize = D.ajax.prototype.beforeSerialize;
1803 D.ajax.prototype.beforeSerialize = function (element, options) { 1804 beforeSerialize.call(this, element, options); 1805 options.data['ajax_page_state[jquery_version]'] = D.settings.ajaxPageState.jquery_version; 1806 options.data['ajax_page_state[jquery_version_token]'] = D.settings.ajaxPageState.jquery_version_token; 1807 } 1808})(Drupal); 1809;
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.