vendor: 8,469 bytes, lines 1-22
1/*! 2 * jQuery Form Plugin 3 * version: 4.2.2 4 * Requires jQuery v1.7.2 or later 5 * Project repository: https://github.com/jquery-form/form 6 7 * Copyright 2017 Kevin Morris 8 * Copyright 2006 M. Alsup 9 10 * Dual licensed under the LGPL-2.1+ or MIT licenses 11 * https://github.com/jquery-form/form#license 12 13 * This library is free software; you can redistribute it and/or 14 * modify it under the terms of the GNU Lesser General Public 15 * License as published by the Free Software Foundation; either 16 * version 2.1 of the License, or (at your option) any later version. 17 * This library is distributed in the hope that it will be useful, 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 * Lesser General Public License for more details. 21 */ 22!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&module.exports?module.exports=function(t,r){return void 0===r&&(r="undefined"!=typeof window?require("jquery"):require("jquery")(t)),e(r),r}:e(jQuery)}(function(e){"use strict";function t(t){var r=t.data;t.isDefaultPrevented()||(t.preventDefault(),e(t.target).closest("form").ajaxSubmit(r))}function r(t){var r=t.target,a=e(r);if(!a.is("[type=submit],[type=image]")){var n=a.closest("[type=submit]");if(0===n.length)return;r=n[0]}var i=r.form;if(i.clk=r,"image"===r.type)if(void 0!==t.offsetX)i.clk_x=t.offsetX,i.clk_y=t.offsetY;else if("function"==typeof e.fn.offset){var o=a.offset();i.clk_x=t.pageX-o.left,i.clk_y=t.pageY-o.top}else i.clk_x=t.pageX-r.offsetLeft,i.clk_y=t.pageY-r.offsetTop;setTimeout(function(){i.clk=i.clk_x=i.clk_y=null},100)}function a(){if(e.fn.ajaxSubmit.debug){var t="[jquery.form] "+Array.prototype.join.call(arguments,"");window.console&&window.console.log?window.console.log(t):window.opera&&window.opera.postError&&window.opera.postError(t)}}var n=/\r?\n/g,i={};i.fileapi=void 0!==e('<input type="file">').get(0).files,i.formdata=void 0!==window.FormData;var o=!!e.fn.prop;e.fn.attr2=function(){if(!o)return this.attr.apply(this,arguments);var e=this.prop.apply(this,arguments);return e&&e.jquery||"string"==typeof e?e:this.attr.apply(this,arguments)},e.fn.ajaxSubmit=function(t,r,n,s){function u(r){var a,n,i=e.param(r,t.traditional).split("&"),o=i.length,s=[];for(a=0;a<o;a++)i[a]=i[a].replace(/\+/g," "),n=i[a].split("="),s.push([decodeURIComponent(n[0]),decodeURIComponent(n[1])]);return s}function c(r){function n(e){var t=null;try{e.contentWindow&&(t=e.contentWindow.document)}catch(e){a("cannot get iframe.contentWindow document: "+e)}if(t)return t;try{t=e.contentDocument?e.contentDocument:e.document}catch(r){a("cannot get iframe.contentDocument: "+r),t=e.document}return t}function i(){function t(){try{var e=n(v).readyState;a("state = "+e),e&&"uninitialized"===e.toLowerCase()&&setTimeout(t,50)}catch(e){a("Server abort: ",e," (",e.name,")"),s(L),j&&clearTimeout(j),j=void 0}}var r=p.attr2("target"),i=p.attr2("action"),o=p.attr("enctype")||p.attr("encoding")||"multipart/form-data";w.setAttribute("target",m),l&&!/post/i.test(l)||w.setAttribute("method","POST"),i!==f.url&&w.setAttribute("action",f.url),f.skipEncodingOverride||l&&!/post/i.test(l)||p.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"}),f.timeout&&(j=setTimeout(function(){T=!0,s(A)},f.timeout));var u=[];try{if(f.extraData)for(var c in f.extraData)f.extraData.hasOwnProperty(c)&&(e.isPlainObject(f.extraData[c])&&f.extraData[c].hasOwnProperty("name")&&f.extraData[c].hasOwnProperty("value")?u.push(e('<input type="hidden" name="'+f.extraData[c].name+'">',k).val(f.extraData[c].value).appendTo(w)[0]):u.push(e('<input type="hidden" name="'+c+'">',k).val(f.extraData[c]).appendTo(w)[0]));f.iframeTarget||h.appendTo(D),v.attachEvent?v.attachEvent("onload",s):v.addEventListener("load",s,!1),setTimeout(t,15);try{w.submit()}catch(e){document.createElement("form").submit.apply(w)}}finally{w.setAttribute("action",i),w.setAttribute("enctype",o),r?w.setAttribute("target",r):p.removeAttr("target"),e(u).remove()}}function s(t){if(!x.aborted&&!X){if((O=n(v))||(a("cannot access response document"),t=L),t===A&&x)return x.abort("timeout"),void S.reject(x,"timeout");if(t===L&&x)return x.abort("server abort"),void S.reject(x,"error","server abort");if(O&&O.location.href!==f.iframeSrc||T){v.detachEvent?v.detachEvent("onload",s):v.removeEventListener("load",s,!1);var r,i="success";try{if(T)throw"timeout";var o="xml"===f.dataType||O.XMLDocument||e.isXMLDoc(O);if(a("isXml="+o),!o&&window.opera&&(null===O.body||!O.body.innerHTML)&&--C)return a("requeing onLoad callback, DOM not available"),void setTimeout(s,250);var u=O.body?O.body:O.documentElement;x.responseText=u?u.innerHTML:null,x.responseXML=O.XMLDocument?O.XMLDocument:O,o&&(f.dataType="xml"),x.getResponseHeader=function(e){return{"content-type":f.dataType}[e.toLowerCase()]},u&&(x.status=Number(u.getAttribute("status"))||x.status,x.statusText=u.getAttribute("statusText")||x.statusText);var c=(f.dataType||"").toLowerCase(),l=/(json|script|text)/.test(c);if(l||f.textarea){var p=O.getElementsByTagName("textarea")[0];if(p)x.responseText=p.value,x.status=Number(p.getAttribute("status"))||x.status,x.statusText=p.getAttribute("statusText")||x.statusText;else if(l){var m=O.getElementsByTagName("pre")[0],g=O.getElementsByTagName("body")[0];m?x.responseText=m.textContent?m.textContent:m.innerText:g&&(x.responseText=g.textContent?g.textContent:g.innerText)}}else"xml"===c&&!x.responseXML&&x.responseText&&(x.responseXML=q(x.responseText));try{M=N(x,c,f)}catch(e){i="parsererror",x.error=r=e||i}}catch(e){a("error caught: ",e),i="error",x.error=r=e||i}x.aborted&&(a("upload aborted"),i=null),x.status&&(i=x.status>=200&&x.status<300||304===x.status?"success":"error"),"success"===i?(f.success&&f.success.call(f.context,M,"success",x),S.resolve(x.responseText,"success",x),d&&e.event.trigger("ajaxSuccess",[x,f])):i&&(void 0===r&&(r=x.statusText),f.error&&f.error.call(f.context,x,i,r),S.reject(x,"error",r),d&&e.event.trigger("ajaxError",[x,f,r])),d&&e.event.trigger("ajaxComplete",[x,f]),d&&!--e.active&&e.event.trigger("ajaxStop"),f.complete&&f.complete.call(f.context,x,i),X=!0,f.timeout&&clearTimeout(j),setTimeout(function(){f.iframeTarget?h.attr("src",f.iframeSrc):h.remove(),x.responseXML=null},100)}}}var u,c,f,d,m,h,v,x,y,b,T,j,w=p[0],S=e.Deferred();if(S.abort=function(e){x.abort(e)},r)for(c=0;c<g.length;c++)u=e(g[c]),o?u.prop("disabled",!1):u.removeAttr("disabled");(f=e.extend(!0,{},e.ajaxSettings,t)).context=f.context||f,m="jqFormIO"+(new Date).getTime();var k=w.ownerDocument,D=p.closest("body");if(f.iframeTarget?(b=(h=e(f.iframeTarget,k)).attr2("name"))?m=b:h.attr2("name",m):(h=e('<iframe name="'+m+'" src="'+f.iframeSrc+'" />',k)).css({position:"absolute",top:"-1000px",left:"-1000px"}),v=h[0],x={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(t){var r="timeout"===t?"timeout":"aborted";a("aborting upload... "+r),this.aborted=1;try{v.contentWindow.document.execCommand&&v.contentWindow.document.execCommand("Stop")}catch(e){}h.attr("src",f.iframeSrc),x.error=r,f.error&&f.error.call(f.context,x,r,t),d&&e.event.trigger("ajaxError",[x,f,r]),f.complete&&f.complete.call(f.context,x,r)}},(d=f.global)&&0==e.active++&&e.event.trigger("ajaxStart"),d&&e.event.trigger("ajaxSend",[x,f]),f.beforeSend&&!1===f.beforeSend.call(f.context,x,f))return f.global&&e.active--,S.reject(),S;if(x.aborted)return S.reject(),S;(y=w.clk)&&(b=y.name)&&!y.disabled&&(f.extraData=f.extraData||{},f.extraData[b]=y.value,"image"===y.type&&(f.extraData[b+".x"]=w.clk_x,f.extraData[b+".y"]=w.clk_y));var A=1,L=2,F=e("meta[name=csrf-token]").attr("content"),E=e("meta[name=csrf-param]").attr("content");E&&F&&(f.extraData=f.extraData||{},f.extraData[E]=F),f.forceSync?i():setTimeout(i,10);var M,O,X,C=50,q=e.parseXML||function(e,t){return window.ActiveXObject?((t=new ActiveXObject("Microsoft.XMLDOM")).async="false",t.loadXML(e)):t=(new DOMParser).parseFromString(e,"text/xml"),t&&t.documentElement&&"parsererror"!==t.documentElement.nodeName?t:null},_=e.parseJSON||function(e){return window.eval("("+e+")")},N=function(t,r,a){var n=t.getResponseHeader("content-type")||"",i=("xml"===r||!r)&&n.indexOf("xml")>=0,o=i?t.responseXML:t.responseText;return i&&"parsererror"===o.documentElement.nodeName&&e.error&&e.error("parsererror"),a&&a.dataFilter&&(
22o=a.dataFilter(o,r)),"string"==typeof o&&(("json"===r||!r)&&n.indexOf("json")>=0?o=_(o):("script"===r||!r)&&n.indexOf("javascript")>=0&&e.globalEval(o)),o};return S}if(!this.length)return a("ajaxSubmit: skipping submit process - no element selected"),this;var l,f,d,p=this;"function"==typeof t?t={success:t}:"string"==typeof t||!1===t&&arguments.length>0?(t={url:t,data:r,dataType:n},"function"==typeof s&&(t.success=s)):void 0===t&&(t={}),l=t.method||t.type||this.attr2("method"),(d=(d="string"==typeof(f=t.url||this.attr2("action"))?e.trim(f):"")||window.location.href||"")&&(d=(d.match(/^([^#]+)/)||[])[1]),t=e.extend(!0,{url:d,success:e.ajaxSettings.success,type:l||e.ajaxSettings.type,iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},t);var m={};if(this.trigger("form-pre-serialize",[this,t,m]),m.veto)return a("ajaxSubmit: submit vetoed via form-pre-serialize trigger"),this;if(t.beforeSerialize&&!1===t.beforeSerialize(this,t))return a("ajaxSubmit: submit aborted via beforeSerialize callback"),this;var h=t.traditional;void 0===h&&(h=e.ajaxSettings.traditional);var v,g=[],x=this.formToArray(t.semantic,g,t.filtering);if(t.data){var y=e.isFunction(t.data)?t.data(x):t.data;t.extraData=y,v=e.param(y,h)}if(t.beforeSubmit&&!1===t.beforeSubmit(x,this,t))return a("ajaxSubmit: submit aborted via beforeSubmit callback"),this;if(this.trigger("form-submit-validate",[x,this,t,m]),m.veto)return a("ajaxSubmit: submit vetoed via form-submit-validate trigger"),this;var b=e.param(x,h);v&&(b=b?b+"&"+v:v),"GET"===t.type.toUpperCase()?(t.url+=(t.url.indexOf("?")>=0?"&":"?")+b,t.data=null):t.data=b;var T=[];
22if(t.resetForm&&T.push(function(){p.resetForm()}),t.clearForm&&T.push(function(){p.clearForm(t.includeHidden)}),!t.dataType&&t.target){var j=t.success||function(){};T.push(function(r,a,n){var i=arguments,o=t.replaceTarget?"replaceWith":"html";e(t.target)[o](r).each(function(){j.apply(this,i)})})}else t.success&&(e.isArray(t.success)?e.merge(T,t.success):T.push(t.success));if(t.success=function(e,r,a){for(var n=t.context||this,i=0,o=T.length;i<o;i++)T[i].apply(n,[e,r,a||p,p])},t.error){var w=t.error;t.error=function(e,r,a){var n=t.context||this;w.apply(n,[e,r,a,p])}}if(t.complete){var S=t.complete;t.complete=function(e,r){var a=t.context||this;S.apply(a,[e,r,p])}}var k=e("input[type=file]:enabled",this).filter(function(){return""!==e(this).val()}).length>0,D="multipart/form-data",A=p.attr("enctype")===D||p.attr("encoding")===D,L=i.fileapi&&i.formdata;a("fileAPI :"+L);var F,E=(k||A)&&!L;!1!==t.iframe&&(t.iframe||E)?t.closeKeepAlive?e.get(t.closeKeepAlive,function(){F=c(x)}):F=c(x):F=(k||A)&&L?function(r){for(var a=new FormData,n=0;n<r.length;n++)a.append(r[n].name,r[n].value);if(t.extraData){var i=u(t.extraData);for(n=0;n<i.length;n++)i[n]&&a.append(i[n][0],i[n][1])}t.data=null;var o=e.extend(!0,{},e.ajaxSettings,t,{contentType:!1,processData:!1,cache:!1,type:l||"POST"});t.uploadProgress&&(o.xhr=function(){var r=e.ajaxSettings.xhr();return r.upload&&r.upload.addEventListener("progress",function(e){var r=0,a=e.loaded||e.position,n=e.total;e.lengthComputable&&(r=Math.ceil(a/n*100)),t.uploadProgress(e,a,n,r)},!1),r}),o.data=null;var s=o.beforeSend;return o.beforeSend=function(e,r){t.formData?r.data=t.formData:r.data=a,s&&s.call(this,e,r)},e.ajax(o)}(x):e.ajax(t),p.removeData("jqxhr").data("jqxhr",F);for(var M=0;M<g.length;M++)g[M]=null;return this.trigger("form-submit-notify",[this,t]),this},e.fn.ajaxForm=function(n,i,o,s){if(("string"==typeof n||!1===n&&arguments.length>0)&&(n={url:n,data:i,dataType:o},"function"==typeof s&&(n.success=s)),n=n||{},n.delegation=n.delegation&&e.isFunction(e.fn.on),!n.delegation&&0===this.length){var u={s:this.selector,c:this.context};return!e.isReady&&u.s?(a("DOM not ready, queuing ajaxForm"),e(function(){e(u.s,u.c).ajaxForm(n)}),this):(a("terminating; zero elements found by selector"+(e.isReady?"":" (DOM not ready)")),this)}return n.delegation?(e(document).off("submit.form-plugin",this.selector,t).off("click.form-plugin",this.selector,r).on("submit.form-plugin",this.selector,n,t).on("click.form-plugin",this.selector,n,r),this):this.ajaxFormUnbind().on("submit.form-plugin",n,t).on("click.form-plugin",n,r)},e.fn.ajaxFormUnbind=function(){return this.off("submit.form-plugin click.form-plugin")},e.fn.formToArray=function(t,r,a){var n=[];if(0===this.length)return n;var o,s=this[0],u=this.attr("id"),c=t||void 0===s.elements?s.getElementsByTagName("*"):s.elements;if(c&&(c=e.makeArray(c)),u&&(t||/(Edge|Trident)\//.test(navigator.userAgent))&&(o=e(':input[form="'+u+'"]').get()).length&&(c=(c||[]).concat(o)),!c||!c.length)return n;e.isFunction(a)&&(c=e.map(c,a));var l,f,d,p,m,h,v;for(l=0,h=c.length;l<h;l++)if(m=c[l],(d=m.name)&&!m.disabled)if(t&&s.clk&&"image"===m.type)s.clk===m&&(n.push({name:d,value:e(m).val(),type:m.type}),n.push({name:d+".x",value:s.clk_x},{name:d+".y",value:s.clk_y}));else if((p=e.fieldValue(m,!0))&&p.constructor===Array)for(r&&r.push(m),f=0,v=p.length;f<v;f++)n.push({name:d,value:p[f]});else if(i.fileapi&&"file"===m.type){r&&r.push(m);var g=m.files;if(g.length)for(f=0;f<g.length;f++)n.push({name:d,value:g[f],type:m.type});else n.push({name:d,value:"",type:m.type})}else null!==p&&void 0!==p&&(r&&r.push(m),n.push({name:d,value:p,type:m.type,required:m.required}));if(!t&&s.clk){var x=e(s.clk),y=x[0];(d=y.name)&&!y.disabled&&"image"===y.type&&(n.push({name:d,value:x.val()}),n.push({name:d+".x",value:s.clk_x},{name:d+".y",value:s.clk_y}))}return n},e.fn.formSerialize=function(t){return e.param(this.formToArray(t))},e.fn.fieldSerialize=function(t){var r=[];return this.each(function(){var a=this.name;if(a){var n=e.fieldValue(this,t);if(n&&n.constructor===Array)for(var i=0,o=n.length;i<o;i++)r.push({name:a,value:n[i]});else null!==n&&void 0!==n&&r.push({name:this.name,value:n})}}),e.param(r)},e.fn.fieldValue=function(t){for(var r=[],a=0,n=this.length;a<n;a++){var i=this[a],o=e.fieldValue(i,t);null===o||void 0===o||o.constructor===Array&&!o.length||(o.constructor===Array?e.merge(r,o):r.push(o))}return r},e.fieldValue=function(t,r){var a=t.name,i=t.type,o=t.tagName.toLowerCase();if(void 0===r&&(r=!0),r&&(!a||t.disabled||"reset"===i||"button"===i||("checkbox"===i||"radio"===i)&&!t.checked||("submit"===i||"image"===i)&&t.form&&t.form.clk!==t||"select"===o&&-1===t.selectedIndex))return null;if("select"===o){var s=t.selectedIndex;if(s<0)return null;for(var u=[],c=t.options,l="select-one"===i,f=l?s+1:c.length,d=l?s:0;d<f;d++){var p=c[d];if(p.selected&&!p.disabled){var m=p.value;if(m||(m=p.attributes&&p.attributes.value&&!p.attributes.value.specified?p.text:p.value),l)return m;u.push(m)}}return u}return e(t).val().replace(n,"\r\n")},e.fn.clearForm=function(t){return this.each(function(){e("input,select,textarea",this).clearFields(t)})},e.fn.clearFields=e.fn.clearInputs=function(t){var r=/^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i;return this.each(function(){var a=this.type,n=this.tagName.toLowerCase();r.test(a)||"textarea"===n?this.value="":"checkbox"===a||"radio"===a?this.checked=!1:"select"===n?this.selectedIndex=-1:"file"===a?/MSIE/.test(navigator.userAgent)?e(this).replaceWith(e(this).clone(!0)):e(this).val(""):t&&(!0===t&&/hidden/.test(a)||"string"==typeof t&&e(this).is(t))&&(this.value="")}
22)},e.fn.resetForm=function(){return this.each(function(){var t=e(this),r=this.tagName.toLowerCase();switch(r){case"input":this.checked=this.defaultChecked;case"textarea":return this.value=this.defaultValue,!0;case"option":case"optgroup":var a=t.parents("select");return a.length&&a[0].multiple?"option"===r?this.selected=this.defaultSelected:t.find("option").resetForm():a.resetForm(),!0;case"select":return t.find("option").each(function(e){if(this.selected=this.defaultSelected,this.defaultSelected&&!t[0].multiple)return t[0].selectedIndex=e,!1}),!0;case"label":var n=e(t.attr("for")),i=t.find("input,select,textarea");return n[0]&&i.unshift(n[0]),i.resetForm(),!0;case"form":return("function"==typeof this.reset||"object"==typeof this.reset&&!this.reset.nodeType)&&this.reset(),!0;default:return t.find("form,input,label,select,textarea").resetForm(),!0}})},e.fn.enable=function(e){return void 0===e&&(e=!0),this.each(function(){this.disabled=!e})},e.fn.selected=function(t){return void 0===t&&(t=!0),this.each(function(){var r=this.type;if("checkbox"===r||"radio"===r)this.checked=t;else if("option"===this.tagName.toLowerCase()){var a=e(this).parent("select");t&&a[0]&&"select-one"===a[0].type&&a.find("option").selected(!1),this.selected=t}})},e.fn.ajaxSubmit.debug=!1}); 23 24; 25/** 26* DO NOT EDIT THIS FILE. 27* See the following change record for more information, 28* https://www.drupal.org/node/2815083 29* @preserve 30**/ 31 32(function ($, Drupal) { 33 Drupal.theme.progressBar = function (id) { 34 return '<div id="' + id + '" class="progress" aria-live="polite">' + '<div class="progress__label"> </div>' + '<div class="progress__track"><div class="progress__bar"></div></div>' + '<div class="progress__percentage"></div>' + '<div class="progress__description"> </div>' + '</div>'; 35 }; 36 37 Drupal.ProgressBar = function (id, updateCallback, method, errorCallback) { 38 this.id = id; 39 this.method = method || 'GET'; 40 this.updateCallback = updateCallback; 41 this.errorCallback = errorCallback; 42 43 this.element = $(Drupal.theme('progressBar', id)); 44 }; 45 46 $.extend(Drupal.ProgressBar.prototype, { 47 setProgress: function setProgress(percentage, message, label) { 48 if (percentage >= 0 && percentage <= 100) { 49 $(this.element).find('div.progress__bar').css('width', percentage + '%'); 50 $(this.element).find('div.progress__percentage').html(percentage + '%'); 51 } 52 $('div.progress__description', this.element).html(message); 53 $('div.progress__label', this.element).html(label); 54 if (this.updateCallback) { 55 this.updateCallback(percentage, message, this); 56 } 57 }, 58 startMonitoring: function startMonitoring(uri, delay) { 59 this.delay = delay; 60 this.uri = uri; 61 this.sendPing(); 62 }, 63 stopMonitoring: function stopMonitoring() { 64 clearTimeout(this.timer); 65 66 this.uri = null; 67 }, 68 sendPing: function sendPing() { 69 if (this.timer) { 70 clearTimeout(this.timer); 71 } 72 if (this.uri) { 73 var pb = this; 74 75 var uri = this.uri; 76 if (uri.indexOf('?') === -1) { 77 uri += '?'; 78 } else { 79 uri += '&'; 80 } 81 uri += '_format=json'; 82 $.ajax({ 83 type: this.method, 84 url: uri, 85 data: '', 86 dataType: 'json', 87 success: function success(progress) { 88 if (progress.status === 0) { 89 pb.displayError(progress.data); 90 return; 91 } 92 93 pb.setProgress(progress.percentage, progress.message, progress.label); 94 95 pb.timer = setTimeout(function () { 96 pb.sendPing(); 97 }, pb.delay); 98 }, 99 error: function error(xmlhttp) { 100 var e = new Drupal.AjaxError(xmlhttp, pb.uri); 101 pb.displayError('<pre>' + e.message + '</pre>'); 102 } 103 }); 104 } 105 }, 106 displayError: function displayError(string) { 107 var error = $('<div class="messages messages--error"></div>').html(string); 108 $(this.element).before(error).hide(); 109 110 if (this.errorCallback) { 111 this.errorCallback(this); 112 } 113 } 114 }); 115})(jQuery, Drupal);; 116/** 117* DO NOT EDIT THIS FILE. 118* See the following change record for more information, 119* https://www.drupal.org/node/2815083 120* @preserve 121**/ 122 123(function (Drupal) { 124 Drupal.behaviors.responsiveImageAJAX = { 125 attach: function attach() { 126 if (window.picturefill) { 127 window.picturefill(); 128 } 129 } 130 }; 131})(Drupal);; 132/** 133* DO NOT EDIT THIS FILE. 134* See the following change record for more information, 135* https://www.drupal.org/node/2815083 136* @preserve 137**/ 138function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } 139 140(function ($, window, Drupal, drupalSettings) { 141 Drupal.behaviors.AJAX = { 142 attach: function attach(context, settings) { 143 function loadAjaxBehavior(base) { 144 var elementSettings = settings.ajax[base]; 145 if (typeof elementSettings.selector === 'undefined') { 146 elementSettings.selector = '#' + base; 147 } 148 $(elementSettings.selector).once('drupal-ajax').each(function () { 149 elementSettings.element = this; 150 elementSettings.base = base; 151 Drupal.ajax(elementSettings); 152 }); 153 } 154 155 Object.keys(settings.ajax || {}
155).forEach(function (base) { 156 return loadAjaxBehavior(base); 157 }); 158 159 Drupal.ajax.bindAjaxLinks(document.body); 160 161 $('.use-ajax-submit').once('ajax').each(function () { 162 var elementSettings = {}; 163 164 elementSettings.url = $(this.form).attr('action'); 165 166 elementSettings.setClick = true; 167 168 elementSettings.event = 'click'; 169 170 elementSettings.progress = { type: 'throbber' }; 171 elementSettings.base = $(this).attr('id'); 172 elementSettings.element = this; 173 174 Drupal.ajax(elementSettings); 175 }); 176 }, 177 detach: function detach(context, settings, trigger) { 178 if (trigger === 'unload') { 179 Drupal.ajax.expired().forEach(function (instance) { 180 Drupal.ajax.instances[instance.instanceIndex] = null; 181 }); 182 } 183 } 184 }; 185 186 Drupal.AjaxError = function (xmlhttp, uri, customMessage) { 187 var statusCode = void 0; 188 var statusText = void 0; 189 var responseText = void 0; 190 if (xmlhttp.status) { 191 statusCode = '\n' + Drupal.t('An AJAX HTTP error occurred.') + '\n' + Drupal.t('HTTP Result Code: !status', { '!status': xmlhttp.status }); 192 } else { 193 statusCode = '\n' + Drupal.t('An AJAX HTTP request terminated abnormally.'); 194 } 195 statusCode += '\n' + Drupal.t('Debugging information follows.'); 196 var pathText = '\n' + Drupal.t('Path: !uri', { '!uri': uri }); 197 statusText = ''; 198 199 try { 200 statusText = '\n' + Drupal.t('StatusText: !statusText', { 201 '!statusText': $.trim(xmlhttp.statusText) 202 }); 203 } catch (e) {} 204 205 responseText = ''; 206 207 try { 208 responseText = '\n' + Drupal.t('ResponseText: !responseText', { 209 '!responseText': $.trim(xmlhttp.responseText) 210 }); 211 } catch (e) {} 212 213 responseText = responseText.replace(/<("[^"]*"|'[^']*'|[^'">])*>/gi, ''); 214 responseText = responseText.replace(/[\n]+\s+/g, '\n'); 215 216 var readyStateText = xmlhttp.status === 0 ? '\n' + Drupal.t('ReadyState: !readyState', { 217 '!readyState': xmlhttp.readyState 218 }) : ''; 219 220 customMessage = customMessage ? '\n' + Drupal.t('CustomMessage: !customMessage', { 221 '!customMessage': customMessage 222 }) : ''; 223 224 this.message = statusCode + pathText + statusText + customMessage + responseText + readyStateText; 225 226 this.name = 'AjaxError'; 227 }; 228 229 Drupal.AjaxError.prototype = new Error(); 230 Drupal.AjaxError.prototype.constructor = Drupal.AjaxError; 231 232 Drupal.ajax = function (settings) { 233 if (arguments.length !== 1) { 234 throw new Error('Drupal.ajax() function must be called with one configuration object only'); 235 } 236 237 var base = settings.base || false; 238 var element = settings.element || false; 239 delete settings.base; 240 delete settings.element; 241 242 if (!settings.progress && !element) { 243 settings.progress = false; 244 } 245 246 var ajax = new Drupal.Ajax(base, element, settings); 247 ajax.instanceIndex = Drupal.ajax.instances.length; 248 Drupal.ajax.instances.push(ajax); 249 250 return ajax; 251 }; 252 253 Drupal.ajax.instances = []; 254 255 Drupal.ajax.expired = function () { 256 return Drupal.ajax.instances.filter(function (instance) { 257 return instance && instance.element !== false && !document.body.contains(instance.element); 258 }); 259 }; 260 261 Drupal.ajax.bindAjaxLinks = function (element) { 262 $(element).find('.use-ajax').once('ajax').each(function (i, ajaxLink) { 263 var $linkElement = $(ajaxLink); 264 265 var elementSettings = { 266 progress: { type: 'throbber' }, 267 dialogType: $linkElement.data('dialog-type'), 268 dialog: $linkElement.data('dialog-options'), 269 dialogRenderer: $linkElement.data('dialog-renderer'), 270 base: $linkElement.attr('id'), 271 element: ajaxLink 272 }; 273 var href = $linkElement.attr('href'); 274 275 if (href) { 276 elementSettings.url = href; 277 elementSettings.event = 'click'; 278 } 279 Drupal.ajax(elementSettings); 280 }); 281 }; 282 283 Drupal.Ajax = function (base, element, elementSettings) { 284 var defaults = { 285 event: element ? 'mousedown' : null, 286 keypress: true, 287 selector: base ? '#' + base : null, 288 effect: 'none', 289 speed: 'none', 290 method: 'replaceWith', 291 progress: { 292 type: 'throbber', 293 message: Drupal.t('Please wait...') 294 }, 295 submit: { 296 js: true 297 } 298 }; 299 300 $.extend(this, defaults, elementSettings); 301 302 this.commands = new Drupal.AjaxCommands(); 303 304 this.instanceIndex = false;
305 306 if (this.wrapper) { 307 this.wrapper = '#' + this.wrapper; 308 } 309 310 this.element = element; 311 312 this.element_settings = elementSettings; 313 314 this.elementSettings = elementSettings; 315 316 if (this.element && this.element.form) { 317 this.$form = $(this.element.form); 318 } 319 320 if (!this.url) { 321 var $element = $(this.element); 322 if ($element.is('a')) { 323 this.url = $element.attr('href'); 324 } else if (this.element && element.form) { 325 this.url = this.$form.attr('action'); 326 } 327 } 328 329 var originalUrl = this.url; 330 331 this.url = this.url.replace(/\/nojs(\/|$|\?|#)/, '/ajax$1'); 332 333 if (drupalSettings.ajaxTrustedUrl[originalUrl]) { 334 drupalSettings.ajaxTrustedUrl[this.url] = true; 335 } 336 337 var ajax = this; 338 339 ajax.options = { 340 url: ajax.url, 341 data: ajax.submit, 342 beforeSerialize: function beforeSerialize(elementSettings, options) { 343 return ajax.beforeSerialize(elementSettings, options); 344 }, 345 beforeSubmit: function beforeSubmit(formValues, elementSettings, options) { 346 ajax.ajaxing = true; 347 return ajax.beforeSubmit(formValues, elementSettings, options); 348 }, 349 beforeSend: function beforeSend(xmlhttprequest, options) { 350 ajax.ajaxing = true; 351 return ajax.beforeSend(xmlhttprequest, options); 352 }, 353 success: function success(response, status, xmlhttprequest) { 354 if (typeof response === 'string') { 355 response = $.parseJSON(response); 356 } 357 358 if (response !== null && !drupalSettings.ajaxTrustedUrl[ajax.url]) { 359 if (xmlhttprequest.getResponseHeader('X-Drupal-Ajax-Token') !== '1') { 360 var customMessage = Drupal.t('The response failed verification so will not be processed.'); 361 return ajax.error(xmlhttprequest, ajax.url, customMessage); 362 } 363 } 364 365 return ajax.success(response, status); 366 }, 367 complete: function complete(xmlhttprequest, status) { 368 ajax.ajaxing = false; 369 if (status === 'error' || status === 'parsererror') { 370 return ajax.error(xmlhttprequest, ajax.url); 371 } 372 }, 373 374 dataType: 'json', 375 type: 'POST' 376 }; 377 378 if (elementSettings.dialog) { 379 ajax.options.data.dialogOptions = elementSettings.dialog; 380 } 381 382 if (ajax.options.url.indexOf('?') === -1) { 383 ajax.options.url += '?'; 384 } else { 385 ajax.options.url += '&'; 386 } 387 388 var wrapper = 'drupal_' + (elementSettings.dialogType || 'ajax'); 389 if (elementSettings.dialogRenderer) { 390 wrapper += '.' + elementSettings.dialogRenderer; 391 } 392 ajax.options.url += Drupal.ajax.WRAPPER_FORMAT + '=' + wrapper; 393 394 $(ajax.element).on(elementSettings.event, function (event) { 395 if (!drupalSettings.ajaxTrustedUrl[ajax.url] && !Drupal.url.isLocal(ajax.url)) { 396 throw new Error(Drupal.t('The callback URL is not local and not trusted: !url', { 397 '!url': ajax.url 398 })); 399 } 400 return ajax.eventResponse(this, event); 401 }); 402 403 if (elementSettings.keypress) { 404 $(ajax.element).on('keypress', function (event) { 405 return ajax.keypressResponse(this, event); 406 }); 407 } 408 409 if (elementSettings.prevent) { 410 $(ajax.element).on(elementSettings.prevent, false); 411 } 412 }; 413 414 Drupal.ajax.WRAPPER_FORMAT = '_wrapper_format'; 415 416 Drupal.Ajax.AJAX_REQUEST_PARAMETER = '_drupal_ajax'; 417 418 Drupal.Ajax.prototype.execute = function () { 419 if (this.ajaxing) { 420 return; 421 } 422 423 try { 424 this.beforeSerialize(this.element, this.options); 425 426 return $.ajax(this.options); 427 } catch (e) { 428 this.ajaxing = false; 429 window.alert('An error occurred while attempting to process ' + this.options.url + ': ' + e.message); 430 431 return $.Deferred().reject(); 432 } 433 }; 434 435 Drupal.Ajax.prototype.keypressResponse = function (element, event) { 436 var ajax = this; 437 438 if (event.which === 13 || event.which === 32 && element.type !== 'text' && element.type !== 'textarea' && element.type !== 'tel' && element.type !== 'number') { 439 event.preventDefault(); 440 event.stopPropagation(); 441 $(element).trigger(ajax.elementSettings.event); 442 } 443 }; 444 445 Drupal.Ajax.prototype.eventResponse = function (element, event) { 446 event.preventDefault(); 447 event.stopPropagation(); 448 449 var ajax = this; 450 451 if (ajax.ajaxing) { 452 return; 453 } 454 455 try { 456 if (ajax.$form) { 457 if (ajax.setClick) { 458 element.form.clk = element; 459 } 460 461 ajax.$form.ajaxSubmit(ajax.options); 462 } else { 463 ajax.beforeSerialize(ajax.element, ajax.options); 464 $.ajax(ajax.options); 465 } 466 } catch (e) { 467 ajax.ajaxing = false;
468 window.alert('An error occurred while attempting to process ' + ajax.options.url + ': ' + e.message); 469 } 470 }; 471 472 Drupal.Ajax.prototype.beforeSerialize = function (element, options) { 473 if (this.$form && document.body.contains(this.$form.get(0))) { 474 var settings = this.settings || drupalSettings; 475 Drupal.detachBehaviors(this.$form.get(0), settings, 'serialize'); 476 } 477 478 options.data[Drupal.Ajax.AJAX_REQUEST_PARAMETER] = 1; 479 480 var pageState = drupalSettings.ajaxPageState; 481 options.data['ajax_page_state[theme]'] = pageState.theme; 482 options.data['ajax_page_state[theme_token]'] = pageState.theme_token; 483 options.data['ajax_page_state[libraries]'] = pageState.libraries; 484 }; 485 486 Drupal.Ajax.prototype.beforeSubmit = function (formValues, element, options) {}; 487 488 Drupal.Ajax.prototype.beforeSend = function (xmlhttprequest, options) { 489 if (this.$form) { 490 options.extraData = options.extraData || {}; 491 492 options.extraData.ajax_iframe_upload = '1'; 493 494 var v = $.fieldValue(this.element); 495 if (v !== null) { 496 options.extraData[this.element.name] = v; 497 } 498 } 499 500 $(this.element).prop('disabled', true); 501 502 if (!this.progress || !this.progress.type) { 503 return; 504 } 505 506 var progressIndicatorMethod = 'setProgressIndicator' + this.progress.type.slice(0, 1).toUpperCase() + this.progress.type.slice(1).toLowerCase(); 507 if (progressIndicatorMethod in this && typeof this[progressIndicatorMethod] === 'function') { 508 this[progressIndicatorMethod].call(this); 509 } 510 }; 511 512 Drupal.theme.ajaxProgressThrobber = function (message) { 513 var messageMarkup = typeof message === 'string' ? Drupal.theme('ajaxProgressMessage', message) : ''; 514 var throbber = '<div class="throbber"> </div>'; 515 516 return '<div class="ajax-progress ajax-progress-throbber">' + throbber + messageMarkup + '</div>'; 517 }; 518 519 Drupal.theme.ajaxProgressIndicatorFullscreen = function () { 520 return '<div class="ajax-progress ajax-progress-fullscreen"> </div>'; 521 }; 522 523 Drupal.theme.ajaxProgressMessage = function (message) { 524 return '<div class="message">' + message + '</div>'; 525 }; 526 527 Drupal.Ajax.prototype.setProgressIndicatorBar = function () { 528 var progressBar = new Drupal.ProgressBar('ajax-progress-' + this.element.id, $.noop, this.progress.method, $.noop); 529 if (this.progress.message) { 530 progressBar.setProgress(-1, this.progress.message); 531 } 532 if (this.progress.url) { 533 progressBar.startMonitoring(this.progress.url, this.progress.interval || 1500); 534 } 535 this.progress.element = $(progressBar.element).addClass('ajax-progress ajax-progress-bar'); 536 this.progress.object = progressBar; 537 $(this.element).after(this.progress.element); 538 }; 539 540 Drupal.Ajax.prototype.setProgressIndicatorThrobber = function () { 541 this.progress.element = $(Drupal.theme('ajaxProgressThrobber', this.progress.message)); 542 $(this.element).after(this.progress.element); 543 }; 544 545 Drupal.Ajax.prototype.setProgressIndicatorFullscreen = function () { 546 this.progress.element = $(Drupal.theme('ajaxProgressIndicatorFullscreen')); 547 $('body').after(this.progress.element); 548 }; 549 550 Drupal.Ajax.prototype.success = function (response, status) { 551 var _this = this; 552 553 if (this.progress.element) { 554 $(this.progress.element).remove(); 555 } 556 if (this.progress.object) { 557 this.progress.object.stopMonitoring(); 558 } 559 $(this.element).prop('disabled', false); 560 561 var elementParents = $(this.element).parents('[data-drupal-selector]').addBack().toArray(); 562 563 var focusChanged = false; 564 Object.keys(response || {}).forEach(function (i) { 565 if (response[i].command && _this.commands[response[i].command]) { 566 _this.commands[response[i].command](_this, response[i], status); 567 if (response[i].command === 'invoke' && response[i].method === 'focus') { 568 focusChanged = true; 569 } 570 } 571 }); 572 573 if (!focusChanged && this.element && !$(this.element).data('disable-refocus')) { 574 var target = false;
575 576 for (var n = elementParents.length - 1; !target && n >= 0; n--) { 577 target = document.querySelector('[data-drupal-selector="' + elementParents[n].getAttribute('data-drupal-selector') + '"]'); 578 } 579 580 if (target) { 581 $(target).trigger('focus'); 582 } 583 } 584 585 if (this.$form && document.body.contains(this.$form.get(0))) { 586 var settings = this.settings || drupalSettings; 587 Drupal.attachBehaviors(this.$form.get(0), settings); 588 } 589 590 this.settings = null; 591 }; 592 593 Drupal.Ajax.prototype.getEffect = function (response) { 594 var type = response.effect || this.effect; 595 var speed = response.speed || this.speed; 596 597 var effect = {}; 598 if (type === 'none') { 599 effect.showEffect = 'show'; 600 effect.hideEffect = 'hide'; 601 effect.showSpeed = ''; 602 } else if (type === 'fade') { 603 effect.showEffect = 'fadeIn'; 604 effect.hideEffect = 'fadeOut'; 605 effect.showSpeed = speed; 606 } else { 607 effect.showEffect = type + 'Toggle'; 608 effect.hideEffect = type + 'Toggle'; 609 effect.showSpeed = speed; 610 } 611 612 return effect; 613 }; 614 615 Drupal.Ajax.prototype.error = function (xmlhttprequest, uri, customMessage) { 616 if (this.progress.element) { 617 $(this.progress.element).remove(); 618 } 619 if (this.progress.object) { 620 this.progress.object.stopMonitoring(); 621 } 622 623 $(this.wrapper).show(); 624 625 $(this.element).prop('disabled', false); 626 627 if (this.$form && document.body.contains(this.$form.get(0))) { 628 var settings = this.settings || drupalSettings; 629 Drupal.attachBehaviors(this.$form.get(0), settings); 630 } 631 throw new Drupal.AjaxError(xmlhttprequest, uri, customMessage); 632 }; 633 634 Drupal.theme.ajaxWrapperNewContent = function ($newContent, ajax, response) { 635 return (response.effect || ajax.effect) !== 'none' && $newContent.filter(function (i) { 636 return !($newContent[i].nodeName === '#comment' || $newContent[i].nodeName === '#text' && /^(\s|\n|\r)*$/.test($newContent[i].textContent)); 637 }).length > 1 ? Drupal.theme('ajaxWrapperMultipleRootElements', $newContent) : $newContent; 638 }; 639 640 Drupal.theme.ajaxWrapperMultipleRootElements = function ($elements) { 641 return $('<div></div>').append($elements); 642 }; 643 644 Drupal.AjaxCommands = function () {}; 645 Drupal.AjaxCommands.prototype = { 646 insert: function insert(ajax, response) { 647 var $wrapper = response.selector ? $(response.selector) : $(ajax.wrapper); 648 var method = response.method || ajax.method; 649 var effect = ajax.getEffect(response); 650 651 var settings = response.settings || ajax.settings || drupalSettings; 652 653 var $newContent = $($.parseHTML(response.data, document, true)); 654 655 $newContent = Drupal.theme('ajaxWrapperNewContent', $newContent, ajax, response); 656 657 switch (method) { 658 case 'html': 659 case 'replaceWith': 660 case 'replaceAll': 661 case 'empty': 662 case 'remove': 663 Drupal.detachBehaviors($wrapper.get(0), settings); 664 break; 665 default: 666 break; 667 } 668 669 $wrapper[method]($newContent); 670 671 if (effect.showEffect !== 'show') { 672 $newContent.hide(); 673 } 674 675 var $ajaxNewContent = $newContent.find('.ajax-new-content'); 676 if ($ajaxNewContent.length) { 677 $ajaxNewContent.hide(); 678 $newContent.show(); 679 $ajaxNewContent[effect.showEffect](effect.showSpeed); 680 } else if (effect.showEffect !== 'show') { 681 $newContent[effect.showEffect](effect.showSpeed); 682 } 683 684 if ($newContent.parents('html').length) { 685 $newContent.each(function (index, element) { 686 if (element.nodeType === Node.ELEMENT_NODE) { 687 Drupal.attachBehaviors(element, settings); 688 } 689 }); 690 } 691 }, 692 remove: function remove(ajax, response, status) { 693 var settings = response.settings || ajax.settings || drupalSettings; 694 $(response.selector).each(function () { 695 Drupal.detachBehaviors(this, settings); 696 }).remove(); 697 }, 698 changed: function changed(ajax, response, status) { 699 var $element = $(response.selector); 700 if (!$element.hasClass('ajax-changed')) { 701 $element.addClass('ajax-changed'); 702 if (response.asterisk) { 703 $element.find(response.asterisk).append(' <abbr class="ajax-changed" title="' + Drupal.t('Changed') + '">*</abbr> '); 704 } 705 } 706 }, 707 alert: function alert(ajax, response, status) { 708 window.alert(response.text, response.title); 709 }, 710 announce: function announce(ajax, response) { 711 if (response.priority) { 712 Drupal.announce(response.text, response.priority); 713 } else { 714 Drupal.announce(response.text); 715 } 716 }, 717 redirect: function redirect(ajax, response, status) { 718 window.location = response.url; 719 }, 720 css: function css(ajax, response, status) { 721 $(response.selector).css(response.argument); 722 }, 723 settings: function settings(ajax, response, status) { 724 var ajaxSettings = drupalSettings.ajax; 725 726 if (ajaxSettings) {
727 Drupal.ajax.expired().forEach(function (instance) { 728 729 if (instance.selector) { 730 var selector = instance.selector.replace('#', ''); 731 if (selector in ajaxSettings) { 732 delete ajaxSettings[selector]; 733 } 734 } 735 }); 736 } 737 738 if (response.merge) { 739 $.extend(true, drupalSettings, response.settings); 740 } else { 741 ajax.settings = response.settings; 742 } 743 }, 744 data: function data(ajax, response, status) { 745 $(response.selector).data(response.name, response.value); 746 }, 747 invoke: function invoke(ajax, response, status) { 748 var $element = $(response.selector); 749 $element[response.method].apply($element, _toConsumableArray(response.args)); 750 }, 751 restripe: function restripe(ajax, response, status) { 752 $(response.selector).find('> tbody > tr:visible, > tr:visible').removeClass('odd even').filter(':even').addClass('odd').end().filter(':odd').addClass('even'); 753 }, 754 update_build_id: function update_build_id(ajax, response, status) { 755 $('input[name="form_build_id"][value="' + response.old + '"]').val(response.new); 756 }, 757 add_css: function add_css(ajax, response, status) { 758 $('head').prepend(response.data); 759 760 var match = void 0; 761 var importMatch = /^@import url\("(.*)"\);$/gim; 762 if (document.styleSheets[0].addImport && importMatch.test(response.data)) { 763 importMatch.lastIndex = 0; 764 do { 765 match = importMatch.exec(response.data); 766 document.styleSheets[0].addImport(match[1]); 767 } while (match); 768 } 769 } 770 }; 771})(jQuery, window, Drupal, drupalSettings);; 772/** 773* DO NOT EDIT THIS FILE. 774* See the following change record for more information, 775* https://www.drupal.org/node/2815083 776* @preserve 777**/ 778 779(function ($, Drupal, drupalSettings) { 780 Drupal.Views = {}; 781 782 Drupal.Views.parseQueryString = function (query) { 783 var args = {}; 784 var pos = query.indexOf('?'); 785 if (pos !== -1) { 786 query = query.substring(pos + 1); 787 } 788 var pair = void 0; 789 var pairs = query.split('&'); 790 for (var i = 0; i < pairs.length; i++) { 791 pair = pairs[i].split('='); 792 793 if (pair[0] !== 'q' && pair[1]) { 794 args[decodeURIComponent(pair[0].replace(/\+/g, ' '))] = decodeURIComponent(pair[1].replace(/\+/g, ' ')); 795 } 796 } 797 return args; 798 }; 799 800 Drupal.Views.parseViewArgs = function (href, viewPath) { 801 var returnObj = {}; 802 var path = Drupal.Views.getPath(href); 803 804 var viewHref = Drupal.url(viewPath).substring(drupalSettings.path.baseUrl.length); 805 806 if (viewHref && path.substring(0, viewHref.length + 1) === viewHref + '/') { 807 returnObj.view_args = decodeURIComponent(path.substring(viewHref.length + 1, path.length)); 808 returnObj.view_path = path; 809 } 810 return returnObj; 811 }; 812 813 Drupal.Views.pathPortion = function (href) { 814 var protocol = window.location.protocol; 815 if (href.substring(0, protocol.length) === protocol) { 816 href = href.substring(href.indexOf('/', protocol.length + 2)); 817 } 818 return href; 819 }; 820 821 Drupal.Views.getPath = function (href) { 822 href = Drupal.Views.pathPortion(href); 823 href = href.substring(drupalSettings.path.baseUrl.length, href.length); 824 825 if (href.substring(0, 3) === '?q=') { 826 href = href.substring(3, href.length); 827 } 828 var chars = ['#', '?', '&']; 829 for (var i = 0; i < chars.length; i++) { 830 if (href.indexOf(chars[i]) > -1) { 831 href = href.substr(0, href.indexOf(chars[i])); 832 } 833 } 834 return href; 835 }; 836})(jQuery, Drupal, drupalSettings);; 837/** 838* DO NOT EDIT THIS FILE. 839* See the following change record for more information, 840* https://www.drupal.org/node/2815083 841* @preserve 842**/ 843 844(function ($, Drupal, drupalSettings) { 845 Drupal.behaviors.ViewsAjaxView = {}; 846 Drupal.behaviors.ViewsAjaxView.attach = function (context, settings) { 847 if (settings && settings.views && settings.views.ajaxViews) { 848 var ajaxViews = settings.views.ajaxViews; 849 850 Object.keys(ajaxViews || {}).forEach(function (i) { 851 Drupal.views.instances[i] = new Drupal.views.ajaxView(ajaxViews[i]); 852 }); 853 } 854 }; 855 Drupal.behaviors.ViewsAjaxView.detach = function (context, settings, trigger) { 856 if (trigger === 'unload') { 857 if (settings && settings.views && settings.views.ajaxViews) { 858 var ajaxViews = settings.views.ajaxViews; 859 860 Object.keys(ajaxViews || {}
860).forEach(function (i) { 861 var selector = '.js-view-dom-id-' + ajaxViews[i].view_dom_id; 862 if ($(selector, context).length) { 863 delete Drupal.views.instances[i]; 864 delete settings.views.ajaxViews[i]; 865 } 866 }); 867 } 868 } 869 }; 870 871 Drupal.views = {}; 872 873 Drupal.views.instances = {}; 874 875 Drupal.views.ajaxView = function (settings) { 876 var selector = '.js-view-dom-id-' + settings.view_dom_id; 877 this.$view = $(selector); 878 879 var ajaxPath = drupalSettings.views.ajax_path; 880 881 if (ajaxPath.constructor.toString().indexOf('Array') !== -1) { 882 ajaxPath = ajaxPath[0]; 883 } 884 885 var queryString = window.location.search || ''; 886 if (queryString !== '') { 887 queryString = queryString.slice(1).replace(/q=[^&]+&?|&?render=[^&]+/, ''); 888 if (queryString !== '') { 889 queryString = (/\?/.test(ajaxPath) ? '&' : '?') + queryString; 890 } 891 } 892 893 this.element_settings = { 894 url: ajaxPath + queryString, 895 submit: settings, 896 setClick: true, 897 event: 'click', 898 selector: selector, 899 progress: { type: 'fullscreen' } 900 }; 901 902 this.settings = settings; 903 904 this.$exposed_form = $('form#views-exposed-form-' + settings.view_name.replace(/_/g, '-') + '-' + settings.view_display_id.replace(/_/g, '-')); 905 this.$exposed_form.once('exposed-form').each($.proxy(this.attachExposedFormAjax, this)); 906 907 this.$view.filter($.proxy(this.filterNestedViews, this)).once('ajax-pager').each($.proxy(this.attachPagerAjax, this)); 908 909 var selfSettings = $.extend({}, this.element_settings, { 910 event: 'RefreshView', 911 base: this.selector, 912 element: this.$view.get(0) 913 }); 914 this.refreshViewAjax = Drupal.ajax(selfSettings); 915 }; 916 917 Drupal.views.ajaxView.prototype.attachExposedFormAjax = function () { 918 var that = this; 919 this.exposedFormAjax = []; 920 921 $('input[type=submit], input[type=image]', this.$exposed_form).not('[data-drupal-selector=edit-reset]').each(function (index) { 922 var selfSettings = $.extend({}, that.element_settings, { 923 base: $(this).attr('id'), 924 element: this 925 }); 926 that.exposedFormAjax[index] = Drupal.ajax(selfSettings); 927 }); 928 }; 929 930 Drupal.views.ajaxView.prototype.filterNestedViews = function () { 931 return !this.$view.parents('.view').length; 932 }; 933 934 Drupal.views.ajaxView.prototype.attachPagerAjax = function () { 935 this.$view.find('ul.js-pager__items > li > a, th.views-field a, .attachment .views-summary a').each($.proxy(this.attachPagerLinkAjax, this)); 936 }; 937 938 Drupal.views.ajaxView.prototype.attachPagerLinkAjax = function (id, link) { 939 var $link = $(link); 940 var viewData = {}; 941 var href = $link.attr('href'); 942 943 $.extend(viewData, this.settings, Drupal.Views.parseQueryString(href), Drupal.Views.parseViewArgs(href, this.settings.view_base_path)); 944 945 var selfSettings = $.extend({}, this.element_settings, {
946 submit: viewData, 947 base: false, 948 element: link 949 }); 950 this.pagerAjax = Drupal.ajax(selfSettings); 951 }; 952 953 Drupal.AjaxCommands.prototype.viewsScrollTop = function (ajax, response) { 954 var offset = $(response.selector).offset(); 955 956 var scrollTarget = response.selector; 957 while ($(scrollTarget).scrollTop() === 0 && $(scrollTarget).parent()) { 958 scrollTarget = $(scrollTarget).parent(); 959 } 960 961 if (offset.top - 10 < $(scrollTarget).scrollTop()) { 962 $(scrollTarget).animate({ scrollTop: offset.top - 10 }, 500); 963 } 964 }; 965})(jQuery, Drupal, drupalSettings);; 966window.matchMedia||(window.matchMedia=function(){"use strict";var e=window.styleMedia||window.media;if(!e){var t=document.createElement("style"),i=document.getElementsByTagName("script")[0],n=null;t.type="text/css";t.id="matchmediajs-test";i.parentNode.insertBefore(t,i);n="getComputedStyle"in window&&window.getComputedStyle(t,null)||t.currentStyle;e={matchMedium:function(e){var i="@media "+e+"{ #matchmediajs-test { width: 1px; } }";if(t.styleSheet){t.styleSheet.cssText=i}else{t.textContent=i}return n.width==="1px"}}}return function(t){return{matches:e.matchMedium(t||"all"),media:t||"all"}}}()); 967; 968/** 969* DO NOT EDIT THIS FILE. 970* See the following change record for more information, 971* https://www.drupal.org/node/2815083 972* @preserve 973**/ 974 975Drupal.debounce = function (func, wait, immediate) { 976 var timeout = void 0; 977 var result = void 0; 978 return function () { 979 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { 980 args[_key] = arguments[_key]; 981 } 982 983 var context = this; 984 var later = function later() { 985 timeout = null; 986 if (!immediate) { 987 result = func.apply(context, args); 988 } 989 }; 990 var callNow = immediate && !timeout; 991 clearTimeout(timeout); 992 timeout = setTimeout(later, wait); 993 if (callNow) { 994 result = func.apply(context, args); 995 } 996 return result; 997 }; 998};; 999(function ($, Drupal, debounce) { 1000 "use strict"; 1001 1002 // Cached reference to $(window). 1003 var $window = $(window); 1004 1005 // The threshold for how far to the bottom you should reach before reloading. 1006 var scrollThreshold = 200; 1007 1008 // The selector for the automatic pager. 1009 var automaticPagerSelector = '[data-drupal-views-infinite-scroll-pager="automatic"]'; 1010 1011 // The selector for both manual load and automatic pager. 1012 var pagerSelector = '[data-drupal-views-infinite-scroll-pager]'; 1013 1014 // The selector for the automatic pager. 1015 var contentWrapperSelector = '[data-drupal-views-infinite-scroll-content-wrapper]'; 1016 1017 // The event and namespace that is bound to window for automatic scrolling. 1018 var scrollEvent = 'scroll.views_infinite_scroll'; 1019 1020 /** 1021 * Insert a views infinite scroll view into the document. 1022 * 1023 * @param {jQuery} $newView 1024 * New content detached from the DOM. 1025 */ 1026 $.fn.infiniteScrollInsertView = function ($newView) { 1027 // Extract the view DOM ID from the view classes. 1028 var matches = /(js-view-dom-id-\w+)/.exec(this.attr('class')); 1029 var currentViewId = matches[1].replace('js-view-dom-id-', 'views_dom_id:'); 1030 1031 // Get the existing ajaxViews object. 1032 var view = Drupal.views.instances[currentViewId]; 1033 // Remove once so that the exposed form and pager are processed on 1034 // behavior attach. 1035 view.$view.removeOnce('ajax-pager'); 1036 view.$exposed_form.removeOnce('exposed-form'); 1037 // Make sure infinite scroll can be reinitialized. 1038 var $existingPager = view.$view.find(pagerSelector); 1039 $existingPager.removeOnce('infinite-scroll'); 1040 1041 var $newRows = $newView.find(contentWrapperSelector).children(); 1042 var $newPager = $newView.find('.js-pager__items'); 1043 1044 // Add the new rows to existing view. 1045 view.$view.find(contentWrapperSelector).append($newRows); 1046 // Replace the pager link with the new link and ajaxPageState values. 1047 $existingPager.replaceWith($newPager); 1048 1049 // Run views and VIS behaviors. 1050 Drupal.attachBehaviors(view.$view[0]); 1051 }; 1052 1053 /** 1054 * Handle the automatic paging based on the scroll amount. 1055 * 1056 * @type {Drupal~behavior} 1057 * 1058 * @prop {Drupal~behaviorAttach} attach 1059 * Initialize infinite scroll pagers and bind the scroll event. 1060 * @prop {Drupal~behaviorDetach} detach 1061 * During `unload` remove the scroll event binding. 1062 */ 1063 Drupal.behaviors.views_infinite_scroll_automatic = { 1064 attach : function(context, settings) { 1065 $(context).find(automaticPagerSelector).once('infinite-scroll').each(function() { 1066 var $pager = $(this); 1067 $pager.addClass('visually-hidden'); 1068 $window.on(scrollEvent, debounce(function() { 1069 if (window.innerHeight + window.pageYOffset > $pager.offset().top - scrollThreshold) { 1070 $pager.find('[rel=next]').click(); 1071 $window.off(scrollEvent); 1072 } 1073 }, 200)); 1074 }); 1075 }, 1076 detach: function (context, settings, trigger) { 1077 // In the case where the view is removed from the document, remove it's 1078 // events. This is important in the case a view being refreshed for a reason 1079 // other than a scroll. AJAX filters are a good example of the event needing 1080 // to be destroyed earlier than above. 1081 if (trigger === 'unload') { 1082 if ($(context).find(automaticPagerSelector).removeOnce('infinite-scroll').length) { 1083 $window.off(scrollEvent); 1084 } 1085 } 1086 } 1087 }; 1088 1089})(jQuery, Drupal, Drupal.debounce); 1090;
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.