PageSourceSearch

https://www.soyvillaclara.gob.cu/templates/jd_atlanta/js/main.js

js soyvillaclara.gob.cu collected 2026-10-03 18:01:02 UTC 12,946 bytes, 376 lines download raw bytes

1/**
2 * @package Helix3 Framework
3 * @author JoomShaper http://www.joomshaper.com
4 * @copyright Copyright (c) 2010 - 2016 JoomShaper
5 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
6 */
7
8jQuery(function ($) {
9
10    // ************    START Helix 1.4 JS    ************** //
11    // **************************************************** //
12
13    //Default
14    if (typeof sp_offanimation === 'undefined' || sp_offanimation === '') {
15        sp_offanimation = 'default';
16    }
17
18    if (sp_offanimation == 'default') {
19        $('#offcanvas-toggler').on('click', function (event) {
20            event.preventDefault();
21            $('.off-canvas-menu-init').addClass('offcanvas');
22        });
23
24        $('<div class="offcanvas-overlay"></div>').insertBefore('.offcanvas-menu');
25        $('.close-offcanvas, .offcanvas-overlay').on('click', function (event) {
26            event.preventDefault();
27            $('.off-canvas-menu-init').removeClass('offcanvas');
28        });
29    }
30
31    // Slide Top Menu
32    if (sp_offanimation == 'slidetop') {
33        $('#offcanvas-toggler').on('click', function (event) {
34            event.preventDefault();
35            $('.off-canvas-menu-init').addClass('slide-top-menu');
36        });
37
38        $('<div class="offcanvas-overlay"></div>').insertBefore('.offcanvas-menu');
39        $('.close-offcanvas, .offcanvas-overlay').on('click', function (event) {
40            event.preventDefault();
41            $('.off-canvas-menu-init').removeClass('slide-top-menu');
42        });
43    }
44
45    //Full Screen
46    if (sp_offanimation == 'fullscreen') {
47        $('#offcanvas-toggler').on('click', function (event) {
48            event.preventDefault();
49            $('.off-canvas-menu-init').addClass('full-screen-off-canvas');
50        });
51        $(document).ready(function () {
52            $('.off-canvas-menu-init').addClass('full-screen');
53        });
54        $('.close-offcanvas, .offcanvas-overlay').on('click', function (event) {
55            event.preventDefault();
56            $('.off-canvas-menu-init').removeClass('full-screen-off-canvas');
57        });
58    }
59
60    //Full screen from top
61    if (sp_offanimation == 'fullScreen-top') {
62        $('#offcanvas-toggler').on('click', function (event) {
63            event.preventDefault();
64            $('.off-canvas-menu-init').addClass('full-screen-off-canvas-ftop');
65        });
66        $(document).ready(function () {
67            $('.off-canvas-menu-init').addClass('full-screen-ftop');
68        });
69        $('.close-offcanvas, .offcanvas-overlay').on('click', function (event) {
70            event.preventDefault();
71            $('.off-canvas-menu-init').removeClass('full-screen-off-canvas-ftop');
72        });
73    }
74
75    //Dark with plus
76    if (sp_offanimation == 'drarkplus') {
77        $('#offcanvas-toggler').on('click', function (event) {
78            event.preventDefault();
79            $('.off-canvas-menu-init').addClass('new-look-off-canvas');
80        });
81        $('<div class="offcanvas-overlay"></div>').insertBefore('.offcanvas-menu');
82        $(document).ready(function () {
83            $('.off-canvas-menu-init').addClass('new-look');
84        });
85        $('.close-offcanvas,.offcanvas-overlay').on('click', function (event) {
86            event.preventDefault();
87            $('.off-canvas-menu-init').removeClass('new-look-off-canvas');
88        });
89    }
90
91    // if sticky header
92    if ($("body.sticky-header").length > 0 && $('#sp-header').length > 0 ) {
93        var fixedSection = $('#sp-header');
94        // sticky nav
95        var headerHeight = $('#sp-menu').outerHeight();
96        var stickyNavTop = fixedSection.offset().top;
97        fixedSection.addClass('animated');
98        fixedSection.before('<div class="nav-placeholder"></div>');
99        $('.nav-placeholder').height('inherit');
100        //add class
101        fixedSection.addClass('menu-fixed-out');
102        var stickyNav = function () {
103            var scrollTop = $(window).scrollTop();
104            if (scrollTop > stickyNavTop) {
105                fixedSection.removeClass('menu-fixed-out').addClass('menu-fixed');
106                $('.nav-placeholder').height(headerHeight);
107               
108            } else {
109                if (fixedSection.hasClass('menu-fixed')) {
110                    fixedSection.removeClass('menu-fixed').addClass('menu-fixed-out');
111                    $('.nav-placeholder').height('inherit');
112                }
113            }
114        };
115        stickyNav();
116        $(window).scroll(function () {
117            stickyNav();
118        });
119    }
120    // go to top
121    if (typeof sp_gotop === 'undefined') {
122        sp_gotop = '';
123    }
124
125    if (sp_gotop) {
126        // go to top
127        $(window).scroll(function () {
128            if ($(this).scrollTop() > 100) {
129                $('.scrollup').fadeIn();
130            } else {
131                $('.scrollup').fadeOut(400);
132            }
133        });
134
135        $('.scrollup').click(function () {
136            $("html, body").animate({
137                scrollTop: 0
138            }, 600);
139            return false;
140        });
141    } // has go to top
142
143    // Preloader
144    if (typeof sp_preloader === 'undefined') {
145        sp_preloader = '';
146    }
147
148    if (sp_preloader) {
149        $(window).on('load', function () {
150            if ($('.sp-loader-with-logo').length > 0) {
151                move();
152            }
153            setTimeout(function () {
154                $('.sp-pre-loader').fadeOut();
155            }, 1000);
156        });
157    } // has preloader
158    //preloader Function
159    function move() {
160        var elem = document.getElementById("line-load");
161        var width = 1;
162        var id = setInterval(frame, 10);
163        function frame() {
164            if (width >= 100) {
165                clearInterval(id);
166            } else {
167                width++;
168                elem.style.width = width + '%';
169            }
170        }
171    }
172    // ************    END:: Helix 1.4 JS    ************** //
173    // **************************************************** //
174
175    // **************   START Mega SCRIPT   *************** //
176    // **************************************************** //
177
178    //mega menu
179    $('.sp-megamenu-wrapper').parent().parent().css('position', 'static').parent().css('position', 'relative');
180    $('.sp-menu-full').each(function () {
181        $(this).parent().addClass('menu-justify');
182    });
183
184    // boxlayout
185    if ($("body.layout-boxed").length > 0) {
186        var windowWidth = $('#sp-header').parent().outerWidth();
187        $("#sp-header").css({"max-width": windowWidth, "left": "auto"});
188    }
189
190    // **************   END:: Mega SCRIPT   *************** //
191    // **************************************************** //
192
193    // **************  START Others SCRIPT  *************** //
194    // **************************************************** //
195
196    //Tooltip
197    $('[data-toggle="tooltip"]').tooltip();
198
199    // Article Ajax voting
200    $(document).on('click', '.sp-rating .star', function (event) {
201        event.preventDefault();
202
203        var data = {
204            'action': 'voting',
205            'user_rating': $(this).data('number'),
206            'id': $(this).closest('.post_rating').attr('id')
207        };
208
209        var request = {
210            'option': 'com_ajax',
211            'plugin': 'helix3',
212            'data': data,
213            'format': 'json'
214        };
215
216        $.ajax({
217            type: 'POST',
218            data: request,
219            beforeSend: function () {
220                $('.post_rating .ajax-loader').show();
221            },
222            success: function (response) {
223                var data = $.parseJSON(response.data);
224
225                $('.post_rating .ajax-loader').hide();
226
227                if (data.status == 'invalid') {
228                    $('.post_rating .voting-result').text('You have already rated this entry!').fadeIn('fast');
229                } else if (data.status == 'false') {
230                    $('.post_rating .voting-result').text('Somethings wrong here, try again!').fadeIn('fast');
231                } else if (data.status == 'true') {
232                    var rate = data.action;
233                    $('.voting-symbol').find('.star').each(function (i) {
234                        if (i < rate) {
235                            $(".star").eq(-(i + 1)).addClass('active');
236                        }
237                    });
238
239                    $('.post_rating .voting-result').text('Thank You!').fadeIn('fast');
240                }
241
242            },
243            error: function () {
244                $('.post_rating .ajax-loader').hide();
245                $('.post_rating .voting-result').text('Failed to rate, try again!').fadeIn('fast');
246            }
247        });
248    });
249
250    // **************  END:: Others SCRIPT  *************** //
251    // **************************************************** //
252
253});
254
255// **************  HEADER MENU  *************** //
256function inout(accion) {
257    if (accion == "in") {
258        document.getElementById("sp-top-bar").style.position = "fixed";
259        document.getElementById("sp-top-bar").style.zIndex = "1024";
260        document.getElementById("sp-top-bar").style.width = '100%';
261        document.getElementById("sp-top-bar").style.padding = '0px';
262        document.getElementById("sp-header").style.marginTop = "40px";
263        document.getElementById("avisos-out").style.display = "block";
264        document.getElementById("avisos-in").style.display = "none";
265        document.getElementById("cartelera-button").style.top = "200px";
266    } else {
267        document.getElementById("sp-top-bar").removeAttribute('style');
268        document.getElementById("sp-header").removeAttribute('style');
269        document.getElementById("avisos-out").style.display = "none";
270        document.getElementById("avisos-in").style.display = "block";
271        document.getElementById("cartelera-button").style.top = "100px";
272    }
273}
274// **************  END:: HEADER MENU  *************** //
275
276/****Counter Estadistics */
277(function ($) {
278	$.fn.countTo = function (options) {
279		options = options || {};
280		
281		return $(this).each(function () {
282			// set options for current element
283			var settings = $.extend({}, $.fn.countTo.defaults, {
284				from:            $(this).data('from'),
285				to:              $(this).data('to'),
286				speed:           $(this).data('speed'),
287				refreshInterval: $(this).data('refresh-interval'),
288				decimals:        $(this).data('decimals')
289			}, options);
290			
291			// how many times to update the value, and how much to increment the value on each update
292			var loops = Math.ceil(settings.speed / settings.refreshInterval),
293				increment = (settings.to - settings.from) / loops;
294			
295			// references & variables that will change with each update
296			var self = this,
297				$self = $(this),
298				loopCount = 0,
299				value = settings.from,
300				data = $self.data('countTo') || {};
301			
302			$self.data('countTo', data);
303			
304			// if an existing interval can be found, clear it first
305			if (data.interval) {
306				clearInterval(data.interval);
307			}
308			data.interval = setInterval(updateTimer, settings.refreshInterval);
309			
310			// initialize the element with the starting value
311			render(value);
312			
313			function updateTimer() {
314				value += increment;
315				loopCount++;
316				
317				render(value);
318				
319				if (typeof(settings.onUpdate) == 'function') {
320					settings.onUpdate.call(self, value);
321				}
322				
323				if (loopCount >= loops) {
324					// remove the interval
325					$self.removeData('countTo');
326					clearInterval(data.interval);
327					value = settings.to;
328					
329					if (typeof(settings.onComplete) == 'function') {
330						settings.onComplete.call(self, value);
331					}
332				}
333			}
334			
335			function render(value) {
336				var formattedValue = settings.formatter.call(self, value, settings);
337				$self.html(formattedValue);
338			}
339		});
340	};
341	
342	$.fn.countTo.defaults = {
343		from: 0,               // the number the element should start at
344		to: 0,                 // the number the element should end at
345		speed: 1000,           // how long it should take to count between the target numbers
346		refreshInterval: 100,  // how often the element should be updated
347		decimals: 0,           // the number of decimal places to show
348		formatter: formatter,  // handler for formatting the value before rendering
349		onUpdate: null,        // callback method for every time the element is updated
350		onComplete: null       // callback method for when the element finishes updating
351	};
352	
353	function formatter(value, settings) {
354		return value.toFixed(settings.decimals);
355	}
356}(jQuery));
357
358jQuery(function ($) {
359  // custom formatting example
360  $('.count-number').data('countToOptions', {
361	formatter: function (value, options) {
362	  return value.toFixed(options.decimals).replace(/\B(?=(?:\d{3})+(?!\d))/g, ',');
363	}
364  });
365  
366  // start all the timers
367  $('.timer').each(count);  
368  
369  function count(options) {
370	var $this = $(this);
371	options = $.extend({}, options || {}, $this.data('countToOptions') || {});
372	$this.countTo(options);
373  }
374});
375/****END Counter Estadistics */
376

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.