1/* add custom js */ 2(function ($) { 3 'use strict'; 4 Drupal.behaviors.etype = { 5 attach: function (context, settings) { 6 $('a[href$="e-edition"]').attr('target', '_blank'); 7 8 var autocompleteOff = function () { 9 if ($('#contact-site-form').length) { 10 var field = 'autocomplete'; 11 var fill = 'nope'; 12 $('#contact-site-form').attr(field, 'off'); 13 $('#contact-site-form .form-item input[type="text"]').attr(field, fill); 14 $('#contact-site-form .form-item textarea').attr(field, fill); 15 } 16 }; 17 autocompleteOff(); 18 } 19 }; 20 21 /** 22 * Keeps the UserWay accessibility button clear of the Klaro consent notice. 23 * 24 * Both are fixed to the bottom right, so while the notice is showing it 25 * covers the button. The notice's height depends on viewport width and how 26 * its text wraps, so measure it rather than guess an offset. 27 */ 28 Drupal.behaviors.etypeKlaroUserway = { 29 attach: function (context, settings) { 30 if (context !== document || Drupal.etypeKlaroUserwayBound) { 31 return; 32 } 33 Drupal.etypeKlaroUserwayBound = true; 34 35 var GAP = 12; 36 var root = document.documentElement; 37 var sizeWatcher = null; 38 39 // Publish the clearance, or drop it so styles.css falls back to 74px. 40 var apply = function () { 41 var notice = document.querySelector('#klaro .cookie-notice'); 42 if (!notice || !notice.offsetHeight) { 43 root.style.removeProperty('--etype-uw-bottom'); 44 return; 45 } 46 // Viewport bottom to notice top, which already includes the notice's 47 // own bottom offset. 48 var fromBottom = window.innerHeight - notice.getBoundingClientRect().top; 49 root.style.setProperty('--etype-uw-bottom', Math.round(fromBottom + GAP) + 'px'); 50 }; 51 52 // Klaro inserts the notice before it has a height and lays it out a 53 // moment later, and it shows and hides the notice by changing classes 54 // rather than by adding and removing the element. Measuring once on 55 // insertion therefore reads zero and never corrects itself, so watch the 56 // notice's size for as long as it exists. 57 var update = function () { 58 var notice = document.querySelector('#klaro .cookie-notice'); 59 if (!notice) { 60 if (sizeWatcher) { 61 sizeWatcher.disconnect(); 62 sizeWatcher = null; 63 } 64 root.style.removeProperty('--etype-uw-bottom'); 65 return; 66 } 67 if (window.ResizeObserver && !sizeWatcher) { 68 sizeWatcher = new ResizeObserver(apply); 69 sizeWatcher.observe(notice); 70 } 71 apply(); 72 }; 73 74 // Klaro builds its own #klaro container at runtime -- it is not in the 75 // server HTML -- so there is nothing Klaro-specific to attach to when 76 // Drupal behaviors run. Watch the document instead and let update() 77 // decide, debounced to a frame so a busy page stays cheap. 78 var scheduled = false; 79 var schedule = function () { 80 if (scheduled) { 81 return; 82 } 83 scheduled = true; 84 window.requestAnimationFrame(function () { 85 scheduled = false; 86 update(); 87 }); 88 }; 89 90 if (window.MutationObserver) { 91 new MutationObserver(schedule).observe(document.body, { 92 childList: true, 93 subtree: true 94 }); 95 } 96 // .on() would break sites without jquery_update (D7 core ships 1.4.4, 97 // and .on() only landed in 1.7). .resize() has been in jQuery since 1.0. 98 $(window).resize(apply); 99 update(); 100 } 101 }; 102 103})(jQuery);
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.