PageSourceSearch

https://safecitygis.com/wp-content/themes/Avada-child/include/dev_scripts.js?1790946913&ver=7.1.2

js safecitygis.com collected 2026-10-02 13:15:22 UTC 13,848 bytes, 436 lines download raw bytes

1(function($) {
2
3
4
5	function getRndInteger(min, max) {
6		var randomNumber = Math.random() * (max - min + 1) + min;
7		return randomNumber.toFixed(2);
8	}
9
10	// MonkeyPatch ScrollReveal to add class when visible
11	ScrollReveal().watch = function(target, onEnter, onExit) {
12
13		onExit = onExit || function() {}
14
15		if (typeof onEnter === 'function' && typeof onExit === 'function') {
16			var noEffect = {
17				delay: 0,
18				distance: 0,
19				duration: 0,
20				scale: 1,
21				opacity: null,
22				rotate: { x: 0, y: 0, z: 0, },
23
24				reset: true,
25				beforeReset: onExit,
26				beforeReveal: onEnter,
27			}
28			this.reveal(target, noEffect)
29		} else {
30			throw new Error('Watch received invalid arguments.')
31		}
32	}
33
34	$(document).ready(function() {
35		ScrollReveal({ distance: '150%', origin: 'top', reset: false, delay: 100, interval: 100, viewFactor: .4, scale: 1 });
36		ScrollReveal().reveal('.value', { interval: 500 });
37		ScrollReveal().reveal('.value-content', { origin: 'right', delay: 300, distance: '40%', interval: 500 });
38		ScrollReveal().reveal('.reveal-left', { origin: 'left', interval: 100 });
39		ScrollReveal().reveal('.reveal-top', { origin: 'top', interval: 100 });
40		ScrollReveal().reveal('.reveal-right', { origin: 'right', interval: 100 });
41		ScrollReveal().reveal('.reveal-bottom', { origin: 'bottom', interval: 100 });
42		ScrollReveal().reveal('.reveal-center', { origin: 'center', interval: 100 });
43		ScrollReveal().reveal('.timeline-container', { origin: 'left' });
44		ScrollReveal().reveal('.geotg-post', { origin: 'left', interval: 60, delay: 60, distance: '60%' });
45		ScrollReveal().reveal('.geotg-post-line', { origin: 'top', interval: 60, delay: 120, distance: '0%' });
46		ScrollReveal().reveal('fusion-row ul li', { origin: 'top', interval: 60, delay: 120, distance: '0%' });
47
48		//Add line to post titles in single post
49		$('.single-post .fusion-post-title').addClass('add-line');
50		//ScrollReveal().reveal('.fusion-post-title', { origin: 'left', interval: 300 });
51
52		//Scroll down
53		$('.hundred-percent-height').each(function() {
54			$(this).append('<div class="scroll-down"><span></span></div>');
55		});
56		ScrollReveal().reveal('.scroll-down', { origin: 'right', delay: 900 });
57
58		//
59		ScrollReveal().watch('.svg-element',
60			function onEnter(el) {
61				el.classList.add('active');
62			},
63			function onExit(el) {
64				el.classList.remove('active')
65			}
66		)
67		
68		if ( $('.orbit').length ) {
69			$('.orbit').each(function() {
70				$(this).append('<div class="image-orbit"><span></span><span></span></div>');
71			});
72			$('.image-orbit span').each(function() {
73				$(this).css('animation-duration', getRndInteger(5, 8) + 's');
74				$(this).css('animation-delay', getRndInteger(.1, .6) + 's');
75			});
76		}
77
78		//Randomize equalizer animation times
79		if ($('#equalizer').length) {
80			$('#equalizer').find('rect').each(function() {
81				$(this).css('animation-duration', getRndInteger(.5, .52) + 's');
82			});
83		}
84
85		//Randomize number animation times
86		if ($('#long_x5F_rays').length) {
87			$('#long_x5F_rays > g, #short_x5F_rays > g').each(function() {
88				$(this).css('animation-duration', getRndInteger(.8, 1.6) + 's');
89			})
90		}
91
92		//Randomize numbers
93		if ($('#numbers').length) {
94			$('#numbers > g').each(function() {
95				$(this).css('animation-delay', getRndInteger(1, 4) + 's');
96			});
97		}
98
99		//Randomize pin animations
100		if ($('#mapicons > path').length) {
101			$('#mapicons > path').each(function() {
102				$(this).css('animation-delay', getRndInteger(2, 2.3) + 's');
103			});
104		}
105
106		//Randomize graph height
107		if ($('#graph').length) {
108			for ( let x = 0; x < 60; x++ ) {
109				$('#graph').append('<div></div>');
110			}
111			$('#graph > div').each(function() {
112				$(this).css('animation-delay', getRndInteger(1.2, 2) + 's');
113			});
114		}
115
116		// GEOTG LINES
117		if ($('.geotg-lines').length) {
118			var geotgLines = $('.geotg-lines');
119			var header = $('.fusion-header-wrapper');
120			var slider = $('#sliders-container');
121			geotgLines.appendTo(slider);
122			//var linesNumber = geotgLines.find('.line').length;
123			//geotgLines.find('.line').css('height', 'calc(100% / '+linesNumber+')');
124			geotgLines.slideDown('slow');
125		}
126
127		// BUSINESS PARTNER
128		if ($('.business-partner').length) {
129			var businessPartner = $('.business-partner');
130			if ($('#sliders-container').length) {
131				businessPartner.appendTo('#sliders-container');
132				businessPartner.slideDown();
133			}
134		}
135
136		// TIMELINE
137		function timeline_activation(element) {
138			var screen = $(window);
139			element.find('.piece').each(function() {
140				//$(this).offset().top - screen.scrollTop();
141			});
142		}
143
144		// Testimonials
145		if ($('.testimonials').length) {
146			$('.testimonials').css('padding', '0px 50px');
147			$('.testimonials').slick({
148				infinite: true,
149				dots: false,
150				arrows: true,
151				prevArrow: '<i class="fas fa-chevron-left fa-2x" style="position: absolute; top: 25%; left: 0;"></i>',
152				nextArrow: '<i class="fas fa-chevron-right fa-2x" style="position: absolute; top: 25%; right: 0;"></i>',
153				slidesToShow: 1,
154				slidesToScroll: 1,
155				speed: 300,
156				autoplay: true,
157				autoplaySpeed: 4000
158			});
159		}
160
161		// Rotate Words
162		if ( $('.rotate-words').length ) {
163			$('.rotate-words').Morphext({
164				animation: 'flipInX',
165				separator: ",",
166				speed: 3000,
167			});
168		}
169
170		// Contact us forms
171		$('.special-button').each(function() {
172			if ($(this).data('form') == 'contact-form') {
173				$(this).addClass('active');
174			}
175		});
176		$('.special-button').click(function() {
177			if ( $(this).data('form') == 'demo-form' ) return;
178			$(this).addClass('active').siblings().removeClass('active');
179			if ($(this).data('form') == 'contact-form') {
180				$('.contact-form-hub').slideDown();
181				$('.techsupport-form').slideUp();
182			} else {
183				console.log($(this).data('form'));
184				$('.contact-form-hub').slideUp();
185				$('.techsupport-form').slideDown();
186			}
187		});
188
189		//EPIC
190		if ($('.dna').length) {
191			$('.dna').prepend('<canvas id="best-thing-ever"></canvas');
192			var canvas = document.getElementById("best-thing-ever"),
193				ctx = canvas.getContext('2d');
194
195			canvas.width = window.innerWidth;
196			canvas.height = window.innerHeight;
197
198			var stars = [], // Array that contains the stars
199				FPS = 60, // Frames per second
200				x = Math.round(document.documentElement.clientWidth / 8), // Number of stars
201				mouse = {
202					x: 0,
203					y: 0
204				}; // mouse location
205
206			// Push stars to array
207			for (var i = 0; i < x; i++) {
208				stars.push({
209					x: Math.random() * canvas.width,
210					y: Math.random() * canvas.height,
211					radius: Math.random() * 1 + 1,
212					vx: Math.floor(Math.random() * 50) - 25,
213					vy: Math.floor(Math.random() * 50) - 25
214				});
215			}
216
217			// Draw the scene
218			function draw() {
219				ctx.clearRect(0, 0, canvas.width, canvas.height);
220
221				ctx.globalCompositeOperation = "lighter";
222
223				for (var i = 0, x = stars.length; i < x; i++) {
224					var s = stars[i];
225
226					ctx.fillStyle = "#86a3bf";
227					ctx.beginPath();
228					ctx.arc(s.x, s.y, s.radius, 0, 3 * Math.PI);
229					ctx.fill();
230					ctx.fillStyle = '#86a3bf';
231					ctx.stroke();
232				}
233
234				ctx.beginPath();
235				for (var i = 0, x = stars.length; i < x; i++) {
236					var starI = stars[i];
237					ctx.moveTo(starI.x, starI.y);
238					if (distance(mouse, starI) < 150) ctx.lineTo(mouse.x, mouse.y);
239					for (var j = 0, x = stars.length; j < x; j++) {
240						var starII = stars[j];
241						if (distance(starI, starII) < 150) {
242							//ctx.globalAlpha = (1 / 150 * distance(starI, starII).toFixed(1));
243							ctx.lineTo(starII.x, starII.y);
244						}
245					}
246				}
247				ctx.lineWidth = 0.1;
248				ctx.strokeStyle = '#dce4eb';
249				ctx.stroke();
250			}
251
252			function distance(point1, point2) {
253				var xs = 0;
254				var ys = 0;
255
256				xs = point2.x - point1.x;
257				xs = xs * xs;
258
259				ys = point2.y - point1.y;
260				ys = ys * ys;
261
262				return Math.sqrt(xs + ys);
263			}
264
265			// Update star locations
266			function update() {
267				for (var i = 0, x = stars.length; i < x; i++) {
268					var s = stars[i];
269
270					s.x += s.vx / FPS;
271					s.y += s.vy / FPS;
272
273					if (s.x < 0 || s.x > canvas.width) s.vx = -s.vx;
274					if (s.y < 0 || s.y > canvas.height) s.vy = -s.vy;
275				}
276			}
277
278			canvas.addEventListener('mousemove', function(e) {
279				mouse.x = e.clientX;
280				mouse.y = e.clientY;
281			});
282
283			// Update and draw
284
285			function tick() {
286				draw();
287				update();
288				requestAnimationFrame(tick);
289			}
290
291			tick();
292		}
293
294		// TIMELINE
295		if ($(".timeline-container").length) {
296			var $gal = $(".timeline-container"),
297				galW = $gal.outerWidth(true),
298				galSW = $gal[0].scrollWidth,
299				wDiff = (galSW / galW) - 1, // widths difference ratio
300				mPadd = 100, // Mousemove Padding
301				damp = 80, // Mousemove response softness
302				mX = 0, // Real mouse position
303				mX2 = 0, // Modified mouse position
304				posX = 0,
305				mmAA = galW - (mPadd * 2), // The mousemove available area
306				mmAAr = (galW / mmAA); // get available mousemove fidderence ratio
307
308			$gal.mousemove(function(e) {
309				mX = e.pageX - $(this).offset().left;
310				mX2 = Math.min(Math.max(0, mX - mPadd), mmAA) * mmAAr;
311			});
312
313			setInterval(function() {
314				posX += (mX2 - posX) / damp; // zeno's paradox equation "catching delay"	
315				$gal.scrollLeft(posX * wDiff);
316			}, 10);
317		}
318
319
320		function findNewPoint(x, y, angle, distance) {
321		    var result = {};
322
323		    result.x = Math.round(Math.cos(angle * Math.PI / 180) * distance + x);
324		    result.y = Math.round(Math.sin(angle * Math.PI / 180) * distance + y);
325
326		    return result;
327		}
328
329		function CalcAngle(px, py, ax, ay)
330		{
331		    return Math.atan2(ay - py, ax - px) * 180 / Math.PI;
332		}
333
334		$('.two').click(function(){
335			centerCircle = $(this);
336			centerPos = centerCircle.position();
337			$('.team-circle').not(centerCircle).each(function(){
338				var circlePos = $(this).position();
339				var calculateAngle = CalcAngle(circlePos.left, circlePos.top, centerPos.left, centerPos.top);
340				$(this).append('<span>'+calculateAngle+'*</span>');
341				var movePos = findNewPoint(circlePos.left, circlePos.top, calculateAngle, -100);
342				$(this).css({ 'left': movePos.x - circlePos.left + 'px', 'top': movePos.y - cir
342clePos.top + 'px' });
343			});
344		});
345		// Team Members
346		if ($('.team-wrapper').length) {
347			var teamWrapper = $('.team-wrapper');
348			var colors = ['#fcb116', '#15477b', '#969696', '#70020d'];
349			var sizes = ['250px', '100px', '170px'];
350			var verticalAlign = ['top', 'bottom', 'middle'];
351			$('.team-circle').each(function() {
352				var randomColor = colors[Math.floor(Math.random() * colors.length)];
353				var randomSize = sizes[Math.floor(Math.random() * sizes.length)];
354				var randomAlign = verticalAlign[Math.floor(Math.random() * verticalAlign.length)];
355				$(this).css({ 'width': randomSize, 'height': randomSize, 'background': randomColor, 'vertical-align': randomAlign });
356				if ($(this).hasClass('category') && randomSize == '250px') {
357					$(this).css({ 'width': '125px', 'height': '125px' });
358				}
359				if ( $(this).hasClass('founder') && !$(this).hasClass('category') ) {
360					$(this).css({ 'width': '280px', 'height': '280px' });	
361				}
362				if ( $(this).hasClass('founder') && $(this).find('h3').text() == 'David Holdstock' ) {
363					$(this).css({ 'width': '300px', 'height': '300px' });	
364				}
365			});
366
367			//randomize category positions
368			/*$('.team-circle.category').each(function() {
369				var len = $(".team-circle").not('.category').length
370				var random = Math.floor(Math.random() * len) + 1;
371				$(this).insertAfter($(".team-circle").not('.category').eq(random));
372			});*/
373
374			ScrollReveal().reveal('.team-circle', { origin: 'bottom', delay: 0, interval: false, scale: .4, interval: 60 });
375
376
377			// events
378			$('.team-circle.category').click(function() {
379				var category = $(this).data('category');
380				$(this).removeClass('disabled');
381				$(this).addClass('clicked-cat');
382				var siblings = $('.team-circle').not($(this)).not('.' + category);
383				siblings.addClass('disabled').removeClass('active');
384				$('.team-circle.'+category).removeClass('disabled').removeClass('active');
385
386				centerPos = $(this).position();
387				siblings.each(function(){
388					var circlePos = $(this).position();
389					var calculateAngle = CalcAngle(circlePos.left, circlePos.top, centerPos.left, centerPos.top);
390					var movePos = findNewPoint(circlePos.left, circlePos.top, calculateAngle, -300);
391					$(this).css({ 'left': movePos.x - circlePos.left + 'px', 'top': movePos.y - circlePos.top + 'px' });
392				});
393			});
394
395			$('.team-circle.category').hover(function(){
396				var category = $(this).data('category');
397				$(this).removeClass('disabled');
398				var siblings = $('.team-circle').not($(this)).not('.' + category);
399				siblings.addClass('disabled').removeClass('active');
400				$('.team-circle.'+category).removeClass('disabled').removeClass('active');
401			}, function(){
402				if ( !$(this).hasClass('clicked-cat') ) {
403					var category = $(this).data('category');
404					$('.team-circle').removeClass('disabled').removeClass('active');
405				}
406			});
407
408			$('.team-circle').not('.category').click(function() {
409				$(this).addClass('active').removeClass('disabled').css({'left':0, 'top':0});
410				var siblings = $('.team-circle').not($(this));
411				siblings.addClass('disabled').removeClass('active').removeClass('clicked-cat');
412
413				centerCircle = $(this);
414				centerPos = centerCircle.position();
415				siblings.each(function(){
416					var circlePos = $(this).position();
417					var calculateAngle = CalcAngle(circlePos.left, circlePos.top, centerPos.left, centerPos.top);
418					var movePos = findNewPoint(circlePos.left, circlePos.top, calculateAngle, -100);
419					$(this).css({ 'left': movePos.x - circlePos.left + 'px', 'top': movePos.y - circlePos.top + 'px' });
420				});
421
422			});
423
424			$(document).click(function(e) {
425				var container = $('.team-circle');
426				if (!container.is(e.target) && container.has(e.target).length === 0) {
427					container.removeClass('disabled').removeClass('active').removeClass('clicked-cat').css({'left':0, 'top':0});
428				}
429			});
430
431		}
432
433
434
435	});
436})(jQuery);

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.