PageSourceSearch

https://nalgene.com/wp-content/plugins/nalgene-customizer/public/js/nalgene-customizer-main.js?ver=1790885341

js nalgene.com collected 2026-10-02 16:42:16 UTC 2,313 bytes, 74 lines download raw bytes

1function onDocumentReady() {
2	const capModalTriggers = document.querySelectorAll('.open-cap-modal');
3	const capModal = document.getElementById('nalgene-customizer--cap-modal'); 
4	const capModalContent = document.getElementById('nalgene-customizer--modal-content'); 
5
6	let capModalReset = null;
7	if (capModal) {
8		capModalReset = capModal.querySelector('.btn-reset');
9	}
10
11	function openModal(e) {
12		e.preventDefault();
13		
14		// gather data from button/trigger
15		const trigger = e.currentTarget;
16		const modalContentContainer = trigger.getAttribute('data-modal-content');
17		const modalContent = document.getElementById( modalContentContainer );
18		const customizerLink = modalContent.querySelector('.nalgene-customizer--button a');
19
20		function updateCustomizerURL(customizerLink, paramName, paramValue) {
21			let url = customizerLink.getAttribute('href');
22			const pattern = new RegExp('\\b('+paramName+'=).*?(&|#|$)');
23	
24			if (paramValue == null) {
25				paramValue = '';
26			}
27			
28			if (url.search(pattern)>=0) {
29				url = url.replace(pattern,'$1' + paramValue + '$2');
30			}
31			
32			else {
33				url = url.replace(/[?#]$/,'');
34			}
35	
36			customizerLink.setAttribute('href', url);
37		}
38
39		if( ! capModal.classList.contains('active') ){
40			capModalContent.setAttribute('data-modal-container', modalContentContainer );
41			capModalContent.appendChild(modalContent.querySelector('.modal-content'));
42			capModal.classList.add('active');
43
44			const radios = capModalContent.querySelectorAll('.cap');
45
46			radios.forEach(radio => {
47				radio.addEventListener('click', function(e){
48					updateCustomizerURL(customizerLink, 'capId', this.getAttribute('data-cap'));
49				});
50			});
51		}
52	}
53
54	function closeModal(e) {
55		e.preventDefault();
56		capModal.classList.remove('active');
57		
58		//move modal content back to initial container
59		const modalContentContainer = document.getElementById( capModalContent.getAttribute('data-modal-container') );
60		modalContentContainer.appendChild( capModalContent.querySelector('.modal-content'));
61	}
62	
63	if( document.querySelectorAll('.open-cap-modal') ) {
64		capModalTriggers.forEach(trigger => {
65			trigger.addEventListener('click', openModal);
66		});
67
68		if(capModalReset) {
69			capModalReset.addEventListener('click', closeModal);
70		}
71	}
72}
73
74document.addEventListener('DOMContentLoaded', onDocumentReady);

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.