1// global.js 2function getElementById(id) { 3 return $G.id(id); 4} 5function open_window(url) { 6 mywin = new_win(url, 400, 335, 0, 0); 7} 8function new_window(url, w, h) { 9 newwin = new_win(url, w, h); 10} 11function new_win(url, w, h, r, s) { 12 w = w ? String(w) : '800'; 13 h = h ? String(h) : '600'; 14 r = r == 0 ? '0' : '1'; 15 s = s == 0 ? '0' : '1'; 16 return window.open(url, 'win', 'toolbar=0,location=0,directories=0,scrollbars=1,resizable=' + r + ',status=' + s + ',menubar=0,width=' + w + ',height=' + h); 17} 18var NewBox = null; 19function infobox(url, w, h) { 20 if (url) { 21 try { 22 w = w ? w : '600'; 23 h = h ? h : '450'; 24 var name = 'NewBox'; 25 var options = 'toolbar=0,directories=0,status=1,menubar=0,resizable=1,scrollbars=1,location=0,height=' + h + ',width=' + w; 26 if (NewBox) { 27 if (!NewBox.closed) { 28 NewBox.close(); 29 } 30 } 31 NewBox = window.open(url, name, options); 32 if (NewBox) { 33 NewBox.focus(); 34 } 35 } 36 catch (e) { 37 window.open(url); 38 } 39 } 40} 41function open_windowMainNav(url) { 42 myMainNavwin = window.open(url, 'win', 'toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1,width=600,height=450,left=1,top=1'); 43} 44function infoLink(theId, which, event) { 45 var box = document.getElementById(theId); 46 if (box) { 47 box.parentNode.title = ''; 48 if (box.innerHTML.trim() != '') { 49 var _box = document.getElementById('infoLinkBox'); 50 if (!_box) { 51 _box = document.createElement('span'); 52 _box.style.display = 'none'; 53 _box.setAttribute('id', 'infoLinkBox'); 54 document.getElementsByTagName('body')[0].appendChild(_box); 55 } 56 _box.innerHTML = box.innerHTML; 57 if (which == 'over') { 58 _box.style.display = ''; 59 _box.style.position = 'absolute'; 60 _box.style.zIndex = '500'; 61 _box.style.backgroundColor = '#FFFDCC'; 62 _box.style.border = '1px solid #E5E3B0'; 63 _box.style.padding = '6px 8px'; 64 showBox(event, _box); 65 } 66 else { 67 _box.style.display = 'none'; 68 } 69 } 70 } 71} 72function showBox(event, target) { 73 var y = event.clientY; 74 var scrollY = (window.pageYOffset) ? window.pageYOffset : document.body.scrollTop; 75 target.style.top = y + scrollY + 15 + "px"; 76 var offset = $G.offset(target.id, true); 77 var w = target.offsetWidth; 78 var x = Number(event.clientX) - Math.round(w / 2 + offset[0]); 79 target.style.left = x + "px"; 80} 81function addLoadEvent(func) { 82 var oldonload = window.onload; 83 if (typeof window.onload != 'function') { 84 window.onload = func; 85 } else { 86 window.onload = function () { 87 oldonload(); 88 func(); 89 } 90 } 91} 92function checkBodyWidth() { 93 if ($G.isIE()) { 94 $G.body().onresize = function () { shiftContainer() }; 95 shiftContainer(); 96 } 97} 98function shiftContainer() { 99 if (document.body.clientWidth || document.documentElement.clientWidth) { 100 if ((document.body.clientWidth) % 2 == 1 || (document.documentElement.clientWidth) % 2 == 1) { 101 $G.id('container').style.left = '1px'; 102 } 103 else { 104 $G.id('container').style.left = '0'; 105 } 106 } 107} 108var fixScreenShot = function () { 109 var container = $G.id('container'); 110 var contentBody = $G.id('contentBody'); 111 if (container && contentBody) { 112 var h = container.getHeight(); 113 if (h < 300) { 114 var contentHeight = Number(contentBody.getHeight()); 115 var contentTop = Number(contentBody.getStyle('top').replace('px', '')); 116 contentTop = contentTop ? contentTop : 0; 117 contentHeight = contentHeight ? contentHeight : 300; 118 container.style.height = (contentTop + contentHeight) + 'px'; 119 container.style.backgroundColor = 'transparent'; 120 } 121 } 122}; 123 124 125// $G - Emerald 'Get' Helper Class 126// for use in core application functionality 127// not recommended for use in custom development. 128// to make functions accessible to designers, 129// add overload to "Global" class 130var $G = { 131 navigation_menu: function () { 132 return $G.id('navigation_menu'); 133 }, 134 isIE: function () { 135 return navigator.appVersion.match('MSIE'); 136 }, 137 ieVersion: function () { 138 var rv = -1; // Return value assumes failure. 139 if ($G.isIE()) { 140 var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); 141 if (re.exec(navigator.userAgent) != null) { 142 rv = parseFloat(RegExp.$1); 143 } 144 } 145 return rv; 146 }, 147 applicationRoot: '/', 148 cookie: function (c_name) { 149 c_name = c_name.trim(); 150 var value = ''; 151 var c = document.cookie.split(';'); 152 for (var i = 0; i < c.length; i++) { 153 var _c = c[i]; 154 if (_c) { 155 if (_c.split('=')[0].trim() == c_name) { 156 if (_c.split('=')[1]) { 157 value = _c.split('=')[1].trim(); 158 } 159 } 160 } 161 } 162 return value; 163 }, 164 body: function () { 165 var body = document.getElementsByTagName('body')[0]; 166 return body; 167 }, 168 id: function (id) { 169 if (typeof id == 'string') { 170 return document.getElementById(id); 171 } 172 else { 173 var e = id; 174 return document.getElementById(e.id); 175 } 176 }, 177 cls: function (className, container) { 178 container = container || $G.body(); 179 var elements = container.getElementsByTagName('*'); 180 var matchingElements = []; 181 for (var i = 0; i < elements.length; i++) { 182 var element = elements[i]; 183 if (String(' ' + element.className + ' ').match(' ' + className + ' ')) { 184 matchingElements.push(element); 185 } 186 } 187 return matchingElements; 188 }, 189 hasClass: function (element, className) { 190 return String(' ' + element.className + ' ').match(' ' + className + ' '); 191 }, 192 offset: function (element, cumulative) { 193 var top = 0; 194 var left = 0; 195 var rel = false; 196 while (element.offsetParent && element.tagName.toLowerCase() != 'body' && rel == false) { 197 top = top + element.offsetTop; 198 left = left + element.offsetLeft; 199 element = element.offsetParent; 200 // if not getting cumulative offset, check to see if 201 // next element is relatively positioned if so, stop 202 if (!cumulative) { 203 if ($G.isIE()) { 204 rel = element.currentStyle.position == 'relative'; 205 } 206 else { 207 rel = window.getComputedStyle(element, null).position == 'relative'; 208 } 209 } 210 } 211 return [left, top]; 212 }, 213 scrollX: function () { 214 return (window.pageXOffset !== undefined) ? window.pageXOffset : (document.documentElement || document.body.parentNode || document.body).scrollLeft; 215 }, 216 scrollY: function () { 217 return (window.pageYOffset !== undefined) ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop; 218 }, 219 windowWidth: function () { 220 return $G.windowDimensions()[0]; 221 }, 222 windowHeight: function () { 223 return $G.windowDimensions()[1]; 224 }, 225 windowDimensions: function () { 226 var h1 = window.innerHeight; 227 var w1 = window.innerWidth; 228 var h2 = document.documentElement.clientHeight; 229 var w2 = document.documentElement.clientWidth; 230 var h3 = document.body.clientHeight; 231 var w3 = document.body.clientWidth; 232 if (typeof h1 != 'undefined') { 233 return [w1, h1]; 234 } 235 else if (typeof h2 != 'undefined' && h2 > 0) { 236 return [w2, h2]; 237 } 238 else { 239 return [w3, h3]; 240 } 241 }, 242 onloads: [], 243 onloads_fired: false, 244 onload: function (callback) { 245 $G.onloads.push(callback); 246 var fire_onloads = function () { 247 if (!$G.onloads_fired) { 248 var onloads = $G.onloads; 249 for (onload_i = 0; onload_i < onloads.length; onload_i++) { 250 onloads[onload_i](); 251 } 252 $G.onloads_fired = true; 253 } 254 } 255 256 var ie_onload = false; 257 /*@cc_on 258 @if (@_win32 || @_win64) 259 // IE 260 ie_onload = true;
261 document.write('<script id="ieScriptLoad" defer src="//:"><\/script>'); 262 $G.id('ieScriptLoad').onreadystatechange = function () { 263 if (this.readyState == 'complete') { 264 setTimeout(function () { 265 fire_onloads(); 266 }, 250); 267 } 268 }; 269 @end@*/ 270 if (!ie_onload) { 271 if (document.addEventListener) { 272 //Mozilla, Chrome, Opera 273 document.addEventListener('DOMContentLoaded', function () { fire_onloads() }, false); 274 } 275 else if (/KHTML|WebKit|iCab/i.test(navigator.userAgent)) { 276 //Safari, iCab, Konqueror 277 var DOMLoadTimer = setInterval(function () { 278 if (/loaded|complete/i.test(document.readyState)) { 279 fire_onloads(); 280 clearInterval(DOMLoadTimer); 281 } 282 }, 10); 283 } 284 else {// other 285 window.onload = function () { fire_onloads() }; 286 } 287 } 288 } 289}; 290 291// $S - Emerald 'Set' Helper Class 292// for use in core application functionality 293// not recommended for use in custom development. 294// to make functions accessible to designers, 295// add overload to "Global" class 296var $S = { 297 cookie: function (c_name, c_value, c_exp) { 298 if (c_name) { 299 if (c_name.trim() != '') { 300 var c_exp_str = c_exp ? '; expires=' + c_exp : ''; 301 document.cookie = c_name + '=' + c_value + c_exp_str; 302 } 303 } 304 }, 305 opacity: function (element, opacity) { 306 if (element) { 307 if ($G.isIE()) { 308 opacity = Math.round(Math.round(opacity) * 10); 309 opacity = Math.max(0, opacity); 310 opacity = Math.min(100, opacity); 311 if (opacity > 90) { 312 element.style.filter = ""; 313 } 314 else { 315 element.style.filter = 'alpha(opacity=' + opacity + ')'; 316 } 317 } 318 else { 319 opacity = opacity > 9 ? 10 : opacity; 320 opacity = opacity < 1 ? 0 : opacity / 10; 321 element.style.opacity = opacity; 322 } 323 } 324 } 325}; 326 327var Global = { 328 applicationRoot: '/', 329 alert: function (options) { 330 EmeraldModal.alert(options); 331 }, 332 confirm: function (options) { 333 EmeraldModal.confirm(options); 334 }, 335 imageInModal: function (src, w, h) { 336 w = typeof w == 'number' ? w : 800; 337 h = typeof h == 'number' ? h + 15 : 600; 338 var options = { message: src, width: w, height: h }; 339 EmeraldModal.image(options); 340 }, 341 openModalWindow: function (url, w, h, f, c) { 342 var d_w = typeof modal_width != 'undefined' ? modal_width : 800; 343 var d_h = typeof modal_height != 'undefined' ? modal_height : 600; 344 if (url) { 345 w = typeof w == 'number' ? w : d_w; 346 h = typeof h == 'number' ? h : d_h; 347 f = f == 0 ? 0 : 1; 348 c = c ? c : 'white'; 349 if ($G.windowWidth() < w + 40 || $G.windowHeight() < h + 40) { 350 // modal width doesn't fit 351 // open in new window 352 window.open(url + String(url.match('http') ? '' : '&intendedmodal=1')); 353 } 354 else { 355 // modal width fits 356 // open modal 357 EmeraldModal.info({ 358 message: url, 359 width: w, 360 height: h, 361 fade: f, 362 color: c, 363 iframe: true, 364 controls: ['close'] 365 }); 366 } 367 } 368 }, 369 openNewTab: function (url) { 370 window.open(url,'_blank'); 371 }, 372 openSmallWindow: function (url, w, h) { 373 if (url) { 374 w = typeof w == 'number' ? w : 800; 375 h = typeof h == 'number' ? h : 600; 376 if ($G.windowWidth() < w + 40 || $G.windowHeight() < h + 40) { 377 // modal width doesn't fit 378 // open in new window 379 window.open(url); 380 } 381 else { 382 // modal width fits 383 // open popup 384 window.open(url, 'small_win', 'width=' + w + ',height=' + h + ',toolbar=0,status=0,scrollbars=1'); 385 } 386 } 387 }, 388 onload: function (callback) { 389 $G.onload(callback); 390 }, 391 bookmarkPage: function () { 392 if (window.sidebar) { // FF 393 window.sidebar.addPanel(document.title, window.location.href, ""); 394 } 395 else if (window.external) { // IE 396 window.external.AddFavorite(window.location.href, document.title); 397 } 398 }, 399 getMap: function (srcID) { 400 var e = $G.id(srcID); 401 if (e) { 402 var addressStr = e.innerHTML.replace(' ', '+'); 403 var urlStr = 'http://www.google.com/maps?f=q&hl=en&geocode=&q=' + addressStr + '&ie=UTF8&z=16&iwloc=addr&om=1' 404 window.open(urlStr); 405 } 406 else { 407 alert('error: no address available'); 408 } 409 }, 410 OpenFlipbookModal: function (element) { 411 if (element) { 412 if (element.attr('href') != undefined || element.attr('href') != '') { 413 EmeraldModal.info({ 414 message: element.attr('href'), 415 width: 727, 416 height: 500, 417 controls: ['close'], 418 iframe: true, 419 color: black 420 }); 421 } 422 } 423 }, 424 GetParameterStringValue: function (string, param) { 425 var arrScript = string.split('?'); 426 var value; 427 if (arrScript.length > 1) { 428 var arrQuerystringParameters = arrScript[1].split('&'); 429 for (i = 0; i < arrQuerystringParameters.length; i++) { 430 var arrParams = arrQuerystringParameters[i].split('='); 431 if (arrParams[0] == param) 432 value = arrParams[1]; 433 } 434 } 435 return value; 436 }, 437 GetQuerystringValue: function (param) { 438 var arrUrl = Global.url().split('/'); 439 var urlHash = Global.urlHash(); 440 var string = arrUrl[arrUrl.length - 1].replace(urlHash, ''); 441 return Global.GetParameterStringValue(string, param); 442 }, 443 SetQuerystringValue: function (param, value, url) { 444 var arrUrl = Global.url(url).split('/'); 445 var found = 0; 446 var arrScript = arrUrl[arrUrl.length - 1].split('?'); 447 if (arrScript.length > 1) { 448 var arrQuerystringParameters = arrScript[1].split('&'); 449 for (i = 0; i < arrQuerystringParameters.length; i++) { 450 var arrParams = arrQuerystringParameters[i].split('='); 451 if (arrParams[0] == param) { 452 arrParams[1] = value; 453 arrQuerystringParameters[i] = arrParams.join('='); 454 found = 1; 455 } 456 } 457 } 458 if (found == 1) { 459 return arrScript[0] + '?' + arrQuerystringParameters.join('&'); 460 } 461 else { 462 if (arrScript.length > 1) 463 return arrScript.join('?') + '&' + param + '=' + value; 464 else 465 return arrScript[0] + '?' + param + '=' + value; 466 } 467 }, 468 DeleteQuerystringValue: function (param, url) { 469 var arrUrl = Global.url(url).split('/'); 470 var found = 0; 471 var arrScript = arrUrl[arrUrl.length - 1].split('?'); 472 if (arrScript.length > 1) { 473 var arrQuerystringParameters = arrScript[1].split('&'); 474 var arrNewQuerystringParameters = new Array(); 475 var j = 0; 476 for (i = 0; i < arrQuerystringParameters.length; i++) { 477 var arrParams = arrQuerystringParameters[i].split('='); 478 if (arrParams[0] != param) { 479 arrNewQuerystringParameters[j] = arrQuerystringParameters[i]; 480 j++; 481 } 482 } 483 return arrScript[0] + '?' + arrNewQuerystringParameters.join('&'); 484 } 485 else { 486 return arrScript[0]; 487 } 488 }, 489 GetScript: function () { 490 var url = location.href; 491 var arrUrl = url.split('/'); 492 var arrScript = arrUrl[arrUrl.length - 1].split('?'); 493 if (arrScript[0] != '') 494 return arrScript[0]; 495 else 496 return 'index.aspx'; 497 }, 498 url: function (url) { 499 if (!url) 500 url = location.href; 501 return url; 502 }, 503 urlHash: function (urlHash) { 504 if (!urlHash) 505 urlHash = location.hash; 506 return urlHash; 507 }, 508 toggleDiv: function (element) { 509 if (element.parentNode.parentNode.className == 'open') { 510 element.parentNode.parentNode.className = 'closed'; 511 } 512 else { 513 element.parentNode.parentNode.className = 'open'; 514 } 515 }, 516 target_blank: function (element) { 517 var loc = element.attr('href').trim(); 518 if (loc != '' && loc != '#' && !loc.match('javascript:')) { 519 window.open(loc); 520 return false; 521 } 522 else { 523 return true; 524 } 525 }, 526 setLanguage: function (language) { 527 var body = $G.body(); 528 body.className = body.className.replace(/english|spanish/g, ''); 529 body.className += ' ' + language; 530 $S.cookie('language', language); 531 }, 532 checkLanguage: function () { 533 var language = $G.cookie('language'); 534 if (language) { 535 if (language.trim() != '') { 536 Global.setLanguage(language); 537 } 538 } 539 }, 540 leavingWebsite: function (element) { 541 var str = typeof leavingText != 'undefined' ? leavingText.text : ''; 542 var $this = element; 543 if (str != '') { 544 EmeraldModal.confirm({ 545 message: str, 546 width: 400, 547 height: 325, 548 controls: ['close'], 549 okLabel: 'Proceed', 550 okCallback: function () { 551 if (element.attr('target') == '_blank' || element.is('.target_blank')) { 552 EmeraldModal.closeAll(); 553 window.open(element.attr('href')); 554 } 555 else { 556 document.location = element.attr('href'); 557 } 558 } 559 }); 560 var offset = $('#EmeraldModal').offset(); 561 $('html, body').animate({ 562 scrollTop: offset.top, 563 }); 564 return false; 565 } 566 else { 567 if ($this.attr('target') == '_blank' || $this.hasClass('target_blank')) { 568 window.open($this.attr('href')); 569 return false; 570 } 571 else { 572 window.location.href = $this.attr('href'); 573 return true; 574 } 575 } 576 }, 577 clickThroughDisclaimer: function (e, url) { 578 EmeraldModal.getModal({ 579 message: url, 580 width: 500, 581 height: 320, 582 iframe: true, 583 okCallback: function () { 584 location = e.href; 585 } 586 }, 'alert', ['ok']); 587 }, 588 showContentNavList: function (e) { 589 if (e) { 590 var e_parent = e.parentNode; 591 if (e_parent) { 592 var current_lis = $G.cls('current', e_parent.parentNode); 593 for (var i = 0; i < current_lis.length; i++) { 594 current_lis[i].className = String(' ' + current_lis[i].className + ' ').replace(/ current /g, ''); 595 } 596 e_parent.className += ' current'; 597 // scroll window to the top 598 // of the just clicked button 599 if ($G.windowWidth() < 500 || $G.windowHeight < 500) { 600 var offset = $G.offset(e_parent, true); 601 scrollTo(0, offset[1]); 602 } 603 var n_list = e_parent.getElementsByTagName('ul')[0]; 604 if (n_list) { 605 var contentElement = $G.id('content'); 606 if (contentElement) { 607 var c_list = n_list.cloneNode(true); 608 var c_h1 = document.createElement('h1'); 609 c_h1.innerHTML = e.innerHTML; 610 c_list.className = c_list.className + ' content_list_plain'; 611 var content_children = contentElement.getElementsByTagName('*'); 612 for (i = 0; i < content_children.length; i++) { 613 var content_child = content_children[i]; 614 content_child.style.display = 'none'; 615 } 616 contentElement.appendChild(c_h1); 617 contentElement.appendChild(c_list); 618 if (typeof initGlobalEventHandlers != 'undefined') { 619 initGlobalEventHandlers(); 620 } 621 } 622 } 623 } 624 } 625 }, 626 matchHeight: function (elements) { 627 var $elements = elements; 628 var maxHeight = Math.max.apply(null, $elements.map(function (element) { 629 return $(this).height(); 630 }).get()); 631 632 $elements.css('height',maxHeight); 633 }, 634 isElementInViewport: function(el){ 635 let rect = el.getBoundingClientRect(); 636 return (rect.top>-1 && rect.bottom <= window.innerHeight); 637 } 638}; // end Global 639 640var initGlobalEventHandlers = function () { 641 if (typeof window.handlersSet === 'boolean' && window.handlersSet) 642 return false 643 644 if (window.handlersSet != true) { 645 window.handlersSet = true 646 jQuery('.dynamic_list').on('click touchend', function () { 647 if (jQuery('body').hasClass('navON')) { 648 return false; 649 } else { 650 if (!$(this).parent().hasClass('slicknav_item')) { 651 Global.showContentNavList(this); 652 } 653 } 654 }); 655 656 jQuery('a').on('click touchend', function (event) { 657 var $a = jQuery(this); 658 if ($a.attr('href') != undefined) { 659 try { 660 if ($a.hasClass('leavingWebsite') && !( jQuery('body').hasClass('editON') || jQuery('body').hasClass('modularON')) ) { 661 event.preventDefault(); 662 return Global.leavingWebsite(jQuery(this)); 663 } 664 else if ($a.hasClass('target_blank_small')) { 665 event.preventDefault(); 666 return Global.openSmallWindow(jQuery(this).attr('href')); 667 } 668 else if ($a.hasClass('target_blank')) { 669 event.preventDefault(); 670 return Global.target_blank(jQuery(this)); 671 } 672 else { 673 return true; 674 } 675 } catch (e) { 676 return true; 677 } 678 } 679 }); 680 681 jQuery('.flipbookModal').on('click touchend', function () { 682 Global.OpenFlipbookModal(jQuery(this)); 683 return false; 684 }); 685 686 jQuery('.toggleDiv').on('click touchend', function () { 687 jQuery(this).attr('title','expand/collapse'); 688 Global.toggleDiv(this); 689 }); 690 691 jQuery('.infoLinks').on({ 692 mouseenter: function () { 693 infoLink('domain_departure_text', 'over', event); 694 }, 695 mouseout: function () { 696 infoLink('domain_departure_text', 'out', event); 697 } 698 }); 699 700 jQuery(window).resize(function(){ 701 flipbooksIsDesktop(); 702 }); 703 704 if (jQuery('body').is('.home,.index')) { 705 if (jQuery('.home_page_image').length > 0) { 706 707 // SET DATA ATTR FOR INITIAL FLOAT OF HOME PAGE IMAGE 708 var initFloat = jQuery('.home_page_image').css('float'); 709 jQuery('.home_page_image').data('initfloat',initFloat); 710 711 jQuery(window).resize(function() { 712 var imageW = $('.home_page_image').width(); 713 var windowW = $(window).width(); 714 var relativePercentage = (imageW/windowW)*100; 715 716 if(relativePercentage >= 70.0 && relativePercentage <= 100.0){ 717 jQuery('.home_page_image').css('float','none'); 718 } 719 else{ 720 jQuery('.home_page_image').css('float',jQuery(this).data('initfloat')); 721 } 722 }).resize(); 723 724 } 725 } 726 } 727 728 var fol = document.querySelector('.focus-on-load') 729 if (fol) 730 fol.focus() 731 732 var _sticky = document.querySelectorAll('.bas-sticky') 733 _sticky.forEach(function(el){ 734 let h = el.offsetHeight 735 if (el.classList.contains('bas-sticky-bottom')){ 736 document.body.style.marginBottom = h+'px' 737 } 738 else if (el.classList.contains('bas-sticky-top')){ 739 document.body.style.marginTop = h+'px' 740 } 741 }) 742 743 try { 744 var evs = document.querySelectorAll('.custEmbedVideo')
745 evs.forEach(function(el){ 746 const p = el.parentElement, 747 pd = p.dataset, 748 root = location.href.includes('uat') && !location.href.includes('preview') ? '/uat' : '', 749 type = pd.url.includes('.mp4')?'video/mp4':'video/webm', 750 autoplay = pd.autostart === 'true'?'autoplay muted="true"':'', 751 poster = pd.image != ''?`poster="${root+pd.image}"`:'', 752 _v_ = `<video src="${root+pd.url}" type="${type}" controls ${autoplay} ${poster} class="generated-video-element" style="width:100%;"></video>` 753 754 el.style.maxWidth = pd.width 755 if (pd.alignment == 'Center'){ 756 el.style.margin = 'auto' 757 p.style.removeProperty('margin') 758 p.style.removeProperty('padding-bottom') 759 } 760 el.insertAdjacentHTML('beforeend', _v_) 761 }) 762 763 } 764 catch(e){ 765 console.error(e) 766 } 767 768} 769 770var fsize = function (size) { 771 var body = $G.body(); 772 if (body) { 773 body.className = body.className.replace(/defaultText|mediumText|largeText/g, ''); 774 body.className += String(' ' + size + 'Text'); 775 } 776 777 try { document.cookie = 'fontSize=' + size + ';path=' + Global.applicationRoot } catch (e) { /*do nothing*/ } 778}; 779 780var fsize_init = function () { 781 // font resize based on cookie 782 try { 783 var fontSize = $G.cookie('fontSize'); 784 if (fontSize) { 785 fsize(fontSize); 786 } 787 } 788 catch (e) { 789 // do nothing 790 } 791}; 792 793function checkEmailForResize() { 794/* function checks to see if the sidebar email address is wrapping. If it is, it loops through and reduces the font size until it no longer wraps. 795 If the font size reaches 12px and is still wrapping, font is set back to it's initial value and wrapping is left in.*/ 796 797 var emailElementList = document.querySelectorAll('#sidebar .email a'); 798 799 if(emailElementList){ 800 for(var i = 0; i<emailElementList.length; i++){ 801 var emailElement = emailElementList[i] 802 var parentContainer = emailElement.parentNode; 803 804 emailElement.style.wordWrap = 'normal'; 805 emailElement.style.display = 'block'; 806 807 var containerWidth = parentContainer.clientWidth; 808 var emailWidth = parentContainer.scrollWidth; 809 810 var currentFontSize = window.getComputedStyle(emailElement).fontSize; 811 var initialFontSize = currentFontSize; 812 813 while(containerWidth < emailWidth){ 814 emailElement.style.fontSize = reduceFontSize1(currentFontSize); 815 emailWidth = parentContainer.scrollWidth; 816 currentFontSize = window.getComputedStyle(emailElement).fontSize; 817 if(currentFontSize === '11px'){ 818 emailElement.style.wordWrap = 'break-word'; 819 emailElement.style.fontSize = initialFontSize; 820 break 821 } 822 } 823 } 824 } 825} 826 827function reduceFontSize1 (currentFontSize) { 828 //function takes a font size input in px, reduces it by 1, and returns the value. 829 var newFontSize; 830 if(currentFontSize.search('px') > 0){ 831 newFontSize = (currentFontSize.slice(0, currentFontSize.search('px')) - 1) + 'px'; 832/* Logic for rems and ems. Currently uneccessary as font is handled in px. 833 Logic would need to be reworked to change font size by an appropriate amount for rem or em (1 point difference too much for these types)*/ 834 // }else if(currentFontSize.search('rem') > 0){ 835 // newFontSize = (currentFontSize.slice(0, currentFontSize.search('rem')) - 1) + 'rem'; 836 // }else if(currentFontSize.search('em') > 0){ 837 // newFontSize = (currentFontSize.slice(0, currentFontSize.search('em')) - 1) + 'em'; 838 } 839 return newFontSize; 840} 841 842function addFBDesktopLink(e){ 843 e.preventDefault(); 844 var _newURL; 845 if(this.hasAttributes()){ 846 //desktop link is set on the element in a data attribute 847 for(var _j = 0, _attributes = this.attributes; _j < _attributes.length; _j++ ) { 848 if (_attributes[_j].name === 'data-link'){ 849 _newURL = _attributes[_j].value; 850 } 851 } 852 } 853 if(_newURL){ 854 window.open(_newURL); 855 } 856} 857 858// determines if the page is being viewed in a window wider than 1024. If so, changes flipbook links to show the flipbook in a standard webpage 859function flipbooksIsDesktop() { 860 861 // check width of window. 1024 width based on ipad pro size 862 var _windowWidth = window.innerWidth; 863 //select all flipbook links on the page 864 var flipbookLinks = document.querySelectorAll('.flipbook a'); 865 if(flipbookLinks) { 866 for(var _i = 0; _i < flipbookLinks.length; _i++) { 867 flipbookLinks[_i].removeEventListener('click', addFBDesktopLink) 868 } 869 if(_windowWidth < 1024) 870 // loop through all the links and change the click event to the new link 871 for(var _i = 0; _i < flipbookLinks.length; _i++) { 872 flipbookLinks[_i].addEventListener('click', addFBDesktopLink) 873 } 874 } 875} 876 877 878$G.onload(function () { 879 if (location.href.match('/uat/')) { 880 $G.applicationRoot = '/uat/'; 881 } else if (location.href.match('/preview/')) { 882 Global.applicationRoot = '/preview/' 883 } 884 initGlobalEventHandlers(); 885 fsize_init(); 886 checkEmailForResize(); 887 flipbooksIsDesktop(); 888});
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.