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**/ 7(function ($, Drupal) { 8 Drupal.theme.progressBar = function (id) { 9 return "<div id=\"".concat(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>'; 10 }; 11 Drupal.ProgressBar = function (id, updateCallback, method, errorCallback) { 12 this.id = id; 13 this.method = method || 'GET'; 14 this.updateCallback = updateCallback; 15 this.errorCallback = errorCallback; 16 this.element = $(Drupal.theme('progressBar', id)); 17 }; 18 $.extend(Drupal.ProgressBar.prototype, { 19 setProgress: function setProgress(percentage, message, label) { 20 if (percentage >= 0 && percentage <= 100) { 21 $(this.element).find('div.progress__bar').css('width', "".concat(percentage, "%")); 22 $(this.element).find('div.progress__percentage').html("".concat(percentage, "%")); 23 } 24 $('div.progress__description', this.element).html(message); 25 $('div.progress__label', this.element).html(label); 26 if (this.updateCallback) { 27 this.updateCallback(percentage, message, this); 28 } 29 }, 30 startMonitoring: function startMonitoring(uri, delay) { 31 this.delay = delay; 32 this.uri = uri; 33 this.sendPing(); 34 }, 35 stopMonitoring: function stopMonitoring() { 36 clearTimeout(this.timer); 37 this.uri = null; 38 }, 39 sendPing: function sendPing() { 40 if (this.timer) { 41 clearTimeout(this.timer); 42 } 43 if (this.uri) { 44 var pb = this; 45 var uri = this.uri; 46 if (uri.indexOf('?') === -1) { 47 uri += '?'; 48 } else { 49 uri += '&'; 50 } 51 uri += '_format=json'; 52 $.ajax({ 53 type: this.method, 54 url: uri, 55 data: '', 56 dataType: 'json', 57 success: function success(progress) { 58 if (progress.status === 0) { 59 pb.displayError(progress.data); 60 return; 61 } 62 pb.setProgress(progress.percentage, progress.message, progress.label); 63 pb.timer = setTimeout(function () { 64 pb.sendPing(); 65 }, pb.delay); 66 }, 67 error: function error(xmlhttp) { 68 var e = new Drupal.AjaxError(xmlhttp, pb.uri); 69 pb.displayError("<pre>".concat(e.message, "</pre>")); 70 } 71 }); 72 } 73 }, 74 displayError: function displayError(string) { 75 var error = $('<div class="messages messages--error"></div>').html(string); 76 $(this.element).before(error).hide(); 77 if (this.errorCallback) { 78 this.errorCallback(this); 79 } 80 } 81 }); 82})(jQuery, Drupal);; 83loadjs=function(){var h=function(){},c={},u={},f={};function o(e,n){if(e){var r=f[e];if(u[e]=n,r)for(;r.length;)r[0](e,n),r.splice(0,1)}}function l(e,n){e.call&&(e={success:e}),n.length?(e.error||h)(n):(e.success||h)(e)}function d(r,t,s,i){var c,o,e=document,n=s.async,u=(s.numRetries||0)+1,f=s.before||h,l=r.replace(/[\?|#].*$/,""),a=r.replace(/^(css|img)!/,"");i=i||0,/(^css!|\.css$)/.test(l)?((o=e.createElement("link")).rel="stylesheet",o.href=a,(c="hideFocus"in o)&&o.relList&&(c=0,o.rel="preload",o.as="style")):/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(l)?(o=e.createElement("img")).src=a:((o=e.createElement("script")).src=r,o.async=void 0===n||n),!(o.onload=o.onerror=o.onbeforeload=function(e){var n=e.type[0];if(c)try{o.sheet.cssText.length||(n="e")}catch(e){18!=e.code&&(n="e")}if("e"==n){if((i+=1)<u)return d(r,t,s,i)}else if("preload"==o.rel&&"style"==o.as)return o.rel="stylesheet";t(r,n,e.defaultPrevented)})!==f(r,o)&&e.head.appendChild(o)}function r(e,n,r){var t,s;if(n&&n.trim&&(t=n),s=(t?r:n)||{},t){if(t in c)throw"LoadJS";c[t]=!0}function i(n,r){!function(e,t,n){var r,s,i=(e=e.push?e:[e]).length,c=i,o=[];for(r=function(e,n,r){if("e"==n&&o.push(e),"b"==n){if(!r)return;o.push(e)}--i||t(o)},s=0;s<c;s++)d(e[s],r,n)}(e,function(e){l(s,e),n&&l({success:n,error:r},e),o(t,e)},s)}if(s.returnPromise)return new Promise(i);i()}return r.ready=function(e,n){return function(e,r){e=e.push?e:[e];var n,t,s,i=[],c=e.length,o=c;
83for(n=function(e,n){n.length&&i.push(e),--o||r(i)};c--;)t=e[c],(s=u[t])?n(t,s):(f[t]=f[t]||[]).push(n)}(e,function(e){l(n,e)}),r},r.done=function(e){o(e,[])},r.reset=function(){c={},u={},f={}},r.isDefined=function(e){return e in c},r}();; 84/** 85* DO NOT EDIT THIS FILE. 86* See the following change record for more information, 87* https://www.drupal.org/node/2815083 88* @preserve 89**/ 90(function (Drupal) { 91 Drupal.behaviors.responsiveImageAJAX = { 92 attach: function attach() { 93 if (window.picturefill) { 94 window.picturefill(); 95 } 96 } 97 }; 98})(Drupal);; 99/** 100* DO NOT EDIT THIS FILE. 101* See the following change record for more information, 102* https://www.drupal.org/node/2815083 103* @preserve 104**/ 105function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } 106function _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."); } 107function _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); } 108function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } 109function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } 110function _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; } 111(function ($, window, Drupal, drupalSettings, loadjs, _ref) { 112 var isFocusable = _ref.isFocusable, 113 tabbable = _ref.tabbable; 114 Drupal.behaviors.AJAX = { 115 attach: function attach(context, settings) { 116 function loadAjaxBehavior(base) { 117 var elementSettings = settings.ajax[base]; 118 if (typeof elementSettings.selector === 'undefined') { 119 elementSettings.selector = "#".concat(base); 120 } 121 once('drupal-ajax', $(elementSettings.selector)).forEach(function (el) { 122 elementSettings.element = el; 123 elementSettings.base = base; 124 Drupal.ajax(elementSettings); 125 }); 126 } 127 Object.keys(settings.ajax || {}).forEach(function (base) { 128 return loadAjaxBehavior(base); 129 }); 130 Drupal.ajax.bindAjaxLinks(document.body); 131 once('ajax', '.use-ajax-submit').forEach(function (el) { 132 var elementSettings = {}; 133 elementSettings.url = $(el.form).attr('action'); 134 elementSettings.setClick = true; 135 elementSettings.event = 'click'; 136 elementSettings.progress = { 137 type: 'throbber' 138 }; 139 elementSettings.base = el.id; 140 elementSettings.element = el; 141 Drupal.ajax(elementSettings); 142 }); 143 }, 144 detach: function detach(context, settings, trigger) { 145 if (trigger === 'unload') { 146 Drupal.ajax.expired().forEach(function (instance) { 147 Drupal.ajax.instances[instance.instanceIndex] = null; 148 }); 149 } 150 } 151 }; 152 Drupal.AjaxError = function (xmlhttp, uri, customMessage) { 153 var statusCode; 154 var statusText; 155 var responseText; 156 if (xmlhttp.status) { 157 statusCode = "\n".concat(Drupal.t('An AJAX HTTP error occurred.'), "\n").concat(Drupal.t('HTTP Result Code: !status', { 158 '!status': xmlhttp.status 159 })); 160 } else { 161 statusCode = "\n".concat(Drupal.t('An AJAX HTTP request terminated abnormally.')); 162 } 163 statusCode += "\n".concat(Drupal.t('Debugging information follows.')); 164 var pathText = "\n".concat(Drupal.t('Path: !uri', { 165 '!uri': uri 166 })); 167 statusText = ''; 168 try { 169 statusText = "\n".concat(Drupal.t('StatusText: !statusText', { 170 '!statusText': xmlhttp.statusText.trim() 171 })); 172 } catch (e) {} 173 responseText = ''; 174 try { 175 responseText = "\n".concat(Drupal.t('ResponseText: !responseText', { 176 '!responseText': xmlhttp.responseText.trim() 177 })); 178 } catch (e) {} 179 responseText = responseText.replace(/<("[^"]*"|'[^']*'|[^'">])*>/gi, ''); 180 responseText = responseText.replace(/[\n]+\s+/g, '\n'); 181 var readyStateText = xmlhttp.status === 0 ? "\n".concat(Drupal.t('ReadyState: !readyState', { 182 '!readyState': xmlhttp.readyState 183 })) : ''; 184 customMessage = customMessage ? "\n".concat(Drupal.t('CustomMessage: !customMessage', { 185 '!customMessage': customMessage 186 })) : ''; 187 this.message = statusCode + pathText + statusText + customMessage + responseText + readyStateText; 188 this.name = 'AjaxError'; 189 }; 190 Drupal.AjaxError.prototype = new Error(); 191 Drupal.AjaxError.prototype.constructor = Drupal.AjaxError; 192 Drupal.ajax = function (settings) { 193 if (arguments.length !== 1) { 194 throw new Error('Drupal.ajax() function must be called with one configuration object only'); 195 } 196 var base = settings.base || false; 197 var element = settings.element || false; 198 delete settings.base; 199 delete settings.element; 200 if (!settings.progress && !element) { 201 settings.progress = false;
202 } 203 var ajax = new Drupal.Ajax(base, element, settings); 204 ajax.instanceIndex = Drupal.ajax.instances.length; 205 Drupal.ajax.instances.push(ajax); 206 return ajax; 207 }; 208 Drupal.ajax.instances = []; 209 Drupal.ajax.expired = function () { 210 return Drupal.ajax.instances.filter(function (instance) { 211 return instance && instance.element !== false && !document.body.contains(instance.element); 212 }); 213 }; 214 Drupal.ajax.bindAjaxLinks = function (element) { 215 once('ajax', '.use-ajax', element).forEach(function (ajaxLink) { 216 var $linkElement = $(ajaxLink); 217 var elementSettings = { 218 progress: { 219 type: 'throbber' 220 }, 221 dialogType: $linkElement.data('dialog-type'), 222 dialog: $linkElement.data('dialog-options'), 223 dialogRenderer: $linkElement.data('dialog-renderer'), 224 base: $linkElement.attr('id'), 225 element: ajaxLink 226 }; 227 var href = $linkElement.attr('href'); 228 if (href) { 229 elementSettings.url = href; 230 elementSettings.event = 'click'; 231 } 232 Drupal.ajax(elementSettings); 233 }); 234 }; 235 Drupal.Ajax = function (base, element, elementSettings) { 236 var defaults = { 237 event: element ? 'mousedown' : null, 238 keypress: true, 239 selector: base ? "#".concat(base) : null, 240 effect: 'none', 241 speed: 'none', 242 method: 'replaceWith', 243 progress: { 244 type: 'throbber', 245 message: Drupal.t('Please wait...') 246 }, 247 submit: { 248 js: true 249 } 250 }; 251 $.extend(this, defaults, elementSettings); 252 this.commands = new Drupal.AjaxCommands(); 253 this.instanceIndex = false; 254 if (this.wrapper) { 255 this.wrapper = "#".concat(this.wrapper); 256 } 257 this.element = element; 258 this.element_settings = elementSettings; 259 this.elementSettings = elementSettings; 260 if (this.element && this.element.form) { 261 this.$form = $(this.element.form); 262 } 263 if (!this.url) { 264 var $element = $(this.element); 265 if ($element.is('a')) { 266 this.url = $element.attr('href'); 267 } else if (this.element && element.form) { 268 this.url = this.$form.attr('action'); 269 } 270 } 271 var originalUrl = this.url; 272 this.url = this.url.replace(/\/nojs(\/|$|\?|#)/, '/ajax$1'); 273 if (drupalSettings.ajaxTrustedUrl[originalUrl]) { 274 drupalSettings.ajaxTrustedUrl[this.url] = true; 275 } 276 var ajax = this; 277 ajax.options = { 278 url: ajax.url, 279 data: ajax.submit, 280 isInProgress: function isInProgress() { 281 return ajax.ajaxing; 282 }, 283 beforeSerialize: function beforeSerialize(elementSettings, options) { 284 return ajax.beforeSerialize(elementSettings, options); 285 }, 286 beforeSubmit: function beforeSubmit(formValues, elementSettings, options) { 287 ajax.ajaxing = true; 288 return ajax.beforeSubmit(formValues, elementSettings, options); 289 }, 290 beforeSend: function beforeSend(xmlhttprequest, options) { 291 ajax.ajaxing = true; 292 return ajax.beforeSend(xmlhttprequest, options); 293 }, 294 success: function success(response, status, xmlhttprequest) { 295 var _this = this; 296 if (typeof response === 'string') { 297 response = $.parseJSON(response); 298 } 299 if (response !== null && !drupalSettings.ajaxTrustedUrl[ajax.url]) { 300 if (xmlhttprequest.getResponseHeader('X-Drupal-Ajax-Token') !== '1') { 301 var customMessage = Drupal.t('The response failed verification so will not be processed.'); 302 return ajax.error(xmlhttprequest, ajax.url, customMessage); 303 } 304 } 305 return Promise.resolve(ajax.success(response, status)).then(function () { 306 ajax.ajaxing = false; 307 $(document).trigger('ajaxSuccess', [xmlhttprequest, _this]); 308 $(document).trigger('ajaxComplete', [xmlhttprequest, _this]); 309 if (--$.active === 0) { 310 $(document).trigger('ajaxStop'); 311 } 312 }); 313 }, 314 error: function error(xmlhttprequest, status, _error) { 315 ajax.ajaxing = false; 316 }, 317 complete: function complete(xmlhttprequest, status) { 318 if (status === 'error' || status === 'parsererror') { 319 return ajax.error(xmlhttprequest, ajax.url); 320 } 321 }, 322 dataType: 'json', 323 jsonp: false, 324 type: 'POST' 325 }; 326 if (elementSettings.dialog) { 327 ajax.options.data.dialogOptions = elementSettings.dialog; 328 } 329 if (ajax.options.url.indexOf('?') === -1) { 330 ajax.options.url += '?'; 331 } else { 332 ajax.options.url += '&'; 333 } 334 var wrapper = "drupal_".concat(elementSettings.dialogType || 'ajax'); 335 if (elementSettings.dialogRenderer) { 336 wrapper += ".".concat(elementSettings.dialogRenderer); 337 } 338 ajax.options.url += "".concat(Drupal.ajax.WRAPPER_FORMAT, "=").concat(wrapper); 339 $(ajax.element).on(elementSettings.event, function (event) { 340 if (!drupalSettings.ajaxTrustedUrl[ajax.url] && !Drupal.url.isLocal(ajax.url)) { 341 throw new Error(Drupal.t('The callback URL is not local and n
341ot trusted: !url', { 342 '!url': ajax.url 343 })); 344 } 345 return ajax.eventResponse(this, event); 346 }); 347 if (elementSettings.keypress) { 348 $(ajax.element).on('keypress', function (event) { 349 return ajax.keypressResponse(this, event); 350 }); 351 } 352 if (elementSettings.prevent) { 353 $(ajax.element).on(elementSettings.prevent, false); 354 } 355 }; 356 Drupal.ajax.WRAPPER_FORMAT = '_wrapper_format'; 357 Drupal.Ajax.AJAX_REQUEST_PARAMETER = '_drupal_ajax'; 358 Drupal.Ajax.prototype.execute = function () { 359 if (this.ajaxing) { 360 return; 361 } 362 try { 363 this.beforeSerialize(this.element, this.options); 364 return $.ajax(this.options); 365 } catch (e) { 366 this.ajaxing = false; 367 window.alert("An error occurred while attempting to process ".concat(this.options.url, ": ").concat(e.message)); 368 return $.Deferred().reject(); 369 } 370 }; 371 Drupal.Ajax.prototype.keypressResponse = function (element, event) { 372 var ajax = this; 373 if (event.which === 13 || event.which === 32 && element.type !== 'text' && element.type !== 'textarea' && element.type !== 'tel' && element.type !== 'number') { 374 event.preventDefault(); 375 event.stopPropagation(); 376 $(element).trigger(ajax.elementSettings.event); 377 } 378 }; 379 Drupal.Ajax.prototype.eventResponse = function (element, event) { 380 event.preventDefault(); 381 event.stopPropagation(); 382 var ajax = this; 383 if (ajax.ajaxing) { 384 return; 385 } 386 try { 387 if (ajax.$form) { 388 if (ajax.setClick) { 389 element.form.clk = element; 390 } 391 ajax.$form.ajaxSubmit(ajax.options); 392 } else { 393 ajax.beforeSerialize(ajax.element, ajax.options); 394 $.ajax(ajax.options); 395 } 396 } catch (e) { 397 ajax.ajaxing = false; 398 window.alert("An error occurred while attempting to process ".concat(ajax.options.url, ": ").concat(e.message)); 399 } 400 }; 401 Drupal.Ajax.prototype.beforeSerialize = function (element, options) { 402 if (this.$form && document.body.contains(this.$form.get(0))) { 403 var settings = this.settings || drupalSettings; 404 Drupal.detachBehaviors(this.$form.get(0), settings, 'serialize'); 405 } 406 options.data[Drupal.Ajax.AJAX_REQUEST_PARAMETER] = 1; 407 var pageState = drupalSettings.ajaxPageState; 408 options.data['ajax_page_state[theme]'] = pageState.theme; 409 options.data['ajax_page_state[theme_token]'] = pageState.theme_token; 410 options.data['ajax_page_state[libraries]'] = pageState.libraries; 411 }; 412 Drupal.Ajax.prototype.beforeSubmit = function (formValues, element, options) {}; 413 Drupal.Ajax.prototype.beforeSend = function (xmlhttprequest, options) { 414 if (this.$form) { 415 options.extraData = options.extraData || {}; 416 options.extraData.ajax_iframe_upload = '1'; 417 var v = $.fieldValue(this.element); 418 if (v !== null) { 419 options.extraData[this.element.name] = v; 420 } 421 } 422 $(this.element).prop('disabled', true); 423 if (!this.progress || !this.progress.type) { 424 return; 425 } 426 var progressIndicatorMethod = "setProgressIndicator".concat(this.progress.type.slice(0, 1).toUpperCase()).concat(this.progress.type.slice(1).toLowerCase()); 427 if (progressIndicatorMethod in this && typeof this[progressIndicatorMethod] === 'function') { 428 this[progressIndicatorMethod].call(this); 429 } 430 }; 431 Drupal.theme.ajaxProgressThrobber = function (message) { 432 var messageMarkup = typeof message === 'string' ? Drupal.theme('ajaxProgressMessage', message) : ''; 433 var throbber = '<div class="throbber"> </div>'; 434 return "<div class=\"ajax-progress ajax-progress-throbber\">".concat(throbber).concat(messageMarkup, "</div>"); 435 }; 436 Drupal.theme.ajaxProgressIndicatorFullscreen = function () { 437 return '<div class="ajax-progress ajax-progress-fullscreen"> </div>'; 438 }; 439 Drupal.theme.ajaxProgressMessage = function (message) { 440 return "<div class=\"message\">".concat(message, "</div>"); 441 }; 442 Drupal.theme.ajaxProgressBar = function ($element) { 443 return $('<div class="ajax-progress ajax-progress-bar"></div>').append($element); 444 }; 445 Drupal.Ajax.prototype.setProgressIndicatorBar = function () { 446 var progressBar = new Drupal.ProgressBar("ajax-progress-".concat(this.element.i
446d), $.noop, this.progress.method, $.noop); 447 if (this.progress.message) { 448 progressBar.setProgress(-1, this.progress.message); 449 } 450 if (this.progress.url) { 451 progressBar.startMonitoring(this.progress.url, this.progress.interval || 1500); 452 } 453 this.progress.element = $(Drupal.theme('ajaxProgressBar', progressBar.element)); 454 this.progress.object = progressBar; 455 $(this.element).after(this.progress.element); 456 }; 457 Drupal.Ajax.prototype.setProgressIndicatorThrobber = function () { 458 this.progress.element = $(Drupal.theme('ajaxProgressThrobber', this.progress.message)); 459 $(this.element).after(this.progress.element); 460 }; 461 Drupal.Ajax.prototype.setProgressIndicatorFullscreen = function () { 462 this.progress.element = $(Drupal.theme('ajaxProgressIndicatorFullscreen')); 463 $('body').append(this.progress.element); 464 }; 465 Drupal.Ajax.prototype.commandExecutionQueue = function (response, status) { 466 var _this2 = this; 467 var ajaxCommands = this.commands; 468 return Object.keys(response || {}).reduce(function (executionQueue, key) { 469 return executionQueue.then(function () { 470 var command = response[key].command; 471 if (command && ajaxCommands[command]) { 472 return ajaxCommands[command](_this2, response[key], status); 473 } 474 }); 475 }, Promise.resolve()); 476 }; 477 Drupal.Ajax.prototype.success = function (response, status) { 478 var _this3 = this; 479 if (this.progress.element) { 480 $(this.progress.element).remove(); 481 } 482 if (this.progress.object) { 483 this.progress.object.stopMonitoring(); 484 } 485 $(this.element).prop('disabled', false); 486 var elementParents = $(this.element).parents('[data-drupal-selector]').addBack().toArray(); 487 var focusChanged = Object.keys(response || {}).some(function (key) { 488 var _response$key = response[key], 489 command = _response$key.command, 490 method = _response$key.method; 491 return command === 'focusFirst' || command === 'invoke' && method === 'focus'; 492 }); 493 return this.commandExecutionQueue(response, status).then(function () { 494 if (!focusChanged && _this3.element && !$(_this3.element).data('disable-refocus')) { 495 var target = false;
496 for (var n = elementParents.length - 1; !target && n >= 0; n--) { 497 target = document.querySelector("[data-drupal-selector=\"".concat(elementParents[n].getAttribute('data-drupal-selector'), "\"]")); 498 } 499 if (target) { 500 $(target).trigger('focus'); 501 } 502 } 503 if (_this3.$form && document.body.contains(_this3.$form.get(0))) { 504 var settings = _this3.settings || drupalSettings; 505 Drupal.attachBehaviors(_this3.$form.get(0), settings); 506 } 507 _this3.settings = null; 508 }).catch(function (error) { 509 return console.error(Drupal.t('An error occurred during the execution of the Ajax response: !error', { 510 '!error': error 511 })); 512 }); 513 }; 514 Drupal.Ajax.prototype.getEffect = function (response) { 515 var type = response.effect || this.effect; 516 var speed = response.speed || this.speed; 517 var effect = {}; 518 if (type === 'none') { 519 effect.showEffect = 'show'; 520 effect.hideEffect = 'hide'; 521 effect.showSpeed = ''; 522 } else if (type === 'fade') { 523 effect.showEffect = 'fadeIn'; 524 effect.hideEffect = 'fadeOut'; 525 effect.showSpeed = speed; 526 } else { 527 effect.showEffect = "".concat(type, "Toggle"); 528 effect.hideEffect = "".concat(type, "Toggle"); 529 effect.showSpeed = speed; 530 } 531 return effect; 532 }; 533 Drupal.Ajax.prototype.error = function (xmlhttprequest, uri, customMessage) { 534 if (this.progress.element) { 535 $(this.progress.element).remove(); 536 } 537 if (this.progress.object) { 538 this.progress.object.stopMonitoring(); 539 } 540 $(this.wrapper).show(); 541 $(this.element).prop('disabled', false); 542 if (this.$form && document.body.contains(this.$form.get(0))) { 543 var settings = this.settings || drupalSettings; 544 Drupal.attachBehaviors(this.$form.get(0), settings); 545 } 546 throw new Drupal.AjaxError(xmlhttprequest, uri, customMessage); 547 }; 548 Drupal.theme.ajaxWrapperNewContent = function ($newContent, ajax, response) { 549 return (response.effect || ajax.effect) !== 'none' && $newContent.filter(function (i) { 550 return !($newContent[i].nodeName === '#comment' || $newContent[i].nodeName === '#text' && /^(\s|\n|\r)*$/.test($newContent[i].textContent)); 551 }).length > 1 ? Drupal.theme('ajaxWrapperMultipleRootElements', $newContent) : $newContent; 552 }; 553 Drupal.theme.ajaxWrapperMultipleRootElements = function ($elements) { 554 return $('<div></div>').append($elements); 555 }; 556 Drupal.AjaxCommands = function () {}; 557 Drupal.AjaxCommands.prototype = { 558 insert: function insert(ajax, response) { 559 var $wrapper = response.selector ? $(response.selector) : $(ajax.wrapper); 560 var method = response.method || ajax.method; 561 var effect = ajax.getEffect(response); 562 var settings = response.settings || ajax.settings || drupalSettings; 563 var $newContent = $($.parseHTML(response.data, document, true)); 564 $newContent = Drupal.theme('ajaxWrapperNewContent', $newContent, ajax, response); 565 switch (method) { 566 case 'html': 567 case 'replaceWith': 568 case 'replaceAll': 569 case 'empty': 570 case 'remove': 571 Drupal.detachBehaviors($wrapper.get(0), settings); 572 break; 573 default: 574 break; 575 } 576 $wrapper[method]($newContent); 577 if (effect.showEffect !== 'show') { 578 $newContent.hide(); 579 } 580 var $ajaxNewContent = $newContent.find('.ajax-new-content'); 581 if ($ajaxNewContent.length) { 582 $ajaxNewContent.hide(); 583 $newContent.show(); 584 $ajaxNewContent[effect.showEffect](effect.showSpeed); 585 } else if (effect.showEffect !== 'show') { 586 $newContent[effect.showEffect](effect.showSpeed); 587 } 588 if ($newContent.parents('html').length) { 589 $newContent.each(function (index, element) { 590 if (element.nodeType === Node.ELEMENT_NODE) { 591 Drupal.attachBehaviors(element, settings); 592 } 593 }); 594 } 595 }, 596 remove: function remove(ajax, response, status) { 597 var settings = response.settings || ajax.settings || drupalSettings; 598 $(response.selector).each(function () { 599 Drupal.detachBehaviors(this, settings); 600 }).remove(); 601 }, 602 changed: function changed(ajax, response, status) { 603 var $element = $(response.selector); 604 if (!$element.hasClass('ajax-changed')) { 605 $element.addClass('ajax-changed'); 606 if (response.asterisk) { 607 $element.find(response.asterisk).append(" <abbr class=\"ajax-changed\" title=\"".concat(Drupal.t('Changed'), "\">*</abbr> ")); 608 } 609 } 610 }, 611 alert: function alert(ajax, response, status) { 612 window.alert(response.text); 613 }, 614 announce: function announce(ajax, response) { 615 if (response.priority) { 616 Drupal.announce(response.text, response.priority); 617 } else { 618 Drupal.announce(response.text); 619 } 620 }, 621 redirect: function redirect(ajax, response, status) { 622 window.location = response.url; 623 }, 624 css: function css(ajax, response, status) { 625 $(response.selector).css(response.argument); 626 }, 627 settings: function settings(ajax, response, status) { 628 var ajaxSettings = drupalSettings.ajax; 629 if (ajaxSettings) {
630 Drupal.ajax.expired().forEach(function (instance) { 631 if (instance.selector) { 632 var selector = instance.selector.replace('#', ''); 633 if (selector in ajaxSettings) { 634 delete ajaxSettings[selector]; 635 } 636 } 637 }); 638 } 639 if (response.merge) { 640 $.extend(true, drupalSettings, response.settings); 641 } else { 642 ajax.settings = response.settings; 643 } 644 }, 645 data: function data(ajax, response, status) { 646 $(response.selector).data(response.name, response.value); 647 }, 648 focusFirst: function focusFirst(ajax, response, status) { 649 var focusChanged = false; 650 var container = document.querySelector(response.selector); 651 if (container) { 652 var tabbableElements = tabbable(container); 653 if (tabbableElements.length) { 654 tabbableElements[0].focus(); 655 focusChanged = true; 656 } else if (isFocusable(container)) { 657 container.focus(); 658 focusChanged = true; 659 } 660 } 661 if (ajax.hasOwnProperty('element') && !focusChanged) { 662 ajax.element.focus(); 663 } 664 }, 665 invoke: function invoke(ajax, response, status) { 666 var $element = $(response.selector); 667 $element[response.method].apply($element, _toConsumableArray(response.args)); 668 }, 669 restripe: function restripe(ajax, response, status) { 670 $(response.selector).find('> tbody > tr:visible, > tr:visible').removeClass('odd even').filter(':even').addClass('odd').end().filter(':odd').addClass('even'); 671 }, 672 update_build_id: function update_build_id(ajax, response, status) { 673 document.querySelectorAll("input[name=\"form_build_id\"][value=\"".concat(response.old, "\"]")).forEach(function (item) { 674 item.value = response.new; 675 }); 676 }, 677 add_css: function add_css(ajax, response, status) { 678 $('head').prepend(response.data); 679 }, 680 message: function message(ajax, response) { 681 var messages = new Drupal.Message(document.querySelector(response.messageWrapperQuerySelector)); 682 if (response.clearPrevious) { 683 messages.clear(); 684 } 685 messages.add(response.message, response.messageOptions); 686 }, 687 add_js: function add_js(ajax, response, status) { 688 var parentEl = document.querySelector(response.selector || 'body'); 689 var settings = ajax.settings || drupalSettings; 690 var allUniqueBundleIds = response.data.map(function (script) { 691 var uniqueBundleId = script.src + ajax.instanceIndex; 692 loadjs(script.src, uniqueBundleId, { 693 async: false, 694 before: function before(path, scriptEl) { 695 Object.keys(script).forEach(function (attributeKey) { 696 scriptEl.setAttribute(attributeKey, script[attributeKey]); 697 }); 698 parentEl.appendChild(scriptEl); 699 return false; 700 } 701 }); 702 return uniqueBundleId; 703 }); 704 return new Promise(function (resolve, reject) { 705 loadjs.ready(allUniqueBundleIds, { 706 success: function success() { 707 Drupal.attachBehaviors(parentEl, settings); 708 resolve(); 709 }, 710 error: function error(depsNotFound) { 711 var message = Drupal.t("The following files could not be loaded: @dependencies", { 712 '@dependencies': depsNotFound.join(', ') 713 }); 714 reject(message); 715 } 716 }); 717 }); 718 } 719 }; 720 var stopEvent = function stopEvent(xhr, settings) { 721 return xhr.getResponseHeader('X-Drupal-Ajax-Token') === '1' && settings.isInProgress && settings.isInProgress(); 722 }; 723 $.extend(true, $.event.special, { 724 ajaxSuccess: { 725 trigger: function trigger(event, xhr, settings) { 726 if (stopEvent(xhr, settings)) { 727 return false; 728 } 729 } 730 }, 731 ajaxComplete: { 732 trigger: function trigger(event, xhr, settings) { 733 if (stopEvent(xhr, settings)) { 734 $.active++; 735 return false; 736 } 737 } 738 } 739 }); 740})(jQuery, window, Drupal, drupalSettings, loadjs, window.tabbable);; 741/** 742 * @file 743 * JavaScript behaviors for Ajax. 744 */ 745 746(function ($) { 747 748 'use strict'; 749 750 /** 751 * Command to render all Turnstile captchas in the page if they are empty. 752 */ 753 Drupal.AjaxCommands.prototype.turnstileRender = function () { 754 window.onloadTurnstileCallback(); 755 } 756 757 window.onloadTurnstileCallback = function () { 758 $('.cf-turnstile').each(function () { 759 // Render Turnstile widget again for empty containers. 760 if ($(this).is(':empty')) { 761 turnstile.render(this); 762 } 763 }); 764 }; 765 766})(jQuery); 767; 768/** 769 * @file 770 * Defines Javascript behaviors for MegaMenu frontend. 771 */ 772 773(function ($, Drupal, drupalSettings) { 774 "use strict"; 775 776 Drupal.TBMegaMenu = Drupal.TBMegaMenu || {}; 777 778 Drupal.TBMegaMenu.oldWindowWidth = 0; 779 Drupal.TBMegaMenu.displayedMenuMobile = false;
780 Drupal.TBMegaMenu.supportedScreens = [980]; 781 Drupal.TBMegaMenu.focusableElements = 'a:not([disabled]), button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), details:not([disabled]), [tabindex]:not([disabled]):not([tabindex="-1"])'; 782 Drupal.TBMegaMenu.menuResponsive = function () { 783 var windowWidth = window.innerWidth ? window.innerWidth : $(window).width(); 784 var navCollapse = $('.tb-megamenu').children('.nav-collapse'); 785 if (windowWidth < Drupal.TBMegaMenu.supportedScreens[0]) { 786 navCollapse.addClass('collapse'); 787 if (Drupal.TBMegaMenu.displayedMenuMobile) { 788 navCollapse.css({height: 'auto', overflow: 'visible'}); 789 } 790 else { 791 navCollapse.css({height: 0, overflow: 'hidden'}); 792 } 793 } 794 else { 795 // If width of window is greater than 980 (supported screen). 796 navCollapse.removeClass('collapse'); 797 if (navCollapse.height() <= 0) { 798 navCollapse.css({height: 'auto', overflow: 'visible'}); 799 } 800 } 801 }; 802 803 Drupal.TBMegaMenu.focusNextPrevElement = function (direction) { 804 // Add all the elements we want to include in our selection 805 var $current = $(document.activeElement); 806 807 if ($current.length) { 808 var $focusable = $(Drupal.TBMegaMenu.focusableElements).filter(function () { 809 var $this = $(this); 810 return $this.closest('.tb-megamenu-subnav').length === 0 && $this.is(':visible'); 811 }) 812 813 var index = $focusable.index($current); 814 if (index > -1) { 815 if (direction === 'next') { 816 var nextElement = $focusable[index + 1] || $focusable[0]; 817 } 818 else { 819 var nextElement = $focusable[index - 1] || $focusable[0]; 820 } 821 822 nextElement.focus(); 823 } 824 } 825 } 826 827 828 Drupal.behaviors.tbMegaMenuAction = { 829 attach: function (context, settings) { 830 831 $('.tb-megamenu', context).once('tb-megamenu').each(function () { 832 833 /* Keyboard Control Setup */ 834 // Semi-Global Variables 835 var navParent = document.querySelector('.tb-megamenu'), 836 linkArray = new Array(), 837 curPos = new Array(-1,-1,-1); 838 839 // Each Top-Level Link 840 $(this).find('.level-1').children('a, span').not('.mobile-only').each(function (i, toplink) { 841 linkArray[i] = new Array(); 842 843 // Add Link to Array 844 linkArray[i][-1] = toplink; 845 846 // Determine Coordinates 847 $(toplink).data({ coordinate: [i, -1] }); 848 849 // Each Column 850 $(toplink).next().children().children().children('.mega-col-nav').each(function (j, column) { 851 // Only add to the linkArray if menu items exist. 852 // TODO - this does not allow for tabbing to links in blocks, only menu item links. 853 if ($(column).find(Drupal.TBMegaMenu.focusableElements).length > 0) { 854 855 linkArray[i][j] = new Array(); 856 857 // Each Link 858 $(column).find(Drupal.TBMegaMenu.focusableElements).each(function (k, sublink) { 859 860 // Add Link to Array 861 linkArray[i][j][k] = sublink; 862 863 // Determine Coordinates 864 $(sublink).data({ coordinate: [i, j, k] }); 865 }); // each link 866 } 867 868 }); // each column 869 870 }); // each top-level link 871 872 // Update Position on Focus 873 $(this).find(Drupal.TBMegaMenu.focusableElements).focus(function () { 874 curPos = $(this).data('coordinate'); 875 }); 876 877 // Key Pressed 878 function keydownEvent(k) { 879 // Determine Key 880 switch(k.keyCode) { 881 882 // TAB 883 case 9: 884 k.preventDefault(); 885 nav_tab(k); 886 break; 887 888 // RETURN 889 case 13: 890 nav_open_link(); 891 break; 892 893 // ESC 894 case 27: 895 nav_esc(); 896 break; 897 898 // LEFT 899 case 37: 900 k.preventDefault(); 901 nav_left(); 902 break; 903 904 // UP 905 case 38: 906 k.preventDefault(); 907 nav_up(); 908 break; 909 910 // RIGHT 911 case 39: 912 k.preventDefault(); 913 nav_right(); 914 break; 915 916 // DOWN 917 case 40: 918 k.preventDefault(); 919 nav_down(); 920 break; 921 922 // HOME 923 case 36: 924 nav_home(); 925 break; 926 927 // END 928 case 35: 929 nav_end(); 930 break; 931 932 // Else 933 default:
934 // Do nothing 935 936 } // determine key 937 } // keydownEvent 938 939 /* Keypress Functions */ 940 // Tab 941 function nav_tab(k) { 942 if (nav_is_toplink()) { 943 if (k.shiftKey) { 944 nav_prev_toplink(); 945 } 946 else { 947 nav_next_toplink(); 948 } 949 } 950 else { 951 if (k.shiftKey) { 952 nav_up(); 953 } 954 else { 955 nav_down(); 956 } 957 } 958 } 959 960 // Open Link 961 function nav_open_link() { 962 linkArray[curPos[0]][curPos[1]][curPos[2]].click(); 963 } 964 965 // Escape 966 function nav_esc() { 967 nav_close_megamenu(); 968 } 969 970 // Left 971 function nav_left() { 972 if (nav_is_toplink()) { 973 nav_prev_toplink(); 974 } 975 else { 976 nav_prev_column(); 977 } 978 } 979 980 // Right 981 function nav_right() { 982 if (nav_is_toplink()) { 983 nav_next_toplink(); 984 } 985 else { 986 nav_next_column(); 987 } 988 } 989 990 // Up 991 function nav_up() { 992 if (nav_is_toplink()) { 993 nav_prev_toplink(); 994 } 995 else { 996 if (linkArray[curPos[0]][curPos[1]][curPos[2] - 1]) { 997 // If the previous link in the array is hidden (ie, it's in a 998 // submenu that is not currently expanded), then skip to the next 999 // item in the array until we find one that's visible. 1000 if ($(linkArray[curPos[0]][curPos[1]][curPos[2] - 1]).is(':visible')) { 1001 linkArray[curPos[0]][curPos[1]][curPos[2] - 1].focus(); 1002 } 1003 else { 1004 curPos = [curPos[0], curPos[1], curPos[2] - 1]; 1005 nav_up(); 1006 } 1007 } 1008 else { 1009 nav_prev_column(); 1010 } 1011 } 1012 } 1013 1014 // Down 1015 function nav_down() { 1016 if (nav_is_toplink()) { 1017 nav_next_column(); 1018 } 1019 else { 1020 if (linkArray[curPos[0]][curPos[1]][curPos[2] + 1]) { 1021 linkArray[curPos[0]][curPos[1]][curPos[2] + 1].focus(); 1022 } 1023 else { 1024 nav_next_column(); 1025 } 1026 } 1027 } 1028 1029 // Home Button 1030 function nav_home() { 1031 if (nav_is_toplink()) { 1032 linkArray[0][-1].focus(); 1033 } 1034 else { 1035 linkArray[curPos[0]][0][0].focus(); 1036 } 1037 } 1038 1039 // End Button 1040 function nav_end() { 1041 if (nav_is_toplink()) { 1042 linkArray.slice(-1)[0][-1].focus(); 1043 } 1044 else { 1045 linkArray[curPos[0]].slice(-1)[0].slice(-1)[0].focus(); 1046 } 1047 } 1048 1049 /* Helper Functions */ 1050 // Determine Link Level 1051 function nav_is_toplink() { 1052 return (curPos[1] < 0); 1053 } 1054 1055 // Close Mega Menu 1056 function nav_close_megamenu() { 1057 $('.tb-megamenu .open').removeClass('open'); 1058 ariaCheck(); 1059 } 1060 1061 // Next Toplink 1062 function nav_next_toplink() { 1063 if (linkArray[curPos[0] + 1]) { 1064 linkArray[curPos[0] + 1][-1].focus(); 1065 } 1066 else { 1067 nav_close_megamenu(); 1068 1069 // Focus on the next element. 1070 Drupal.TBMegaMenu.focusNextPrevElement('next'); 1071 } 1072 } 1073 1074 // Previous Toplink 1075 function nav_prev_toplink() { 1076 if (linkArray[curPos[0] - 1]) { 1077 linkArray[curPos[0] - 1][-1].focus(); 1078 } 1079 else { 1080 // Focus on the previous element. 1081 Drupal.TBMegaMenu.focusNextPrevElement('prev'); 1082 } 1083 } 1084 1085 // Previous Column 1086 function nav_prev_column() { 1087 if (linkArray[curPos[0]][curPos[1] - 1][0]) { 1088 linkArray[curPos[0]][curPos[1] - 1][0].focus(); 1089 } 1090 else { 1091 nav_parent_toplink(); 1092 } 1093 } 1094 1095 // Next Column 1096 function nav_next_column() { 1097 if (linkArray[curPos[0]][curPos[1] + 1]) { 1098 linkArray[curPos[0]][curPos[1] + 1][0].focus(); 1099 } 1100 else { 1101 nav_parent_toplink(); 1102 } 1103 } 1104 1105 // Go to Parent Toplink 1106 function nav_parent_toplink() { 1107 linkArray[curPos[0]][-1].focus(); 1108 } 1109 1110 var ariaCheck = function () { 1111 $("li.tb-megamenu-item", this).each(function () { 1112 if ($(this).is('.mega-group')) { 1113 // Mega menu item has mega class (it's a true mega menu) 1114 if (!$(this).parents().is('.open')) { 1115 // Mega menu item has mega class and its ancestor is closed, so apply appropriate ARIA attributes 1116 $(this).children().attr('aria-expanded', 'false'); 1117 } 1118 else if ($(this).parents().is('.open')) { 1119 // Mega menu item has mega class and its ancestor is o
1119pen, so apply appropriate ARIA attributes 1120 $(this).children().attr('aria-expanded', 'true'); 1121 } 1122 } 1123 else if ($(this).is('.dropdown') || $(this).is('.dropdown-submenu')) { 1124 // Mega menu item has dropdown (it's a flyout menu) 1125 if (!$(this).is('.open')) { 1126 // Mega menu item has dropdown class and is closed, so apply appropriate ARIA attributes 1127 $(this).children().attr('aria-expanded', 'false'); 1128 } 1129 else if ($(this).is('.open')) { 1130 // Mega menu item has dropdown class and is open, so apply appropriate ARIA attributes 1131 $(this).children().attr('aria-expanded', 'true'); 1132 } 1133 } 1134 else { 1135 // Mega menu item is neither a mega or dropdown class, so remove ARIA attributes (it doesn't have children) 1136 $(this).children().removeAttr('aria-expanded'); 1137 } 1138 }); 1139 }; 1140 1141 var showMenu = function ($subMenu, mm_timeout) { 1142 if ($subMenu.hasClass('mega')) { 1143 $subMenu.addClass('animating'); 1144 clearTimeout($subMenu.data('animatingTimeout')); 1145 $subMenu.data('animatingTimeout', setTimeout(function () { 1146 $subMenu.removeClass('animating') 1147 }, mm_timeout)); 1148 clearTimeout($subMenu.data('hoverTimeout')); 1149 $subMenu.data('hoverTimeout', setTimeout(function () { 1150 $subMenu.addClass('open'); 1151 ariaCheck(); 1152 }, 100)); 1153 } 1154 else { 1155 clearTimeout($subMenu.data('hoverTimeout')); 1156 $subMenu.data('hoverTimeout', 1157 setTimeout(function () { 1158 $subMenu.addClass('open'); 1159 ariaCheck(); 1160 }, 100)); 1161 } 1162 }; 1163 1164 var hideMenu = function ($subMenu, mm_timeout) { 1165 $subMenu.children('.dropdown-toggle').attr('aria-expanded', 'false'); 1166 if ($subMenu.hasClass('mega')) { 1167 $subMenu.addClass('animating'); 1168 clearTimeout($subMenu.data('animatingTimeout')); 1169 $subMenu.data('animatingTimeout', setTimeout(function () { 1170 $subMenu.removeClass('animating') 1171 }, mm_timeout)); 1172 clearTimeout($subMenu.data('hoverTimeout')); 1173 $subMenu.data('hoverTimeout', setTimeout(function () { 1174 $subMenu.removeClass('open'); 1175 ariaCheck(); 1176 }, 100)); 1177 } 1178 else { 1179 clearTimeout($subMenu.data('hoverTimeout')); 1180 $subMenu.data('hoverTimeout', setTimeout(function () { 1181 $subMenu.removeClass('open'); 1182 ariaCheck(); 1183 }, 100)); 1184 } 1185 }; 1186 1187 $('.tb-megamenu-button', this).click(function () { 1188 if (parseInt($(this).parent().children('.nav-collapse').height())) { 1189 $(this).parent().children('.nav-collapse').css({height: 0, overflow: 'hidden'}); 1190 Drupal.TBMegaMenu.displayedMenuMobile = false; 1191 } 1192 else { 1193 $(this).parent().children('.nav-collapse').css({height: 'auto', overflow: 'visible'}); 1194 Drupal.TBMegaMenu.displayedMenuMobile = true; 1195 } 1196 }); 1197 1198 var isTouch = window.matchMedia('(pointer: coarse)').matches; 1199 1200 if (!isTouch) { 1201 var mm_duration = 0; 1202 1203 $('.tb-megamenu', context).each(function () { 1204 if ($(this).data('duration')) { 1205 mm_duration = $(this).data('duration'); 1206 } 1207 }); 1208 1209 var mm_timeout = mm_duration ? 100 + mm_duration : 500; 1210 $('.nav > li, li.mega', context).bind('mouseenter', function (event) { 1211 showMenu($(this), mm_timeout); 1212 }); 1213 1214 $('.nav > li > .dropdown-toggle, li.mega > .dropdown-toggle', context).bind('focus', function (event) { 1215 var $this = $(this); 1216 var $subMenu = $this.closest('li'); 1217 showMenu($subMenu, mm_timeout); 1218 // If the focus moves outside of the subMenu, close it. 1219 $(document).bind('focusin', function (event) { 1220 if ($subMenu.has(event.target).length) { 1221 return; 1222 } 1223 $(document).unbind(event); 1224 hideMenu($subMenu, mm_timeout); 1225 }); 1226 }); 1227 1228 $('.nav > li, li.mega', context).bind('mouseleave', function (event) { 1229 hideMenu($(this), mm_timeout); 1230 }); 1231 1232 /** 1233 * Allow tabbing by appending the open class. 1234 * Works in tandem with CSS changes that utilize opacity rather than 1235 * display none 1236 */ 1237 // If the selected anchor is not in the TB Megamenu, remove all "open" 1238 // class occurrences 1239 $('a, span').focus(function (event) { 1240 if (!$(this).parent().hasClass('tb-megamenu-item') && !$(this).parents('.tb-megamenu-block').length) {
1241 nav_close_megamenu(); 1242 } 1243 }); 1244 1245 $('.nav > li > a, li.mega > a').focus(function (event) { 1246 // Remove all occurrences of "open" from other menu trees 1247 var siblings = $(this).parents('.tb-megamenu-item').siblings(); 1248 // var siblings = $(this).closest('.tb-megamenu-item.level-1').siblings(); 1249 $.each(siblings, function (i, v) { 1250 var cousins = $(v).find('.open'); 1251 $.each(cousins, function (index, value) { 1252 $(value).removeClass('open'); 1253 ariaCheck($(this)); 1254 }); 1255 $(v).removeClass('open'); 1256 ariaCheck(); 1257 }); 1258 // Open the submenu if the selected item has one 1259 if ($(this).next(".tb-megamenu-submenu").length > 0) { 1260 if (!$(this).parent().hasClass("open")) { 1261 $(this).parent().addClass("open"); 1262 } 1263 } 1264 // If the anchor's top-level parent is not open, open it 1265 if (!$(this).closest('.tb-megamenu-item.dropdown').hasClass('open') && $(this).closest('.tb-megamenu-item.dropdown').find('.tb-megamenu-submenu').length > 0) { 1266 $(this).closest('.tb-megamenu-item.dropdown').addClass('open'); 1267 ariaCheck(); 1268 } 1269 // If anchor's parent submenus are not open, open them 1270 var parents = $(this).parents('.tb-megamenu-item.dropdown-submenu'); 1271 $.each(parents, function (i, v) { 1272 if (!$(v).hasClass('open')) { 1273 $(v).addClass('open'); 1274 ariaCheck(); 1275 } 1276 }); 1277 }); 1278 } 1279 1280 // Define actions for touch devices. 1281 var createTouchMenu = function (items) { 1282 items.children("a, span").each(function () { 1283 var $item = $(this); 1284 var tbitem = $(this).parent(); 1285 1286 $item.click(function (event) { 1287 // If the menu link has already been clicked once... 1288 if ($item.hasClass("tb-megamenu-clicked")) { 1289 var $uri = $item.attr("href"); 1290 1291 // If the menu link has a URI, go to the link. 1292 // <nolink> menu items will not have a URI. 1293 if ($uri) { 1294 window.location.href = $uri; 1295 } 1296 else { 1297 $item.removeClass("tb-megamenu-clicked"); 1298 hideMenu(tbitem, mm_timeout); 1299 } 1300 } 1301 else { 1302 event.preventDefault(); 1303 1304 // Hide any already open menus. 1305 nav_close_megamenu(); 1306 $(".tb-megamenu").find(".tb-megamenu-clicked").removeClass("tb-megamenu-clicked"); 1307 1308 // Open the submenu. 1309 $item.addClass("tb-megamenu-clicked"); 1310 showMenu(tbitem, mm_timeout); 1311 } 1312 }); 1313 }); 1314 1315 // Anytime there's a click outside the menu, close the menu. 1316 $(document).on('click', function (event) { 1317 if ($(event.target).closest('.tb-megamenu-nav').length === 0) { 1318 nav_close_megamenu(); 1319 $(".tb-megamenu").find(".tb-megamenu-clicked").removeClass("tb-megamenu-clicked"); 1320 }; 1321 }) 1322 }; 1323 1324 if (isTouch) { 1325 createTouchMenu($(".tb-megamenu ul.nav li.mega", context).has(".dropdown-menu")); 1326 }; 1327 1328 $(window).on('load resize', function () { 1329 var windowWidth = window.innerWidth ? window.innerWidth : $(window).width(); 1330 if (windowWidth != Drupal.TBMegaMenu.oldWindowWidth) { 1331 Drupal.TBMegaMenu.oldWindowWidth = windowWidth; 1332 Drupal.TBMegaMenu.menuResponsive(); 1333 1334 if (windowWidth >= Drupal.TBMegaMenu.supportedScreens[0]) { 1335 navParent.addEventListener('keydown',keydownEvent); 1336 } 1337 else { 1338 navParent.removeEventListener('keydown',keydownEvent); 1339 } 1340 } 1341 }); 1342 1343 }); 1344 1345 } 1346 } 1347})(jQuery, Drupal, drupalSettings); 1348;
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.