PageSourceSearch

https://www.enigmasoftware.fr/wp-content/themes/enigma/js/pages/spyhunter5.js?1790149470

js enigmasoftware.fr collected 2026-10-06 07:29:17 UTC 4,419 bytes, 155 lines download raw bytes

1//globals
2Check_discount = new Check_discount_class();
3
4//early actions
5Check_discount.main();
6
7//onload
8window.addEventListener('load', function(){
9	support_toggle_buttons();
10	auto_play_videos();
11}, false);
12
13function support_toggle_buttons(){
14	var targets = document.querySelectorAll('table.compare button');
15	for(var i = 0; i < targets.length; i++) {
16		targets[i].addEventListener("click", function(e){
17			var tr = e.target.parentNode.parentNode;
18			tr.classList.toggle('active');
19			if(tr.classList.contains('active')){
20				e.target.innerHTML = '-';
21			}
22			else{
23				e.target.innerHTML = '+';
24			}
25		}, false);
26	}
27}
28
29/**
30 * recalculate spyhunter home banner prices
31 */
32function recalculate_sh5_business_price(parent_selector) {
33	var deviceObject = document.querySelector(parent_selector + ' #devices');
34	var device_count = parseInt(deviceObject.value);
35	var discount = parseFloat(deviceObject.options[deviceObject.selectedIndex].getAttribute('data-discount'));
36
37	var periodsObject = document.querySelector(parent_selector + ' #sh5b-period');
38	var periods = parseFloat(periodsObject.value);
39
40	//change price multiplier based on devices and period
41	var targets = document.querySelectorAll(parent_selector + ' .js-price');
42
43	for(var i = 0; i < targets.length; i++ ) {
44		if (targets[i].dataset.product == undefined) {
45			continue;
46		}
47		var product_key = targets[i].dataset.product;
48		if(product_key != 'sh_basic' && product_key != 'sh_pro' && product_key != 'sh_mac') {
49			continue;
50		}
51
52		var period_value = parseFloat(targets[i].dataset.periods);
53		if(targets[i].dataset.periods == undefined){
54			period_value = periods;
55		}
56		if(targets[i].classList.contains('has-discount')){
57			targets[i].dataset.multiply = device_count * period_value * (1 - discount / 100);
58		}
59		else {
60			targets[i].dataset.multiply = device_count * period_value;
61		}
62	}
63
64	//update discount
65	document.querySelector(parent_selector + ' #discount-value').innerHTML = discount;
66	document.querySelector(parent_selector + ' #discount-top-value').innerHTML = discount;
67
68	//ask to recalculate
69	if(typeof CURRENCY2 != "undefined") {
70		CURRENCY2.convert_currency();
71	}
72}
73
74function Check_discount_class() {
75
76	this.main = function() {
77		var discount_code = this._findGetParameter('dc');
78		var discount_value = this._findGetParameter('dcv');
79
80		if(discount_code == '' || discount_code == null || discount_value == '' || discount_value == null) {
81			return;
82		}
83		discount_value = parseFloat(discount_value);
84
85		//update links
86		var targets = document.querySelectorAll('.button.buy.product-sh');
87		for (var i = 0; i < targets.length; i++) {
88			var target = targets[i];
89			var href_value = target.getAttribute("href");
90
91			if (href_value == '' || href_value == '#') {
92				//empty or wrong link
93				continue;
94			}
95
96			var href = new URL(target.href);
97			href.searchParams.set('dc', discount_code);
98
99			target.href = href.toString();
100		}
101
102		//enable discount HTML sections - enable it after coupons activations @todo
103		/*var targets = document.querySelectorAll(".js_if_discount");
104		for (var i = 0; i < targets.length; i++) {
105			targets[i].classList.remove('hidden');
106		}
107		var targets = document.querySelectorAll(".js_if_no_discount");
108		for (var i = 0; i < targets.length; i++) {
109			targets[i].classList.add('hidden');
110		}
111
112		var targets = document.querySelectorAll(".js_discount");
113		for (var i = 0; i < targets.length; i++) {
114			targets[i].innerHTML = discount_value + '%';
115		}
116		var targets = document.querySelectorAll(".js-price[data-multiply]");
117		for (var i = 0; i < targets.length; i++) {
118			targets[i].dataset.multiply = (1 - discount_value/100);
119		}*/
120
121		//recalculate prices
122		if(typeof CURRENCY2 != "undefined") {
123			//CURRENCY2.convert_currency(); //@todo
124		}
125	};
126
127	this._findGetParameter = function(parameterName) {
128		let urlParams = new URLSearchParams(window.location.search);
129		return urlParams.get(parameterName);
130	};
131}
132
133/**
134 * plays video when it appears on scroll view
135 */
136function auto_play_videos() {
137	const video = document.getElementById('malware_video_win');
138	if(video == null) {
139		return;
140	}
141
142	// Use Intersection Observer
143	const observer = new IntersectionObserver((entries) => {
144		entries.forEach(entry => {
145			if (entry.isIntersecting) {
146				video.play();
147			}
148			else {
149				video.pause(); // optional: pause when out of view
150			}
151		});
152	}, { threshold: 0.5 }); // play when 50% of video is visible
153
154	observer.observe(video);
155}

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.