PageSourceSearch

https://www.viola-group.com/wp-content/themes/viola/assets/js/global.js

js viola-group.com collected 2026-09-24 19:37:54 UTC 5,742 bytes, 247 lines download raw bytes

1function setCookie(name, value, days) {
2	const date = new Date();
3	date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
4	const expires = "expires=" + date.toUTCString();
5	document.cookie = name + "=" + value + ";" + expires + ";path=/";
6}
7
8function getCookie(name) {
9	const nameEQ = name + "=";
10	const ca = document.cookie.split(';');
11	for (let i = 0; i < ca.length; i++) {
12		let c = ca[i];
13		while (c.charAt(0) === ' ') c = c.substring(1, c.length);
14		if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
15	}
16	return null;
17}
18
19// Show the popup
20function showPopup() {
21	$(".popup-overlay").show();
22	$("#map-popup").show();
23}
24
25// Close the popup and set a cookie
26function closePopup() {
27	$(".popup-overlay").hide();
28	$("#map-popup").hide();
29	setCookie('popupShown', 'true', 1); // 1 day
30}
31
32$(document).ready(function(){
33	var vw = $(window).width(),
34		menu = $('.sticky-menu'),
35		menuBtn = $('.sticky-menu .btn'),
36		hero = $('.hero'),
37		lastScrollPos = 0,
38		wScroll = $(window).scrollTop(),
39		direction;
40
41
42	$(window).bind('mousewheel', function(event) {
43	    if (event.originalEvent.wheelDelta >= 0) {
44	    	direction = 'up';
45	    }
46	    else {
47	        direction = 'down';
48	    }
49	    // console.log(direction);
50	});
51
52	// Back Button
53	$(".back-btn").click(function(event) {
54	    event.preventDefault();
55	    history.back(1);
56	});
57
58	// Menu hovers
59	$('.menu-item')
60	.on('mouseover', function(){
61
62		$('.menu-item').css({
63			'opacity' : '0.5'
64		});
65
66		$(this).css({
67			'opacity' : '1'
68		});
69
70	})
71	.on('mouseleave', function(){
72		$('.menu-item').css({
73			'opacity' : '1'
74		});
75	});
76
77	// Parrallax
78	$(window).scroll(function(){
79
80		var wScroll = $(this).scrollTop();
81
82		// Hero Image
83		$('.hero').css({
84			'background-position' : 'center ' + wScroll / 2 + 'px'
85		});
86
87	});
88
89
90	//Mailing List Popup
91	$('.popup-btn').on('click', function(e){
92		e.preventDefault();
93		$('.mailing-list-popup').fadeIn('300');
94		$('.popup-overlay').fadeIn('300');
95	});
96	
97	$('.popup-contacts-btn').on('click', function(e){
98		e.preventDefault();
99		$('.mailing-contacts-popup').fadeIn('300');
100		$('.popup-overlay').fadeIn('300');
101	});
102
103
104	$('.mailing-list-popup .close-btn').on('click', function(){
105		$('.mailing-list-popup').fadeOut('300');
106		$('.popup-overlay').fadeOut('300');
107	});
108	
109	$('.mailing-contacts-popup .close-btn').on('click', function(){
110		$('.mailing-contacts-popup').fadeOut('300');
111		$('.popup-overlay').fadeOut('300');
112	});
113
114	$('.popup-overlay').on('click', function(){
115		$('.mailing-list-popup').fadeOut('300');
116		$('.mailing-contacts-popup').fadeOut('300');
117		$('.popup-overlay').fadeOut('300');
118	});
119
120
121	if (vw > 480) {
122		// Funds Dropdown
123		$('.btn-ul .btn').on('click', function(){
124			
125			$('ul.funds-dropdown').slideToggle();
126		});
127	}
128	
129	
130
131	// Mobile JS
132	if (vw < 480) {
133
134		// Funds Dropdown
135		$('.btn-ul .btn').on('click', function(){
136			
137			$('ul.funds-dropdown').fadeToggle();
138		});
139
140		if($('body').hasClass('home-page')) {
141			$('body').removeClass('overflow-hidden').css('overflow-y', 'visible');
142			$('.sticky-menu').removeClass('white');
143			$('.viola-plus .blocks-wrap .img-block .more-h').appendTo('.viola-plus .blocks-wrap');
144		}
145
146		$('.select-row .select-inner').on('click', function(){
147
148			var h = $('.card-outer.active').innerHeight();
149
150			$('.cards-section .cards-inner').height(h);
151
152		});
153
154		if ($('body').hasClass('home-page')) {
155			
156		} else {
157			$('.sticky-menu').addClass('white');
158			$('.sticky-menu .btn').removeClass('white-outline-btn').addClass('blue-btn');
159		}
160
161		$('.menu-btn').on('click', function(){
162			$('.main-menu').toggleClass('open');
163			$('.menu-overlay').toggleClass('open');
164			$('.menu-burg').toggleClass('open');
165		});
166
167		$('.menu-overlay').on('click', function(){
168			$('.main-menu').removeClass('open');
169			$('.menu-overlay').removeClass('open');
170			$('.menu-burg').removeClass('open');
171		});
172
173	}
174
175	const mapPopup = $("#map-popup");
176
177	if (!getCookie('popupShown') && mapPopup.length > 0) {
178		$(window).on('scroll', function() {
179			if ($(window).scrollTop() > 200) { // When the user scrolls down 100px
180				showPopup();
181				$(window).off('scroll'); // Remove the scroll event handler
182			}
183		});
184	}
185
186	// Close button handler
187	$("#popup-closer").click(function() {
188		closePopup();
189	});
190
191	$(".map-popup .popup-button").click(function(e) {
192		e.preventDefault();
193		let href = $(this).attr("href");
194		closePopup();
195		setTimeout(function() {
196			window.location.href = href; // Navigate to the URL after a delay
197		}, 500); // 2000 milliseconds = 2 seconds
198	});
199
200	// Overlay click handler
201	$(".popup-overlay").click(function() {
202		closePopup();
203	});
204});
205document.addEventListener('DOMContentLoaded', function() {
206	// Get the link element
207	const copyLink = document.getElementById('copy-sharing');
208
209	// Add click event listener
210	copyLink.addEventListener('click', function(event) {
211		// Prevent default link behavior
212		event.preventDefault();
213
214		// Get the URL to copy
215		const urlToCopy = window.location.href;
216
217		// Create a temporary input element
218		const tempInput = document.createElement('input');
219
220		// Set its value to the URL to copy
221		tempInput.value = urlToCopy;
222
223		// Append the input element to the document
224		document.body.appendChild(tempInput);
225
226		// Select the URL text
227		tempInput.select();
228
229		// Copy the selected text
230		document.execCommand('copy');
231
232		// Remove the temporary input element
233		document.body.removeChild(tempInput);
234
235		// Display a message
236		const messageElement = document.getElementById('message-copied');
237		messageElement.textContent = 'Link copied!';
238		messageElement.classList.add('copied');
239
240		// Clear the message after 3 seconds
241		setTimeout(function() {
242			messageElement.classList.remove('copied');
243			messageElement.textContent = '';
244		}, 3000);
245	});
246});
247

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.