1/** 2 * @file 3 * Attaches behaviors for the Clientside Validation jQuery module. 4 */ 5(function ($, Drupal, drupalSettings) { 6 7 /** 8 * Attaches jQuery validate behavoir to forms. 9 * 10 * @type {Drupal~behavior} 11 * 12 * @prop {Drupal~behaviorAttach} attach 13 * Attaches the outline behavior to the right context. 14 */ 15 Drupal.behaviors.cvJqueryValidate = { 16 attach: function (context) { 17 if (typeof drupalSettings.cvJqueryValidateOptions === 'undefined') { 18 drupalSettings.cvJqueryValidateOptions = {}; 19 } 20 21 // Allow all modules to update the validate options. 22 // Example of how to do this is shown below. 23 $(document).trigger('cv-jquery-validate-options-update', drupalSettings.cvJqueryValidateOptions); 24 25 $(context).find('form').each(function() { 26 $(this).validate(drupalSettings.cvJqueryValidateOptions); 27 }); 28 } 29 }; 30})(jQuery, Drupal, drupalSettings); 31; 32/** 33 * @file 34 * Attaches behaviors for the Clientside Validation jQuery module. 35 */ 36(function ($, Drupal, debounce, CKEDITOR) { 37 /** 38 * Attaches jQuery validate behavoir to forms. 39 * 40 * @type {Drupal~behavior} 41 * 42 * @prop {Drupal~behaviorAttach} attach 43 * Attaches the outline behavior to the right context. 44 */ 45 Drupal.behaviors.cvJqueryValidateCKEditor = { 46 attach: function (context) { 47 if (typeof CKEDITOR === 'undefined') { 48 return; 49 } 50 var ignore = ':hidden'; 51 var not = []; 52 for (var instance in CKEDITOR.instances) { 53 if (CKEDITOR.instances.hasOwnProperty(instance)) { 54 not.push('#' + instance); 55 } 56 } 57 ignore += not.length ? ':not(' + not.join(', ') + ')' : ''; 58 $('form').each(function () { 59 var validator = $(this).data('validator'); 60 if (!validator) { 61 return; 62 } 63 validator.settings.ignore = ignore; 64 validator.settings.errorPlacement = function(place, $element) { 65 var id = $element.attr('id'); 66 var afterElement = $element[0]; 67 if (CKEDITOR.instances.hasOwnProperty(id)) { 68 afterElement = CKEDITOR.instances[id].container.$; 69 } 70 place.insertAfter(afterElement); 71 }; 72 }); 73 var updateText = function (instance) { 74 return debounce(function (e) { 75 instance.updateElement(); 76 var event = $.extend(true, {}, e.data.$); 77 delete event.target; 78 delete event.explicitOriginalTarget; 79 delete event.originalTarget; 80 delete event.currentTarget; 81 $(instance.element.$).trigger(new $.Event(e.name, event)); 82 }, 250); 83 }; 84 CKEDITOR.on('instanceReady', function () { 85 for (var instance in CKEDITOR.instances) { 86 if (CKEDITOR.instances.hasOwnProperty(instance)) { 87 CKEDITOR.instances[instance].document.on("keyup", updateText(CKEDITOR.instances[instance])); 88 CKEDITOR.instances[instance].document.on("paste", updateText(CKEDITOR.instances[instance])); 89 CKEDITOR.instances[instance].document.on("keypress", updateText(CKEDITOR.instances[instance])); 90 CKEDITOR.instances[instance].document.on("blur", updateText(CKEDITOR.instances[instance])); 91 CKEDITOR.instances[instance].document.on("change", updateText(CKEDITOR.instances[instance])); 92 } 93 } 94 }); 95 } 96 }; 97})(jQuery, Drupal, Drupal.debounce, (typeof CKEDITOR === 'undefined') ? undefined : CKEDITOR); 98; 99/** 100 * @file 101 * Unlock protected forms. 102 * 103 * This works by resetting the form action to the path that It should be as well 104 * as injecting the secret form key, only if the current user is verified to be 105 * human which is done by waiting for a mousemove, swipe, or tab/enter key to be 106 * pressed. 107 */ 108 109(function (Drupal, drupalSettings) { 110 "use strict"; 111 112 Drupal.antibot = {}; 113 114 Drupal.behaviors.antibot = { 115 attach: function (context) { 116 // Assume the user is not human, despite JS being enabled. 117 drupalSettings.antibot.human = false; 118 119 // Wait for a mouse to move, indicating they are human. 120 document.body.addEventListener('mousemove', function () { 121 // Unlock the forms. 122 Drupal.antibot.unlockForms(); 123 }); 124 125 // Wait for a touch move event, indicating that they are human.
126 document.body.addEventListener('touchmove', function () { 127 // Unlock the forms. 128 Drupal.antibot.unlockForms(); 129 }); 130 131 // A tab or enter key pressed can also indicate they are human. 132 document.body.addEventListener('keydown', function (e) { 133 if ((e.code == 'Tab') || (e.code == 'Enter')) { 134 // Unlock the forms. 135 Drupal.antibot.unlockForms(); 136 } 137 }); 138 } 139 }; 140 141 /** 142 * Unlock all locked forms. 143 */ 144 Drupal.antibot.unlockForms = function () { 145 // Act only if we haven't yet verified this user as being human. 146 if (!drupalSettings.antibot.human) { 147 // Check if there are forms to unlock. 148 if (drupalSettings.antibot.forms != undefined) { 149 // Iterate all antibot forms that we need to unlock. 150 Object.values(drupalSettings.antibot.forms).forEach(function (config) { 151 // Switch the action. 152 const form = document.getElementById(config.id); 153 if (form) { 154 form.setAttribute('action', form.getAttribute('data-action')); 155 156 // Set the key. 157 const input = form.querySelector('input[name="antibot_key"]'); 158 if (input) { 159 input.value = config.key; 160 } 161 } 162 }); 163 } 164 // Mark this user as being human. 165 drupalSettings.antibot.human = true; 166 } 167 }; 168})(Drupal, drupalSettings); 169; 170(function ($) { 171 'use strict'; 172 173 Drupal.form_placeholder = {}; 174 175 Drupal.form_placeholder.elementIsSupported = function ($element) { 176 var supportedElement = $element.is('input[type=number], input[type=text], input[type=date], input[type=email], input[type=url], input[type=tel], input[type=password], textarea'); 177 var hasId = $element.attr('id'); 178 return supportedElement && hasId; 179 }; 180 181 Drupal.form_placeholder.placeholderIsSupported = function () { 182 // Opera Mini v7 doesnât support placeholder although its DOM seems to 183 // indicate so. 184 var isOperaMini = Object.prototype.toString.call(window.operamini) == '[object OperaMini]'; 185 return 'placeholder' in document.createElement('input') && !isOperaMini; 186 }; 187 188 Drupal.behaviors.form_placeholder = { 189 attach: function (context, settings) { 190 // In some cases settings after ajax form submit could contain only 191 // settings from response but not all Drupal.settings data. 192 if (!settings.hasOwnProperty('form_placeholder')) { 193 settings = Drupal.settings; 194 } 195 var include = settings.form_placeholder.include; 196 if (include) { 197 include += ', '; 198 } 199 include += '.form-placeholder-include-children *'; 200 include += ', .form-placeholder-include'; 201 var exclude = settings.form_placeholder.exclude; 202 if (exclude) { 203 exclude += ', '; 204 } 205 exclude += '.form-placeholder-exclude-children *'; 206 exclude += ', .form-placeholder-exclude'; 207 208 var required_indicator = settings.form_placeholder.required_indicator; 209 210 $(include, context).not(exclude).each(function () { 211 var $textfield = $(this); 212 var elementSupported = Drupal.form_placeholder.elementIsSupported($textfield); 213 var placeholderSupported = Drupal.form_placeholder.placeholderIsSupported() || $().placeholder; 214 215 // Placeholder is supported. 216 if (elementSupported && placeholderSupported) { 217 var $form = $textfield.closest('form'); 218 var $label = $form.find('label[for=' + this.id + ']'); 219 var placeholder = $.trim($label.text()); 220 221 // Handle required field marker. 222 if ($label.hasClass('form-required')) { 223 switch (required_indicator) { 224 case 'append': 225 $textfield.after('<span class="form-required"></span>'); 226 break; 227 case 'remove': 228 // It's removed anyway, so we don't have to do anything. 229 break; 230 case 'leave': 231 placeholder += ' *'; 232 break; 233 case 'text': 234 placeholder += ' (' + Drupal.t('required') + ')'; 235 break; 236 } 237 } 238 else if (required_indicator === 'optional') { 239 placeholder += ' (' + Drupal.t('optional') + ')'; 240 } 241 242 if (!$textfield.attr('placeholder')) { 243 $textfield.attr('placeholder', placeholder); 244 $label.addClass('visually-hidden'); 245 } 246 247 // Fallback support for older browsers. 248 if (!Drupal.form_placeholder.placeholderIsSupported() && $().placeholder) { 249 $textfield.placeholder(); 250 } 251 } 252 }); 253 } 254 }; 255 256})(jQuery); 257; 258window.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"}}}()); 259; 260/** 261* DO NOT EDIT THIS FILE. 262* See the following change record for more information, 263* https://www.drupal.org/node/2815083 264* @preserve 265**/ 266 267(function ($, Drupal) { 268 Drupal.theme.progressBar = function (id) {
269 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>'; 270 }; 271 272 Drupal.ProgressBar = function (id, updateCallback, method, errorCallback) { 273 this.id = id; 274 this.method = method || 'GET'; 275 this.updateCallback = updateCallback; 276 this.errorCallback = errorCallback; 277 278 this.element = $(Drupal.theme('progressBar', id)); 279 }; 280 281 $.extend(Drupal.ProgressBar.prototype, { 282 setProgress: function setProgress(percentage, message, label) { 283 if (percentage >= 0 && percentage <= 100) { 284 $(this.element).find('div.progress__bar').css('width', percentage + '%'); 285 $(this.element).find('div.progress__percentage').html(percentage + '%'); 286 } 287 $('div.progress__description', this.element).html(message); 288 $('div.progress__label', this.element).html(label); 289 if (this.updateCallback) { 290 this.updateCallback(percentage, message, this); 291 } 292 }, 293 startMonitoring: function startMonitoring(uri, delay) { 294 this.delay = delay; 295 this.uri = uri; 296 this.sendPing(); 297 }, 298 stopMonitoring: function stopMonitoring() { 299 clearTimeout(this.timer); 300 301 this.uri = null; 302 }, 303 sendPing: function sendPing() { 304 if (this.timer) { 305 clearTimeout(this.timer); 306 } 307 if (this.uri) { 308 var pb = this; 309 310 var uri = this.uri; 311 if (uri.indexOf('?') === -1) { 312 uri += '?'; 313 } else { 314 uri += '&'; 315 } 316 uri += '_format=json'; 317 $.ajax({ 318 type: this.method, 319 url: uri, 320 data: '', 321 dataType: 'json', 322 success: function success(progress) { 323 if (progress.status === 0) { 324 pb.displayError(progress.data); 325 return; 326 } 327 328 pb.setProgress(progress.percentage, progress.message, progress.label); 329 330 pb.timer = setTimeout(function () { 331 pb.sendPing(); 332 }, pb.delay); 333 }, 334 error: function error(xmlhttp) { 335 var e = new Drupal.AjaxError(xmlhttp, pb.uri); 336 pb.displayError('<pre>' + e.message + '</pre>'); 337 } 338 }); 339 } 340 }, 341 displayError: function displayError(string) { 342 var error = $('<div class="messages messages--error"></div>').html(string); 343 $(this.element).before(error).hide(); 344 345 if (this.errorCallback) { 346 this.errorCallback(this); 347 } 348 } 349 }); 350})(jQuery, Drupal);; 351/** 352* DO NOT EDIT THIS FILE. 353* See the following change record for more information, 354* https://www.drupal.org/node/2815083 355* @preserve 356**/ 357 358(function (Drupal) { 359 Drupal.behaviors.responsiveImageAJAX = { 360 attach: function attach() { 361 if (window.picturefill) { 362 window.picturefill(); 363 } 364 } 365 }; 366})(Drupal);; 367/** 368* DO NOT EDIT THIS FILE. 369* See the following change record for more information, 370* https://www.drupal.org/node/2815083 371* @preserve 372**/ 373function _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); } } 374 375(function ($, window, Drupal, drupalSettings) { 376 Drupal.behaviors.AJAX = { 377 attach: function attach(context, settings) { 378 function loadAjaxBehavior(base) { 379 var elementSettings = settings.ajax[base]; 380 if (typeof elementSettings.selector === 'undefined') { 381 elementSettings.selector = '#' + base; 382 } 383 $(elementSettings.selector).once('drupal-ajax').each(function () { 384 elementSettings.element = this; 385 elementSettings.base = base; 386 Drupal.ajax(elementSettings); 387 }); 388 } 389 390 Object.keys(settings.ajax || {}).forEach(function (base) { 391 return loadAjaxBehavior(base); 392 }); 393 394 Drupal.ajax.bindAjaxLinks(document.body); 395
396 $('.use-ajax-submit').once('ajax').each(function () { 397 var elementSettings = {}; 398 399 elementSettings.url = $(this.form).attr('action'); 400 401 elementSettings.setClick = true; 402 403 elementSettings.event = 'click'; 404 405 elementSettings.progress = { type: 'throbber' }; 406 elementSettings.base = $(this).attr('id'); 407 elementSettings.element = this; 408 409 Drupal.ajax(elementSettings); 410 }); 411 }, 412 detach: function detach(context, settings, trigger) { 413 if (trigger === 'unload') { 414 Drupal.ajax.expired().forEach(function (instance) { 415 Drupal.ajax.instances[instance.instanceIndex] = null; 416 }); 417 } 418 } 419 }; 420 421 Drupal.AjaxError = function (xmlhttp, uri, customMessage) { 422 var statusCode = void 0; 423 var statusText = void 0; 424 var responseText = void 0; 425 if (xmlhttp.status) { 426 statusCode = '\n' + Drupal.t('An AJAX HTTP error occurred.') + '\n' + Drupal.t('HTTP Result Code: !status', { 427 '!status': xmlhttp.status 428 }); 429 } else { 430 statusCode = '\n' + Drupal.t('An AJAX HTTP request terminated abnormally.'); 431 } 432 statusCode += '\n' + Drupal.t('Debugging information follows.'); 433 var pathText = '\n' + Drupal.t('Path: !uri', { '!uri': uri }); 434 statusText = ''; 435 436 try { 437 statusText = '\n' + Drupal.t('StatusText: !statusText', { 438 '!statusText': $.trim(xmlhttp.statusText) 439 }); 440 } catch (e) {} 441 442 responseText = ''; 443 444 try { 445 responseText = '\n' + Drupal.t('ResponseText: !responseText', { 446 '!responseText': $.trim(xmlhttp.responseText) 447 }); 448 } catch (e) {} 449 450 responseText = responseText.replace(/<("[^"]*"|'[^']*'|[^'">])*>/gi, ''); 451 responseText = responseText.replace(/[\n]+\s+/g, '\n'); 452 453 var readyStateText = xmlhttp.status === 0 ? '\n' + Drupal.t('ReadyState: !readyState', { 454 '!readyState': xmlhttp.readyState 455 }) : ''; 456 457 customMessage = customMessage ? '\n' + Drupal.t('CustomMessage: !customMessage', { 458 '!customMessage': customMessage 459 }) : ''; 460 461 this.message = statusCode + pathText + statusText + customMessage + responseText + readyStateText; 462 463 this.name = 'AjaxError'; 464 }; 465 466 Drupal.AjaxError.prototype = new Error(); 467 Drupal.AjaxError.prototype.constructor = Drupal.AjaxError; 468 469 Drupal.ajax = function (settings) { 470 if (arguments.length !== 1) { 471 throw new Error('Drupal.ajax() function must be called with one configuration object only'); 472 } 473 474 var base = settings.base || false; 475 var element = settings.element || false; 476 delete settings.base; 477 delete settings.element; 478 479 if (!settings.progress && !element) { 480 settings.progress = false; 481 } 482 483 var ajax = new Drupal.Ajax(base, element, settings); 484 ajax.instanceIndex = Drupal.ajax.instances.length; 485 Drupal.ajax.instances.push(ajax); 486 487 return ajax; 488 }; 489 490 Drupal.ajax.instances = []; 491 492 Drupal.ajax.expired = function () { 493 return Drupal.ajax.instances.filter(function (instance) { 494 return instance && instance.element !== false && !document.body.contains(instance.element); 495 }); 496 }; 497 498 Drupal.ajax.bindAjaxLinks = function (element) { 499 $(element).find('.use-ajax').once('ajax').each(function (i, ajaxLink) { 500 var $linkElement = $(ajaxLink); 501 502 var elementSettings = { 503 progress: { type: 'throbber' }, 504 dialogType: $linkElement.data('dialog-type'), 505 dialog: $linkElement.data('dialog-options'), 506 dialogRenderer: $linkElement.data('dialog-renderer'), 507 base: $linkElement.attr('id'), 508 element: ajaxLink 509 }; 510 var href = $linkElement.attr('href'); 511 512 if (href) { 513 elementSettings.url = href; 514 elementSettings.event = 'click'; 515 } 516 Drupal.ajax(elementSettings); 517 }); 518 }; 519 520 Drupal.Ajax = function (base, element, elementSettings) { 521 var defaults = { 522 event: element ? 'mousedown' : null, 523 keypress: true, 524 selector: base ? '#' + base : null, 525 effect: 'none', 526 speed: 'none', 527 method: 'replaceWith', 528 progress: { 529 type: 'throbber', 530 message: Drupal.t('Please wait...') 531 }, 532 submit: { 533 js: true 534 } 535 }; 536 537 $.extend(this, defaults, elementSettings); 538 539 this.commands = new Drupal.AjaxCommands(); 540 541 this.instanceIndex = false;
542 543 if (this.wrapper) { 544 this.wrapper = '#' + this.wrapper; 545 } 546 547 this.element = element; 548 549 this.element_settings = elementSettings; 550 551 this.elementSettings = elementSettings; 552 553 if (this.element && this.element.form) { 554 this.$form = $(this.element.form); 555 } 556 557 if (!this.url) { 558 var $element = $(this.element); 559 if ($element.is('a')) { 560 this.url = $element.attr('href'); 561 } else if (this.element && element.form) { 562 this.url = this.$form.attr('action'); 563 } 564 } 565 566 var originalUrl = this.url; 567 568 this.url = this.url.replace(/\/nojs(\/|$|\?|#)/, '/ajax$1'); 569 570 if (drupalSettings.ajaxTrustedUrl[originalUrl]) { 571 drupalSettings.ajaxTrustedUrl[this.url] = true; 572 } 573 574 var ajax = this; 575 576 ajax.options = { 577 url: ajax.url, 578 data: ajax.submit, 579 beforeSerialize: function beforeSerialize(elementSettings, options) { 580 return ajax.beforeSerialize(elementSettings, options); 581 }, 582 beforeSubmit: function beforeSubmit(formValues, elementSettings, options) { 583 ajax.ajaxing = true; 584 return ajax.beforeSubmit(formValues, elementSettings, options); 585 }, 586 beforeSend: function beforeSend(xmlhttprequest, options) { 587 ajax.ajaxing = true; 588 return ajax.beforeSend(xmlhttprequest, options); 589 }, 590 success: function success(response, status, xmlhttprequest) { 591 if (typeof response === 'string') { 592 response = $.parseJSON(response); 593 } 594 595 if (response !== null && !drupalSettings.ajaxTrustedUrl[ajax.url]) { 596 if (xmlhttprequest.getResponseHeader('X-Drupal-Ajax-Token') !== '1') { 597 var customMessage = Drupal.t('The response failed verification so will not be processed.'); 598 return ajax.error(xmlhttprequest, ajax.url, customMessage); 599 } 600 } 601 602 return ajax.success(response, status); 603 }, 604 complete: function complete(xmlhttprequest, status) { 605 ajax.ajaxing = false; 606 if (status === 'error' || status === 'parsererror') { 607 return ajax.error(xmlhttprequest, ajax.url); 608 } 609 }, 610 611 dataType: 'json', 612 jsonp: false, 613 type: 'POST' 614 }; 615 616 if (elementSettings.dialog) { 617 ajax.options.data.dialogOptions = elementSettings.dialog; 618 } 619 620 if (ajax.options.url.indexOf('?') === -1) { 621 ajax.options.url += '?'; 622 } else { 623 ajax.options.url += '&'; 624 } 625 626 var wrapper = 'drupal_' + (elementSettings.dialogType || 'ajax'); 627 if (elementSettings.dialogRenderer) { 628 wrapper += '.' + elementSettings.dialogRenderer; 629 } 630 ajax.options.url += Drupal.ajax.WRAPPER_FORMAT + '=' + wrapper; 631 632 $(ajax.element).on(elementSettings.event, function (event) { 633 if (!drupalSettings.ajaxTrustedUrl[ajax.url] && !Drupal.url.isLocal(ajax.url)) { 634 throw new Error(Drupal.t('The callback URL is not local and not trusted: !url', { 635 '!url': ajax.url 636 })); 637 } 638 return ajax.eventResponse(this, event); 639 }); 640 641 if (elementSettings.keypress) { 642 $(ajax.element).on('keypress', function (event) { 643 return ajax.keypressResponse(this, event); 644 }); 645 } 646 647 if (elementSettings.prevent) { 648 $(ajax.element).on(elementSettings.prevent, false); 649 } 650 }; 651 652 Drupal.ajax.WRAPPER_FORMAT = '_wrapper_format'; 653 654 Drupal.Ajax.AJAX_REQUEST_PARAMETER = '_drupal_ajax'; 655 656 Drupal.Ajax.prototype.execute = function () { 657 if (this.ajaxing) { 658 return; 659 } 660 661 try { 662 this.beforeSerialize(this.element, this.options); 663 664 return $.ajax(this.options); 665 } catch (e) { 666 this.ajaxing = false; 667 window.alert('An error occurred while attempting to process ' + this.options.url + ': ' + e.message); 668 669 return $.Deferred().reject(); 670 } 671 }; 672 673 Drupal.Ajax.prototype.keypressResponse = function (element, event) { 674 var ajax = this; 675 676 if (event.which === 13 || event.which === 32 && element.type !== 'text' && element.type !== 'textarea' && element.type !== 'tel' && element.type !== 'number') { 677 event.preventDefault(); 678 event.stopPropagation(); 679 $(element).trigger(ajax.elementSettings.event); 680 } 681 }; 682 683 Drupal.Ajax.prototype.eventResponse = function (element, event) { 684 event.preventDefault(); 685 event.stopPropagation(); 686 687 var ajax = this; 688 689 if (ajax.ajaxing) { 690 return; 691 } 692 693 try { 694 if (ajax.$form) { 695 if (ajax.setClick) { 696 element.form.clk = element; 697 } 698 699 ajax.$form.ajaxSubmit(ajax.options); 700 } else { 701 ajax.beforeSerialize(ajax.element, ajax.options); 702 $.ajax(ajax.options); 703 } 704 } catch (e) { 705 ajax.ajaxing = false;
706 window.alert('An error occurred while attempting to process ' + ajax.options.url + ': ' + e.message); 707 } 708 }; 709 710 Drupal.Ajax.prototype.beforeSerialize = function (element, options) { 711 if (this.$form && document.body.contains(this.$form.get(0))) { 712 var settings = this.settings || drupalSettings; 713 Drupal.detachBehaviors(this.$form.get(0), settings, 'serialize'); 714 } 715 716 options.data[Drupal.Ajax.AJAX_REQUEST_PARAMETER] = 1; 717 718 var pageState = drupalSettings.ajaxPageState; 719 options.data['ajax_page_state[theme]'] = pageState.theme; 720 options.data['ajax_page_state[theme_token]'] = pageState.theme_token; 721 options.data['ajax_page_state[libraries]'] = pageState.libraries; 722 }; 723 724 Drupal.Ajax.prototype.beforeSubmit = function (formValues, element, options) {}; 725 726 Drupal.Ajax.prototype.beforeSend = function (xmlhttprequest, options) { 727 if (this.$form) { 728 options.extraData = options.extraData || {}; 729 730 options.extraData.ajax_iframe_upload = '1'; 731 732 var v = $.fieldValue(this.element); 733 if (v !== null) { 734 options.extraData[this.element.name] = v; 735 } 736 } 737 738 $(this.element).prop('disabled', true); 739 740 if (!this.progress || !this.progress.type) { 741 return; 742 } 743 744 var progressIndicatorMethod = 'setProgressIndicator' + this.progress.type.slice(0, 1).toUpperCase() + this.progress.type.slice(1).toLowerCase(); 745 if (progressIndicatorMethod in this && typeof this[progressIndicatorMethod] === 'function') { 746 this[progressIndicatorMethod].call(this); 747 } 748 }; 749 750 Drupal.theme.ajaxProgressThrobber = function (message) { 751 var messageMarkup = typeof message === 'string' ? Drupal.theme('ajaxProgressMessage', message) : ''; 752 var throbber = '<div class="throbber"> </div>'; 753 754 return '<div class="ajax-progress ajax-progress-throbber">' + throbber + messageMarkup + '</div>'; 755 }; 756 757 Drupal.theme.ajaxProgressIndicatorFullscreen = function () { 758 return '<div class="ajax-progress ajax-progress-fullscreen"> </div>'; 759 }; 760 761 Drupal.theme.ajaxProgressMessage = function (message) { 762 return '<div class="message">' + message + '</div>'; 763 }; 764 765 Drupal.theme.ajaxProgressBar = function ($element) { 766 return $('<div class="ajax-progress ajax-progress-bar"></div>').append($element); 767 }; 768 769 Drupal.Ajax.prototype.setProgressIndicatorBar = function () { 770 var progressBar = new Drupal.ProgressBar('ajax-progress-' + this.element.id, $.noop, this.progress.method, $.noop); 771 if (this.progress.message) { 772 progressBar.setProgress(-1, this.progress.message); 773 } 774 if (this.progress.url) { 775 progressBar.startMonitoring(this.progress.url, this.progress.interval || 1500); 776 } 777 this.progress.element = $(Drupal.theme('ajaxProgressBar', progressBar.element)); 778 this.progress.object = progressBar; 779 $(this.element).after(this.progress.element); 780 }; 781 782 Drupal.Ajax.prototype.setProgressIndicatorThrobber = function () { 783 this.progress.element = $(Drupal.theme('ajaxProgressThrobber', this.progress.message)); 784 $(this.element).after(this.progress.element); 785 }; 786 787 Drupal.Ajax.prototype.setProgressIndicatorFullscreen = function () { 788 this.progress.element = $(Drupal.theme('ajaxProgressIndicatorFullscreen')); 789 $('body').append(this.progress.element); 790 }; 791 792 Drupal.Ajax.prototype.success = function (response, status) { 793 var _this = this; 794 795 if (this.progress.element) { 796 $(this.progress.element).remove(); 797 } 798 if (this.progress.object) { 799 this.progress.object.stopMonitoring(); 800 } 801 $(this.element).prop('disabled', false); 802 803 var elementParents = $(this.element).parents('[data-drupal-selector]').addBack().toArray(); 804 805 var focusChanged = false; 806 Object.keys(response || {}).forEach(function (i) { 807 if (response[i].command && _this.commands[response[i].command]) { 808 _this.commands[response[i].command](_this, response[i], status); 809 if (response[i].command === 'invoke' && response[i].method === 'focus') { 810 focusChanged = true; 811 } 812 } 813 }); 814 815 if (!focusChanged && this.element && !$(this.element).data('disable-refocus')) { 816 var target = false;
817 818 for (var n = elementParents.length - 1; !target && n >= 0; n--) { 819 target = document.querySelector('[data-drupal-selector="' + elementParents[n].getAttribute('data-drupal-selector') + '"]'); 820 } 821 822 if (target) { 823 $(target).trigger('focus'); 824 } 825 } 826 827 if (this.$form && document.body.contains(this.$form.get(0))) { 828 var settings = this.settings || drupalSettings; 829 Drupal.attachBehaviors(this.$form.get(0), settings); 830 } 831 832 this.settings = null; 833 }; 834 835 Drupal.Ajax.prototype.getEffect = function (response) { 836 var type = response.effect || this.effect; 837 var speed = response.speed || this.speed; 838 839 var effect = {}; 840 if (type === 'none') { 841 effect.showEffect = 'show'; 842 effect.hideEffect = 'hide'; 843 effect.showSpeed = ''; 844 } else if (type === 'fade') { 845 effect.showEffect = 'fadeIn'; 846 effect.hideEffect = 'fadeOut'; 847 effect.showSpeed = speed; 848 } else { 849 effect.showEffect = type + 'Toggle'; 850 effect.hideEffect = type + 'Toggle'; 851 effect.showSpeed = speed; 852 } 853 854 return effect; 855 }; 856 857 Drupal.Ajax.prototype.error = function (xmlhttprequest, uri, customMessage) { 858 if (this.progress.element) { 859 $(this.progress.element).remove(); 860 } 861 if (this.progress.object) { 862 this.progress.object.stopMonitoring(); 863 } 864 865 $(this.wrapper).show(); 866 867 $(this.element).prop('disabled', false); 868 869 if (this.$form && document.body.contains(this.$form.get(0))) { 870 var settings = this.settings || drupalSettings; 871 Drupal.attachBehaviors(this.$form.get(0), settings); 872 } 873 throw new Drupal.AjaxError(xmlhttprequest, uri, customMessage); 874 }; 875 876 Drupal.theme.ajaxWrapperNewContent = function ($newContent, ajax, response) { 877 return (response.effect || ajax.effect) !== 'none' && $newContent.filter(function (i) { 878 return !($newContent[i].nodeName === '#comment' || $newContent[i].nodeName === '#text' && /^(\s|\n|\r)*$/.test($newContent[i].textContent)); 879 }).length > 1 ? Drupal.theme('ajaxWrapperMultipleRootElements', $newContent) : $newContent; 880 }; 881 882 Drupal.theme.ajaxWrapperMultipleRootElements = function ($elements) { 883 return $('<div></div>').append($elements); 884 }; 885 886 Drupal.AjaxCommands = function () {}; 887 Drupal.AjaxCommands.prototype = { 888 insert: function insert(ajax, response) { 889 var $wrapper = response.selector ? $(response.selector) : $(ajax.wrapper); 890 var method = response.method || ajax.method; 891 var effect = ajax.getEffect(response); 892 893 var settings = response.settings || ajax.settings || drupalSettings; 894 895 var $newContent = $($.parseHTML(response.data, document, true)); 896 897 $newContent = Drupal.theme('ajaxWrapperNewContent', $newContent, ajax, response); 898 899 switch (method) { 900 case 'html': 901 case 'replaceWith': 902 case 'replaceAll': 903 case 'empty': 904 case 'remove': 905 Drupal.detachBehaviors($wrapper.get(0), settings); 906 break; 907 default: 908 break; 909 } 910 911 $wrapper[method]($newContent); 912 913 if (effect.showEffect !== 'show') { 914 $newContent.hide(); 915 } 916 917 var $ajaxNewContent = $newContent.find('.ajax-new-content'); 918 if ($ajaxNewContent.length) { 919 $ajaxNewContent.hide(); 920 $newContent.show(); 921 $ajaxNewContent[effect.showEffect](effect.showSpeed); 922 } else if (effect.showEffect !== 'show') { 923 $newContent[effect.showEffect](effect.showSpeed); 924 } 925 926 if ($newContent.parents('html').length) { 927 $newContent.each(function (index, element) { 928 if (element.nodeType === Node.ELEMENT_NODE) { 929 Drupal.attachBehaviors(element, settings); 930 } 931 }); 932 } 933 }, 934 remove: function remove(ajax, response, status) { 935 var settings = response.settings || ajax.settings || drupalSettings; 936 $(response.selector).each(function () { 937 Drupal.detachBehaviors(this, settings); 938 }).remove(); 939 }, 940 changed: function changed(ajax, response, status) { 941 var $element = $(response.selector); 942 if (!$element.hasClass('ajax-changed')) { 943 $element.addClass('ajax-changed'); 944 if (response.asterisk) { 945 $element.find(response.asterisk).append(' <abbr class="ajax-changed" title="' + Drupal.t('Changed') + '">*</abbr> '); 946 } 947 } 948 }, 949 alert: function alert(ajax, response, status) { 950 window.alert(response.text, response.title); 951 }, 952 announce: function announce(ajax, response) { 953 if (response.priority) { 954 Drupal.announce(response.text, response.priority); 955 } else { 956 Drupal.announce(response.text); 957 } 958 }, 959 redirect: function redirect(ajax, response, status) { 960 window.location = response.url; 961 }, 962 css: function css(ajax, response, status) { 963 $(response.selector).css(response.argument); 964 }, 965 settings: function settings(ajax, response, status) { 966 var ajaxSettings = drupalSettings.ajax; 967 968 if (ajaxSettings) {
969 Drupal.ajax.expired().forEach(function (instance) { 970 971 if (instance.selector) { 972 var selector = instance.selector.replace('#', ''); 973 if (selector in ajaxSettings) { 974 delete ajaxSettings[selector]; 975 } 976 } 977 }); 978 } 979 980 if (response.merge) { 981 $.extend(true, drupalSettings, response.settings); 982 } else { 983 ajax.settings = response.settings; 984 } 985 }, 986 data: function data(ajax, response, status) { 987 $(response.selector).data(response.name, response.value); 988 }, 989 invoke: function invoke(ajax, response, status) { 990 var $element = $(response.selector); 991 $element[response.method].apply($element, _toConsumableArray(response.args)); 992 }, 993 restripe: function restripe(ajax, response, status) { 994 $(response.selector).find('> tbody > tr:visible, > tr:visible').removeClass('odd even').filter(':even').addClass('odd').end().filter(':odd').addClass('even'); 995 }, 996 update_build_id: function update_build_id(ajax, response, status) { 997 $('input[name="form_build_id"][value="' + response.old + '"]').val(response.new); 998 }, 999 add_css: function add_css(ajax, response, status) { 1000 $('head').prepend(response.data); 1001 }, 1002 message: function message(ajax, response) { 1003 var messages = new Drupal.Message(document.querySelector(response.messageWrapperQuerySelector)); 1004 if (response.clearPrevious) { 1005 messages.clear(); 1006 } 1007 messages.add(response.message, response.messageOptions); 1008 } 1009 }; 1010})(jQuery, window, Drupal, drupalSettings);; 1011/** 1012* DO NOT EDIT THIS FILE. 1013* See the following change record for more information, 1014* https://www.drupal.org/node/2815083 1015* @preserve 1016**/ 1017 1018(function (Drupal) { 1019 Drupal.theme.ajaxProgressBar = function ($element) { 1020 return $element.addClass('ajax-progress ajax-progress-bar'); 1021 }; 1022})(Drupal);;
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.