1"use strict"; 2 3(function ($, Drupal) { 4 Drupal.behaviors.otsukaJynarqueHCCFocusAdvanced = { 5 attach: function attach(context) { 6 var body = $('body'); 7 var radios = body.find('input[type="radio"]', context); 8 var checkboxes = body.find('input[type="checkbox"]', context); 9 var key = { 10 'tab': 9, 11 'enter': 13, 12 'space': 32, 13 'left': 37, 14 'up': 38, 15 'right': 39, 16 'down': 40 17 }; 18 19 function focusByInterval(selector) { 20 var intervalCounter = 0; 21 var interval = setInterval(function () { 22 if (selector.length) { 23 selector.focus(); 24 clearInterval(interval); 25 } else { 26 if (intervalCounter >= 50) { 27 clearInterval(interval); 28 } 29 30 intervalCounter++; 31 } 32 }, 50); 33 } 34 35 function freezeWindow() { 36 $('html, body').css({ 37 overflow: 'hidden', 38 height: '100%' 39 }); 40 } 41 42 function unfreezeWindow() { 43 $('html, body').css({ 44 overflow: 'auto', 45 height: 'auto' 46 }); 47 } 48 49 var covid19PopUpTrigger = $('a.covid-popup', context); 50 var covid19Modal = $('#spb-block-covidpopupblock', context); 51 var covid19ModalClose = covid19Modal.find('.spb_close'); 52 var covid19ModalFirstLink = covid19Modal.find('a').first(); 53 var covid19ModalLastLink = covid19Modal.find('a').last(); 54 covid19PopUpTrigger.attr('tabindex', '0'); 55 covid19ModalClose.attr('tabindex', '0'); 56 covid19PopUpTrigger.on('keydown', function (e) { 57 var keyCode = e.keyCode; 58 59 if ([key.enter].indexOf(keyCode) >= 0) { 60 $(this).click(); 61 freezeWindow(); 62 focusByInterval(covid19ModalClose); 63 } 64 }); 65 covid19PopUpTrigger.click(function () { 66 freezeWindow(); 67 }); 68 covid19ModalFirstLink.on('keydown', function (e) { 69 var keyCode = e.keyCode; 70 71 if ([key.tab].indexOf(keyCode) >= 0) { 72 if (e.shiftKey) { 73 e.preventDefault(); 74 covid19ModalClose.focus(); 75 } 76 } 77 }); 78 covid19ModalLastLink.on('keydown', function (e) { 79 var keyCode = e.keyCode; 80 81 if ([key.tab].indexOf(keyCode) >= 0) { 82 if (!e.shiftKey) { 83 e.preventDefault(); 84 covid19ModalClose.focus(); 85 } 86 } 87 }); 88 covid19ModalClose.on('keydown', function (e) { 89 var keyCode = e.keyCode; 90 91 if ([key.tab].indexOf(keyCode) >= 0) { 92 e.preventDefault(); 93 94 if (!e.shiftKey) { 95 covid19ModalFirstLink.focus(); 96 } else { 97 covid19ModalLastLink.focus(); 98 } 99 } 100 101 if ([key.enter].indexOf(keyCode) >= 0) { 102 e.preventDefault(); 103 $(this).click(); 104 unfreezeWindow(); 105 covid19PopUpTrigger.focus(); 106 } 107 }); 108 covid19ModalClose.click(function () { 109 unfreezeWindow(); 110 }); 111 $('.menu-item--expanded > a', context).on('keyup', function (e) { 112 if (e.keyCode === 9) { 113 e.preventDefault(); 114 $('.menu-item--expanded', context).removeClass('expanded'); 115 var currentMenuItem = $(this).parent('.menu-item'); 116 currentMenuItem.addClass('expanded'); 117 } 118 }); 119 $('.menu-main > .menu-item:not(.menu-item--expanded) > a', context).on('keyup', function (e) { 120 if (e.keyCode === 9) { 121 e.preventDefault(); 122 $('.menu-item--expanded', context).removeClass('expanded'); 123 } 124 }); 125 var cookieFocusCounter = 0; 126 var cookieFocus = setInterval(function () { 127 var cookieAgreeButton = $(document).find('.eu-cookie-compliance-banner .agree-button'); 128 129 if (cookieAgreeButton.length) { 130 cookieAgreeButton.focus(); 131 } 132 133 cookieFocusCounter++; 134 135 if (cookieFocusCounter >= 10) { 136 clearInterval(cookieFocus); 137 } 138 }, 50); 139 $('input:radio[name="receive_message_toggle"]', context).change(function () { 140 if ($(this).is(':checked') && $(this).val() === '1') { 141 focusByInterval($('input#edit-mobile', context)); 142 } 143 }); 144 $('input:radio[name="receive_email_toggle"]', context).change(function () { 145 if ($(this).is(':checked') && $(this).val() === '1') {
146 focusByInterval($('input#edit-address-1', context)); 147 } 148 }); 149 $('input:radio[name="taking_jynarque_toggle"]', context).change(function () { 150 if ($(this).is(':checked') && $(this).val() === '2') { 151 focusByInterval($('input:radio[id="edit-taking-jynarque-text-2"]', context)); 152 } 153 }); 154 radios.on('keydown', function (e) { 155 var keyCode = e.keyCode; 156 157 if ([key.enter, key.space].indexOf(keyCode) >= 0) { 158 e.preventDefault(); 159 $(this).trigger('click'); 160 } 161 162 if ([key.tab].indexOf(keyCode) >= 0) { 163 var radioElementWrapper = $(this).parent(); 164 var radioContainer = $(this).closest('.js-webform-radios'); 165 166 var _radios = radioContainer.find('.form-item'); 167 168 var radioIndex = _radios.index(radioElementWrapper[0]); 169 170 var radiosCount = _radios.length; 171 172 if (!e.shiftKey) { 173 if (radioIndex < radiosCount - 1) { 174 e.preventDefault(); 175 radioElementWrapper.next().find('input[type="radio"]').focus(); 176 } 177 } else { 178 if (radioIndex !== 0) { 179 e.preventDefault(); 180 radioElementWrapper.prev().find('input[type="radio"]').focus(); 181 } 182 } 183 } 184 }); 185 $(once('html', 'body input[type="checkbox"]', context)).on('keydown', function (e) { 186 var keyCode = e.keyCode; 187 188 if ([key.enter, key.space].indexOf(keyCode) >= 0) { 189 e.preventDefault(); 190 $(this).trigger('click'); 191 } 192 }); 193 $(document).ready(function () { 194 $('#drawer-isi a, #drawer-isi button', context).attr('tabindex', '-1'); 195 }); 196 197 if (window.location.pathname === '/online-resources') { 198 var setTabindexNonCollapsibleAccordion = function setTabindexNonCollapsibleAccordion() { 199 if (window.innerWidth >= 960) { 200 collapsibleBLinks.attr('tabindex', '-1'); 201 } else { 202 collapsibleBLinks.attr('tabindex', '0'); 203 } 204 }; 205 206 var collapsibleBLinks = $('.otsuka-collapsable-b .panel-heading a'); 207 setTabindexNonCollapsibleAccordion(); 208 $(window).resize(function () { 209 setTabindexNonCollapsibleAccordion(); 210 }); 211 } 212 213 var questionnaireForm = $('.webform-submission-questionnaire-form', context); 214 questionnaireForm.find('.navigation-button', context).on('keydown', function (e) { 215 var keyCode = e.keyCode; 216 217 if ([key.enter, key.space].indexOf(keyCode) >= 0) { 218 var activeWrapperId = questionnaireForm.find('.wrapper-page.active').attr('id'); 219 var activeWrapperNumber = parseInt(activeWrapperId.substr(21)); 220 var nextWrapper = questionnaireForm.find("#wrapper-page-wrapper-".concat(activeWrapperNumber + 1)); 221 222 if (nextWrapper.length) { 223 setTimeout(function () { 224 focusByInterval(nextWrapper.find('input').first()); 225 }, 500); 226 } 227 } 228 }); 229 var jynarqueInterstitialTrigger = $('#block-jynarqueinterstitial a.interstitial-learn-more', context); 230 var jynarqueInterstitialModal = $('#block-jynarqueinterstitialmodal', context); 231 var jynarqueInterstitialModalClose = jynarqueInterstitialModal.find('.interstitial-close-button'); 232 var jynarqueInterstitialModalLearnMore = jynarqueInterstitialModal.find('a.interstitial-learn-more'); 233 jynarqueInterstitialModal.find('.interstitial-close-button').attr('tabindex', '0'); 234 jynarqueInterstitialTrigger.click(function () { 235 freezeWindow(); 236 focusByInterval(jynarqueInterstitialModalLearnMore); 237 }); 238 jynarqueInterstitialModalLearnMore.on('keydown', function (e) { 239 var keyCode = e.keyCode; 240 241 if ([key.tab].indexOf(keyCode) >= 0) { 242 e.preventDefault(); 243 jynarqueInterstitialModalClose.focus(); 244 } 245 }); 246 jynarqueInterstitialModalClose.on('keydown', function (e) { 247 var keyCode = e.keyCode; 248 249 if ([key.enter].indexOf(keyCode) >= 0) { 250 $(this).click(); 251 } 252 }); 253 var patientStoriesPreview = $('.field--name-field-media-poster', context); 254 var patientStoriesActiveVideo = null; 255 patientStoriesPreview.attr('tabindex', '0'); 256 patientStoriesPreview.on('keydown', function (e) { 257 var keyCode = e.keyCode; 258 259 if ([key.enter].indexOf(keyCode) >= 0) { 260 $(this).click(); 261 patientStoriesActiveVideo = $('this'); 262 var videoModalClose = $('body').find('.video-modal-opened .ui-dialog-titlebar-close'); 263 focusByInterval(videoModalClose); 264 } 265 }); 266 body.on('keydown', '.video-modal-opened .ui-dialog-titlebar-close', function (e) { 267 var keyCode = e.keyCode; 268 269 if ([key.tab].indexOf(keyCode) >= 0) { 270 if (e.shiftKey) { 271 e.preventDefault(); 272 body.find('.video-modal-opened .vjs-fullscreen-control').first().focus(); 273 } 274 } 275 }); 276 body.on('keydown', '.video-modal-opened .vjs-fullscreen-control', function (e) { 277 var keyCode = e.keyCode; 278 279 if ([key.tab].indexOf(keyCode) >= 0) { 280 if (!e.shiftKey) { 281 e.preventDefault(); 282 body.find('.video-modal-opened .ui-dialog-titlebar-close').first().focus(); 283 } 284 } 285 }); 286 } 287 }; 288})(jQuery, 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.