1/** 2* DO NOT EDIT THIS FILE. 3* See the following change record for more information, 4* https://www.drupal.org/node/2815083 5* @preserve 6**/ 7function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } 8function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 9function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 10function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } 11function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } 12function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } 13(function ($, window, Drupal, drupalSettings, loadjs, _ref) { 14 var isFocusable = _ref.isFocusable, 15 tabbable = _ref.tabbable; 16 Drupal.behaviors.AJAX = { 17 attach: function attach(context, settings) { 18 function loadAjaxBehavior(base) { 19 var elementSettings = settings.ajax[base]; 20 if (typeof elementSettings.selector === 'undefined') { 21 elementSettings.selector = "#".concat(base); 22 } 23 once('drupal-ajax', $(elementSettings.selector)).forEach(function (el) { 24 elementSettings.element = el; 25 elementSettings.base = base; 26 Drupal.ajax(elementSettings); 27 }); 28 } 29 Object.keys(settings.ajax || {}).forEach(function (base) { 30 return loadAjaxBehavior(base); 31 }); 32 Drupal.ajax.bindAjaxLinks(document.body); 33 once('ajax', '.use-ajax-submit').forEach(function (el) { 34 var elementSettings = {}; 35 elementSettings.url = $(el.form).attr('action'); 36 elementSettings.setClick = true; 37 elementSettings.event = 'click'; 38 elementSettings.progress = { 39 type: 'throbber' 40 }; 41 elementSettings.base = el.id; 42 elementSettings.element = el; 43 Drupal.ajax(elementSettings); 44 }); 45 }, 46 detach: function detach(context, settings, trigger) { 47 if (trigger === 'unload') { 48 Drupal.ajax.expired().forEach(function (instance) { 49 Drupal.ajax.instances[instance.instanceIndex] = null; 50 }); 51 } 52 } 53 }; 54 Drupal.AjaxError = function (xmlhttp, uri, customMessage) { 55 var statusCode; 56 var statusText; 57 var responseText; 58 if (xmlhttp.status) { 59 statusCode = "\n".concat(Drupal.t('An AJAX HTTP error occurred.'), "\n").concat(Drupal.t('HTTP Result Code: !status', { 60 '!status': xmlhttp.status 61 })); 62 } else { 63 statusCode = "\n".concat(Drupal.t('An AJAX HTTP request terminated abnormally.')); 64 } 65 statusCode += "\n".concat(Drupal.t('Debugging information follows.')); 66 var pathText = "\n".concat(Drupal.t('Path: !uri', { 67 '!uri': uri 68 })); 69 statusText = ''; 70 try { 71 statusText = "\n".concat(Drupal.t('StatusText: !statusText', { 72 '!statusText': xmlhttp.statusText.trim() 73 })); 74 } catch (e) {} 75 responseText = ''; 76 try { 77 responseText = "\n".concat(Drupal.t('ResponseText: !responseText', { 78 '!responseText': xmlhttp.responseText.trim() 79 })); 80 } catch (e) {} 81 responseText = responseText.replace(/<("[^"]*"|'[^']*'|[^'">])*>/gi, ''); 82 responseText = responseText.replace(/[\n]+\s+/g, '\n'); 83 var readyStateText = xmlhttp.status === 0 ? "\n".concat(Drupal.t('ReadyState: !readyState', { 84 '!readyState': xmlhttp.readyState 85 })) : ''; 86 customMessage = customMessage ? "\n".concat(Drupal.t('CustomMessage: !customMessage', { 87 '!customMessage': customMessage 88 })) : ''; 89 this.message = statusCode + pathText + statusText + customMessage + responseText + readyStateText; 90 this.name = 'AjaxError'; 91 }; 92 Drupal.AjaxError.prototype = new Error(); 93 Drupal.AjaxError.prototype.constructor = Drupal.AjaxError; 94 Drupal.ajax = function (settings) { 95 if (arguments.length !== 1) { 96 throw new Error('Drupal.ajax() function must be called with one configuration object only'); 97 } 98 var base = settings.base || false; 99 var element = settings.element || false; 100 delete settings.base; 101 delete settings.element; 102 if (!settings.progress && !element) { 103 settings.progress = false;
104 } 105 var ajax = new Drupal.Ajax(base, element, settings); 106 ajax.instanceIndex = Drupal.ajax.instances.length; 107 Drupal.ajax.instances.push(ajax); 108 return ajax; 109 }; 110 Drupal.ajax.instances = []; 111 Drupal.ajax.expired = function () { 112 return Drupal.ajax.instances.filter(function (instance) { 113 return instance && instance.element !== false && !document.body.contains(instance.element); 114 }); 115 }; 116 Drupal.ajax.bindAjaxLinks = function (element) { 117 once('ajax', '.use-ajax', element).forEach(function (ajaxLink) { 118 var $linkElement = $(ajaxLink); 119 var elementSettings = { 120 progress: { 121 type: 'throbber' 122 }, 123 dialogType: $linkElement.data('dialog-type'), 124 dialog: $linkElement.data('dialog-options'), 125 dialogRenderer: $linkElement.data('dialog-renderer'), 126 base: $linkElement.attr('id'), 127 element: ajaxLink 128 }; 129 var href = $linkElement.attr('href'); 130 if (href) { 131 elementSettings.url = href; 132 elementSettings.event = 'click'; 133 } 134 Drupal.ajax(elementSettings); 135 }); 136 }; 137 Drupal.Ajax = function (base, element, elementSettings) { 138 var defaults = { 139 event: element ? 'mousedown' : null, 140 keypress: true, 141 selector: base ? "#".concat(base) : null, 142 effect: 'none', 143 speed: 'none', 144 method: 'replaceWith', 145 progress: { 146 type: 'throbber', 147 message: Drupal.t('Please wait...') 148 }, 149 submit: { 150 js: true 151 } 152 }; 153 $.extend(this, defaults, elementSettings); 154 this.commands = new Drupal.AjaxCommands(); 155 this.instanceIndex = false; 156 if (this.wrapper) { 157 this.wrapper = "#".concat(this.wrapper); 158 } 159 this.element = element; 160 this.element_settings = elementSettings; 161 this.elementSettings = elementSettings; 162 if (this.element && this.element.form) { 163 this.$form = $(this.element.form); 164 } 165 if (!this.url) { 166 var $element = $(this.element); 167 if ($element.is('a')) { 168 this.url = $element.attr('href'); 169 } else if (this.element && element.form) { 170 this.url = this.$form.attr('action'); 171 } 172 } 173 var originalUrl = this.url; 174 this.url = this.url.replace(/\/nojs(\/|$|\?|#)/, '/ajax$1'); 175 if (drupalSettings.ajaxTrustedUrl[originalUrl]) { 176 drupalSettings.ajaxTrustedUrl[this.url] = true; 177 } 178 var ajax = this; 179 ajax.options = { 180 url: ajax.url, 181 data: ajax.submit, 182 isInProgress: function isInProgress() { 183 return ajax.ajaxing; 184 }, 185 beforeSerialize: function beforeSerialize(elementSettings, options) { 186 return ajax.beforeSerialize(elementSettings, options); 187 }, 188 beforeSubmit: function beforeSubmit(formValues, elementSettings, options) { 189 ajax.ajaxing = true; 190 return ajax.beforeSubmit(formValues, elementSettings, options); 191 }, 192 beforeSend: function beforeSend(xmlhttprequest, options) { 193 ajax.ajaxing = true; 194 return ajax.beforeSend(xmlhttprequest, options); 195 }, 196 success: function success(response, status, xmlhttprequest) { 197 var _this = this; 198 if (typeof response === 'string') { 199 response = $.parseJSON(response); 200 } 201 if (response !== null && !drupalSettings.ajaxTrustedUrl[ajax.url]) { 202 if (xmlhttprequest.getResponseHeader('X-Drupal-Ajax-Token') !== '1') { 203 var customMessage = Drupal.t('The response failed verification so will not be processed.'); 204 return ajax.error(xmlhttprequest, ajax.url, customMessage); 205 } 206 } 207 return Promise.resolve(ajax.success(response, status)).then(function () { 208 ajax.ajaxing = false; 209 $(document).trigger('ajaxSuccess', [xmlhttprequest, _this]); 210 $(document).trigger('ajaxComplete', [xmlhttprequest, _this]); 211 if (--$.active === 0) { 212 $(document).trigger('ajaxStop'); 213 } 214 }); 215 }, 216 error: function error(xmlhttprequest, status, _error) { 217 ajax.ajaxing = false; 218 }, 219 complete: function complete(xmlhttprequest, status) { 220 if (status === 'error' || status === 'parsererror') { 221 return ajax.error(xmlhttprequest, ajax.url); 222 } 223 }, 224 dataType: 'json', 225 jsonp: false, 226 type: 'POST' 227 }; 228 if (elementSettings.dialog) { 229 ajax.options.data.dialogOptions = elementSettings.dialog; 230 } 231 if (ajax.options.url.indexOf('?') === -1) { 232 ajax.options.url += '?'; 233 } else { 234 ajax.options.url += '&'; 235 } 236 var wrapper = "drupal_".concat(elementSettings.dialogType || 'ajax'); 237 if (elementSettings.dialogRenderer) { 238 wrapper += ".".concat(elementSettings.dialogRenderer); 239 } 240 ajax.options.url += "".concat(Drupal.ajax.WRAPPER_FORMAT, "=").concat(wrapper); 241 $(ajax.element).on(elementSettings.event, function (event) { 242 if (!drupalSettings.ajaxTrustedUrl[ajax.url] && !Drupal.url.isLocal(ajax.url)) { 243 throw new Error(Drupal.t('The callback URL is not local and n
243ot trusted: !url', { 244 '!url': ajax.url 245 })); 246 } 247 return ajax.eventResponse(this, event); 248 }); 249 if (elementSettings.keypress) { 250 $(ajax.element).on('keypress', function (event) { 251 return ajax.keypressResponse(this, event); 252 }); 253 } 254 if (elementSettings.prevent) { 255 $(ajax.element).on(elementSettings.prevent, false); 256 } 257 }; 258 Drupal.ajax.WRAPPER_FORMAT = '_wrapper_format'; 259 Drupal.Ajax.AJAX_REQUEST_PARAMETER = '_drupal_ajax'; 260 Drupal.Ajax.prototype.execute = function () { 261 if (this.ajaxing) { 262 return; 263 } 264 try { 265 this.beforeSerialize(this.element, this.options); 266 return $.ajax(this.options); 267 } catch (e) { 268 this.ajaxing = false; 269 window.alert("An error occurred while attempting to process ".concat(this.options.url, ": ").concat(e.message)); 270 return $.Deferred().reject(); 271 } 272 }; 273 Drupal.Ajax.prototype.keypressResponse = function (element, event) { 274 var ajax = this; 275 if (event.which === 13 || event.which === 32 && element.type !== 'text' && element.type !== 'textarea' && element.type !== 'tel' && element.type !== 'number') { 276 event.preventDefault(); 277 event.stopPropagation(); 278 $(element).trigger(ajax.elementSettings.event); 279 } 280 }; 281 Drupal.Ajax.prototype.eventResponse = function (element, event) { 282 event.preventDefault(); 283 event.stopPropagation(); 284 var ajax = this; 285 if (ajax.ajaxing) { 286 return; 287 } 288 try { 289 if (ajax.$form) { 290 if (ajax.setClick) { 291 element.form.clk = element; 292 } 293 ajax.$form.ajaxSubmit(ajax.options); 294 } else { 295 ajax.beforeSerialize(ajax.element, ajax.options); 296 $.ajax(ajax.options); 297 } 298 } catch (e) { 299 ajax.ajaxing = false; 300 window.alert("An error occurred while attempting to process ".concat(ajax.options.url, ": ").concat(e.message)); 301 } 302 }; 303 Drupal.Ajax.prototype.beforeSerialize = function (element, options) { 304 if (this.$form && document.body.contains(this.$form.get(0))) { 305 var settings = this.settings || drupalSettings; 306 Drupal.detachBehaviors(this.$form.get(0), settings, 'serialize'); 307 } 308 options.data[Drupal.Ajax.AJAX_REQUEST_PARAMETER] = 1; 309 var pageState = drupalSettings.ajaxPageState; 310 options.data['ajax_page_state[theme]'] = pageState.theme; 311 options.data['ajax_page_state[theme_token]'] = pageState.theme_token; 312 options.data['ajax_page_state[libraries]'] = pageState.libraries; 313 }; 314 Drupal.Ajax.prototype.beforeSubmit = function (formValues, element, options) {}; 315 Drupal.Ajax.prototype.beforeSend = function (xmlhttprequest, options) { 316 if (this.$form) { 317 options.extraData = options.extraData || {}; 318 options.extraData.ajax_iframe_upload = '1'; 319 var v = $.fieldValue(this.element); 320 if (v !== null) { 321 options.extraData[this.element.name] = v; 322 } 323 } 324 $(this.element).prop('disabled', true); 325 if (!this.progress || !this.progress.type) { 326 return; 327 } 328 var progressIndicatorMethod = "setProgressIndicator".concat(this.progress.type.slice(0, 1).toUpperCase()).concat(this.progress.type.slice(1).toLowerCase()); 329 if (progressIndicatorMethod in this && typeof this[progressIndicatorMethod] === 'function') { 330 this[progressIndicatorMethod].call(this); 331 } 332 }; 333 Drupal.theme.ajaxProgressThrobber = function (message) { 334 var messageMarkup = typeof message === 'string' ? Drupal.theme('ajaxProgressMessage', message) : ''; 335 var throbber = '<div class="throbber"> </div>'; 336 return "<div class=\"ajax-progress ajax-progress-throbber\">".concat(throbber).concat(messageMarkup, "</div>"); 337 }; 338 Drupal.theme.ajaxProgressIndicatorFullscreen = function () { 339 return '<div class="ajax-progress ajax-progress-fullscreen"> </div>'; 340 }; 341 Drupal.theme.ajaxProgressMessage = function (message) { 342 return "<div class=\"message\">".concat(message, "</div>"); 343 }; 344 Drupal.theme.ajaxProgressBar = function ($element) { 345 return $('<div class="ajax-progress ajax-progress-bar"></div>').append($element); 346 }; 347 Drupal.Ajax.prototype.setProgressIndicatorBar = function () { 348 var progressBar = new Drupal.ProgressBar("ajax-progress-".concat(this.element.i
348d), $.noop, this.progress.method, $.noop); 349 if (this.progress.message) { 350 progressBar.setProgress(-1, this.progress.message); 351 } 352 if (this.progress.url) { 353 progressBar.startMonitoring(this.progress.url, this.progress.interval || 1500); 354 } 355 this.progress.element = $(Drupal.theme('ajaxProgressBar', progressBar.element)); 356 this.progress.object = progressBar; 357 $(this.element).after(this.progress.element); 358 }; 359 Drupal.Ajax.prototype.setProgressIndicatorThrobber = function () { 360 this.progress.element = $(Drupal.theme('ajaxProgressThrobber', this.progress.message)); 361 $(this.element).after(this.progress.element); 362 }; 363 Drupal.Ajax.prototype.setProgressIndicatorFullscreen = function () { 364 this.progress.element = $(Drupal.theme('ajaxProgressIndicatorFullscreen')); 365 $('body').append(this.progress.element); 366 }; 367 Drupal.Ajax.prototype.commandExecutionQueue = function (response, status) { 368 var _this2 = this; 369 var ajaxCommands = this.commands; 370 return Object.keys(response || {}).reduce(function (executionQueue, key) { 371 return executionQueue.then(function () { 372 var command = response[key].command; 373 if (command && ajaxCommands[command]) { 374 return ajaxCommands[command](_this2, response[key], status); 375 } 376 }); 377 }, Promise.resolve()); 378 }; 379 Drupal.Ajax.prototype.success = function (response, status) { 380 var _this3 = this; 381 if (this.progress.element) { 382 $(this.progress.element).remove(); 383 } 384 if (this.progress.object) { 385 this.progress.object.stopMonitoring(); 386 } 387 $(this.element).prop('disabled', false); 388 var elementParents = $(this.element).parents('[data-drupal-selector]').addBack().toArray(); 389 var focusChanged = Object.keys(response || {}).some(function (key) { 390 var _response$key = response[key], 391 command = _response$key.command, 392 method = _response$key.method; 393 return command === 'focusFirst' || command === 'invoke' && method === 'focus'; 394 }); 395 return this.commandExecutionQueue(response, status).then(function () { 396 if (!focusChanged && _this3.element && !$(_this3.element).data('disable-refocus')) { 397 var target = false;
398 for (var n = elementParents.length - 1; !target && n >= 0; n--) { 399 target = document.querySelector("[data-drupal-selector=\"".concat(elementParents[n].getAttribute('data-drupal-selector'), "\"]")); 400 } 401 if (target) { 402 $(target).trigger('focus'); 403 } 404 } 405 if (_this3.$form && document.body.contains(_this3.$form.get(0))) { 406 var settings = _this3.settings || drupalSettings; 407 Drupal.attachBehaviors(_this3.$form.get(0), settings); 408 } 409 _this3.settings = null; 410 }).catch(function (error) { 411 return console.error(Drupal.t('An error occurred during the execution of the Ajax response: !error', { 412 '!error': error 413 })); 414 }); 415 }; 416 Drupal.Ajax.prototype.getEffect = function (response) { 417 var type = response.effect || this.effect; 418 var speed = response.speed || this.speed; 419 var effect = {}; 420 if (type === 'none') { 421 effect.showEffect = 'show'; 422 effect.hideEffect = 'hide'; 423 effect.showSpeed = ''; 424 } else if (type === 'fade') { 425 effect.showEffect = 'fadeIn'; 426 effect.hideEffect = 'fadeOut'; 427 effect.showSpeed = speed; 428 } else { 429 effect.showEffect = "".concat(type, "Toggle"); 430 effect.hideEffect = "".concat(type, "Toggle"); 431 effect.showSpeed = speed; 432 } 433 return effect; 434 }; 435 Drupal.Ajax.prototype.error = function (xmlhttprequest, uri, customMessage) { 436 if (this.progress.element) { 437 $(this.progress.element).remove(); 438 } 439 if (this.progress.object) { 440 this.progress.object.stopMonitoring(); 441 } 442 $(this.wrapper).show(); 443 $(this.element).prop('disabled', false); 444 if (this.$form && document.body.contains(this.$form.get(0))) { 445 var settings = this.settings || drupalSettings; 446 Drupal.attachBehaviors(this.$form.get(0), settings); 447 } 448 throw new Drupal.AjaxError(xmlhttprequest, uri, customMessage); 449 }; 450 Drupal.theme.ajaxWrapperNewContent = function ($newContent, ajax, response) { 451 return (response.effect || ajax.effect) !== 'none' && $newContent.filter(function (i) { 452 return !($newContent[i].nodeName === '#comment' || $newContent[i].nodeName === '#text' && /^(\s|\n|\r)*$/.test($newContent[i].textContent)); 453 }).length > 1 ? Drupal.theme('ajaxWrapperMultipleRootElements', $newContent) : $newContent; 454 }; 455 Drupal.theme.ajaxWrapperMultipleRootElements = function ($elements) { 456 return $('<div></div>').append($elements); 457 }; 458 Drupal.AjaxCommands = function () {}; 459 Drupal.AjaxCommands.prototype = { 460 insert: function insert(ajax, response) { 461 var $wrapper = response.selector ? $(response.selector) : $(ajax.wrapper); 462 var method = response.method || ajax.method; 463 var effect = ajax.getEffect(response); 464 var settings = response.settings || ajax.settings || drupalSettings; 465 var $newContent = $($.parseHTML(response.data, document, true)); 466 $newContent = Drupal.theme('ajaxWrapperNewContent', $newContent, ajax, response); 467 switch (method) { 468 case 'html': 469 case 'replaceWith': 470 case 'replaceAll': 471 case 'empty': 472 case 'remove': 473 Drupal.detachBehaviors($wrapper.get(0), settings); 474 break; 475 default: 476 break; 477 } 478 $wrapper[method]($newContent); 479 if (effect.showEffect !== 'show') { 480 $newContent.hide(); 481 } 482 var $ajaxNewContent = $newContent.find('.ajax-new-content'); 483 if ($ajaxNewContent.length) { 484 $ajaxNewContent.hide(); 485 $newContent.show(); 486 $ajaxNewContent[effect.showEffect](effect.showSpeed); 487 } else if (effect.showEffect !== 'show') { 488 $newContent[effect.showEffect](effect.showSpeed); 489 } 490 if ($newContent.parents('html').length) { 491 $newContent.each(function (index, element) { 492 if (element.nodeType === Node.ELEMENT_NODE) { 493 Drupal.attachBehaviors(element, settings); 494 } 495 }); 496 } 497 }, 498 remove: function remove(ajax, response, status) { 499 var settings = response.settings || ajax.settings || drupalSettings; 500 $(response.selector).each(function () { 501 Drupal.detachBehaviors(this, settings); 502 }).remove(); 503 }, 504 changed: function changed(ajax, response, status) { 505 var $element = $(response.selector); 506 if (!$element.hasClass('ajax-changed')) { 507 $element.addClass('ajax-changed'); 508 if (response.asterisk) { 509 $element.find(response.asterisk).append(" <abbr class=\"ajax-changed\" title=\"".concat(Drupal.t('Changed'), "\">*</abbr> ")); 510 } 511 } 512 }, 513 alert: function alert(ajax, response, status) { 514 window.alert(response.text); 515 }, 516 announce: function announce(ajax, response) { 517 if (response.priority) { 518 Drupal.announce(response.text, response.priority); 519 } else { 520 Drupal.announce(response.text); 521 } 522 }, 523 redirect: function redirect(ajax, response, status) { 524 window.location = response.url; 525 }, 526 css: function css(ajax, response, status) { 527 $(response.selector).css(response.argument); 528 }, 529 settings: function settings(ajax, response, status) { 530 var ajaxSettings = drupalSettings.ajax; 531 if (ajaxSettings) {
532 Drupal.ajax.expired().forEach(function (instance) { 533 if (instance.selector) { 534 var selector = instance.selector.replace('#', ''); 535 if (selector in ajaxSettings) { 536 delete ajaxSettings[selector]; 537 } 538 } 539 }); 540 } 541 if (response.merge) { 542 $.extend(true, drupalSettings, response.settings); 543 } else { 544 ajax.settings = response.settings; 545 } 546 }, 547 data: function data(ajax, response, status) { 548 $(response.selector).data(response.name, response.value); 549 }, 550 focusFirst: function focusFirst(ajax, response, status) { 551 var focusChanged = false; 552 var container = document.querySelector(response.selector); 553 if (container) { 554 var tabbableElements = tabbable(container); 555 if (tabbableElements.length) { 556 tabbableElements[0].focus(); 557 focusChanged = true; 558 } else if (isFocusable(container)) { 559 container.focus(); 560 focusChanged = true; 561 } 562 } 563 if (ajax.hasOwnProperty('element') && !focusChanged) { 564 ajax.element.focus(); 565 } 566 }, 567 invoke: function invoke(ajax, response, status) { 568 var $element = $(response.selector); 569 $element[response.method].apply($element, _toConsumableArray(response.args)); 570 }, 571 restripe: function restripe(ajax, response, status) { 572 $(response.selector).find('> tbody > tr:visible, > tr:visible').removeClass('odd even').filter(':even').addClass('odd').end().filter(':odd').addClass('even'); 573 }, 574 update_build_id: function update_build_id(ajax, response, status) { 575 document.querySelectorAll("input[name=\"form_build_id\"][value=\"".concat(response.old, "\"]")).forEach(function (item) { 576 item.value = response.new; 577 }); 578 }, 579 add_css: function add_css(ajax, response, status) { 580 $('head').prepend(response.data); 581 }, 582 message: function message(ajax, response) { 583 var messages = new Drupal.Message(document.querySelector(response.messageWrapperQuerySelector)); 584 if (response.clearPrevious) { 585 messages.clear(); 586 } 587 messages.add(response.message, response.messageOptions); 588 }, 589 add_js: function add_js(ajax, response, status) { 590 var parentEl = document.querySelector(response.selector || 'body'); 591 var settings = ajax.settings || drupalSettings; 592 var allUniqueBundleIds = response.data.map(function (script) { 593 var uniqueBundleId = script.src + ajax.instanceIndex; 594 loadjs(script.src, uniqueBundleId, { 595 async: false, 596 before: function before(path, scriptEl) { 597 Object.keys(script).forEach(function (attributeKey) { 598 scriptEl.setAttribute(attributeKey, script[attributeKey]); 599 }); 600 parentEl.appendChild(scriptEl); 601 return false; 602 } 603 }); 604 return uniqueBundleId; 605 }); 606 return new Promise(function (resolve, reject) { 607 loadjs.ready(allUniqueBundleIds, { 608 success: function success() { 609 Drupal.attachBehaviors(parentEl, settings); 610 resolve(); 611 }, 612 error: function error(depsNotFound) { 613 var message = Drupal.t("The following files could not be loaded: @dependencies", { 614 '@dependencies': depsNotFound.join(', ') 615 }); 616 reject(message); 617 } 618 }); 619 }); 620 } 621 }; 622 var stopEvent = function stopEvent(xhr, settings) { 623 return xhr.getResponseHeader('X-Drupal-Ajax-Token') === '1' && settings.isInProgress && settings.isInProgress(); 624 }; 625 $.extend(true, $.event.special, { 626 ajaxSuccess: { 627 trigger: function trigger(event, xhr, settings) { 628 if (stopEvent(xhr, settings)) { 629 return false; 630 } 631 } 632 }, 633 ajaxComplete: { 634 trigger: function trigger(event, xhr, settings) { 635 if (stopEvent(xhr, settings)) { 636 $.active++; 637 return false; 638 } 639 } 640 } 641 }); 642})(jQuery, window, Drupal, drupalSettings, loadjs, window.tabbable);
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.