1(() => { 2 const SURVEY = { 3 token: 'tt-ZYdB-b3ddxy', 4 account: 'nphoto.surveysparrow.com', 5 name: 'pixbook---ankieta-szablony', 6 }; 7 8 const TTL_180_DAYS_MS = 180 * 24 * 60 * 60 * 1000; 9 10 function now() { 11 return Date.now(); 12 } 13 14 function safeJsonParse(value) { 15 try { 16 return JSON.parse(value); 17 } catch (e) { 18 return null; 19 } 20 } 21 22 function getCookie(name) { 23 const parts = (`; ${document.cookie}`).split(`; ${name}=`); 24 if (parts.length !== 2) return null; 25 return parts.pop().split(';').shift() || null; 26 } 27 28 function getGaClientId() { 29 // _ga=GA1.2.123456789.123456789 -> "123456789.123456789" 30 const ga = getCookie('_ga'); 31 if (!ga) return null; 32 const m = ga.match(/^GA\d\.\d\.(\d+\.\d+)$/); 33 return m ? m[1] : null; 34 } 35 36 function getOrCreateAnonClientId() { 37 const key = 'ss_pixbook_anonClientId'; 38 const existing = localStorage.getItem(key); 39 if (existing) return existing; 40 41 const id = (typeof crypto !== 'undefined' && crypto.randomUUID) 42 ? crypto.randomUUID() 43 : `anon_${Math.random().toString(16).slice(2)}_${now().toString(16)}`; 44 localStorage.setItem(key, id); 45 return id; 46 } 47 48 function productFromPath(pathname) { 49 const parts = (pathname || '').split('?')[0].split('#')[0].split('/').filter(Boolean); 50 const first = parts[0] || null; 51 const second = parts[1] || null; 52 if (!first) return null; 53 54 // If fotokalendarz has a format in URL (e.g. /fotokalendarz/a3), pass combined product. 55 if (first === 'fotokalendarz' && second) { 56 const looksLikeFormat = /^(a\d+|b\d+|\d{2}x\d{2})$/i.test(second); 57 if (looksLikeFormat) return `${first}-${second.toLowerCase()}`; 58 } 59 60 return first.toLowerCase(); 61 } 62 63 function ttlKeyCompleted(product) { 64 return `ss_pixbook_completed_${product}`; 65 } 66 67 function ttlKeyTemplates(product) { 68 return `ss_pixbook_seenTemplates_${product}`; 69 } 70 71 function ttlGetBool(key) { 72 const raw = localStorage.getItem(key); 73 if (!raw) return false; 74 const obj = safeJsonParse(raw); 75 if (!obj || typeof obj !== 'object') return false; 76 if (obj.exp && typeof obj.exp === 'number' && obj.exp < now()) { 77 localStorage.removeItem(key); 78 return false; 79 } 80 return !!obj.v; 81 } 82 83 function ttlSetBool(key, value, ttlMs) { 84 const payload = { v: !!value, exp: now() + ttlMs }; 85 localStorage.setItem(key, JSON.stringify(payload)); 86 } 87 88 function getSeenTemplates(product) { 89 const raw = localStorage.getItem(ttlKeyTemplates(product)); 90 if (!raw) return { items: [], exp: now() + TTL_180_DAYS_MS }; 91 const obj = safeJsonParse(raw); 92 if (!obj || typeof obj !== 'object' || !Array.isArray(obj.items)) { 93 return { items: [], exp: now() + TTL_180_DAYS_MS }; 94 } 95 if (obj.exp && typeof obj.exp === 'number' && obj.exp < now()) { 96 localStorage.removeItem(ttlKeyTemplates(product)); 97 return { items: [], exp: now() + TTL_180_DAYS_MS }; 98 } 99 return obj; 100 } 101 102 function addSeenTemplate(product, templateId) { 103 if (!product || !templateId) return { count: 0, isNew: false }; 104 const obj = getSeenTemplates(product); 105 const items = Array.from(new Set(obj.items.concat([templateId]))).slice(0, 100); 106 const isNew = items.length !== obj.items.length; 107 localStorage.setItem(ttlKeyTemplates(product), JSON.stringify({ items, exp: now() + TTL_180_DAYS_MS })); 108 return { count: items.length, isNew }; 109 } 110 111 function isProductPath(pathname) { 112 const product = productFromPath(pathname); 113 if (!product) return false; 114 return [ 115 'fotoksiazka', 116 'fotoksiazka-lux', 117 'fotoalbum', 118 'fotoobraz', 119 'fotokalendarz', 120 'fotokalendarz-a3', 121 'fotokalendarz-a4', 122 'fotokalendarz-b1', 123 'fotokalendarz-b2', 124 ].includes(product) || ['fotoksiazka', 'fotoksiazka-lux', 'fotoalbum', 'fotoobraz', 'fotokalendarz'].includes(product.split('-')[0]); 125 } 126 127 function getTemplateIdFromUrl(url) { 128 try { 129 const u = new URL(url, window.location.origin); 130 // Use path as a stable-ish identifier. 131 return u.pathname.toLowerCase(); 132 } catch (e) { 133 return null; 134 } 135 } 136 137 function shouldAttemptLaunch(product) { 138 if (!product) return false;
139 if (!isProductPath(window.location.pathname)) return false; 140 141 const completed = ttlGetBool(ttlKeyCompleted(product)); 142 if (completed) return false; 143 144 return true; 145 } 146 147 function ensureWidgetContainer() { 148 let el = document.getElementById('ss_survey_widget'); 149 if (el) return el; 150 el = document.createElement('div'); 151 el.id = 'ss_survey_widget'; 152 document.body.appendChild(el); 153 return el; 154 } 155 156 function sparrowLaunch(opts) { 157 const scriptId = 'ss-widget'; 158 const tag = 'script'; 159 const a = document; 160 const r = window; 161 const l = window.localStorage; 162 163 r.SS_WIDGET_TOKEN = SURVEY.token; 164 r.SS_ACCOUNT = SURVEY.account; 165 r.SS_SURVEY_NAME = SURVEY.name; 166 167 if (a.getElementById(scriptId)) return; 168 169 // SurveySparrow stores a "removed" flag when user closes the widget. 170 // For our use case (frequency cap only after completion), we allow 171 // re-launching once conditions are met by clearing this flag. 172 const removedKey = `removed-ss-widget-${SURVEY.token}`; 173 if (l.getItem(removedKey)) { 174 l.removeItem(removedKey); 175 } 176 177 const S = function () { S.update(arguments); }; 178 S.args = []; 179 S.update = function (args) { S.args.push(args); }; 180 r.SparrowLauncher = S; 181 182 const scripts = a.getElementsByTagName(tag); 183 const last = scripts[scripts.length - 1]; 184 const n = a.createElement(tag); 185 n.type = 'text/javascript'; 186 n.async = true; 187 n.id = scriptId; 188 n.src = [ 189 'https://', 190 SURVEY.account, 191 '/widget/', 192 SURVEY.token, 193 '?customParams=', 194 // Encode to ensure a valid script URL (some browsers/extensions can choke 195 // on raw JSON characters in querystring). 196 encodeURIComponent(JSON.stringify(opts || {})), 197 ].join(''); 198 199 last.parentNode.insertBefore(n, last); 200 r.SS_VARIABLES = opts || {}; 201 } 202 203 function bindCompletionListener(product) { 204 function toObject(payload) { 205 if (!payload) return null; 206 if (typeof payload === 'object') return payload; 207 if (typeof payload === 'string') { 208 const parsed = safeJsonParse(payload); 209 return parsed && typeof parsed === 'object' ? parsed : null; 210 } 211 return null; 212 } 213 214 function hasCompletedMarker(value) { 215 if (typeof value !== 'string') return false; 216 const v = value.toLowerCase(); 217 return [ 218 'surveycompleted', 219 'survey_completed', 220 'survey-completed', 221 'survey:completed', 222 'survey_submitted', 223 'survey-submitted', 224 'survey:submitted', 225 'submitted', 226 'completed', 227 'thankyou', 228 'thank_you', 229 'thank-you', 230 ].some((marker) => v.indexOf(marker) !== -1); 231 } 232 233 function isFromSurveySparrowOrigin(origin) { 234 if (!origin || typeof origin !== 'string') return false; 235 return origin.indexOf('surveysparrow.com') !== -1; 236 } 237 238 function isCompletionMessage(event) { 239 const data = toObject(event && event.data ? event.data : null); 240 if (!data) return false; 241 242 // Accept explicit completion markers from message metadata. 243 const keysToCheck = ['type', 'event', 'name', 'action', 'status', 'state']; 244 for (let i = 0; i < keysToCheck.length; i++) { 245 const key = keysToCheck[i]; 246 if (hasCompletedMarker(data[key])) return true; 247 } 248 249 // Some integrations nest payload under "data"/"detail"/"payload". 250 const nestedCandidates = [data.data, data.detail, data.payload]; 251 for (let i = 0; i < nestedCandidates.length; i++) { 252 const nested = toObject(nestedCandidates[i]); 253 if (!nested) continue; 254 for (let j = 0; j < keysToCheck.length; j++) { 255 const key = keysToCheck[j]; 256 if (hasCompletedMarker(nested[key])) return true; 257 } 258 } 259 260 // Conservative fallback: 261 // only trust generic "submitted/completed" when the origin is SurveySparrow. 262 if (isFromSurveySparrowOrigin(event && event.origin ? event.origin : '')) { 263 const text = JSON.stringify(data).toLowerCase(); 264 if (text.indexOf('submitted') !== -1 || text.indexOf('completed') !== -1) { 265 return true; 266 } 267 } 268 269 return false;
270 } 271 272 const handler = (e) => { 273 if (!isCompletionMessage(e)) return; 274 275 ttlSetBool(ttlKeyCompleted(product), true, TTL_180_DAYS_MS); 276 window.removeEventListener('message', handler); 277 }; 278 279 window.addEventListener('message', handler); 280 } 281 282 function launchSurveyIfReady(reason) { 283 const product = productFromPath(window.location.pathname); 284 if (!product) return; 285 if (!shouldAttemptLaunch(product)) return; 286 287 const seen = getSeenTemplates(product); 288 if (!seen.items || seen.items.length < 3) return; 289 290 ensureWidgetContainer(); 291 292 const completed = ttlGetBool(ttlKeyCompleted(product)); 293 const clientId = getGaClientId() || getOrCreateAnonClientId(); 294 const clientProductKey = `${clientId}_${product}`; 295 296 bindCompletionListener(product); 297 sparrowLaunch({ 298 product, 299 userCompletedSurvey: completed, 300 clientId, 301 clientProductKey, 302 triggerReason: reason, 303 }); 304 } 305 306 function recordCurrentTemplateAndMaybeLaunch() { 307 const product = productFromPath(window.location.pathname); 308 if (!product) return; 309 if (!isProductPath(window.location.pathname)) return; 310 311 const parts = window.location.pathname.split('/').filter(Boolean); 312 // Treat deeper paths as "template pages" (e.g. /fotoksiazka/szkolne/nazwa-szablonu). 313 const isLikelyTemplatePage = parts.length >= 2; 314 if (!isLikelyTemplatePage) return; 315 316 const templateId = getTemplateIdFromUrl(window.location.href); 317 addSeenTemplate(product, templateId); 318 319 // Give the page a moment to settle before showing. 320 setTimeout(() => launchSurveyIfReady('pageview'), 1200); 321 } 322 323 function bindTemplateClickRecorder() { 324 document.addEventListener('click', (e) => { 325 const target = e.target && e.target.closest ? e.target.closest('a') : null; 326 if (!target) return; 327 const href = target.getAttribute('href') || ''; 328 if (!href) return; 329 330 // Only count clicks inside templates listing wrapper if present. 331 const inTemplates = !!(target.closest && target.closest('.templates')); 332 if (!inTemplates) return; 333 334 const product = productFromPath(window.location.pathname); 335 if (!product) return; 336 337 const templateId = getTemplateIdFromUrl(href); 338 const { count, isNew } = addSeenTemplate(product, templateId); 339 if (isNew && count >= 3) { 340 // If this click doesn't navigate (e.g. opens modal), try launching. 341 setTimeout(() => launchSurveyIfReady('click'), 300); 342 } 343 }, true); 344 } 345 346 function init() { 347 if (typeof window === 'undefined' || typeof document === 'undefined') return; 348 if (!window.localStorage) return; 349 350 bindTemplateClickRecorder(); 351 352 if (document.readyState === 'loading') { 353 document.addEventListener('DOMContentLoaded', recordCurrentTemplateAndMaybeLaunch); 354 } else { 355 recordCurrentTemplateAndMaybeLaunch(); 356 } 357 } 358 359 init(); 360})(); 361 362; 363/*! 364 * jQuery Form Plugin 365 * version: 3.51.0-2014.06.20 366 * Requires jQuery v1.5 or later 367 * Copyright (c) 2014 M. Alsup 368 * Examples and documentation at: http://malsup.com/jquery/form/ 369 * Project repository: https://github.com/malsup/form 370 * Dual licensed under the MIT and GPL licenses. 371 * https://github.com/malsup/form#copyright-and-license 372 */ 373!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):e("undefined"!=typeof jQuery?jQuery:window.Zepto)}(function(e){"use strict";function t(t){var r=t.data;t.isDefaultPrevented()||(t.preventDefault(),e(t.target).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=this;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={};n.fileapi=void 0!==e("<input type='file'/>").get(0).files,n.formdata=void 0!==window.FormData;var i=!!e.fn.prop;e.fn.attr2=function(){if(!i)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){function r(r){var a,n,i=e.param(r,t.traditional).split("&"),o=i.length,s=[];for(a=0;o>a;a++)i[a]=i[a].replace(/\+/g," "),n=i[a].split("="),s.push([decodeURIComponent(n[0]),decodeURIComponent(n[1])]);return s}function o(a){for(var n=new FormData,i=0;i<a.length;i++)n.append(a[i].name,a[i].value);if(t.extraData){var o=r(t.extraData);for(i=0;i<o.length;i++)o[i]&&n.append(o[i][0],o[i][1])}t.data=null;var s=e.extend(!0,{},e.ajaxSettings,t,{contentType:!1,processData:!1,cache:!1,type:u||"POST"});t.uploadProgress&&(s.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}),s.data=null;var c=s.beforeSend;return s.beforeSend=function(e,r){r.data=t.formData?t.formData:n,c&&c.call(this,e,r)},e.ajax(s)}function s(r){function n(e){var t=null;try{e.contentWindow&&(t=e.contentWindow.document)}catch(r){a("cannot get iframe.contentWindow document: "+r)}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 o(){function t(){try{var e=n(g).readyState;a("state = "+e),e&&"uninitialized"==e.toLowerCase()&&setTimeout(t,50)}catch(r){a("Server abort: ",r," (",r.name,")"),s(k),j&&clearTimeout(j),j=void 0}}
373var r=f.attr2("target"),i=f.attr2("action"),o="multipart/form-data",c=f.attr("enctype")||f.attr("encoding")||o;w.setAttribute("target",p),(!u||/post/i.test(u))&&w.setAttribute("method","POST"),i!=m.url&&w.setAttribute("action",m.url),m.skipEncodingOverride||u&&!/post/i.test(u)||f.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"}),m.timeout&&(j=setTimeout(function(){T=!0,s(D)},m.timeout));var l=[];try{if(m.extraData)for(var d in m.extraData)m.extraData.hasOwnProperty(d)&&l.push(e.isPlainObject(m.extraData[d])&&m.extraData[d].hasOwnProperty("name")&&m.extraData[d].hasOwnProperty("value")?e('<input type="hidden" name="'+m.extraData[d].name+'">').val(m.extraData[d].value).appendTo(w)[0]:e('<input type="hidden" name="'+d+'">').val(m.extraData[d]).appendTo(w)[0]);m.iframeTarget||v.appendTo("body"),g.attachEvent?g.attachEvent("onload",s):g.addEventListener("load",s,!1),setTimeout(t,15);try{w.submit()}catch(h){var x=document.createElement("form").submit;x.apply(w)}}finally{w.setAttribute("action",i),w.setAttribute("enctype",c),r?w.setAttribute("target",r):f.removeAttr("target"),e(l).remove()}}function s(t){if(!x.aborted&&!F){if(M=n(g),M||(a("cannot access response document"),t=k),t===D&&x)return x.abort("timeout"),void S.reject(x,"timeout");if(t==k&&x)return x.abort("server abort"),void S.reject(x,"error","server abort");if(M&&M.location.href!=m.iframeSrc||T){g.detachEvent?g.detachEvent("onload",s):g.removeEventListener("load",s,!1);var r,i="success";try{if(T)throw"timeout";var o="xml"==m.dataType||M.XMLDocument||e.isXMLDoc(M);if(a("isXml="+o),!o&&window.opera&&(null===M.body||!M.body.innerHTML)&&--O)return a("requeing onLoad callback, DOM not available"),void setTimeout(s,250);var u=M.body?M.body:M.documentElement;x.responseText=u?u.innerHTML:null,x.responseXML=M.XMLDocument?M.XMLDocument:M,o&&(m.dataType="xml"),x.getResponseHeader=function(e){var t={"content-type":m.dataType};return t[e.toLowerCase()]},u&&(x.status=Number(u.getAttribute("status"))||x.status,x.statusText=u.getAttribute("statusText")||x.statusText);var c=(m.dataType||"").toLowerCase(),l=/(json|script|text)/.test(c);if(l||m.textarea){var f=M.getElementsByTagName("textarea")[0];if(f)x.responseText=f.value,x.status=Number(f.getAttribute("status"))||x.status,x.statusText=f.getAttribute("statusText")||x.statusText;else if(l){var p=M.getElementsByTagName("pre")[0],h=M.getElementsByTagName("body")[0];p?x.responseText=p.textContent?p.textContent:p.innerText:h&&(x.responseText=h.textContent?h.textContent:h.innerText)}}else"xml"==c&&!x.responseXML&&x.responseText&&(x.responseXML=X(x.responseText));try{E=_(x,c,m)}catch(y){i="parsererror",x.error=r=y||i}}catch(y){a("error caught: ",y),i="error",x.error=r=y||i}x.aborted&&(a("upload aborted"),i=null),x.status&&(i=x.status>=200&&x.status<300||304===x.status?"success":"error"),"success"===i?(m.success&&m.success.call(m.context,E,"success",x),S.resolve(x.responseText,"success",x),d&&e.event.trigger("ajaxSuccess",[x,m])):i&&(void 0===r&&(r=x.statusText),m.error&&m.error.call(m.context,x,i,r),S.reject(x,"error",r),d&&e.event.trigger("ajaxError",[x,m,r])),d&&e.event.trigger("ajaxComplete",[x,m]),d&&!--e.active&&e.event.trigger("ajaxStop"),m.complete&&m.complete.call(m.context,x,i),F=!0,m.timeout&&clearTimeout(j),setTimeout(function(){m.iframeTarget?v.attr("src",m.iframeSrc):v.remove(),x.responseXML=null},100)}}}var c,l,m,d,p,v,g,x,y,b,T,j,w=f[0],S=e.Deferred();if(S.abort=function(e){x.abort(e)},r)for(l=0;l<h.length;l++)c=e(h[l]),i?c.prop("disabled",!1):c.removeAttr("disabled");if(m=e.extend(!0,{},e.ajaxSettings,t),m.context=m.context||m,p="jqFormIO"+(new Date).getTime(),m.iframeTarget?(v=e(m.iframeTarget),b=v.attr2("name"),b?p=b:v.attr2("name",p)):(v=e('<iframe name="'+p+'" src="'+m.iframeSrc+'" />'),v.css({position:"absolute",top:"-1000px",left:"-1000px"})),g=v[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{g.contentWindow.document.execCommand&&g.contentWindow.document.execCommand("Stop")}catch(n){}v.attr("src",m.iframeSrc),x.error=r,m.error&&m.error.call(m.context,x,r,t),d&&e.event.trigger("ajaxError",[x,m,r]),m.complete&&m.complete.call(m.context,x,r)}},d=m.global,d&&0===e.active++&&e.event.trigger("ajaxStart"),d&&e.event.trigger("ajaxSend",[x,m]),m.beforeSend&&m.beforeSend.c
373all(m.context,x,m)===!1)return m.global&&e.active--,S.reject(),S;if(x.aborted)return S.reject(),S;y=w.clk,y&&(b=y.name,b&&!y.disabled&&(m.extraData=m.extraData||{},m.extraData[b]=y.value,"image"==y.type&&(m.extraData[b+".x"]=w.clk_x,m.extraData[b+".y"]=w.clk_y)));var D=1,k=2,A=e("meta[name=csrf-token]").attr("content"),L=e("meta[name=csrf-param]").attr("content");L&&A&&(m.extraData=m.extraData||{},m.extraData[L]=A),m.forceSync?o():setTimeout(o,10);var E,M,F,O=50,X=e.parseXML||function(e,t){return window.ActiveXObject?(t=new ActiveXObject("Microsoft.XMLDOM"),t.async="false",t.loadXML(e)):t=(new DOMParser).parseFromString(e,"text/xml"),t&&t.documentElement&&"parsererror"!=t.documentElement.nodeName?t:null},C=e.parseJSON||function(e){return window.eval("("+e+")")},_=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&&(o=a.dataFilter(o,r)),"string"==typeof o&&("json"===r||!r&&n.indexOf("json")>=0?o=C(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 u,c,l,f=this;"function"==typeof t?t={success:t}:void 0===t&&(t={}),u=t.type||this.attr2("method"),c=t.url||this.attr2("action"),l="string"==typeof c?e.trim(c):"",l=l||window.location.href||"",l&&(l=(l.match(/^([^#]+)/)||[])[1]),t=e.extend(!0,{url:l,success:e.ajaxSettings.success,type:u||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&&t.beforeSerialize(this,t)===!1)return a("ajaxSubmit: submit aborted via beforeSerialize callback"),this;var d=t.traditional;void 0===d&&(d=e.ajaxSettings.traditional);var p,h=[],v=this.formToArray(t.semantic,h);if(t.data&&(t.extraData=t.data,p=e.param(t.data,d)),t.beforeSubmit&&t.beforeSubmit(v,this,t)===!1)return a("ajaxSubmit: submit aborted via beforeSubmit callback"),this;if(this.trigger("form-submit-validate",[v,this,t,m]),m.veto)return a("ajaxSubmit: submit vetoed via form-submit-validate trigger"),this;var g=e.param(v,d);p&&(g=g?g+"&"+p:p),"GET"==t.type.toUpperCase()?(t.url+=(t.url.indexOf("?")>=0?"&":"?")+g,t.data=null):t.data=g;var x=[];if(t.resetForm&&x.push(function(){f.resetForm()}),t.clearForm&&x.push(function(){f.clearForm(t.includeHidden)}),!t.dataType&&t.target){var y=t.success||function(){};x.push(function(r){var a=t.replaceTarget?"replaceWith":"html";e(t.target)[a](r).each(y,arguments)})}else t.success&&x.push(t.success);if(t.success=function(e,r,a){for(var n=t.context||this,i=0,o=x.length;o>i;i++)x[i].apply(n,[e,r,a||f,f])},t.error){var b=t.error;t.error=function(e,r,a){var n=t.context||this;b.apply(n,[e,r,a,f])}}if(t.complete){var T=t.complete;t.complete=function(e,r){var a=t.context||this;T.apply(a,[e,r,f])}}var j=e("input[type=file]:enabled",this).filter(function(){return""!==e(this).val()}),w=j.length>0,S="multipart/form-data",D=f.attr("enctype")==S||f.attr("encoding")==S,k=n.fileapi&&n.formdata;a("fileAPI :"+k);var A,L=(w||D)&&!k;t.iframe!==!1&&(t.iframe||L)?t.closeKeepAlive?e.get(t.closeKeepAlive,function(){A=s(v)}):A=s(v):A=(w||D)&&k?o(v):e.ajax(t),f.removeData("jqxhr").data("jqxhr",A);for(var E=0;E<h.length;E++)h[E]=null;return this.trigger("form-submit-notify",[this,t]),this},e.fn.ajaxForm=function(n){if(n=n||{},n.delegation=n.delegation&&e.isFunction(e.fn.on),!n.delegation&&0===this.length){var i={s:this.selector,c:this.context};return!e.isReady&&i.s?(a("DOM not ready, queuing ajaxForm"),e(function(){e(i.s,i.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().bind("submit.form-plugin",n,t).bind("click.form-plugin",n,r)},e.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin")},e.fn.formToArray=function(t,r){var a=[];if(0===this.length)return a;var i,o=this[0],s=this.attr("id"),u=t?o.getElementsByTagName("*"):o.elements;if(u&&!/MSIE [678]/.test(navigator.userAgent)&&(u=e(u).get()),s&&(i=e(':input[form="'+s+'"]').get(),i.length&&(u=(u||[]).concat(i))),!u||!u.length)return a;var c,l,f,m,d,p,h;for(c=0,p=u.length;p>c;c++)if(d=u[c],f=d.name,f&&!d.disabled)if(t&&o.clk&&"image"==d.type)o.clk==d&&(a.push({name:f,value:e(d).val(),type:d.type}),a.push({name:f+".x",value:o.clk_x},{name:f+".y",value:o.clk_y}));else if(m=e.fieldValue(d,!0),m&&m.constructor==Array)for(r&&r.push(d),l=0,h=m.length;h>l;l++)a.push({name:f,value:m[l]});else if(n.fileapi&&"file"==d.type){r&&r.push(d);var v=d.files;if(v.length)for(l=0;l<v.length;l++)a.push({name:f,value:v[l],type:d.type});else a.push({name:f,value:"",type:d.type})}else null!==m&&"undefined"!=typeof m&&(r&&r.push(d),a.push({name:f,value:m,type:d.type,required:d.required}));if(!t&&o.clk){var g=e(o.clk),x=g[0];f=x.name,f&&!x.disabled&&"image"==x.type&&(a.push({name:f,value:g.val()}),a.push({name:f+".x",value:o.clk_x},{name:f+".y",value:o.clk_y}))}return a}
373,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;o>i;i++)r.push({name:a,value:n[i]});else null!==n&&"undefined"!=typeof n&&r.push({name:this.name,value:n})}}),e.param(r)},e.fn.fieldValue=function(t){for(var r=[],a=0,n=this.length;n>a;a++){var i=this[a],o=e.fieldValue(i,t);null===o||"undefined"==typeof 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,n=t.type,i=t.tagName.toLowerCase();if(void 0===r&&(r=!0),r&&(!a||t.disabled||"reset"==n||"button"==n||("checkbox"==n||"radio"==n)&&!t.checked||("submit"==n||"image"==n)&&t.form&&t.form.clk!=t||"select"==i&&-1==t.selectedIndex))return null;if("select"==i){var o=t.selectedIndex;if(0>o)return null;for(var s=[],u=t.options,c="select-one"==n,l=c?o+1:u.length,f=c?o:0;l>f;f++){var m=u[f];if(m.selected){var d=m.value;if(d||(d=m.attributes&&m.attributes.value&&!m.attributes.value.specified?m.text:m.value),c)return d;s.push(d)}}return s}return e(t).val()},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&&(t===!0&&/hidden/.test(a)||"string"==typeof t&&e(this).is(t))&&(this.value="")})},e.fn.resetForm=function(){return this.each(function(){("function"==typeof this.reset||"object"==typeof this.reset&&!this.reset.nodeType)&&this.reset()})},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}); 374; 375/** 376* DO NOT EDIT THIS FILE. 377* See the following change record for more information, 378* https://www.drupal.org/node/2815083 379* @preserve 380**/ 381 382(function ($, Drupal) { 383 Drupal.theme.progressBar = function (id) { 384 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>'; 385 }; 386 387 Drupal.ProgressBar = function (id, updateCallback, method, errorCallback) { 388 this.id = id; 389 this.method = method || 'GET'; 390 this.updateCallback = updateCallback; 391 this.errorCallback = errorCallback; 392 393 this.element = $(Drupal.theme('progressBar', id)); 394 }; 395 396 $.extend(Drupal.ProgressBar.prototype, { 397 setProgress: function setProgress(percentage, message, label) { 398 if (percentage >= 0 && percentage <= 100) { 399 $(this.element).find('div.progress__bar').css('width', percentage + '%'); 400 $(this.element).find('div.progress__percentage').html(percentage + '%'); 401 } 402 $('div.progress__description', this.element).html(message); 403 $('div.progress__label', this.element).html(label); 404 if (this.updateCallback) { 405 this.updateCallback(percentage, message, this); 406 } 407 }, 408 startMonitoring: function startMonitoring(uri, delay) { 409 this.delay = delay; 410 this.uri = uri; 411 this.sendPing(); 412 }, 413 stopMonitoring: function stopMonitoring() { 414 clearTimeout(this.timer); 415 416 this.uri = null; 417 }, 418 sendPing: function sendPing() { 419 if (this.timer) { 420 clearTimeout(this.timer); 421 } 422 if (this.uri) { 423 var pb = this; 424 425 var uri = this.uri; 426 if (uri.indexOf('?') === -1) { 427 uri += '?'; 428 } else { 429 uri += '&'; 430 } 431 uri += '_format=json'; 432 $.ajax({ 433 type: this.method,
434 url: uri, 435 data: '', 436 dataType: 'json', 437 success: function success(progress) { 438 if (progress.status === 0) { 439 pb.displayError(progress.data); 440 return; 441 } 442 443 pb.setProgress(progress.percentage, progress.message, progress.label); 444 445 pb.timer = setTimeout(function () { 446 pb.sendPing(); 447 }, pb.delay); 448 }, 449 error: function error(xmlhttp) { 450 var e = new Drupal.AjaxError(xmlhttp, pb.uri); 451 pb.displayError('<pre>' + e.message + '</pre>'); 452 } 453 }); 454 } 455 }, 456 displayError: function displayError(string) { 457 var error = $('<div class="messages messages--error"></div>').html(string); 458 $(this.element).before(error).hide(); 459 460 if (this.errorCallback) { 461 this.errorCallback(this); 462 } 463 } 464 }); 465})(jQuery, Drupal);; 466/** 467* DO NOT EDIT THIS FILE. 468* See the following change record for more information, 469* https://www.drupal.org/node/2815083 470* @preserve 471**/ 472function _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); } } 473 474(function ($, window, Drupal, drupalSettings) { 475 Drupal.behaviors.AJAX = { 476 attach: function attach(context, settings) { 477 function loadAjaxBehavior(base) { 478 var elementSettings = settings.ajax[base]; 479 if (typeof elementSettings.selector === 'undefined') { 480 elementSettings.selector = '#' + base; 481 } 482 $(elementSettings.selector).once('drupal-ajax').each(function () { 483 elementSettings.element = this; 484 elementSettings.base = base; 485 Drupal.ajax(elementSettings); 486 }); 487 } 488 489 Object.keys(settings.ajax || {}).forEach(function (base) { 490 return loadAjaxBehavior(base); 491 }); 492 493 Drupal.ajax.bindAjaxLinks(document.body); 494 495 $('.use-ajax-submit').once('ajax').each(function () { 496 var elementSettings = {}; 497 498 elementSettings.url = $(this.form).attr('action'); 499 500 elementSettings.setClick = true; 501 502 elementSettings.event = 'click'; 503 504 elementSettings.progress = { type: 'throbber' }; 505 elementSettings.base = $(this).attr('id'); 506 elementSettings.element = this; 507 508 Drupal.ajax(elementSettings); 509 }); 510 }, 511 detach: function detach(context, settings, trigger) { 512 if (trigger === 'unload') { 513 Drupal.ajax.expired().forEach(function (instance) { 514 Drupal.ajax.instances[instance.instanceIndex] = null; 515 }); 516 } 517 } 518 }; 519 520 Drupal.AjaxError = function (xmlhttp, uri, customMessage) { 521 var statusCode = void 0; 522 var statusText = void 0; 523 var responseText = void 0; 524 if (xmlhttp.status) { 525 statusCode = '\n' + Drupal.t('An AJAX HTTP error occurred.') + '\n' + Drupal.t('HTTP Result Code: !status', { '!status': xmlhttp.status }); 526 } else { 527 statusCode = '\n' + Drupal.t('An AJAX HTTP request terminated abnormally.'); 528 } 529 statusCode += '\n' + Drupal.t('Debugging information follows.'); 530 var pathText = '\n' + Drupal.t('Path: !uri', { '!uri': uri }); 531 statusText = ''; 532 533 try { 534 statusText = '\n' + Drupal.t('StatusText: !statusText', { '!statusText': $.trim(xmlhttp.statusText) }); 535 } catch (e) {} 536 537 responseText = ''; 538 539 try { 540 responseText = '\n' + Drupal.t('ResponseText: !responseText', { '!responseText': $.trim(xmlhttp.responseText) }); 541 } catch (e) {} 542 543 responseText = responseText.replace(/<("[^"]*"|'[^']*'|[^'">])*>/gi, ''); 544 responseText = responseText.replace(/[\n]+\s+/g, '\n'); 545 546 var readyStateText = xmlhttp.status === 0 ? '\n' + Drupal.t('ReadyState: !readyState', { '!readyState': xmlhttp.readyState }) : ''; 547 548 customMessage = customMessage ? '\n' + Drupal.t('CustomMessage: !customMessage', { '!customMessage': customMessage }) : ''; 549 550 this.message = statusCode + pathText + statusText + customMessage + responseText + readyStateText; 551 552 this.name = 'AjaxError'; 553 }; 554 555 Drupal.AjaxError.prototype = new Error(); 556 Drupal.AjaxError.prototype.constructor = Drupal.AjaxError; 557 558 Drupal.ajax = function (settings) { 559 if (arguments.length !== 1) { 560 throw new Error('Drupal.ajax() function must be called with one configuration object only'); 561 } 562 563 var base = settings.base || false; 564 var element = settings.element || false; 565 delete settings.base; 566 delete settings.element; 567 568 if (!settings.progress && !element) { 569 settings.progress = false;
570 } 571 572 var ajax = new Drupal.Ajax(base, element, settings); 573 ajax.instanceIndex = Drupal.ajax.instances.length; 574 Drupal.ajax.instances.push(ajax); 575 576 return ajax; 577 }; 578 579 Drupal.ajax.instances = []; 580 581 Drupal.ajax.expired = function () { 582 return Drupal.ajax.instances.filter(function (instance) { 583 return instance && instance.element !== false && !document.body.contains(instance.element); 584 }); 585 }; 586 587 Drupal.ajax.bindAjaxLinks = function (element) { 588 $(element).find('.use-ajax').once('ajax').each(function (i, ajaxLink) { 589 var $linkElement = $(ajaxLink); 590 591 var elementSettings = { 592 progress: { type: 'throbber' }, 593 dialogType: $linkElement.data('dialog-type'), 594 dialog: $linkElement.data('dialog-options'), 595 dialogRenderer: $linkElement.data('dialog-renderer'), 596 base: $linkElement.attr('id'), 597 element: ajaxLink 598 }; 599 var href = $linkElement.attr('href'); 600 601 if (href) { 602 elementSettings.url = href; 603 elementSettings.event = 'click'; 604 } 605 Drupal.ajax(elementSettings); 606 }); 607 }; 608 609 Drupal.Ajax = function (base, element, elementSettings) { 610 var defaults = { 611 event: element ? 'mousedown' : null, 612 keypress: true, 613 selector: base ? '#' + base : null, 614 effect: 'none', 615 speed: 'none', 616 method: 'replaceWith', 617 progress: { 618 type: 'throbber', 619 message: Drupal.t('Please wait...') 620 }, 621 submit: { 622 js: true 623 } 624 }; 625 626 $.extend(this, defaults, elementSettings); 627 628 this.commands = new Drupal.AjaxCommands(); 629 630 this.instanceIndex = false; 631 632 if (this.wrapper) { 633 this.wrapper = '#' + this.wrapper; 634 } 635 636 this.element = element; 637 638 this.element_settings = elementSettings; 639 640 this.elementSettings = elementSettings; 641 642 if (this.element && this.element.form) { 643 this.$form = $(this.element.form); 644 } 645 646 if (!this.url) { 647 var $element = $(this.element); 648 if ($element.is('a')) { 649 this.url = $element.attr('href'); 650 } else if (this.element && element.form) { 651 this.url = this.$form.attr('action'); 652 } 653 } 654 655 var originalUrl = this.url; 656 657 this.url = this.url.replace(/\/nojs(\/|$|\?|#)/g, '/ajax$1'); 658 659 if (drupalSettings.ajaxTrustedUrl[originalUrl]) { 660 drupalSettings.ajaxTrustedUrl[this.url] = true; 661 } 662 663 var ajax = this; 664 665 ajax.options = { 666 url: ajax.url, 667 data: ajax.submit, 668 beforeSerialize: function beforeSerialize(elementSettings, options) { 669 return ajax.beforeSerialize(elementSettings, options); 670 }, 671 beforeSubmit: function beforeSubmit(formValues, elementSettings, options) { 672 ajax.ajaxing = true; 673 return ajax.beforeSubmit(formValues, elementSettings, options); 674 }, 675 beforeSend: function beforeSend(xmlhttprequest, options) { 676 ajax.ajaxing = true; 677 return ajax.beforeSend(xmlhttprequest, options); 678 }, 679 success: function success(response, status, xmlhttprequest) { 680 if (typeof response === 'string') { 681 response = $.parseJSON(response); 682 } 683 684 if (response !== null && !drupalSettings.ajaxTrustedUrl[ajax.url]) { 685 if (xmlhttprequest.getResponseHeader('X-Drupal-Ajax-Token') !== '1') { 686 var customMessage = Drupal.t('The response failed verification so will not be processed.'); 687 return ajax.error(xmlhttprequest, ajax.url, customMessage); 688 } 689 } 690 691 return ajax.success(response, status); 692 }, 693 complete: function complete(xmlhttprequest, status) { 694 ajax.ajaxing = false; 695 if (status === 'error' || status === 'parsererror') { 696 return ajax.error(xmlhttprequest, ajax.url); 697 } 698 }, 699 700 dataType: 'json', 701 type: 'POST' 702 }; 703 704 if (elementSettings.dialog) { 705 ajax.options.data.dialogOptions = elementSettings.dialog; 706 } 707 708 if (ajax.options.url.indexOf('?') === -1) { 709 ajax.options.url += '?'; 710 } else { 711 ajax.options.url += '&'; 712 } 713 714 var wrapper = 'drupal_' + (elementSettings.dialogType || 'ajax'); 715 if (elementSettings.dialogRenderer) { 716 wrapper += '.' + elementSettings.dialogRenderer; 717 } 718 ajax.options.url += Drupal.ajax.WRAPPER_FORMAT + '=' + wrapper; 719 720 $(ajax.element).on(elementSettings.event, function (event) { 721 if (!drupalSettings.ajaxTrustedUrl[ajax.url] && !Drupal.url.isLocal(ajax.url)) { 722 throw new Error(Drupal.t('The callback URL is not local and n
722ot trusted: !url', { '!url': ajax.url })); 723 } 724 return ajax.eventResponse(this, event); 725 }); 726 727 if (elementSettings.keypress) { 728 $(ajax.element).on('keypress', function (event) { 729 return ajax.keypressResponse(this, event); 730 }); 731 } 732 733 if (elementSettings.prevent) { 734 $(ajax.element).on(elementSettings.prevent, false); 735 } 736 }; 737 738 Drupal.ajax.WRAPPER_FORMAT = '_wrapper_format'; 739 740 Drupal.Ajax.AJAX_REQUEST_PARAMETER = '_drupal_ajax'; 741 742 Drupal.Ajax.prototype.execute = function () { 743 if (this.ajaxing) { 744 return; 745 } 746 747 try { 748 this.beforeSerialize(this.element, this.options); 749 750 return $.ajax(this.options); 751 } catch (e) { 752 this.ajaxing = false; 753 window.alert('An error occurred while attempting to process ' + this.options.url + ': ' + e.message); 754 755 return $.Deferred().reject(); 756 } 757 }; 758 759 Drupal.Ajax.prototype.keypressResponse = function (element, event) { 760 var ajax = this; 761 762 if (event.which === 13 || event.which === 32 && element.type !== 'text' && element.type !== 'textarea' && element.type !== 'tel' && element.type !== 'number') { 763 event.preventDefault(); 764 event.stopPropagation(); 765 $(element).trigger(ajax.elementSettings.event); 766 } 767 }; 768 769 Drupal.Ajax.prototype.eventResponse = function (element, event) { 770 event.preventDefault(); 771 event.stopPropagation(); 772 773 var ajax = this; 774 775 if (ajax.ajaxing) { 776 return; 777 } 778 779 try { 780 if (ajax.$form) { 781 if (ajax.setClick) { 782 element.form.clk = element; 783 } 784 785 ajax.$form.ajaxSubmit(ajax.options); 786 } else { 787 ajax.beforeSerialize(ajax.element, ajax.options); 788 $.ajax(ajax.options); 789 } 790 } catch (e) { 791 ajax.ajaxing = false; 792 window.alert('An error occurred while attempting to process ' + ajax.options.url + ': ' + e.message); 793 } 794 }; 795 796 Drupal.Ajax.prototype.beforeSerialize = function (element, options) { 797 if (this.$form) { 798 var settings = this.settings || drupalSettings; 799 Drupal.detachBehaviors(this.$form.get(0), settings, 'serialize'); 800 } 801 802 options.data[Drupal.Ajax.AJAX_REQUEST_PARAMETER] = 1; 803 804 var pageState = drupalSettings.ajaxPageState; 805 options.data['ajax_page_state[theme]'] = pageState.theme; 806 options.data['ajax_page_state[theme_token]'] = pageState.theme_token; 807 options.data['ajax_page_state[libraries]'] = pageState.libraries; 808 }; 809 810 Drupal.Ajax.prototype.beforeSubmit = function (formValues, element, options) {}; 811 812 Drupal.Ajax.prototype.beforeSend = function (xmlhttprequest, options) { 813 if (this.$form) { 814 options.extraData = options.extraData || {}; 815 816 options.extraData.ajax_iframe_upload = '1'; 817 818 var v = $.fieldValue(this.element); 819 if (v !== null) { 820 options.extraData[this.element.name] = v; 821 } 822 } 823 824 $(this.element).prop('disabled', true); 825 826 if (!this.progress || !this.progress.type) { 827 return; 828 } 829 830 var progressIndicatorMethod = 'setProgressIndicator' + this.progress.type.slice(0, 1).toUpperCase() + this.progress.type.slice(1).toLowerCase(); 831 if (progressIndicatorMethod in this && typeof this[progressIndicatorMethod] === 'function') { 832 this[progressIndicatorMethod].call(this); 833 } 834 }; 835 836 Drupal.Ajax.prototype.setProgressIndicatorBar = function () { 837 var progressBar = new Drupal.ProgressBar('ajax-progress-' + this.element.id, $.noop, this.progress.method, $.noop); 838 if (this.progress.message) { 839 progressBar.setProgress(-1, this.progress.message); 840 } 841 if (this.progress.url) { 842 progressBar.startMonitoring(this.progress.url, this.progress.interval || 1500); 843 } 844 this.progress.element = $(progressBar.element).addClass('ajax-progress ajax-progress-bar'); 845 this.progress.object = progressBar; 846 $(this.element).after(this.progress.element); 847 }; 848 849 Drupal.Ajax.prototype.setProgressIndicatorThrobber = function () { 850 this.progress.element = $('<div class="ajax-progress ajax-progress-throbber"><div class="throbber"> </div></div>'); 851 if (this.progress.message) { 852 this.progress.element.find('.throbber').after('<div class="message">' + this.progress.message + '</div>'); 853 } 854 $(this.element).after(this.progress.element); 855 }; 856 857 Drupal.Ajax.prototype.setProgressIndicatorFullscreen = function () { 858 this.progress.element = $('<div class="ajax-progress ajax-progress-fullscreen"> </div>'); 859 $('body').after(this.progress.element); 860 }; 861 862 Drupal.Ajax.prototype.success = function (response, status) { 863 var _this = this; 864 865 if (this.progress.element) { 866 $(this.progress.element).remove(); 867 } 868 if (this.progress.object) { 869 this.progress.object.stopMonitoring(); 870 } 871 $(this.element).prop('disabled', false); 872 873 var elementParents = $(this.element).parents('[data-drupal-selector]').addBack().toArray(); 874 875 var focusChanged = false;
876 Object.keys(response || {}).forEach(function (i) { 877 if (response[i].command && _this.commands[response[i].command]) { 878 _this.commands[response[i].command](_this, response[i], status); 879 if (response[i].command === 'invoke' && response[i].method === 'focus') { 880 focusChanged = true; 881 } 882 } 883 }); 884 885 if (!focusChanged && this.element && !$(this.element).data('disable-refocus')) { 886 var target = false; 887 888 for (var n = elementParents.length - 1; !target && n > 0; n--) { 889 target = document.querySelector('[data-drupal-selector="' + elementParents[n].getAttribute('data-drupal-selector') + '"]'); 890 } 891 892 if (target) { 893 $(target).trigger('focus'); 894 } 895 } 896 897 if (this.$form) { 898 var settings = this.settings || drupalSettings; 899 Drupal.attachBehaviors(this.$form.get(0), settings); 900 } 901 902 this.settings = null; 903 }; 904 905 Drupal.Ajax.prototype.getEffect = function (response) { 906 var type = response.effect || this.effect; 907 var speed = response.speed || this.speed; 908 909 var effect = {}; 910 if (type === 'none') { 911 effect.showEffect = 'show'; 912 effect.hideEffect = 'hide'; 913 effect.showSpeed = ''; 914 } else if (type === 'fade') { 915 effect.showEffect = 'fadeIn'; 916 effect.hideEffect = 'fadeOut'; 917 effect.showSpeed = speed; 918 } else { 919 effect.showEffect = type + 'Toggle'; 920 effect.hideEffect = type + 'Toggle'; 921 effect.showSpeed = speed; 922 } 923 924 return effect; 925 }; 926 927 Drupal.Ajax.prototype.error = function (xmlhttprequest, uri, customMessage) { 928 if (this.progress.element) { 929 $(this.progress.element).remove(); 930 } 931 if (this.progress.object) { 932 this.progress.object.stopMonitoring(); 933 } 934 935 $(this.wrapper).show(); 936 937 $(this.element).prop('disabled', false); 938 939 if (this.$form) { 940 var settings = this.settings || drupalSettings; 941 Drupal.attachBehaviors(this.$form.get(0), settings); 942 } 943 throw new Drupal.AjaxError(xmlhttprequest, uri, customMessage); 944 }; 945 946 Drupal.AjaxCommands = function () {}; 947 Drupal.AjaxCommands.prototype = { 948 insert: function insert(ajax, response, status) { 949 var $wrapper = response.selector ? $(response.selector) : $(ajax.wrapper); 950 var method = response.method || ajax.method; 951 var effect = ajax.getEffect(response); 952 var settings = void 0; 953 954 var $newContentWrapped = $('<div></div>').html(response.data); 955 var $newContent = $newContentWrapped.contents(); 956 957 if ($newContent.length !== 1 || $newContent.get(0).nodeType !== 1) { 958 $newContent = $newContentWrapped; 959 } 960 961 switch (method) { 962 case 'html': 963 case 'replaceWith': 964 case 'replaceAll': 965 case 'empty': 966 case 'remove': 967 settings = response.settings || ajax.settings || drupalSettings; 968 Drupal.detachBehaviors($wrapper.get(0), settings); 969 } 970 971 $wrapper[method]($newContent); 972 973 if (effect.showEffect !== 'show') { 974 $newContent.hide(); 975 } 976 977 if ($newContent.find('.ajax-new-content').length > 0) { 978 $newContent.find('.ajax-new-content').hide(); 979 $newContent.show(); 980 $newContent.find('.ajax-new-content')[effect.showEffect](effect.showSpeed); 981 } else if (effect.showEffect !== 'show') { 982 $newContent[effect.showEffect](effect.showSpeed); 983 } 984 985 if ($newContent.parents('html').length > 0) { 986 settings = response.settings || ajax.settings || drupalSettings; 987 Drupal.attachBehaviors($newContent.get(0), settings); 988 } 989 }, 990 remove: function remove(ajax, response, status) { 991 var settings = response.settings || ajax.settings || drupalSettings; 992 $(response.selector).each(function () { 993 Drupal.detachBehaviors(this, settings); 994 }).remove(); 995 }, 996 changed: function changed(ajax, response, status) { 997 var $element = $(response.selector); 998 if (!$element.hasClass('ajax-changed')) { 999 $element.addClass('ajax-changed'); 1000 if (response.asterisk) { 1001 $element.find(response.asterisk).append(' <abbr class="ajax-changed" title="' + Drupal.t('Changed') + '">*</abbr> '); 1002 } 1003 } 1004 }, 1005 alert: function alert(ajax, response, status) { 1006 window.alert(response.text, response.title); 1007 }, 1008 redirect: function redirect(ajax, response, status) { 1009 window.location = response.url; 1010 }, 1011 css: function css(ajax, response, status) { 1012 $(response.selector).css(response.argument); 1013 }, 1014 settings: function settings(ajax, response, status) { 1015 var ajaxSettings = drupalSettings.ajax; 1016 1017 if (ajaxSettings) {
1018 Drupal.ajax.expired().forEach(function (instance) { 1019 1020 if (instance.selector) { 1021 var selector = instance.selector.replace('#', ''); 1022 if (selector in ajaxSettings) { 1023 delete ajaxSettings[selector]; 1024 } 1025 } 1026 }); 1027 } 1028 1029 if (response.merge) { 1030 $.extend(true, drupalSettings, response.settings); 1031 } else { 1032 ajax.settings = response.settings; 1033 } 1034 }, 1035 data: function data(ajax, response, status) { 1036 $(response.selector).data(response.name, response.value); 1037 }, 1038 invoke: function invoke(ajax, response, status) { 1039 var $element = $(response.selector); 1040 $element[response.method].apply($element, _toConsumableArray(response.args)); 1041 }, 1042 restripe: function restripe(ajax, response, status) { 1043 $(response.selector).find('> tbody > tr:visible, > tr:visible').removeClass('odd even').filter(':even').addClass('odd').end().filter(':odd').addClass('even'); 1044 }, 1045 update_build_id: function update_build_id(ajax, response, status) { 1046 $('input[name="form_build_id"][value="' + response.old + '"]').val(response.new); 1047 }, 1048 add_css: function add_css(ajax, response, status) { 1049 $('head').prepend(response.data); 1050 1051 var match = void 0; 1052 var importMatch = /^@import url\("(.*)"\);$/igm; 1053 if (document.styleSheets[0].addImport && importMatch.test(response.data)) { 1054 importMatch.lastIndex = 0; 1055 do { 1056 match = importMatch.exec(response.data); 1057 document.styleSheets[0].addImport(match[1]); 1058 } while (match); 1059 } 1060 } 1061 }; 1062})(jQuery, window, Drupal, drupalSettings);; 1063/** 1064* DO NOT EDIT THIS FILE. 1065* See the following change record for more information, 1066* https://www.drupal.org/node/2815083 1067* @preserve 1068**/ 1069 1070(function ($, Drupal, drupalSettings) { 1071 Drupal.Views = {}; 1072 1073 Drupal.Views.parseQueryString = function (query) { 1074 var args = {}; 1075 var pos = query.indexOf('?'); 1076 if (pos !== -1) { 1077 query = query.substring(pos + 1); 1078 } 1079 var pair = void 0; 1080 var pairs = query.split('&'); 1081 for (var i = 0; i < pairs.length; i++) { 1082 pair = pairs[i].split('='); 1083 1084 if (pair[0] !== 'q' && pair[1]) { 1085 args[decodeURIComponent(pair[0].replace(/\+/g, ' '))] = decodeURIComponent(pair[1].replace(/\+/g, ' ')); 1086 } 1087 } 1088 return args; 1089 }; 1090 1091 Drupal.Views.parseViewArgs = function (href, viewPath) { 1092 var returnObj = {}; 1093 var path = Drupal.Views.getPath(href); 1094 1095 var viewHref = Drupal.url(viewPath).substring(drupalSettings.path.baseUrl.length); 1096 1097 if (viewHref && path.substring(0, viewHref.length + 1) === viewHref + '/') { 1098 returnObj.view_args = decodeURIComponent(path.substring(viewHref.length + 1, path.length)); 1099 returnObj.view_path = path; 1100 } 1101 return returnObj; 1102 }; 1103 1104 Drupal.Views.pathPortion = function (href) { 1105 var protocol = window.location.protocol; 1106 if (href.substring(0, protocol.length) === protocol) { 1107 href = href.substring(href.indexOf('/', protocol.length + 2)); 1108 } 1109 return href; 1110 }; 1111 1112 Drupal.Views.getPath = function (href) { 1113 href = Drupal.Views.pathPortion(href); 1114 href = href.substring(drupalSettings.path.baseUrl.length, href.length); 1115 1116 if (href.substring(0, 3) === '?q=') { 1117 href = href.substring(3, href.length); 1118 } 1119 var chars = ['#', '?', '&']; 1120 for (var i = 0; i < chars.length; i++) { 1121 if (href.indexOf(chars[i]) > -1) { 1122 href = href.substr(0, href.indexOf(chars[i])); 1123 } 1124 } 1125 return href; 1126 }; 1127})(jQuery, Drupal, drupalSettings);; 1128/** 1129* DO NOT EDIT THIS FILE. 1130* See the following change record for more information, 1131* https://www.drupal.org/node/2815083 1132* @preserve 1133**/ 1134 1135(function ($, Drupal, drupalSettings) { 1136 Drupal.behaviors.ViewsAjaxView = {}; 1137 Drupal.behaviors.ViewsAjaxView.attach = function () { 1138 if (drupalSettings && drupalSettings.views && drupalSettings.views.ajaxViews) { 1139 var ajaxViews = drupalSettings.views.ajaxViews; 1140 Object.keys(ajaxViews || {}).forEach(function (i) { 1141 Drupal.views.instances[i] = new Drupal.views.ajaxView(ajaxViews[i]); 1142 }); 1143 } 1144 }; 1145 1146 Drupal.views = {}; 1147 1148 Drupal.views.instances = {}; 1149 1150 Drupal.views.ajaxView = function (settings) { 1151 var selector = '.js-view-dom-id-' + settings.view_dom_id; 1152 this.$view = $(selector); 1153 1154 var ajaxPath = drupalSettings.views.ajax_path; 1155 1156 if (ajaxPath.constructor.toString().indexOf('Array') !== -1) { 1157 ajaxPath = ajaxPath[0]; 1158 } 1159 1160 var queryString = window.location.search || ''; 1161 if (queryString !== '') { 1162 queryString = queryString.slice(1).replace(/q=[^&]+&?|&?render=[^&]+/, ''); 1163 if (queryString !== '') { 1164 queryString = (/\?/.test(ajaxPath) ? '&' : '?') + queryString; 1165 } 1166 } 1167 1168 this.element_settings = { 1169 url: ajaxPath + queryString, 1170 submit: settings, 1171 setClick: true, 1172 event: 'click', 1173 selector: selector, 1174 progress: { type: 'fullscreen' } 1175 }; 1176 1177 this.settings = settings; 1178 1179 this.$exposed_form = $('form#views-exposed-form-' + settings.view_name.replace(/_/g, '-') + '-' + settings.view_display_id.replace(/_/g, '-')); 1180 this.$exposed_form.once('exposed-form').each($.proxy(this.attachExposedFormAjax, this)); 1181 1182 this.$view.filter($.proxy(this.filterNestedViews, this)).once('aja
1182x-pager').each($.proxy(this.attachPagerAjax, this)); 1183 1184 var selfSettings = $.extend({}, this.element_settings, { 1185 event: 'RefreshView', 1186 base: this.selector, 1187 element: this.$view.get(0) 1188 }); 1189 this.refreshViewAjax = Drupal.ajax(selfSettings); 1190 }; 1191 1192 Drupal.views.ajaxView.prototype.attachExposedFormAjax = function () { 1193 var that = this; 1194 this.exposedFormAjax = []; 1195 1196 $('input[type=submit], input[type=image]', this.$exposed_form).not('[data-drupal-selector=edit-reset]').each(function (index) { 1197 var selfSettings = $.extend({}, that.element_settings, { 1198 base: $(this).attr('id'), 1199 element: this 1200 }); 1201 that.exposedFormAjax[index] = Drupal.ajax(selfSettings); 1202 }); 1203 }; 1204 1205 Drupal.views.ajaxView.prototype.filterNestedViews = function () { 1206 return !this.$view.parents('.view').length; 1207 }; 1208 1209 Drupal.views.ajaxView.prototype.attachPagerAjax = function () { 1210 this.$view.find('ul.js-pager__items > li > a, th.views-field a, .attachment .views-summary a').each($.proxy(this.attachPagerLinkAjax, this)); 1211 }; 1212 1213 Drupal.views.ajaxView.prototype.attachPagerLinkAjax = function (id, link) { 1214 var $link = $(link); 1215 var viewData = {}; 1216 var href = $link.attr('href'); 1217 1218 $.extend(viewData, this.settings, Drupal.Views.parseQueryString(href), Drupal.Views.parseViewArgs(href, this.settings.view_base_path)); 1219 1220 var selfSettings = $.extend({}, this.element_settings, {
1221 submit: viewData, 1222 base: false, 1223 element: link 1224 }); 1225 this.pagerAjax = Drupal.ajax(selfSettings); 1226 }; 1227 1228 Drupal.AjaxCommands.prototype.viewsScrollTop = function (ajax, response) { 1229 var offset = $(response.selector).offset(); 1230 1231 var scrollTarget = response.selector; 1232 while ($(scrollTarget).scrollTop() === 0 && $(scrollTarget).parent()) { 1233 scrollTarget = $(scrollTarget).parent(); 1234 } 1235 1236 if (offset.top - 10 < $(scrollTarget).scrollTop()) { 1237 $(scrollTarget).animate({ scrollTop: offset.top - 10 }, 500); 1238 } 1239 }; 1240})(jQuery, Drupal, drupalSettings);;
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.