1!function(t,n,o){"use strict";Drupal.behaviors.atdoubleTap={attach:function(){t.fn.doubleTapToGo=function(i){return!!("ontouchstart"in n||navigator.msMaxTouchPoints||navigator.userAgent.toLowerCase().match(/windows phone os 7/i))&&("unbind"===i?this.each(function(){t(this).off(),t(o).off("click touchstart MSPointerDown",handleTouch)}):this.each(function(){var n=!1;t(this).on("click",function(o){var i=t(this);i[0]!=n[0]&&(o.preventDefault(),n=i)}),t(o).on("click touchstart MSPointerDown",function(o){for(var i=!0,a=t(o.target).parents(),c=0;c<a.length;c++)a[c]==n[0]&&(i=!1);i&&(n=!1)})}),this)}}}}(jQuery,window,document); 2 3!function(e,a,r){"use strict";Drupal.behaviors.atrM={attach:function(o,n){function t(a){a.preventDefault(),a.stopPropagation(),e(this).toggleClass("is-open--parent"),"true"==e(this).attr("aria-expanded")?e(this).attr("aria-expanded","false"):"false"==e(this).attr("aria-expanded")&&e(this).attr("aria-expanded","true"),e(this).parent().next(".is-child").toggleClass("is-open--child")}function i(a){var r=e("#rm-accordion-trigger").html();e(a).each(function(){0==e(this).next(".rm-accordion-trigger").length&&e(this).after(r);var a=e(this).parent().parent().attr("id");e(this).next().attr("aria-controls",a+"__child-menu"),e(this).parent().next(".is-child").attr("id",a+"__child-menu")})}if(e(".rm-block").removeClass("js-hide"),r.matchMedia("only screen").matches){var s=n[n.ajaxPageState.theme].at_responsivemenus,c=s.default,l=s.responsive,d=".rm-block .rm-toggle__link",m=s.acd.acd_default,u=s.acd.acd_responsive,p=s.acd.acd_both,_=s.acd.acd_load;e(d,o).on("click",function(r){r.preventDefault(),r.stopPropagation(),e(a.body).toggleClass("rm-is-open"),"true"==e(this).attr("aria-expanded")?(e(this).attr("aria-expanded","false"),e("#rm-toggle__icon--use").attr("xlink:href","#rm-toggle__icon--open")):"false"==e(this).attr("aria-expanded")&&(e(this).attr("aria-expanded","true"),e("#rm-toggle__icon--use").attr("xlink:href","#rm-toggle__icon--close")),e(a).one("click",function(r){0===e(".rm-block").has(r.target).length&&(e(a.body).removeClass("rm-is-open"),e(d).attr("aria-expanded","false"),e("#rm-toggle__icon--use").attr("xlink:href","#rm-toggle__icon--open"))})}),enquire.register(s.bp,{setup:function(){e(a.body).addClass(c),e(".rm-block").parent(".l-r").addClass("rm-region").parent(".l-rw").addClass("rm-row"),"ms-dropmenu"==c&&e(".rm-block__content li:has(ul)").doubleTapToGo(),1==m&&1==_&&(e(".rm-block .menu-level-1").addClass("ms-accordion"),e.ready(i(".ms-accordion .is-parent__wrapper .menu__link")),e(".ms-accordion .rm-accordion-trigger",o).on("click",t))},match:function(){"ms-none"!==l&&l!==c&&(e(a.body).removeClass(c).addClass(l),1==_&&(1==u?0==p&&(e(".rm-block .menu-level-1").addClass("ms-accordion"),e.ready(i(".ms-accordion .is-parent__wrapper .menu__link")),e(".ms-accordion .rm-accordion-trigger",o).on("click",t)):(e(".ms-accordion .rm-accordion-trigger").remove(),e(".rm-block .menu-level-1").removeClass("ms-accordion"),e(".rm-block .menu").removeClass("is-open--child"))),"ms-dropmenu"==l?e(".rm-block__content li:has(ul)").doubleTapToGo():e(".rm-block__content li:has(ul)").doubleTapToGo("unbind"))},unmatch:function(){e(a.body).addClass(c),1==_&&(1==m?0==p&&(e(".rm-block .menu-level-1").addClass("ms-accordion"),e.ready(i(".ms-accordion .is-parent__wrapper .menu__link")),e(".ms-accordion .rm-accordion-trigger",o).on("click",t)):(e(".ms-accordion .rm-accordion-trigger").remove(),e(".rm-block .menu-level-1").removeClass("ms-accordion"),e(".rm-block .menu").removeClass("is-open--child"))),"ms-dropmenu"==c?e(".rm-block__content li:has(ul)").doubleTapToGo():e(".rm-block__content li:has(ul)").doubleTapToGo("unbind"),l!==c&&e(a.body).removeClass(l)}})}}}}(jQuery,document,window); 4 5(function ($) { 6 const autosize = createAutosizer(); 7 8 $(document).on('click', '.new-form-item--change-password-btn', onChangePasswordInputView) 9 $(document).on('click', '.new-form--user-registration-step--close-btn', onCloseUserFormClick) 10 $(document).on('click', '.new-alert--close', onAlertClose) 11 $(document).on('change', '.new-form-item input, .new-form-item select, .new-form-item textarea', onInputsChange); 12 $(document).on('mousedown', '.new-form-item-checkbox label', onCheckboxFocusIn); 13 $(document).on('mouseup', '.new-form-item-checkbox label', onCheckboxFocusOut); 14 $(document).on('change', '.new-form-item-checkbox input', onCheckboxChange); 15 $(document).on('keypress', '.new-form-item input', onInputsKeyPress); 16 $(document).on('blur', '.redactor-box', onRedactorBoxBlur) 17 18 checkInputsForEmpty(); 19 20 //to catch browser autofill 21 setTimeout(checkInputsForEmpty, 500); 22 setTimeout(checkInputsForEmpty, 1500); 23
24 newDialogsInit(); 25 26 mobileMenuInit(); 27 28 attachAltToMainImg(); 29 30 initArticleResponsiveTables(); 31 32 stylePaypalBlock(); 33 34 autosize(document.querySelectorAll('.form-textarea')); 35 36 function onRedactorBoxBlur(e) { 37 toggleNotEmptyState($(e.currentTarget)); 38 } 39 40 function onCheckboxChange(e) { 41 if ( $(e.target).is(':checked') ) { 42 $(e.target).parent().addClass('new-form-item-checkbox--checked'); 43 } else { 44 $(e.target).parent().removeClass('new-form-item-checkbox--checked'); 45 } 46 47 } 48 function onCheckboxFocusIn(e) { 49 $(e.currentTarget).addClass('new-form-item-checkbox--focused') 50 } 51 function onCheckboxFocusOut(e) { 52 $(e.currentTarget).removeClass('new-form-item-checkbox--focused') 53 } 54 55 function stylePaypalBlock() { 56 if ($('.new-paypal-form-wrapper').length > 0) { 57 $('.new-paypal-form-wrapper').find('table').wrap($('<div class="new-paypal-form-wrapper--table-wrapper">')) 58 } 59 } 60 61 function onAlertClose(e) { 62 e.preventDefault(); 63 $(e.target).parents('.new-alert--closeble').addClass('new-alert--hidden') 64 } 65 66 function onCloseUserFormClick(e) { 67 e.preventDefault(); 68 window.history.back() 69 } 70 71 function onChangePasswordInputView(e) { 72 e.preventDefault(); 73 const $input = $(e.currentTarget).siblings('input'); 74 const input = $input[0]; 75 const inputType = $input.attr('type'); 76 const value = $input.val(); 77 const len = value.length * 2; 78 79 $(e.currentTarget).toggleClass('new-form-item--change-password--visible'); 80 $input.focus(); 81 82 if (inputType === 'password') { 83 $input.attr('type', 'text') 84 } else { 85 $input.attr('type', 'password') 86 } 87 //move cursor to the end 88 if (input.setSelectionRange) { 89 setTimeout(function () { 90 input.setSelectionRange(len, len); 91 }, 0); 92 } else { 93 $input.val(value); 94 } 95 } 96 97 function onInputsKeyPress(e) { 98 if (e.keyCode === 13) { 99 $(e.target.form).find('.js-form-submit').trigger('mousedown'); 100 } 101 } 102 103 function checkInputsForEmpty(e) { 104 const $inputs = $('.new-form-item input, .new-form-item select, .new-form-item textarea, .redactor-box'); 105 $inputs.each(function(i, input) { 106 toggleNotEmptyState($(input)) 107 }) 108 } 109 function onInputsChange(e) { 110 toggleNotEmptyState($(e.target)); 111 } 112 113 function toggleNotEmptyState($input){ 114 let notEmpty = $input.val().length > 0; 115 if (!notEmpty && $input.find('option').length > 0) { 116 notEmpty = $input.find('option:selected').length > 0; 117 } 118 if ($input.hasClass('redactor-box')) { 119 notEmpty = $input.find('.redactor-styles').text().length > 0 120 } 121 if (notEmpty) { 122 $input.addClass('new-form-item--not-empty'); 123 } else { 124 $input.removeClass('new-form-item--not-empty'); 125 } 126 } 127 128 function newDialogsInit() { 129 const DIALOG_OVERLAY_CLASS = 'ui-widget-overlay'; 130 const DIALOG_WRAPPER_CLASS = 'new-dialog'; 131 132 const DIALOG_CREATED_CLASS = 'new-dialog--created'; 133 const DIALOG_OPENED_CLASS = 'new-dialog--opened'; 134 const DIALOG_OVERLAY_OPENED_CLASS = 'new-dialog-overlay--opened'; 135 136 $(document).on("dialogopen", onDialogOpened); 137 $(document).on("dialogbeforeclose", onDialogClose); 138 139 function onDialogClose(e, ui) { 140 const $dialogElement = e.target; 141 const dialogObject = createDialogObject($dialogElement); 142 143 if (!dialogObject.element.closeable) { 144 closeDialog(dialogObject) 145 } 146 return dialogObject.element.closeable; 147 } 148 149 function onDialogOpened(e, ui) { 150 const $dialogElement = e.target; 151 const dialogObject = createDialogObject($dialogElement); 152 const $registerLink = dialogObject.dialog.find('.user-login-form--register-link-wrapper'); 153 const $textareas = dialogObject.dialog.find('.form-textarea'); 154 155 if (dialogObject.wrapper.length > 0) { 156 dialogObject.element.closeable = false; 157 openDialog(dialogObject) 158 } 159 if ($registerLink.length > 0) { 160 $registerLink.detach(); 161 $registerLink.appendTo('.ui-dialog-buttonpane') 162 } 163 if ($textareas.length > 0) { 164 autosize($textareas.get()); 165 } 166 167 } 168
169 function createDialogObject($dialogElement) { 170 const $dialog = $($dialogElement); 171 return { 172 element: $dialogElement, 173 dialog: $dialog, 174 wrapper: $dialog.parents('.' + DIALOG_WRAPPER_CLASS), 175 overlay: $('.' + DIALOG_OVERLAY_CLASS) 176 } 177 } 178 179 function openDialog(dialogObject) { 180 dialogObject.wrapper.addClass(DIALOG_CREATED_CLASS); 181 dialogObject.overlay.addClass(DIALOG_OVERLAY_OPENED_CLASS) 182 setTimeout(function () { 183 dialogObject.wrapper.addClass(DIALOG_OPENED_CLASS) 184 }, 200) 185 } 186 187 function closeDialog(dialogObject) { 188 dialogObject.wrapper.removeClass(DIALOG_OPENED_CLASS) 189 dialogObject.overlay.removeClass(DIALOG_OVERLAY_OPENED_CLASS) 190 setTimeout(function () { 191 dialogObject.element.closeable = true; 192 dialogObject.dialog.dialog().dialog('close'); 193 }, 1000); 194 } 195 } 196 197 function mobileMenuInit() { 198 const MENU_OPENED_CLASS_NAME = 'mobile-menu-opened'; 199 const MENU_MARGIN_LEFT = 24; 200 const MENU_MARGIN_TOP = 16; 201 202 const $mobileMenuOutline = $('.mobile-menu--outline'); 203 const $mobileMenuContent = $('.mobile-menu--content'); 204 const $leaderboard = $('.l-leaderboard'); 205 const $navBar = $('#rid-navbar'); 206 207 let menuWidth; 208 let menuHeight; 209 210 $(document).on('click', '.mobile-menu-toggle-btn', toggleMobileMenu); 211 recalculateSizes(); 212 $(window).on('resize', recalculateSizes) 213 $(window).on('scroll', checkIfMenuResizeNeeded) 214 215 function toggleMobileMenu(e) { 216 e.preventDefault(); 217 $('body').toggleClass(MENU_OPENED_CLASS_NAME); 218 recalculateSizes(); 219 } 220 221 function checkIfMenuResizeNeeded() { 222 if ($('body').hasClass(MENU_OPENED_CLASS_NAME) && !$navBar.hasClass('sticky')) { 223 recalculateSizes(); 224 } 225 } 226 227 function setSizes() { 228 $mobileMenuOutline.width(menuWidth).height(menuHeight); 229 $mobileMenuContent.outerWidth(menuWidth).outerHeight(menuHeight) 230 if ($('body').hasClass(MENU_OPENED_CLASS_NAME)) { 231 $mobileMenuContent.css({ 232 'clip': 'rect(0, ' + menuWidth + 'px, ' + menuHeight + 'px, 0)' 233 }) 234 } else { 235 $mobileMenuContent.css({ 236 'clip': 'rect(0, ' + menuWidth + 'px, 0, ' + menuWidth + 'px)' 237 }) 238 } 239 } 240 241 function recalculateSizes() { 242 leaderboardHeight = 0; 243 menutopmargin = MENU_MARGIN_TOP; 244 if ($leaderboard.length > 0 && !$navBar.hasClass('sticky')) { 245 leaderboardHeight = $leaderboard.height() - $(window).scrollTop() 246 } 247 if ($(window).width() <= 500) { 248 menutopmargin = 0; 249 } 250 menuWidth = $(window).width() - MENU_MARGIN_LEFT; 251 menuHeight = $(window).height() - leaderboardHeight + menutopmargin; 252 setSizes(); 253 } 254 } 255 256 function attachAltToMainImg () { 257 //if there's a main img... add alt text from the caption if one exists otherwise from the title 258 const $img = $('.node--view-mode-full').find('.field-node-field-media-main-image').find('img'); 259 if ($img.length > 0) { 260 const caption = $('.field-name-field-media-image-caption').find('.field__item').text(); 261 const text = caption.length > 0? caption : $('.field-node--node-title').find('h1').text(); 262 $img.attr('alt', text); 263 } 264 } 265 266 function initArticleResponsiveTables () { 267 const $tables = $('.node--view-mode-full').find('.field-node--body').find('table'); 268 269 if ($tables.length > 0) { 270 // console.log($tables) 271 $tables.each(function (i, table) { 272 $(table).wrap('<div class="new-table-responsive--wrapper">'); 273 //console.log($table) 274 }) 275 } 276 } 277 278})(jQuery) 279 280function createAutosizer() { 281 const map = (typeof Map === "function") ? new Map() : (function () { 282 const keys = []; 283 const values = []; 284 285 return { 286 has(key) { 287 return keys.indexOf(key) > -1; 288 }, 289 get(key) { 290 return values[keys.indexOf(key)]; 291 }, 292 set(key, value) { 293 if (keys.indexOf(key) === -1) { 294 keys.push(key); 295 values.push(value); 296 } 297 }, 298 delete(key) { 299 const index = keys.indexOf(key); 300 if (index > -1) { 301 keys.splice(index, 1); 302 values.splice(index, 1); 303 } 304 }, 305 } 306 })(); 307 308 let createEvent = (name) => new Event(name, { 309 bubbles: true 310 }); 311 try { 312 new Event('test'); 313 } catch (e) { 314 // IE does not support `new Event()` 315 createEvent = (name) => { 316 const evt = document.createEvent('Event'); 317 evt.initEvent(name, true, false); 318 return evt; 319 }; 320 } 321 322 function assign(ta) { 323 if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return; 324 325 let heightOffset = null;
326 let clientWidth = null; 327 let cachedHeight = null; 328 329 function init() { 330 const style = window.getComputedStyle(ta, null); 331 332 if (style.resize === 'vertical') { 333 ta.style.resize = 'none'; 334 } else if (style.resize === 'both') { 335 ta.style.resize = 'horizontal'; 336 } 337 338 if (style.boxSizing === 'content-box') { 339 heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom)); 340 } else { 341 heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth); 342 } 343 // Fix when a textarea is not on document body and heightOffset is Not a Number 344 if (isNaN(heightOffset)) { 345 heightOffset = 0; 346 } 347 348 update(); 349 } 350 351 function changeOverflow(value) { 352 { 353 // Chrome/Safari-specific fix: 354 // When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space 355 // made available by removing the scrollbar. The following forces the necessary text reflow. 356 const width = ta.style.width; 357 ta.style.width = '0px'; 358 // Force reflow: 359 /* jshint ignore:start */ 360 ta.offsetWidth; 361 /* jshint ignore:end */ 362 ta.style.width = width; 363 } 364 365 ta.style.overflowY = value; 366 } 367 368 function getParentOverflows(el) { 369 const arr = []; 370 371 while (el && el.parentNode && el.parentNode instanceof Element) { 372 if (el.parentNode.scrollTop) { 373 arr.push({ 374 node: el.parentNode, 375 scrollTop: el.parentNode.scrollTop, 376 }) 377 } 378 el = el.parentNode; 379 } 380 381 return arr; 382 } 383 384 function resize() { 385 if (ta.scrollHeight === 0) { 386 // If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM. 387 return; 388 } 389 390 const overflows = getParentOverflows(ta); 391 const docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240) 392 393 ta.style.height = ''; 394 ta.style.height = (ta.scrollHeight + heightOffset) + 'px'; 395 396 // used to check if an update is actually necessary on window.resize 397 clientWidth = ta.clientWidth; 398 399 // prevents scroll-position jumping 400 overflows.forEach(el => { 401 el.node.scrollTop = el.scrollTop 402 }); 403 404 if (docTop) { 405 document.documentElement.scrollTop = docTop; 406 } 407 } 408 409 function update() { 410 resize(); 411 412 const styleHeight = Math.round(parseFloat(ta.style.height)); 413 const computed = window.getComputedStyle(ta, null); 414 415 // Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box 416 var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight; 417 418 // The actual height not matching the style height (set via the resize method) indicates that 419 // the max-height has been exceeded, in which case the overflow should be allowed. 420 if (actualHeight < styleHeight) { 421 if (computed.overflowY === 'hidden') { 422 changeOverflow('scroll'); 423 resize(); 424 actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight; 425 } 426 } else { 427 // Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands. 428 if (computed.overflowY !== 'hidden') { 429 changeOverflow('hidden'); 430 resize(); 431 actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight; 432 } 433 } 434 435 if (cachedHeight !== actualHeight) { 436 cachedHeight = actualHeight; 437 const evt = createEvent('autosize:resized'); 438 try { 439 ta.dispatchEvent(evt); 440 } catch (err) { 441 // Firefox will throw an error on dispatchEvent for a detached element 442 // https://bugzilla.mozilla.org/show_bug.cgi?id=889376 443 } 444 } 445 } 446 447 const pageResize = () => { 448 if (ta.clientWidth !== clientWidth) { 449 update(); 450 } 451 }; 452 453 const destroy = (style => { 454 window.removeEventListener('resize', pageResize, false); 455 ta.removeEventListener('input', update, false); 456 ta.removeEventListener('keyup', update, false); 457 ta.removeEventListener('autosize:destroy', destroy, false); 458 ta.removeEventListener('autosize:update', update, false); 459 460 Object.keys(style).forEach(key => { 461 ta.style[key] = style[key]; 462 }); 463 464 map.delete(ta); 465 }).bind(ta, { 466 height: ta.style.height, 467 resize: ta.style.resize, 468 overflowY: ta.style.overflowY, 469 overflowX: ta.style.overflowX, 470 wordWrap: ta.style.wordWrap, 471 }); 472 473 ta.addEventListener('autosize:destroy', destroy, false); 474
475 // IE9 does not fire onpropertychange or oninput for deletions, 476 // so binding to onkeyup to catch most of those events. 477 // There is no way that I know of to detect something like 'cut' in IE9. 478 if ('onpropertychange' in ta && 'oninput' in ta) { 479 ta.addEventListener('keyup', update, false); 480 } 481 482 window.addEventListener('resize', pageResize, false); 483 ta.addEventListener('input', update, false); 484 ta.addEventListener('autosize:update', update, false); 485 ta.style.overflowX = 'hidden'; 486 ta.style.wordWrap = 'break-word'; 487 488 map.set(ta, { 489 destroy, 490 update, 491 }); 492 493 init(); 494 } 495 496 function destroy(ta) { 497 const methods = map.get(ta); 498 if (methods) { 499 methods.destroy(); 500 } 501 } 502 503 function update(ta) { 504 const methods = map.get(ta); 505 if (methods) { 506 methods.update(); 507 } 508 } 509 510 let autosize = null; 511 512 513 autosize = (el, options) => { 514 if (el) { 515 Array.prototype.forEach.call(el.length ? el : [el], x => assign(x, options)); 516 } 517 return el; 518 }; 519 autosize.destroy = el => { 520 if (el) { 521 Array.prototype.forEach.call(el.length ? el : [el], destroy); 522 } 523 return el; 524 }; 525 autosize.update = el => { 526 if (el) { 527 Array.prototype.forEach.call(el.length ? el : [el], update); 528 } 529 return el; 530 }; 531 return autosize; 532} 533; 534(function ($, Drupal) { 535 //let utility_block_settings = drupalSettings.utility_block_settings; 536 537 if($('#subscribe-wrapper').length > 0) { 538 var subhtml = $('#subscribe-wrapper').html(); 539 $('#subscribe-wrapper').html(''); 540 if($('#block-labsadssidebarslot1').length > 0) { 541 $('#block-labsadssidebarslot1').before(subhtml); 542 } 543 if($('#rid-content > .slot-index-3').length > 0) { 544 $('#rid-content > .slot-index-3').before(subhtml); 545 } 546 if($('.layout__region--bottom .field-node--field-flags').length > 0) { 547 subhtml = subhtml.replace('new-btn new-btn--secondary', 'new-btn new-btn--primary'); 548 $('.layout__region--bottom .field-node--field-flags').before(subhtml); 549 } 550 } 551 552 if($('#paypal-wrapper-wrapper').length > 0 && !$('.paypal-wrapper').is(':visible')) { 553 var pphtml = $('#paypal-wrapper-wrapper').html(); 554 if($('.slot-index-7').length > 0 ) { 555 $('.slot-index-4').after(pphtml); 556 } 557 } 558 559 if($('#labsfblike') && $('#social-sharing-block')) { 560 var html = $('#labsfblike').html(); 561 $('#labsfblike').html(''); 562 if($('.field-type-social-media').css('display')== 'none') { 563 $('.field-node--node-title').prepend(html); 564 } else { 565 $('#social-sharing-block').prepend(html); 566 } 567 } 568 569 570 $('.location-viewer a').on('click', function(e){ 571 $('.org-locations-nav').toggleClass('hidden'); 572 }); 573 $('.field-node--body a').each(function(){ 574 var a = new RegExp('/' + window.location.host + '/'); 575 if (!a.test(this.href)) { 576 $(this).attr("target","_blank"); 577 } 578 }); 579 580})(jQuery, Drupal); 581 582//defer images 583deferred_images = document.getElementsByClassName('defer-load'); 584// deferred_images.forEach(loadDeferredImage); 585 for (var index = 0; index < deferred_images.length; index++) { 586 587 if(deferred_images[index] !== 'undefined' && deferred_images[index].hasAttribute('data-src')){ 588 var imgsrc = deferred_images[index].getAttribute('data-src'); 589 deferred_images[index].setAttribute('src', imgsrc); 590 } 591} 592 593//console.log(deferred_images); 594; 595var source_url = drupalSettings.labs_ads.source_url; 596var ad_cta_populated = false; 597debug = false; 598if (getParameterByName('debug')) { 599 debug = true; 600} 601if (debug) { 602 console.log('ads'); 603 console.log('source_url: ' + source_url); 604} 605var bannerad = document.getElementById('leaderboard-ad-0'); 606var leaderboard_div = document.getElementById('rid-leaderboard'); 607 608var page_slots_for_normal_ads = document.getElementsByClassName('not-banner-ad'); //@todo change to not-leaderboard ad 609var sidebar_slots_for_normal_ads = document.getElementsByClassName('slot-sidebar-adslot'); 610var contentscroll_slots_for_normal_ads = document.getElementsByClassName('slot-adslot-contentscroll'); 611var page_slots_for_adpost_ad = document.getElementsByClassName('adpost-ad'); 612 613var lb_extraone = document.getElementsByClassName('leaderboard-extra-1'); 614var lb_extratwo = document.getElementsByClassName('leaderboard-extra-2'); 615var lb_extrathree = document.getElementsByClassName('leaderboard-extra-3'); 616var lb_extrafour = document.getElementsByClassName('leaderboard-extra-4'); 617 618var cta = document.getElementById('footer-ad-cta').innerHTML; 619 620var total_num_of_normal_ad_divs = 0; 621var total_num_of_normal_ads_populated = 0; 622 623//put all website normal slots in an object sorted by proximity to top of page 624var website_normal_ad_divs = {}; 625let n = 0; 626 627var shuffle = function (array) { 628 var currentIndex = array.length; 629 var temporaryValue, randomIndex; 630 // While there remain elements to shuffle... 631 while (0 !== currentIndex) { 632 // Pick a remaining element... 633 randomIndex = Math.floor(Math.random() * currentIndex); 634 currentIndex -= 1; 635 636 // And swap it with the current element. 637 temporaryValue = array[currentIndex]; 638 array[currentIndex] = array[randomIndex]; 639 array[randomIndex] = temporaryValue; 640 } 641 return array; 642}; 643while (n < page_slots_for_normal_ads.length) { 644 rect = page_slots_for_normal_ads[n].getBoundingClientRect(); 645 // console.log(rect.top); 646 var rect_top = Math.round(rect.top); 647 website_normal_ad_divs[rect_top + n] = page_slots_for_normal_ads[n]; 648 n++; 649} 650 651// 652//check if adslots on the page 653if (bannerad || page_slots_for_normal_ads.length || page_slots_for_adpost_ad.length && source_url.length) { 654 var i = 0; 655 if (bannerad) { 656 leaderboard_div.setAttribute('display', 'block'); 657 } 658 var request = new XMLHttpRequest(); 659 request.open('GET', source_url, true); 660 request.onload = function () { 661 if (request.status >= 200 && request.status < 400) { 662 var success = true;
663 try { 664 var data = JSON.parse(request.responseText); 665 } catch(e) { 666 success = false; 667 if (debug) { 668 console.log(e); 669 var data = request.responseText; 670 } 671 } 672 if (debug) { 673 console.log('data'); 674 console.log(data); 675 } 676 if (success && data.website_leaderboard.length) { 677 let website_leaderboard_ads = data.website_leaderboard; 678 shuffle(website_leaderboard_ads); 679 bannerad.innerHTML = website_leaderboard_ads[0].extra.html; 680 681 //extra slots on the rail 682 if (data.website_leaderboard.length > 1 && lb_extraone) { 683 if (debug) { 684 console.log('placing banner in lbextra1'); 685 } 686 lb_extraone = document.getElementById('leaderboard-extra-1'); 687 var adhtml = data.website_leaderboard[1].extra.html; 688 var adhtml = adhtml.replace('hide-mobile', 'hidden'); 689 var adhtml = adhtml.replace('hide-desktop', 'height-250'); 690 lb_extraone.innerHTML = adhtml; 691 } 692 if (data.website_leaderboard.length > 2 && lb_extratwo) { 693 if (debug) { 694 console.log('placing banner in lbextra2'); 695 } 696 lb_extratwo = document.getElementById('leaderboard-extra-2'); 697 var adhtml = data.website_leaderboard[2].extra.html; 698 var adhtml = adhtml.replace('hide-mobile', 'hidden'); 699 var adhtml = adhtml.replace('hide-desktop', 'height-250'); 700 lb_extratwo.innerHTML = adhtml; 701 } 702 // if(data.website_leaderboard.length > 3 && lb_extrathree){ 703 // lb_extrathree = document.getElementById('leaderboard-extra-3'); 704 // var adhtml = data.website_leaderboard[3].extra.html; 705 // var adhtml = adhtml.replace('hide-mobile', 'hidden'); 706 // var adhtml = adhtml.replace('hide-desktop', 'height-250'); 707 // lb_extrathree.innerHTML = adhtml; 708 // } 709 // if(data.website_leaderboard.length > 4 && lb_extrafour){ 710 // lb_extrafour = document.getElementById('leaderboard-extra-4'); 711 // var adhtml = data.website_leaderboard[4].extra.html; 712 // var adhtml = adhtml.replace('hide-mobile', 'hidden'); 713 // var adhtml = adhtml.replace('hide-desktop', 'height-250'); 714 // lb_extrafour.innerHTML = adhtml; 715 // } 716 } 717 718 if (success && data.adpost_ad.length && page_slots_for_adpost_ad.length) { 719 let adpost_ad = data.adpost_ad; 720 page_slots_for_adpost_ad[0].innerHTML = adpost_ad[0].extra.html; 721 } 722 723 if (success && data.website_normal.length) { 724 let website_normal_ads = data.website_normal; 725 shuffle(website_normal_ads); 726 var ad_keys_filled = []; 727 var ad_items_filled = []; 728 var total_num_of_normal_ads = data.website_normal.length; 729 total_num_of_normal_ad_divs = Object.entries(website_normal_ad_divs).length; 730 var failsafe = 0; 731 failsafe++; 732 if (debug) { 733 console.log('total_num_of_normal_ads'); 734 console.log(total_num_of_normal_ads); 735 console.log('ad_keys_filled.length'); 736 console.log(ad_keys_filled.length); 737 console.log('total_num_of_normal_ad_divs'); 738 console.log(total_num_of_normal_ad_divs); 739 console.log('failsafe'); 740 console.log(failsafe); 741 } 742 for (let [key, value] of Object.entries(website_normal_ad_divs)) { 743 if (debug) { 744 console.log('key'); 745 console.log(key); 746 747 console.log('website_normal_ads'); 748 console.log(website_normal_ads); 749 console.log('website_normal_ads.length'); 750 console.log(website_normal_ads.length); 751 } 752 var x = 0; 753 while (x < website_normal_ads.length) { 754 755 var ad = website_normal_ads[x]; 756 if (debug) { 757 console.log('while ' + key + ' ------ ad_item' + x + ' --- ' + ad.body_summary); 758 console.log(ad); 759 console.log('ad_keys_filled'); 760 console.log(ad_keys_filled); 761 } 762 if (!ad_keys_filled.includes(key) && !ad_items_filled.includes(x)) { 763 if (debug) { 764 console.log('ad_keys_filled does not include ' + key); 765 console.log('populating key' + key + ' with ' + ad.title); 766 } 767 768 if (ad.extra.has_both_images || ad.extra.text_only && website_normal_ad_divs[key].innerHTML == '') { 769 website_normal_ad_divs[key].innerHTML = website_normal_ads[x].extra.html; 770 //website_normal_ads[i] = 'PLACED'; 771 total_num_of_normal_ads_populated++; 772 ad_keys_filled.push(key); 773 ad_items_filled.push(x); 774 } else if (ad.extra.mobile_image && website_normal_ad_divs[key].innerHTML == '' && website_normal_ad_divs[key].classList.contains('slot-sidebar-adslot')) { 775 website_normal_ad_divs[key].innerHTML = website_normal_ads[x].extra.html; 776 // website_normal_ads[i] = 'PLACED'; 777 total_num_of_normal_ads_populated++; 778 ad_keys_filled.push(key); 779 ad_items_filled.push(x); 780 } else if (ad.extra.website_normal_image && website_normal_ad_divs[key].innerHTML == '' && website_normal_ad_divs[key].classList.contains('slot-adslot-contentscroll')) { 781 website_normal_ad_divs[key].innerHTML = website_normal_ads[x].extra.html; 782 //website_normal_ads[i] = 'PLACED'; 783 total_num_of_normal_ads_populated++; 784 ad_keys_filled.push(key); 785 ad_items_filled.push(x); 786 } 787 } 788 x++; 789 } 790 } 791 792 if(total_num_of_normal_ad_divs < total_num_of_normal_ads_populated) { 793 page_slots_for_normal_ads[total_num_of_normal_ads_populated].innerHTML = cta; //put cta in next div 794 } 795 796 } else { 797 page_slots_for_normal_ads[total_num_of_normal_ad_divs].innerHTML = cta; //put cta in last div 798 } 799 } 800 } 801 request.send(); 802} 803 804function getParameterByName(name, url) { 805 if (!url) url = window.location.href; 806 name = name.replace(/[\[\]]/g, '\\$&'); 807 var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'), 808 results = regex.exec(url); 809 if (!results) return null; 810 if (!results[2]) return ''; 811 return decodeURIComponent(results[2].replace(/\+/g, ' ')); 812} 813; 814 815var recirc_block = document.getElementById('block-labslabsrecirc-blocknavblock'); 816var article_node_view = document.getElementsByClassName('node--view-mode-full'); 817var tile = document.getElementById('supporter-cta-tile'); 818var top_slot = document.getElementsByClassName('slot-index-1'); 819if(!recirc_block){ 820 if(tile && top_slot[0]){ 821 top_slot[0].after(tile); 822 } 823} 824if(article_node_view[0]) { 825 article_node_view[0].before(tile); 826 tile.style.borderColor = null; 827 tile.classList.add('no-shadow'); 828} 829 830 831; 832!function(t,a,e){"use strict";Drupal.behaviors.atBP={attach:function(t,n){if(a.matchMedia("only screen").matches){var i=n[n.ajaxPageState.theme].at_breakpoints;for(var o in i)i.hasOwnProperty(o)&&function(t,a){enquire.register(a,{match:function(){e.body.classList.add("bp--"+t)},unmatch:function(){e.body.classList.remove("bp--"+t)}})}(o.split("_").join("-"),i[o].mediaquery)}}}}(jQuery,window,document); 833 834window.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"}}}()); 835; 836(function(){if(window.matchMedia&&window.matchMedia("all").addListener){return false}var e=window.matchMedia,i=e("only all").matches,n=false,t=0,a=[],r=function(i){clearTimeout(t);t=setTimeout(function(){for(var i=0,n=a.length;i<n;i++){var t=a[i].mql,r=a[i].listeners||[],o=e(t.media).matches;if(o!==t.matches){t.matches=o;for(var s=0,l=r.length;s<l;s++){r[s].call(window,t)}}}},30)};window.matchMedia=function(t){var o=e(t),s=[],l=0;o.addListener=function(e){if(!i){return}if(!n){n=true;window.addEventListener("resize",r,true)}if(l===0){l=a.push({mql:o,listeners:s})}s.push(e)};o.removeListener=function(e){for(var i=0,n=s.length;i<n;i++){if(s[i]===e){s.splice(i,1)}}};return o}})(); 837; 838let dashboardNavSettings = drupalSettings.nav_settings; 839//console.info(dashboardNavSettings); 840 841// Get the .click-me element 842// Listen to all click events on the document 843// const locbutton = document.querySelector('.location-viewer-new'); 844// const locdiv = document.querySelector('.org-locations-nav-new'); 845 846(function () { 847 848 var addEvent = function (el, type, fn) { 849 if (el.addEventListener) 850 el.addEventListener(type, fn, false); 851 else 852 el.attachEvent('on' + type, fn); 853 }; 854 855 var extend = function (obj, ext) { 856 for (var key in ext) 857 if (ext.hasOwnProperty(key)) 858 obj[key] = ext[key]; 859 return obj; 860 }; 861 862 window.fitText = function (el, kompressor, options) { 863 864 var settings = extend({ 865 'minFontSize': -1 / 0, 866 'maxFontSize': 1 / 0 867 }, options); 868 869 var fit = function (el) { 870 var compressor = kompressor || 1; 871 872 var resizer = function () { 873 el.style.fontSize = Math.max(Math.min(el.clientWidth / (compressor * 10), parseFloat(settings.maxFontSize)), parseFloat(settings.minFontSize)) + 'px'; 874 }; 875 876 // Call once to set. 877 resizer(); 878 879 // Bind events 880 // If you have any js library which support Events, replace this part 881 // and remove addEvent function (or use original jQuery version) 882 addEvent(window, 'resize', resizer); 883 addEvent(window, 'orientationchange', resizer); 884 }; 885 886 if (el && el.length) 887 for (var i = 0; i < el.length; i++) 888 fit(el[i]); 889 else if (el) { 890 fit(el); 891 } 892 893 // return set of elements 894 return el; 895 }; 896})(); 897 898 899// 900// window.quasarConfig = { 901// // your config here 902// loadingBar: { //this takes QAjaxBar Props 903// skipHijack: true // set this 904// }, 905// framework: { 906// cssAddon:true 907// }, 908// iconSet: 'fontawesomeV5' 909// } 910// 911// var NavApp = new Vue({ 912// el: '#labs-quasar-nav', 913// data: function () { 914// return { 915// } 916// }, 917// computed: { 918// showSomething: function (){ 919// } 920// }, 921// watch : { 922// subscriberCount: function () { 923// } 924// }, 925// methods : { 926// something: function() { 927// 928// } 929// }, 930// mounted() { 931// //alert('mount'); 932// } 933// }) 934 935 936var weather_canvas = document.getElementById("labs-weather-icon-quasar-nav"); 937
938if (weather_canvas && weather_canvas.length !== 0) { 939 var tile_skycons_icon = weather_canvas.getAttribute('data-skycon'); 940 var skycons_tile = new Skycons( 941 { 942 "monochrome": false, 943 "strokewidth": '.1' 944 } 945 ); 946 skycons_tile.add(weather_canvas, tile_skycons_icon); 947 // start animation! 948 skycons_tile.play(); 949} 950 951 952var locviewer = document.getElementById('location-viewer-new'); 953if (locviewer) { 954 locviewer.onclick = function () { 955 var locdiv = document.getElementById('org-locations-nav-new'); 956 locdiv.classList.toggle('hidden'); 957 } 958} 959 960var locviewerMobile = document.getElementById('location-viewer-new-mobile'); 961if (locviewerMobile) { 962 locviewerMobile.onclick = function () { 963 var locdiv = document.getElementById('org-locations-nav-new'); 964 locdiv.classList.toggle('hidden'); 965 } 966} 967var mobilemenuviewer = document.getElementById('q-mobile-menu-toggle'); 968mobilemenuviewer.onclick = function () { 969 var mobilemenu = document.getElementById('q-mobile-menu'); 970 // console.log("here it is --->", mobilemenu.childElementCount); 971 if (mobilemenu.classList.contains('box-shadow')) { 972 mobilemenu.style.height = 0 + "px"; 973 mobilemenu.classList.toggle('box-shadow'); 974 } else { 975 mobilemenu.style.height = "auto"; 976 mobilemenu.classList.toggle('box-shadow'); 977 } 978 979 mobilemenuviewer.classList.toggle('rotate-90'); 980 mobilemenuviewer.classList.toggle('fa-times'); 981 mobilemenuviewer.classList.toggle('fa-bars'); 982} 983 984var searchLinkDesktop = document.getElementById('search-link-toggle-desktop'); 985var searchTextDesktop = document.getElementById('desktop-search-string'); 986var searchDesktopGoButton = document.getElementById('desktop-search-go-button'); 987 988var searchLinkMobile = document.getElementById('search-link-toggle-mobile'); 989var searchTextMobile = document.getElementById('mobile-search-string'); 990var searchMobileGoButton = document.getElementById('mobile-search-go-button'); 991 992if ((searchLinkDesktop && searchTextDesktop) || (searchLinkDesktop && searchTextDesktop)) { 993 searchLinkDesktop.onclick = function (event) { 994 searchToggle(); 995 searchTextDesktop.focus(); 996 } 997 searchLinkMobile.onclick = function (event) { 998 searchToggle(); 999 searchTextMobile.focus(); 1000 } 1001 searchTextMobile.addEventListener("keydown", function (e) { 1002 var key = e.which && e.which || e.keyCode(); 1003 if (key === 13) { 1004 (function OnKeyEnterPressDoThis() { 1005 if (searchTextDesktop.value.length > 3) { 1006 goToSearch(searchTextDesktop.value); 1007 } 1008 }()); 1009 } 1010 }); 1011 searchTextDesktop.addEventListener("keydown", function (e) { 1012 var key = e.which && e.which || e.keyCode(); 1013 if (key === 13) { 1014 (function OnKeyEnterPressDoThis() { 1015 if (searchTextDesktop.value.length > 3) { 1016 goToSearch(searchTextDesktop.value); 1017 } 1018 }()); 1019 } 1020 }); 1021 1022 searchDesktopGoButton.onclick = function (event) { 1023 if (searchTextDesktop.value.length > 3) { 1024 goToSearch(searchTextDesktop.value); 1025 } 1026 } 1027 searchMobileGoButton.onclick = function (event) { 1028 if (searchTextMobile.value.length > 3) { 1029 goToSearch(searchTextMobile.value); 1030 } 1031 } 1032} 1033 1034 1035function searchToggle(){ 1036 const searchHide = document.querySelectorAll('.search-hide'); 1037 for (const box of searchHide) { 1038 box.classList.toggle('hidden'); 1039 } 1040} 1041function goToSearch(str) { 1042 window.location = '/search/' + str; 1043} 1044 1045fitText(document.getElementById("q-site-title"), 1.2, {minFontSize: '1px', maxFontSize: '40px'}); 1046; 1047var weather_canvas = document.getElementById("labs-weather-icon"); 1048 1049if (weather_canvas && weather_canvas.length !== 0) { 1050 var tile_skycons_icon = weather_canvas.getAttribute('data-skycon'); 1051 var skycons_tile = new Skycons( 1052 { 1053 "monochrome": false, 1054 "strokewidth": '.1' 1055 } 1056 ); 1057 skycons_tile.add(weather_canvas, tile_skycons_icon); 1058 // start animation! 1059 skycons_tile.play(); 1060} 1061;
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.