1// ID of the element for the privacy policy notification. 2var ppElementID = 'ppID'; 3 4/* 5 * Instantiating the base NRA library object. 6 */ 7if (!window.NRA) { 8 /* 9 * Get the URL of the folder that contains this script. 10 * Any absolute urls constructed within this file can 11 * utilize the window.NRA.ScriptPath variable in order 12 * to build a relatively url to the required resource. 13 * This is done specifically so that this script can be 14 * referenced in the html of ServSafe's CMS. 15 * 16 * It is CRITICAL that this be updated if the script is moved 17 * out of the /Scripts folder. These path helpers assume 18 * that the script is exactly one directory level deeper 19 * than the base application path. 20 */ 21 /*var scriptPath = null;*/ 22 var scripts = document.getElementsByTagName('script'); 23 var thisScriptElement = scripts[scripts.length - 1]; 24 /*var path = thisScriptElement.src.split('?')[0]; 25 scriptPath = path.split('/').slice(0, -1).join('/') + '/'; 26 var appPath = path.split('/').slice(0, -2).join('/'); 27 */ 28 29 /* 30 * NOTE: Replaced the path definition with the following. 31 * The previous method relied on this script being the last 32 * script included on the page which cannot be guaranteed. 33 */ 34 var appPath = location.origin + '/access'; 35 var scriptPath = location.origin + '/CMSScripts/Custom/'; 36 37 /* 38 * This code is meant to detect if the element.classList 39 * object is supported. We use the script element from the code 40 * above because we know for certain there is one 41 * script tag on the page. 42 * This is mostly for IE11 support, which does not allow the 43 * element.classList property. 44 */ 45 var classListSupported = false; 46 if (thisScriptElement.classList) { classListSupported = true; } 47 48 49 window.NRA = { 50 ScriptPath: scriptPath, 51 AppPath: appPath, 52 Debug: false, 53 54 Helpers: { 55 ClassListSupported: classListSupported 56 }, 57 58 Products: { 59 /* 60 * This object is used to cache products that 61 * have already been retrieved from the catalog. 62 * This is to avoid redundant calls. 63 */ 64 RetrievedProducts: {} 65 } 66 }; 67 68 //console.log(window.NRA.ScriptPath); 69} 70 71NRA.addElementEvent = function (element, eventName, fn) { 72 if (element.addEventListener) { 73 element.addEventListener(eventName, fn, false); 74 } else if (element.attachEvent) { 75 element.attachEvent('on' + eventName, fn); 76 } else { 77 console.log('No event handler function available.'); 78 } 79}; 80 81NRA.productAlert = function (element) { 82 $(element) 83 .attr({ title: 'Alert', 'class': 'alert' }) 84 .dialog({ 85 buttons: { OK: function () { $(this).dialog('close'); } }, 86 close: function () { $(this).remove(); }, 87 draggable: true, 88 modal: true, 89 resizable: false, 90 width: '30%' 91 }); 92}; 93 94NRA.Helpers.getCookie = function (name) { 95 if (typeof name === 'undefined' || name == null || name.length === 0) return null; 96 var v = document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)'); 97 return v ? decodeURIComponent(v[2]) : null; 98}; 99 100NRA.Helpers.setCookie = function (name, value, maxAge, expires, path, domain) { 101 if (typeof name === 'undefined' || name == null || name.length === 0) return; 102 var cValue = name + '=' + encodeURIComponent(value); 103 if (typeof maxAge !== 'undefined' && isFinite(maxAge)) { 104 cValue += '; max-age=' + maxAge; 105 } 106 if (typeof expires !== 'undefined' && expires != null && expires.length > 0) { 107 cValue += '; expires=' + expires; 108 } 109 if (typeof path !== 'undefined' && path != null && path.length > 0) { 110 cValue += '; path=' + path; 111 } 112 if (typeof domain !== 'undefined' && domain != null && domain.length > 0) { 113 cValue += '; domain=' + domain; 114 } 115 document.cookie = cValue; 116}; 117 118NRA.Helpers.cookieEquals = function (name, value) { 119 if (typeof name === 'undefined' || name == null || name.length === 0) return false; 120 var cv = name + '=' + encodeURIComponent(value); 121 return document.cookie.split(';').filter(function (item) { return item.indexOf(cv) >= 0; }).length > 0;
122}; 123 124// Checks the privacy policy banner for a version attribute and checks localstorage if it exists 125NRA.Helpers.checkPrivacyPolicy = function (elementId) { 126 if (typeof elementId === 'undefined' || elementId == null || elementId.length === 0) { 127 // ElementId is not specified. 128 if (console && console.error) console.error('ElementId not specified in checkPrivacyPolicy!'); 129 return; 130 } 131 var element = document.getElementById(elementId); 132 if (!element) { 133 // Element not found. 134 if (console && console.error) console.error('ElementId not found in checkPrivacyPolicy!'); 135 return; 136 } 137 element.style.display = 'none'; 138 var ppVersion = element.getAttribute('data-ppversion'); 139 if (typeof (ppVersion) === 'undefined' || ppVersion == null || ppVersion.length === 0) { 140 // ElementId is not specified. 141 if (console && console.error) console.error('Could not read current policy version from ' + elementId + ' in checkPrivacyPolicy!'); 142 return; 143 } 144 if (NRA.Helpers.cookieEquals('ppversion', ppVersion)) { 145 // Latest version has been seen 146 return; 147 } 148 var closeButton = document.getElementById('cookiesAgree'); 149 if (closeButton) { 150 closeButton.onclick = function (ev) { 151 var ppelement = ev.target; 152 while (!ppelement.hasAttribute('data-ppversion') && ppelement.parentElement) { ppelement = ppelement.parentElement; } 153 var version = ppelement.getAttribute('data-ppversion'); 154 NRA.Helpers.setCookie('ppversion', version, null, null, '/'); 155 ppelement.style.display = 'none'; 156 }; 157 } 158 element.style.display = 'block'; 159}; 160 161NRA.Helpers.createClassyElement = function (elementTagName, options) { 162 var element = document.createElement(elementTagName); 163 164 if (!options) 165 return element; 166 167 if (options.classList) { 168 for (var className in options.classList) { 169 if (NRA.Helpers.ClassListSupported) { 170 element.classList.add(options.classList[className]); 171 } else { 172 element.className += " " + options.classList[className]; 173 } 174 } 175 } 176 177 if (options.attrs) { 178 var attrs = options.attrs; 179 for (var attrName in attrs) { 180 element.setAttribute(attrName, attrs[attrName].toString()); 181 } 182 } 183 184 if (options.text) { 185 if (element.innerText) { 186 element.innerText = options.text; 187 } else { 188 element.textContent = options.text; 189 } 190 } 191 192 if (options.html) { 193 element.innerHTML = options.html; 194 } 195 196 return element; 197}; 198 199NRA.Products.getCategoryDataUrl = function (categoryId) { 200 return NRA.AppPath + "/api/Category/" + categoryId; 201}; 202 203NRA.Products.getProductDataUrl = function (sku) { 204 return NRA.AppPath + "/api/Product/" + sku; 205}; 206 207NRA.Products.__createProductElement = function (cssClass, data) { 208 var classes = []; 209 210 if (cssClass) { 211 cssClass.split(' '); 212 } 213 214 var containerDiv = NRA.Helpers.createClassyElement('div', { 215 classList: classes 216 }); 217 218 var table = NRA.Helpers.createClassyElement('table', { 219 classList: ['ProductEmbed'] 220 }); 221 var tbody = document.createElement('tbody'); 222 var tr = document.createElement('tr'); 223 var detailTd = document.createElement('td'); 224 var imageTd = document.createElement('td'); 225 containerDiv.appendChild(table); 226 table.appendChild(tbody); 227 tbody.appendChild(tr); 228 tr.appendChild(imageTd); 229 tr.appendChild(detailTd); 230 231 var detailDiv = NRA.Helpers.createClassyElement('div', { 232 classList: ['ProductTitle'] 233 }); 234 detailDiv.appendChild(NRA.Helpers.createClassyElement('a', { 235 attrs: { 236 href: data.DetailLink 237 }, 238 text: data.Title 239 })); 240 detailDiv.appendChild(NRA.Helpers.createClassyElement('br')); 241 detailDiv.appendChild(NRA.Helpers.createClassyElement('span', { 242 classList: ['ProductDescription'], 243 html: data.Description + '<span class="ProductCode">' + data.ProductCode + '</span>' 244 })); 245 246 if (data.BackorderText) { 247 var backorderDiv = NRA.Helpers.createClassyElement('div', { 248 classList: ['backorder-text'], 249 text: data.BackorderText 250 }); 251 252 detailDiv.appendChild(backorderDiv); 253 } 254 255 var priceDiv = NRA.Helpers.createClassyElement('div', { 256 classList: ['ProductPrice'] 257 });
258 259 priceDiv.appendChild(NRA.Helpers.createClassyElement('div', { 260 classList: ['UnitPrice'], 261 text: '$' + parseFloat(data.Price).toFixed(2).toString() 262 })); 263 264 if (data.Price != data.DiscountPrice) { 265 priceDiv.appendChild(NRA.Helpers.createClassyElement('div', { 266 classList: ['DiscountPrice'], 267 text: '$' + parseFloat(data.DiscountPrice).toFixed(2).toString() 268 })); 269 } 270 271 var addDiv = NRA.Helpers.createClassyElement('div'); 272 addDiv.appendChild(NRA.Helpers.createClassyElement('a', { 273 attrs: { 274 href: data.AddLink 275 }, 276 classList: ['button'], 277 text: 'Add To Shopping Cart' 278 })); 279 280 var imageDiv = NRA.Helpers.createClassyElement('div', { 281 classList: ['image'] 282 }); 283 var imageLink = NRA.Helpers.createClassyElement('a', { 284 attrs: { 285 href: data.DetailLink 286 } 287 }); 288 imageDiv.appendChild(imageLink); 289 imageLink.appendChild(NRA.Helpers.createClassyElement('img', { 290 attrs: { 291 src: data.ImageUrl, 292 alt: data.Title 293 } 294 })); 295 296 imageTd.appendChild(imageDiv); 297 detailTd.appendChild(detailDiv); 298 detailTd.appendChild(priceDiv); 299 detailTd.appendChild(addDiv); 300 301 return containerDiv; 302}; 303 304NRA.Products.formatProductElement = function (element, data) { 305 var cssClass = $(element).attr('data-nra-class'); 306 var containerDiv = this.__createProductElement(cssClass, data); 307 $(element).append(containerDiv); 308}; 309 310NRA.Products.formatCategoryElement = function (element, data) { 311 var cssClass = $(element).attr('data-nra-class'); 312 313 var containerDiv = NRA.Helpers.createClassyElement('div', { 314 classList: cssClass.split(' ') 315 }); 316 317 containerDiv.appendChild(NRA.Helpers.createClassyElement('h3', { 318 text: data.Title 319 })); 320 321 containerDiv.appendChild(NRA.Helpers.createClassyElement('span', { 322 text: data.ShortDescription 323 })); 324 325 if (data.Products && data.Products instanceof Array) { 326 for (var i = 0; i < data.Products.length; i++) { 327 var productDiv = this.__createProductElement(null, data.Products[i]); 328 containerDiv.appendChild(productDiv); 329 } 330 } 331 332 $(element).append(containerDiv); 333}; 334 335NRA.Products.getCategoryData = function (categoryId, params, callback) { 336 $.getJSON(NRA.Products.getCategoryDataUrl(categoryId), params, function (data) { 337 if (data.Products && data.Products instanceof Array) { 338 for (var i = 0; i < data.Products.length; i++) { 339 var sku = data.Products[i].ProductCode; 340 NRA.Products.RetrievedProducts[sku] = data.Products[i]; 341 } 342 343 callback(data); 344 } 345 }); 346}; 347 348NRA.Products.getProductData = function (sku, params, callback) { 349 350 if (NRA.Products.RetrievedProducts[sku]) { 351 callback(NRA.Products.RetrievedProducts[sku]); 352 return; 353 } 354 355 $.getJSON(NRA.Products.getProductDataUrl(sku), params, function (data) { 356 NRA.Products.RetrievedProducts[sku] = data; 357 callback(data); 358 }); 359}; 360 361NRA.Products.populateCategoryElement = function (element) { 362 var params = NRA.Products.__getCatalogParams(element); 363 364 NRA.Products.getCategoryData(params.category, params, function (data) { 365 NRA.Products.formatCategoryElement(element, data); 366 }); 367}; 368 369NRA.Products.populateProductElement = function (element) { 370 var params = NRA.Products.__getCatalogParams(element); 371 372 NRA.Products.getProductData(params.sku, params, function (data) { 373 NRA.Products.formatProductElement(element, data); 374 }); 375}; 376 377NRA.Products.__getCatalogParams = function (element) { 378 var sku = $(element).attr('data-nra-sku'); 379 var website = $(element).attr('data-nra-website'); 380 var categoryId = $(element).attr('data-nra-category'); 381 var coupon = $(element).attr('data-nra-coupon'); 382 383 return { 384 sku: sku, 385 property: website, 386 category: categoryId, 387 couponCode: coupon 388 }; 389};
390 391NRA.addElementEvent(window, 'load', function () { 392 $("div[data-nra-sku]").each(function (index, element) { 393 NRA.Products.populateProductElement(element); 394 }); 395 396 $("div[data-nra-category]").each(function (index, element) { 397 NRA.Products.populateCategoryElement(element); 398 }); 399 400 NRA.Helpers.checkPrivacyPolicy(ppElementID); 401}); 402 403// Country/State/Province dropdown cascading 404// Defaults dropdown ids to "Country" & "State". 405function countryDropDown(url, countryControlId, stateControlId) { 406 407 countryControlId = typeof countryControlId !== 'undefined' ? countryControlId : '#Country'; 408 stateControlId = typeof stateControlId !== 'undefined' ? stateControlId : '#State'; 409 410 if ($(stateControlId).val() == "") { 411 $(stateControlId).prop("disabled", true); 412 } 413 414 $(countryControlId).change(function () { 415 if ($(countryControlId).val() != "") { 416 var options = {}; 417 options.url = url; 418 options.type = "POST"; 419 options.data = JSON.stringify({ countryCode: $(countryControlId).val() }); 420 options.dataType = "json"; 421 options.contentType = "application/json"; 422 options.success = function (states) { 423 $(stateControlId).empty(); 424 for (var i = 0; i < states.length; i++) { 425 $(stateControlId).append($('<option></option>').val(states[i].Value).html(states[i].Text)); 426 } 427 $(stateControlId).prop("disabled", states.length <= 1); 428 }; 429 options.error = function (XMLHttpRequest, textStatus, errorThrown) { alert("Error retrieving states/provinces for selected country."); }; 430 $.ajax(options); 431 } 432 else { 433 $(stateControlId).empty(); 434 $(stateControlId).prop("disabled", true); 435 } 436 }); 437} 438 439function populateStateFromCountry(url, countryCode, selectedState, stateControlId) { 440 stateControlId = typeof stateControlId !== 'undefined' ? stateControlId : '#StateDropDown'; 441 var stateControl = $(stateControlId); 442 if (countryCode != "") { 443 var options = {}; 444 options.url = url; 445 options.type = "POST"; 446 options.data = JSON.stringify({ countryCode: countryCode }); 447 options.dataType = "json"; 448 options.contentType = "application/json"; 449 options.success = function (data) { 450 var res = "<select id='State' class='form-control valid' name='State'>"; 451 for (var i = 0; i < data.length; i++) { 452 if (data[i].Value == selectedState) { 453 res = res + "<option selected='selected' value='" + data[i].Value + "'>" + data[i].Text + "</option> "; 454 } else { 455 res = res + "<option value='" + data[i].Value + "'>" + data[i].Text + "</option> "; 456 } 457 } 458 res = res + "</select>"; 459 stateControl.html(res); 460 }; 461 options.error = function (XMLHttpRequest, textStatus, errorThrown) { alert("Error retrieving states/provinces for selected country."); }; 462 $.ajax(options); 463 } 464} 465 466NRA.Helpers.countryDropDown = countryDropDown; 467 468//GDPR Functions 469function getGDPROptions(url, countryCode, state, city, optionsModel) { 470 $.ajax({
471 type: "POST", 472 url: url, 473 contentType: "application/json", 474 dataType: "json", 475 data: JSON.stringify({ countryCode: countryCode, state: state, city: city, model: optionsModel }), 476 success: function (response) { 477 //If SSI, we want to prevent the user from creating their account if GDPR API has fatal errors 478 if (response.message === "SSIError") { 479 location.href = response.errorUrl; 480 } 481 $('#GDPROptInOptions').html(response.PartialView); 482 $('#GDPROptInOptions').show(); 483 }, 484 error: function (xhr, httpStatusMessage, errorMessage) { 485 console.log(errorMessage); 486 $('#GDPROptInOptions').hide(); 487 } 488 }); 489} 490 491NRA.Helpers.getGDPROptions = getGDPROptions; 492 493//function getShippingMethods(countryControlId, stateControlId, cityControlId) { 494 495// countryControlId = typeof countryControlId !== 'undefined' ? countryControlId : '#Country'; 496// stateControlId = typeof stateControlId !== 'undefined' ? stateControlId : '#State'; 497// cityControlId = typeof cityControlId !== 'undefined' ? stateControlId : '#City'; 498 499 500//} 501 502 503NRA.Helpers.populateStateFromCountry = populateStateFromCountry; 504 505// Set sort glyphs 506function setArrows(displayType) { 507 // hidden fields in grid 508 var dir = $('#dir').val(); 509 var col = $('#col').val(); 510 511 var header = $('th a[href*=' + col + ']'); 512 513 if (dir == 'Ascending') { 514 515 switch (displayType) { 516 517 case "css": 518 header.addClass('asc'); 519 break; 520 case "image": 521 header.html(header.html() + ' <span class="glyphicon glyphicon-arrow-up"></span>'); 522 break; 523 case "text": 524 header.text(header.text() + ' â²'); 525 break; 526 } 527 528 // Text 529 530 // Image 531 } 532 533 if (dir == 'Descending') { 534 535 switch (displayType) { 536 537 case "css": 538 header.addClass('desc'); 539 break; 540 case "image": 541 header.html(header.html() + ' <span class="glyphicon glyphicon-arrow-down"></span>'); 542 break; 543 case "text": 544 header.text(header.text() + ' â¼'); 545 break; 546 } 547 548 } 549} 550 551NRA.Helpers.setArrows = setArrows; 552 553 554// Portals, BEGIN 555function AppendSubmenu(oPortalSubNav, navLink, navTitle) { 556 oPortalSubNav.append("<ul><li><a href='" + navLink + "'>" + navTitle + "</li></ul>"); 557} 558function SubscribeProduct(alertMessage, url) { 559 if (alertMessage != null) { 560 if (!confirm(alertMessage)) 561 return; 562 } 563 564 location.href = url; 565} 566// Portals, END 567 568//tabcollapse 569!function ($) { 570 571 "use strict"; 572 573 // TABCOLLAPSE CLASS DEFINITION 574 // ====================== 575 576 var TabCollapse = function (el, options) { 577 this.options = options; 578 this.$tabs = $(el); 579 580 this._accordionVisible = false; //content is attached to tabs at first 581 this._initAccordion(); 582 this._checkStateOnResize(); 583 584 585 // checkState() has gone to setTimeout for making it possible to attach listeners to 586 // shown-accordion.bs.tabcollapse event on page load. 587 // See https://github.com/flatlogic/bootstrap-tabcollapse/issues/23 588 var that = this; 589 setTimeout(function () { 590 that.checkState(); 591 }, 0); 592 }; 593 594 TabCollapse.DEFAULTS = { 595 accordionClass: 'visible-xs', 596 tabsClass: 'hidden-xs', 597 accordionTemplate: function (heading, groupId, parentId, active) { 598 return '<div class="panel panel-default">' + 599 ' <div class="panel-heading">' + 600 ' <h4 class="panel-title">' + 601 ' </h4>' + 602 ' </div>' + 603 ' <div id="' + groupId + '" class="panel-collapse collapse ' + (active ? 'in' : '') + '">' + 604 ' <div class="panel-body js-tabcollapse-panel-body">' + 605 ' </div>' + 606 ' </div>' + 607 '</div>'; 608 } 609 }; 610 611 TabCollapse.prototype.checkState = function () { 612 if (this.$tabs.is(':visible') && this._accordionVisible) { 613 this.showTabs(); 614 this._accordionVisible = false; 615 } else if (this.$accordion.is(':visible') && !this._accordionVisible) { 616 this.showAccordion(); 617 this._accordionVisible = true; 618 } 619 }; 620 621 TabCollapse.prototype.showTabs = function () { 622 var view = this; 623 this.$tabs.trigger($.Event('show-tabs.bs.tabcollapse')); 624 625 var $panelHeadings = this.$accordion.find('.js-tabcollapse-panel-heading').detach(); 626 627 $panelHeadings.each(function () { 628 var $panelHeading = $(this), 629 $parentLi = $panelHeading.data('bs.tabcollapse.parentLi'); 630 631 var $oldHeading = view._panelHeadingToTabHeading($panelHeading); 632 633 $parentLi.removeClass('active'); 634 if ($parentLi.parent().hasClass('dropdown-menu') && !$parentLi.siblings('li').hasClass('active')) { 635 $parentLi.parent().parent().removeClass('active'); 636 } 637 638 if (!$oldHeading.hasClass('collapsed')) { 639 $parentLi.addClass('active'); 640 if ($parentLi.parent().hasClass('dropdown-menu')) { 641 $parentLi.parent().parent().addClass('active'); 642 } 643 } else { 644 $oldHeading.removeClass('collapsed'); 645 } 646 647 $parentLi.append($panelHeading); 648 }); 649 650 if (!$('li').hasClass('active')) { 651 $('li').first().addClass('active'); 652 } 653 654 var $panelBodies = this.$accordion.find('.js-tabcollapse-panel-body'); 655 $panelBodies.each(function () { 656 var $panelBody = $(this), 657 $tabPane = $panelBody.data('bs.tabcollapse.tabpane'); 658 $tabPane.append($panelBody.contents().detach()); 659 }); 660 this.$accordion.html(''); 661 662 if (this.options.updateLinks) { 663 var $tabContents = this.getTabContentElement(); 664 $tabContents.find('[data-toggle-was="tab"], [data-toggle-was="pill"]').each(function () { 665 var $el = $(this); 666 var href = $el.attr('href').replace(/-collapse$/g, ''); 667 $el.attr({ 668 'data-toggle': $el.attr('data-toggle-was'), 669 'data-toggle-was': '', 670 'data-parent': '', 671 href: href 672 }); 673 }); 674 } 675 676 this.$tabs.trigger($.Event('shown-tabs.bs.tabcollapse')); 677 }; 678 679 TabCollapse.prototype.getTabContentElement = function () { 680 var $tabContents = $(this.options.tabContentSelector); 681 if ($tabContents.length === 0) { 682 $tabContents = this.$tabs.siblings('.tab-content'); 683 } 684 return $tabContents; 685 }; 686 687 TabCollapse.prototype.showAccordion = function () { 688 this.$tabs.trigger($.Event('show-accordion.bs.tabcollapse')); 689 690 var $headings = this.$tabs.find('li:not(.dropdown) [data-toggle="tab"], li:not(.dropdown) [data-toggle="pill"]'), 691 view = this; 692 $headings.each(function () { 693 var $heading = $(this), 694 $parentLi = $heading.parent(); 695 $heading.data('bs.tabcollapse.parentLi', $parentLi); 696 view.$accordion.append(view._createAccordionGroup(view.$accordion.attr('id'), $heading.detach())); 697 }); 698 699 if (this.options.updateLinks) { 700 var parentId = this.$accordion.attr('id'); 701 var $selector = this.$accordion.find('.js-tabcollapse-panel-body'); 702 $selector.find('[data-toggle="tab"], [data-toggle="pill"]').each(function () { 703 var $el = $(this); 704 var href = $el.attr('href') + '-collapse'; 705 $el.attr({ 706 'data-toggle-was': $el.attr('data-toggle'), 707 'data-toggle': 'collapse', 708 'data-parent': '#' + parentId, 709 href: href 710 }); 711 }); 712 } 713 714 this.$tabs.trigger($.Event('shown-accordion.bs.tabcollapse')); 715 }; 716 717 TabCollapse.prototype._panelHeadingToTabHeading = function ($heading) { 718 var href = $heading.attr('href').replace(/-collapse$/g, ''); 719 $heading.attr({ 720 'data-toggle': 'tab', 721 'href': href, 722 'data-parent': '' 723 }); 724 return $heading; 725 }; 726 727 TabCollapse.prototype._tabHeadingToPanelHeading = function ($heading, groupId, parentId, active) { 728 $heading.addClass('js-tabcollapse-panel-heading ' + (active ? '' : 'collapsed')); 729 $heading.attr({ 730 'data-toggle': 'collapse', 731 'data-parent': '#' + parentId, 732 'href': '#' + groupId 733 }); 734 return $heading; 735 }; 736 737 TabCollapse.prototype._checkStateOnResize = function () { 738 var view = this; 739 $(window).resize(function () { 740 clearTimeout(view._resizeTimeout); 741 view._resizeTimeout = setTimeout(function () { 742 view.checkState(); 743 }, 100); 744 }); 745 }; 746 747 748 TabCollapse.prototype._initAccordion = function () { 749 var randomString = function () { 750 var result = "", 751 possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; 752 for (var i = 0; i < 5; i++) { 753 result += possible.charAt(Math.floor(Math.random() * possible.length)); 754 } 755 return result; 756 }; 757 758 var srcId = this.$tabs.attr('id'), 759 accordionId = (srcId ? srcId : randomString()) + '-accordion'; 760 761 this.$accordion = $('<div class="panel-group ' + this.options.accordionClass + '" id="' + accordionId + '"></div>'); 762 this.$tabs.after(this.$accordion); 763 this.$tabs.addClass(this.options.tabsClass); 764 this.getTabContentElement().addClass(this.options.tabsClass); 765 }; 766 767 TabCollapse.prototype._createAccordionGroup = function (parentId, $heading) { 768 var tabSelector = $heading.attr('data-target'), 769 active = $heading.data('bs.tabcollapse.parentLi').is('.active'); 770 771 if (!tabSelector) { 772 tabSelector = $heading.attr('href'); 773 tabSelector = tabSelector && tabSelector.replace(/.*(?=#[^\s]*$)/, ''); //strip for ie7 774 } 775 776 var $tabPane = $(tabSelector), 777 groupId = $tabPane.attr('id') + '-collapse', 778 $panel = $(this.options.accordionTemplate($heading, groupId, parentId, active)); 779 $panel.find('.panel-heading > .panel-title').append(this._tabHeadingToPanelHeading($heading, groupId, parentId, active)); 780 $panel.find('.panel-body').append($tabPane.contents().detach()) 781 .data('bs.tabcollapse.tabpane', $tabPane); 782 783 return $panel; 784 }; 785 786 787 788 // TABCOLLAPSE PLUGIN DEFINITION 789 // ======================= 790 // Edited out. Not used on the site and was causing an error. 5/2017
791 //$.fn.tabCollapse = function (option) { 792 // return this.each(function () { 793 // var $this = $(this); 794 // var data = $this.data('bs.tabcollapse'); 795 // var options = $.extend({}, TabCollapse.DEFAULTS, $this.data(), typeof option === 'object' && option); 796 797 // if (!data) $this.data('bs.tabcollapse', new TabCollapse(this, options)); 798 // }); 799 // }; 800 801 //$.fn.tabCollapse.Constructor = TabCollapse; 802 803 804}(window.jQuery); 805 806document.addEventListener("DOMContentLoaded", function (event) { 807 808 // const lblZipSuggestionClass = document.getElementsByClassName("lblZipSuggestionClass"); 809 const lblAddressClass = document.getElementsByClassName("lblAddressClass"); 810 let firstlblAddressClass = lblAddressClass[0]; 811 const btnAcceptAddChanges = document.getElementsByClassName("btnAcceptAddChanges"); 812 // const btnRejectAddChanges = document.getElementsByClassName("btnRejectAddChanges"); 813 // const addressSuggestionContainer = document.getElementById("addressSuggestionContainer"); 814 const txtAddressSuggestion = document.getElementById("txtAddressSuggestion"); 815 // const suggestedAddress = document.getElementById("suggestedAddress"); 816 const suggAddressOne = document.getElementById("suggAddressOne"); 817 // const suggAddressTwo = document.getElementById("suggAddressTwo"); 818 // const suggCityStateZip = document.getElementById("suggCityStateZip"); 819 const lblCitySuggestionClass = document.getElementsByClassName("lblCitySuggestionClass"); 820 // const lblStateSuggestionClass = document.getElementsByClassName("lblStateSuggestionClass"); 821 822 823 if (typeof (firstlblAddressClass) != "undefined") { 824 if (lblAddressClass[0].innerHTML === '') { 825 txtAddressSuggestion.innerHTML = "<strong>If you see 'No Suggested Address'</strong>, please <strong>choose</strong> the option <strong>REJECT THIS AND USE THE ONE I ENTERED</strong> to continue on to the exam." 826 suggCityStateZip.innerHTML = ''; 827 suggAddressOne.innerHTML = '<strong>No Suggested Address</strong>'; 828 btnAcceptAddChanges[0].disabled = true; 829 } else { 830 btnAcceptAddChanges[0].disabled = false; 831 } 832 } 833 834});
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.