vendor: 6,567 bytes, lines 1-57
1/*! jQuery UI - v1.10.2 - 2013-03-14 2* http://jqueryui.com 3* Copyright 2013 jQuery Foundation and other contributors; Licensed MIT */ 4(function(e,t){function i(t,i){var a,n,r,o=t.nodeName.toLowerCase();return"area"===o?(a=t.parentNode,n=a.name,t.href&&n&&"map"===a.nodeName.toLowerCase()?(r=e("img[usemap=#"+n+"]")[0],!!r&&s(r)):!1):(/input|select|textarea|button|object/.test(o)?!t.disabled:"a"===o?t.href||i:i)&&s(t)}function s(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}var a=0,n=/^ui-id-\d+$/;e.ui=e.ui||{},e.extend(e.ui,{version:"1.10.2",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({focus:function(t){return function(i,s){return"number"==typeof i?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),s&&s.call(t)},i)}):t.apply(this,arguments)}}(e.fn.focus),scrollParent:function(){var t;return t=e.ui.ie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(e.css(this,"position"))&&/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0),/fixed/.test(this.css("position"))||!t.length?e(document):t},zIndex:function(i){if(i!==t)return this.css("zIndex",i);if(this.length)for(var s,a,n=e(this[0]);n.length&&n[0]!==document;){if(s=n.css("position"),("absolute"===s||"relative"===s||"fixed"===s)&&(a=parseInt(n.css("zIndex"),10),!isNaN(a)&&0!==a))return a;n=n.parent()}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++a)})},removeUniqueId:function(){return this.each(function(){n.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(i){return!!e.data(i,t)}}):function(t,i,s){return!!e.data(t,s[3])},focusable:function(t){return i(t,!isNaN(e.attr(t,"tabindex")))},tabbable:function(t){var s=e.attr(t,"tabindex"),a=isNaN(s);return(a||s>=0)&&i(t,!a)}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(i,s){function a(t,i,s,a){return e.each(n,function(){i-=parseFloat(e.css(t,"padding"+this))||0,s&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),a&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var n="Width"===s?["Left","Right"]:["Top","Bottom"],r=s.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+s]=function(i){return i===t?o["inner"+s].call(this):this.each(function(){e(this).css(r,a(this,i)+"px")})},e.fn["outer"+s]=function(t,i){return"number"!=typeof t?o["outer"+s].call(this,t):this.each(function(){e(this).css(r,a(this,t,!0,i)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.support.selectstart="onselectstart"in document.createElement("div"),e.fn.extend({disableSelection:function(){return this.bind((e.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),e.extend(e.ui,{plugin:{add:function(t,i,s){var a,n=e.ui[t].prototype;for(a in s)n.plugins[a]=n.plugins[a]||[],n.plugins[a].push([i,s[a]])},call:function(e,t,i){var s,a=e.plugins[t];if(a&&e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType)for(s=0;a.length>s;s++)e.options[a[s][0]]&&a[s][1].apply(e.element,i)}},hasScroll:function(t,i){if("hidden"===e(t).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",a=!1;return t[s]>0?!0:(t[s]=1,a=t[s]>0,t[s]=0,a)}})})(jQuery);; 5/*jslint browser: true */ /*global jQuery: true */ 6 7/** 8 * jQuery Cookie plugin 9 * 10 * Copyright (c) 2010 Klaus Hartl (stilbuero.de) 11 * Dual licensed under the MIT and GPL licenses: 12 * http://www.opensource.org/licenses/mit-license.php 13 * http://www.gnu.org/licenses/gpl.html 14 * 15 */ 16 17// TODO JsDoc 18 19/** 20 * Create a cookie with the given key and value and other optional parameters. 21 * 22 * @example $.cookie('the_cookie', 'the_value'); 23 * @desc Set the value of a cookie. 24 * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true }); 25 * @desc Create a cookie with all available options. 26 * @example $.cookie('the_cookie', 'the_value'); 27 * @desc Create a session cookie. 28 * @example $.cookie('the_cookie', null); 29 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain 30 * used when the cookie was set. 31 * 32 * @param String key The key of the cookie. 33 * @param String value The value of the cookie. 34 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes. 35 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object. 36 * If a negative value is specified (e.g. a date in the past), the cookie will be deleted. 37 * If set to null or omitted, the cookie will be a session cookie and will not be retained 38 * when the the browser exits. 39 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie). 40 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie). 41 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will 42 * require a secure protocol (like HTTPS). 43 * @type undefined 44 * 45 * @name $.cookie 46 * @cat Plugins/Cookie 47 * @author Klaus Hartl/[email protected] 48 */ 49 50/** 51 * Get the value of a cookie with the given key. 52 * 53 * @example $.cookie('the_cookie'); 54 * @desc Get the value of a cookie. 55 * 56 * @param String key The key of the cookie. 57 * @return The value of the cookie.
58 * @type String 59 * 60 * @name $.cookie 61 * @cat Plugins/Cookie 62 * @author Klaus Hartl/[email protected] 63 */ 64jQuery.cookie = function (key, value, options) { 65 66 // key and value given, set cookie... 67 if (arguments.length > 1 && (value === null || typeof value !== "object")) { 68 options = jQuery.extend({}, options); 69 70 if (value === null) { 71 options.expires = -1; 72 } 73 74 if (typeof options.expires === 'number') { 75 var days = options.expires, t = options.expires = new Date(); 76 t.setDate(t.getDate() + days); 77 } 78 79 return (document.cookie = [ 80 encodeURIComponent(key), '=', 81 options.raw ? String(value) : encodeURIComponent(String(value)), 82 options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE 83 options.path ? '; path=' + options.path : '', 84 options.domain ? '; domain=' + options.domain : '', 85 options.secure ? '; secure' : '' 86 ].join('')); 87 } 88 89 // key and possibly options given, get cookie... 90 options = value || {}; 91 var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent; 92 return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null; 93}; 94; 95/*! 96 * jQuery Form Plugin 97 * version: 4.2.1 98 * Requires jQuery v1.7 or later 99 * Copyright 2017 Kevin Morris 100 * Copyright 2006 M. Alsup 101 * Project repository: https://github.com/jquery-form/form 102 * Dual licensed under the MIT and LGPLv3 licenses. 103 * https://github.com/jquery-form/form#license 104 */ 105!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;d++)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.
105context,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)})})}
105else 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
105(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}); 106; 107(function ($) { 108 109/** 110 * Provides Ajax page updating via jQuery $.ajax (Asynchronous JavaScript and XML). 111 * 112 * Ajax is a method of making a request via JavaScript while viewing an HTML 113 * page. The request returns an array of commands encoded in JSON, which is 114 * then executed to make any changes that are necessary to the page. 115 * 116 * Drupal uses this file to enhance form elements with #ajax['path'] and 117 * #ajax['wrapper'] properties. If set, this file will automatically be included 118 * to provide Ajax capabilities. 119 */ 120 121Drupal.ajax = Drupal.ajax || {}; 122 123Drupal.settings.urlIsAjaxTrusted = Drupal.settings.urlIsAjaxTrusted || {}; 124 125/** 126 * Attaches the Ajax behavior to each Ajax form element. 127 */ 128Drupal.behaviors.AJAX = { 129 attach: function (context, settings) { 130 // Load all Ajax behaviors specified in the settings. 131 for (var base in settings.ajax) { 132 if (!$('#' + base + '.ajax-processed').length) { 133 var element_settings = settings.ajax[base]; 134 135 if (typeof element_settings.selector == 'undefined') { 136 element_settings.selector = '#' + base; 137 } 138 $(element_settings.selector).each(function () { 139 element_settings.element = this; 140 Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings); 141 }); 142 143 $('#' + base).addClass('ajax-processed'); 144 } 145 } 146 147 // Bind Ajax behaviors to all items showing the class. 148 $('.use-ajax:not(.ajax-processed)').addClass('ajax-processed').each(function () { 149 var element_settings = {}; 150 // Clicked links look better with the throbber than the progress bar. 151 element_settings.progress = { 'type': 'throbber' }; 152 153 // For anchor tags, these will go to the target of the anch
153or rather 154 // than the usual location. 155 if ($(this).attr('href')) { 156 element_settings.url = $(this).attr('href'); 157 element_settings.event = 'click'; 158 } 159 var base = $(this).attr('id'); 160 Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings); 161 }); 162 163 // This class means to submit the form to the action using Ajax. 164 $('.use-ajax-submit:not(.ajax-processed)').addClass('ajax-processed').each(function () { 165 var element_settings = {}; 166 167 // Ajax submits specified in this manner automatically submit to the 168 // normal form action. 169 element_settings.url = $(this.form).attr('action'); 170 // Form submit button clicks need to tell the form what was clicked so 171 // it gets passed in the POST request. 172 element_settings.setClick = true; 173 // Form buttons use the 'click' event rather than mousedown. 174 element_settings.event = 'click'; 175 // Clicked form buttons look better with the throbber than the progress bar. 176 element_settings.progress = { 'type': 'throbber' }; 177 178 var base = $(this).attr('id'); 179 Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings); 180 }); 181 } 182}; 183 184/** 185 * Ajax object. 186 * 187 * All Ajax objects on a page are accessible through the global Drupal.ajax 188 * object and are keyed by the submit button's ID. You can access them from 189 * your module's JavaScript file to override properties or functions. 190 * 191 * For example, if your Ajax enabled button has the ID 'edit-submit', you can 192 * redefine the function that is called to insert the new content like this 193 * (inside a Drupal.behaviors attach block): 194 * @code 195 * Drupal.behaviors.myCustomAJAXStuff = { 196 * attach: function (context, settings) { 197 * Drupal.ajax['edit-submit'].commands.insert = function (ajax, response, status) { 198 * new_content = $(response.data); 199 * $('#my-wrapper').append(new_content); 200 * alert('New content was appended to #my-wrapper'); 201 * } 202 * } 203 * }; 204 * @endcode 205 */ 206Drupal.ajax = function (base, element, element_settings) { 207 var defaults = { 208 url: 'system/ajax', 209 event: 'mousedown', 210 keypress: true, 211 selector: '#' + base, 212 effect: 'none', 213 speed: 'none', 214 method: 'replaceWith', 215 progress: { 216 type: 'throbber', 217 message: Drupal.t('Please wait...') 218 }, 219 submit: { 220 'js': true 221 } 222 }; 223 224 $.extend(this, defaults, element_settings); 225 226 this.element = element; 227 this.element_settings = element_settings; 228 229 // Replacing 'nojs' with 'ajax' in the URL allows for an easy method to let 230 // the server detect when it needs to degrade gracefully. 231 // There are five scenarios to check for: 232 // 1. /nojs/ 233 // 2. /nojs$ - The end of a URL string. 234 // 3. /nojs? - Followed by a query (with clean URLs enabled). 235 // E.g.: path/nojs?destination=foobar 236 // 4. /nojs& - Followed by a query (without clean URLs enabled). 237 // E.g.: ?q=path/nojs&destination=foobar 238 // 5. /nojs# - Followed by a fragment. 239 // E.g.: path/nojs#myfragment 240 this.url = element_settings.url.replace(/\/nojs(\/|$|\?|&|#)/g, '/ajax$1'); 241 // If the 'nojs' version of the URL is trusted, also trust the 'ajax' version. 242 if (Drupal.settings.urlIsAjaxTrusted[element_settings.url]) { 243 Drupal.settings.urlIsAjaxTrusted[this.url] = true; 244 } 245 246 this.wrapper = '#' + element_settings.wrapper; 247 248 // If there isn't a form, jQuery.ajax() will be used instead, allowing us to 249 // bind Ajax to links as well. 250 if (this.element.form) { 251 this.form = $(this.element.form); 252 } 253 254 // Set the options for the ajaxSubmit function. 255 // The 'this' variable will not persist inside of the options object. 256 var ajax = this; 257 ajax.options = { 258 url: Drupal.sanitizeAjaxUrl(ajax.url), 259 data: ajax.submit, 260 beforeSerialize: function (element_settings, options) { 261 return ajax.beforeSerialize(element_settings, options); 262 }, 263 beforeSubmit: function (form_values, element_settings, options) { 264 ajax.ajaxing = true; 265 return ajax.beforeSubmit(form_values, element_settings, options); 266 }, 267 beforeSend: function (xmlhttprequest, options) { 268 ajax.ajaxing = true; 269 return ajax.beforeSend(xmlhttprequest, options); 270 }, 271 success: function (response, status, xmlhttprequest) { 272 // Sanity check for browser support (object expected). 273 // When using iFrame uploads, responses must be returned as a string. 274 if (typeof response == 'string') { 275 response = $.parseJSON(response); 276 } 277 278 // Prior to invoking the response's commands, verify that they can be 279 // trusted by checking for a response header. See 280 // ajax_set_verification_header() for details. 281 // - Empty responses are harmless so can bypass verification. This avoids 282 // an alert message for server-generated no-op responses that skip Ajax 283 // rendering. 284 // - Ajax objects with trusted URLs (e.g., ones defined server-side via 285 // #ajax) can bypass header verification. This is especially useful for 286 // Ajax with multipart forms. Because IFRAME transport is used, the 287 // response headers cannot be accessed for verification. 288 if (response !== null && !Drupal.settings.urlIsAjaxTrusted[ajax.url]) { 289 if (xmlhttprequest.getResponseHeader('X-Drupal-Ajax-Token') !== '1') { 290 var customMessage = Drupal.t("The response failed verification so will not be processed."); 291 return ajax.error(xmlhttprequest, ajax.url, customMessage); 292 } 293 } 294 295 return ajax.success(response, status); 296 }, 297 complete: function (xmlhttprequest, status) { 298 ajax.ajaxing = false;
299 if (status == 'error' || status == 'parsererror') { 300 return ajax.error(xmlhttprequest, ajax.url); 301 } 302 }, 303 dataType: 'json', 304 jsonp: false, 305 type: 'POST' 306 }; 307 308 // For multipart forms (e.g., file uploads), jQuery Form targets the form 309 // submission to an iframe instead of using an XHR object. The initial "src" 310 // of the iframe, prior to the form submission, is set to options.iframeSrc. 311 // "about:blank" is the semantically correct, standards-compliant, way to 312 // initialize a blank iframe; however, some old IE versions (possibly only 6) 313 // incorrectly report a mixed content warning when iframes with an 314 // "about:blank" src are added to a parent document with an https:// origin. 315 // jQuery Form works around this by defaulting to "javascript:false" instead, 316 // but that breaks on Chrome 83, so here we force the semantically correct 317 // behavior for all browsers except old IE. 318 // @see https://www.drupal.org/project/drupal/issues/3143016 319 // @see https://github.com/jquery-form/form/blob/df9cb101b9c9c085c8d75ad980c7ff1cf62063a1/jquery.form.js#L68 320 // @see https://bugs.chromium.org/p/chromium/issues/detail?id=1084874 321 // @see https://html.spec.whatwg.org/multipage/browsers.html#creating-browsing-contexts 322 // @see https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy 323 if (navigator.userAgent.indexOf("MSIE") === -1) { 324 ajax.options.iframeSrc = 'about:blank'; 325 } 326 327 // Bind the ajaxSubmit function to the element event. 328 $(ajax.element).bind(element_settings.event, function (event) { 329 if (!Drupal.settings.urlIsAjaxTrusted[ajax.url] && !Drupal.urlIsLocal(ajax.url)) { 330 throw new Error(Drupal.t('The callback URL is not local and not trusted: !url', {'!url': ajax.url})); 331 } 332 return ajax.eventResponse(this, event); 333 }); 334 335 // If necessary, enable keyboard submission so that Ajax behaviors 336 // can be triggered through keyboard input as well as e.g. a mousedown 337 // action. 338 if (element_settings.keypress) { 339 $(ajax.element).keypress(function (event) { 340 return ajax.keypressResponse(this, event); 341 }); 342 } 343 344 // If necessary, prevent the browser default action of an additional event. 345 // For example, prevent the browser default action of a click, even if the 346 // AJAX behavior binds to mousedown. 347 if (element_settings.prevent) { 348 $(ajax.element).bind(element_settings.prevent, false); 349 } 350}; 351 352/** 353 * Handle a key press. 354 * 355 * The Ajax object will, if instructed, bind to a key press response. This 356 * will test to see if the key press is valid to trigger this event and 357 * if it is, trigger it for us and prevent other keypresses from triggering. 358 * In this case we're handling RETURN and SPACEBAR keypresses (event codes 13 359 * and 32. RETURN is often used to submit a form when in a textfield, and 360 * SPACE is often used to activate an element without submitting. 361 */ 362Drupal.ajax.prototype.keypressResponse = function (element, event) { 363 // Create a synonym for this to reduce code confusion. 364 var ajax = this; 365 366 // Detect enter key and space bar and allow the standard response for them, 367 // except for form elements of type 'text' and 'textarea', where the 368 // spacebar activation causes inappropriate activation if #ajax['keypress'] is 369 // TRUE. On a text-type widget a space should always be a space. 370 if (event.which == 13 || (event.which == 32 && element.type != 'text' && element.type != 'textarea')) { 371 $(ajax.element_settings.element).trigger(ajax.element_settings.event); 372 return false; 373 } 374}; 375 376/** 377 * Handle an event that triggers an Ajax response. 378 * 379 * When an event that triggers an Ajax response happens, this method will 380 * perform the actual Ajax call. It is bound to the event using 381 * bind() in the constructor, and it uses the options specified on the 382 * ajax object. 383 */ 384Drupal.ajax.prototype.eventResponse = function (element, event) { 385 // Create a synonym for this to reduce code confusion. 386 var ajax = this; 387 388 // Do not perform another ajax command if one is already in progress. 389 if (ajax.ajaxing) { 390 return false; 391 } 392 393 try { 394 if (ajax.form) { 395 // If setClick is set, we must set this to ensure that the button's 396 // value is passed. 397 if (ajax.setClick) { 398 // Mark the clicked button. 'form.clk' is a special variable for 399 // ajaxSubmit that tells the system which element got clicked to 400 // trigger the submit. Without it there would be no 'op' or
401 // equivalent. 402 element.form.clk = element; 403 } 404 405 ajax.form.ajaxSubmit(ajax.options); 406 } 407 else { 408 ajax.beforeSerialize(ajax.element, ajax.options); 409 $.ajax(ajax.options); 410 } 411 } 412 catch (e) { 413 // Unset the ajax.ajaxing flag here because it won't be unset during 414 // the complete response. 415 ajax.ajaxing = false; 416 alert("An error occurred while attempting to process " + ajax.options.url + ": " + e.message); 417 } 418 419 // For radio/checkbox, allow the default event. On IE, this means letting 420 // it actually check the box. 421 if (typeof element.type != 'undefined' && (element.type == 'checkbox' || element.type == 'radio')) { 422 return true; 423 } 424 else { 425 return false; 426 } 427 428}; 429 430/** 431 * Handler for the form serialization. 432 * 433 * Runs before the beforeSend() handler (see below), and unlike that one, runs 434 * before field data is collected. 435 */ 436Drupal.ajax.prototype.beforeSerialize = function (element, options) { 437 // Allow detaching behaviors to update field values before collecting them. 438 // This is only needed when field values are added to the POST data, so only 439 // when there is a form such that this.form.ajaxSubmit() is used instead of 440 // $.ajax(). When there is no form and $.ajax() is used, beforeSerialize() 441 // isn't called, but don't rely on that: explicitly check this.form. 442 if (this.form) { 443 var settings = this.settings || Drupal.settings; 444 Drupal.detachBehaviors(this.form, settings, 'serialize'); 445 } 446 447 // Prevent duplicate HTML ids in the returned markup. 448 // @see drupal_html_id() 449 options.data['ajax_html_ids[]'] = []; 450 $('[id]').each(function () { 451 options.data['ajax_html_ids[]'].push(this.id); 452 }); 453 454 // Allow Drupal to return new JavaScript and CSS files to load without 455 // returning the ones already loaded. 456 // @see ajax_base_page_theme() 457 // @see drupal_get_css() 458 // @see drupal_get_js() 459 options.data['ajax_page_state[theme]'] = Drupal.settings.ajaxPageState.theme; 460 options.data['ajax_page_state[theme_token]'] = Drupal.settings.ajaxPageState.theme_token; 461 for (var key in Drupal.settings.ajaxPageState.css) { 462 options.data['ajax_page_state[css][' + key + ']'] = 1; 463 } 464 for (var key in Drupal.settings.ajaxPageState.js) { 465 options.data['ajax_page_state[js][' + key + ']'] = 1; 466 } 467}; 468 469/** 470 * Modify form values prior to form submission. 471 */ 472Drupal.ajax.prototype.beforeSubmit = function (form_values, element, options) { 473 // This function is left empty to make it simple to override for modules 474 // that wish to add functionality here. 475}; 476 477/** 478 * Prepare the Ajax request before it is sent. 479 */ 480Drupal.ajax.prototype.beforeSend = function (xmlhttprequest, options) { 481 // For forms without file inputs, the jQuery Form plugin serializes the form 482 // values, and then calls jQuery's $.ajax() function, which invokes this 483 // handler. In this circumstance, options.extraData is never used. For forms 484 // with file inputs, the jQuery Form plugin uses the browser's normal form 485 // submission mechanism, but captures the response in a hidden IFRAME. In this 486 // circumstance, it calls this handler first, and then appends hidden fields 487 // to the form to submit the values in options.extraData. There is no simple 488 // way to know which submission mechanism will be used, so we add to extraData 489 // regardless, and allow it to be ignored in the former case. 490 if (this.form) { 491 options.extraData = options.extraData || {}; 492 493 // Let the server know when the IFRAME submission mechanism is used. The 494 // server can use this information to wrap the JSON response in a TEXTAREA, 495 // as per http://jquery.malsup.com/form/#file-upload. 496 options.extraData.ajax_iframe_upload = '1'; 497 498 // The triggering element is about to be disabled (see below), but if it 499 // contains a value (e.g., a checkbox, textfield, select, etc.), ensure that 500 // value is included in the submission. As per above, submissions that use 501 // $.ajax() are already serialized prior to the element being disabled, so 502 // this is only needed for IFRAME submissions. 503 var v = $.fieldValue(this.element); 504 if (v !== null) { 505 options.extraData[this.element.name] = Drupal.checkPlain(v); 506 } 507 } 508 509 // Disable the element that received the change to prevent user interface 510 // interaction while the Ajax request is in progress. ajax.ajaxing prevents 511 // the element from triggering a new request, but does not prevent the user 512 // from changing its value. 513 $(this.element).addClass('progress-disabled').attr('disabled', true); 514 515 // Insert progressbar or throbber. 516 if (this.progress.type == 'bar') { 517 var progressBar = new Drupal.progressBar('ajax-progress-' + this.element.i
517d, $.noop, this.progress.method, $.noop); 518 if (this.progress.message) { 519 progressBar.setProgress(-1, this.progress.message); 520 } 521 if (this.progress.url) { 522 progressBar.startMonitoring(this.progress.url, this.progress.interval || 1500); 523 } 524 this.progress.element = $(progressBar.element).addClass('ajax-progress ajax-progress-bar'); 525 this.progress.object = progressBar; 526 $(this.element).after(this.progress.element); 527 } 528 else if (this.progress.type == 'throbber') { 529 this.progress.element = $('<div class="ajax-progress ajax-progress-throbber"><div class="throbber"> </div></div>'); 530 if (this.progress.message) { 531 $('.throbber', this.progress.element).after('<div class="message">' + this.progress.message + '</div>'); 532 } 533 $(this.element).after(this.progress.element); 534 } 535}; 536 537/** 538 * Handler for the form redirection completion. 539 */ 540Drupal.ajax.prototype.success = function (response, status) { 541 // Remove the progress element. 542 if (this.progress.element) { 543 $(this.progress.element).remove(); 544 } 545 if (this.progress.object) { 546 this.progress.object.stopMonitoring(); 547 } 548 $(this.element).removeClass('progress-disabled').removeAttr('disabled'); 549 550 Drupal.freezeHeight(); 551 552 for (var i in response) { 553 if (response.hasOwnProperty(i) && response[i]['command'] && this.commands[response[i]['command']]) { 554 this.commands[response[i]['command']](this, response[i], status); 555 } 556 } 557 558 // Reattach behaviors, if they were detached in beforeSerialize(). The 559 // attachBehaviors() called on the new content from processing the response 560 // commands is not sufficient, because behaviors from the entire form need 561 // to be reattached. 562 if (this.form) { 563 var settings = this.settings || Drupal.settings; 564 Drupal.attachBehaviors(this.form, settings); 565 } 566 567 Drupal.unfreezeHeight(); 568 569 // Remove any response-specific settings so they don't get used on the next 570 // call by mistake. 571 this.settings = null; 572}; 573 574/** 575 * Build an effect object which tells us how to apply the effect when adding new HTML. 576 */ 577Drupal.ajax.prototype.getEffect = function (response) { 578 var type = response.effect || this.effect; 579 var speed = response.speed || this.speed; 580 581 var effect = {}; 582 if (type == 'none') { 583 effect.showEffect = 'show'; 584 effect.hideEffect = 'hide'; 585 effect.showSpeed = ''; 586 } 587 else if (type == 'fade') { 588 effect.showEffect = 'fadeIn'; 589 effect.hideEffect = 'fadeOut'; 590 effect.showSpeed = speed; 591 } 592 else { 593 effect.showEffect = type + 'Toggle'; 594 effect.hideEffect = type + 'Toggle'; 595 effect.showSpeed = speed; 596 } 597 598 return effect; 599}; 600 601/** 602 * Handler for the form redirection error. 603 */ 604Drupal.ajax.prototype.error = function (xmlhttprequest, uri, customMessage) { 605 Drupal.displayAjaxError(Drupal.ajaxError(xmlhttprequest, uri, customMessage)); 606 // Remove the progress element. 607 if (this.progress.element) { 608 $(this.progress.element).remove(); 609 } 610 if (this.progress.object) { 611 this.progress.object.stopMonitoring(); 612 } 613 // Undo hide. 614 $(this.wrapper).show(); 615 // Re-enable the element. 616 $(this.element).removeClass('progress-disabled').removeAttr('disabled'); 617 // Reattach behaviors, if they were detached in beforeSerialize(). 618 if (this.form) { 619 var settings = this.settings || Drupal.settings; 620 Drupal.attachBehaviors(this.form, settings); 621 } 622}; 623 624/** 625 * Provide a series of commands that the server can request the client perform. 626 */ 627Drupal.ajax.prototype.commands = { 628 /** 629 * Command to insert new content into the DOM. 630 */ 631 insert: function (ajax, response, status) { 632 // Get information from the response. If it is not there, default to 633 // our presets. 634 var wrapper = response.selector ? $(response.selector) : $(ajax.wrapper); 635 var method = response.method || ajax.method; 636 var effect = ajax.getEffect(response); 637 638 // We don't know what response.data contains: it might be a string of text 639 // without HTML, so don't rely on jQuery correctly iterpreting 640 // $(response.data) as new HTML rather than a CSS selector. Also, if 641 // response.data contains top-level text nodes, they get lost with either 642 // $(response.data) or $('<div></div>').replaceWith(response.data). 643 var new_content_wrapped = $('<div></div>').html(response.data); 644 var new_content = new_content_wrapped.contents(); 645 646 // For legacy reasons, the effects processing code assumes that new_content 647 // consists of a single top-level element. Also, it has not been 648 // sufficiently tested whether attachBehaviors() can be successfully called 649 // with a context object that includes top-level text nodes. However, to 650 // give developers full control of the HTML appearing in the page, and to 651 // enable Ajax content to be inserted in places where DIV elements are not 652 // allowed (e.g., within TABLE, TR, and SPAN parents), we check if the new 653 // content satisfies the requirement of a single top-level element, and 654 // only use the container DIV created above when it doesn't. For more 655 // information, please see http://drupal.org/node/736066. 656 if (new_content.length != 1 || new_content.get(0).nodeType != 1) { 657 new_content = new_content_wrapped; 658 } 659 660 // If removing content from the wrapper, detach behaviors first. 661 switch (method) { 662 case 'html': 663 case 'replaceWith': 664 case 'replaceAll': 665 case 'empty': 666 case 'remove': 667 var settings = response.settings || ajax.settings || Drupal.settings; 668 Drupal.detachBehaviors(wrapper, settings); 669 } 670 671 // Add the new content to the page. 672 wrapper[method](new_content); 673 674 // Immediately hide the new content if we're using any effects. 675 if (effect.showEffect != 'show') { 676 new_content.hide(); 677 } 678 679 // Determine which effect to use and what content will receive the 680 // effect, then show the new content. 681 if ($('.ajax-new-content', new_content).length > 0) { 682 $('.ajax-new-content', new_content).hide(); 683 new_content.show(); 684 $('.ajax-new-content', new_content)[effect.showEffect](effect.showSpeed); 685 } 686 else if (effect.showEffect != 'show') { 687 new_content[effect.showEffect](effect.showSpeed); 688 } 689 690 // Attach all JavaScript behaviors to the new content, if it was successfully 691 // added to the page, this if statement allows #ajax['wrapper'] to be 692 // optional. 693 if (new_content.parents('html').length > 0) { 694 // Apply any settings from the returned JSON if available. 695 var settings = response.settings || ajax.settings || Drupal.settings; 696 Drupal.attachBehaviors(new_content, settings); 697 } 698 }, 699 700 /** 701 * Command to remove a chunk from the page. 702 */ 703 remove: function (ajax, response, status) { 704 var settings = response.settings || ajax.settings || Drupal.settings; 705 Drupal.detachBehaviors($(response.selector), settings); 706 $(response.selector).remove(); 707 }, 708 709 /** 710 * Command to mark a chunk changed. 711 */ 712 changed: function (ajax, response, status) { 713 if (!$(response.selector).hasClass('ajax-changed')) { 714 $(response.selector).addClass('ajax-changed'); 715 if (response.asterisk) { 716 $(response.selector).find(response.asterisk).append(' <span class="ajax-changed">*</span> '); 717 } 718 } 719 }, 720 721 /** 722 * Command to provide an alert. 723 */ 724 alert: function (ajax, response, status) { 725 alert(response.text, response.title); 726 }, 727 728 /** 729 * Command to provide the jQuery css() function. 730 */ 731 css: function (ajax, response, status) { 732 $(response.selector).css(response.argument); 733 }, 734 735 /** 736 * Command to set the settings that will be used for other commands in this response. 737 */ 738 settings: function (ajax, response, status) { 739 if (response.merge) { 740 $.extend(true, Drupal.settings, response.settings); 741 } 742 else { 743 ajax.settings = response.settings; 744 } 745 }, 746 747 /** 748 * Command to attach data using jQuery's data API. 749 */ 750 data: function (ajax, response, status) { 751 $(response.selector).data(response.name, response.value); 752 }, 753 754 /** 755 * Command to apply a jQuery method. 756 */ 757 invoke: function (ajax, response, status) { 758 var $element = $(response.selector); 759 $element[response.method].apply($element, response.arguments); 760 }, 761 762 /** 763 * Command to restripe a table. 764 */ 765 restripe: function (ajax, response, status) { 766 // :even and :odd are reversed because jQuery counts from 0 and 767 // we count from 1, so we're out of sync. 768 // Match immediate children of the parent element to allow nesting. 769 $('> tbody > tr:visible, > tr:visible', $(response.selector)) 770 .removeClass('odd even') 771 .filter(':even').addClass('odd').end() 772 .filter(':odd').addClass('even'); 773 }, 774 775 /** 776 * Command to add css. 777 * 778 * Uses the proprietary addImport method if available as browsers which 779 * support that method ignore @import statements in dynamically added 780 * stylesheets. 781 */ 782 add_css: function (ajax, response, status) { 783 // Add the styles in the normal way. 784 $('head').prepend(response.data); 785 // Add imports in the styles using the addImport method if available. 786 var match, importMatch = /^@import url\("(.*)"\);$/igm; 787 if (document.styleSheets[0].addImport && importMatch.test(response.data)) { 788 importMatch.lastIndex = 0; 789 while (match = importMatch.exec(response.data)) { 790 document.styleSheets[0].addImport(match[1]); 791 } 792 } 793 }, 794 795 /** 796 * Command to update a form's build ID. 797 */ 798 updateBuildId: function(ajax, response, status) { 799 $('input[name="form_build_id"][value="' + response['old'] + '"]').val(response['new']); 800 } 801}; 802 803})(jQuery); 804; 805(function (D) { 806 var beforeSerialize = D.ajax.prototype.beforeSerialize;
807 D.ajax.prototype.beforeSerialize = function (element, options) { 808 beforeSerialize.call(this, element, options); 809 options.data['ajax_page_state[jquery_version]'] = D.settings.ajaxPageState.jquery_version; 810 } 811})(Drupal); 812;
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.