PageSourceSearch

https://croplifela.org/templates/rsedimo/js/template.js?ee8ba1

js croplifela.org collected 2026-10-02 05:45:19 UTC 13,678 bytes, 369 lines download raw bytes

1/*
2 * @version       1.0.0
3 * @package       RSEdimo! 1.0.0
4 * @copyright (C) 2022 www.rsjoomla.com
5 * @license       GNU General Public License http://www.gnu.org/licenses/gpl-3.0.en.html
6 */
7
8!function(jQuery) {
9    jQuery(document).ready(function() {
10        // Turn radios into btn-group
11        RSTemplate.transformBtnGroup();
12
13        // Fix for Bootstrap carousel slide
14        RSTemplate.fixCarousels();
15
16        // OnePage website
17        if (RSTemplate.onePageCheck()) {
18            RSTemplate.initOnePage();
19        }
20
21        // Search from
22        RSTemplate.initSearchForm();
23
24        // Login form
25        RSTemplate.initLoginForm();
26
27        // Tooltip
28        RSTemplate.initTooltip();
29
30        // Go to top button
31        RSTemplate.initGoToTop();
32
33        // Input effect
34        RSTemplate.initLabelEffect();
35
36        // Initialize main menu
37        RSTemplate.initMainMenu();
38
39        jQuery(window).ready(function() {
40            // Fade content
41            if (RSTemplate.hasContentFader()) {
42                RSTemplate.fadeContent();
43            }
44        });
45    });
46
47}(window.jQuery);
48var RSTemplate;
49
50window.addEventListener('scroll', function(e) {
51    if (document.querySelector(".rstpl-sticky-menu") !== null) {
52        RSTemplate.initStickyMenu();
53    }
54});
55
56window.addEventListener("load", function (){
57    // Preloader
58    RSTemplate.initPreloader();
59});
60
61RSTemplate = {
62    onePageCheck       	: function() {
63        var $menu = jQuery('.rstpl-main-menu-position');
64        if (typeof $menu !== 'undefined') {
65            var $links = $menu.find('.rstpl-template-menu > li:not(.active) > a'),
66                $continue = true;
67
68            $links.each(function() {
69                if (!(jQuery(this).hasClass('open-login') || jQuery(this).hasClass('open-search'))) {
70                    var $href = jQuery(this).attr('href');
71
72                    if ($href.charAt(0) !== '#') {
73                        $continue = false;
74                    }
75                }
76            });
77
78            if ($menu.prop('data-onepage') === "true" && $continue) {
79                return true;
80            }
81        }
82        return false;
83    },
84    initOnePage        	: function() {
85        var $menu = jQuery('.rstpl-main-menu-position');
86        if (typeof $menu !== 'undefined') {
87            $menu.find('.rstpl-template-menu > .active > a').attr('href', '#rstpl-main-menu-position');
88
89            $menu.find('.rstpl-template-menu').onePageNav({
90                currentClass   	: 'active',
91                changeHash     	: true,
92                scrollSpeed    	: 750,
93                scrollThreshold : 0.5,
94                filter         	: '',
95                easing         	: 'swing'
96            });
97        }
98    },
99    fadeContent        	: function() {
100        try {
101            window.sr = new scrollReveal({
102                vFactor: 0.60,
103                move   : '30px',
104                scale  : {direction: 'up', power: '0%'},
105                over   : '1s',
106                ease   : 'hustle'
107            });
108        } catch (error) {}
109    },
110    hasContentFader    	: function() {
111        return (typeof scrollReveal !== 'undefined');
112    },
113    initPreloader    	: function() {
114        const preloader = document.getElementById("rstpl-preloader");
115        if (preloader) {
116            // when page loading is complete we'll add the Out transition effect on the preloader element
117            if (document.readyState === 'complete') {
118                if (preloader.className !== 'animated ' + preloader.dataset.out) {
119                    preloader.className = 'animated ' + preloader.dataset.out;
120                    setTimeout(function(){
121                        preloader.className += ' rstpl-animation-end';
122                    }, 2500);
123                }
124            }
125
126            // when clicking a link element add the In transition effect on the preloader element
127            const all_links = document.querySelectorAll('body a:not(.rsmg-item-link):not(.rsmg_lightbox):not(.magnific-popup):not(.magnific-popup):not(.comment-reply-link):not(.collapsed):not(.modal):not(.btn-floating):not(.rstpl-mega-menu-link):not(.dd-c a):not(#rsmg_load_more):not([target="_blank"]):not([href*="javascript:void(0)"]):not([href^="#"]):not([data-tag]):not([onclick]):not([data-dismiss])');
128
129            for (i = 0; i < all_links.length; i++) {
130                all_links[i].addEventListener('click', function (ev) {
131                    ev.preventDefault();
132                    var link = this.getAttribute('href');
133                    preloader.className = 'animated ' + preloader.dataset.in;
134                    setTimeout(function () {
135                        window.location = link;
136                    }, 3000);
137                });
138            }
139        }
140    },
141    transformBtnGroup  	: function() {
142        jQuery('.radio.btn-group label').addClass('btn');
143        jQuery('.btn-group label:not(.active)').click(function() {
144
145            var label = jQuery(this);
146            var input = jQuery('#' + label.attr('for'));
147
148            if (!input.prop('checked')) {
149                label.closest('.btn-group').find('label').removeClass('active btn-success btn-danger btn-primary');
150                if (input.val() == '') {
151                    label.addClass('active btn-primary');
152                } else if (input.val() == 0) {
153                    label.addClass('active btn-danger');
154                } else {
155                    label.addClass('active btn-success');
156                }
157                input.prop('checked', true).trigger('change');
158            }
159        });
160        jQuery('.btn-group input[checked=checked]').each(function() {
161            if (jQuery(this).val() == '') {
162                jQuery('label[for=' + jQuery(this).attr('id') + ']').addClass('active btn-primary');
163            } else if (jQuery(this).val() == 0) {
164                jQuery('label[for=' + jQuery(this).attr('id') + ']').addClass('active btn-danger');
165            } else {
166                jQuery('label[for=' + jQuery(this).attr('id') + ']').addClass('active btn-success');
167            }
168        });
169    },
170    fixCarousels       	: function() {
171        // add reset if function does not exist in Carousel
172        if (jQuery.fn.carousel.Constructor.prototype.reset === 'undefined') {
173            jQuery.fn.carousel.Constructor.prototype.reset = function() {
174                this.sliding = false;
175            }
176        }
177    },
178    initTooltip        	: function() {
179        jQuery('*[rel=tooltip]').tooltip();
180        jQuery('*[data-toggle=tooltip]').tooltip();
181        jQuery('*[class=hasTooltip]').tooltip();
182    },
183    initGoToTop        	: function() {
184        var back_to_top = jQuery('.rstpl-go-top');
185
186        jQuery(window).scroll(function () {
187            (jQuery(this).scrollTop() > 300) ? back_to_top.addClass('rstpl-go-top-is-visible') : back_to_top.removeClass('rstpl-go-top-is-visible rstpl-go-top-fade-out');
188            if (jQuery(this).scrollTop() > 1200) {
189                back_to_top.addClass('rstpl-go-top-fade-out');
190            }
191        });
192
193        back_to_top.on('click', function (event) {
194            event.preventDefault();
195            jQuery('body,html').velocity("scroll", { duration: 1500, easing: "easeInOutCubic" });
196        });
197    },
198    initMainMenu	: function() {
199        // Add the icon
200        var menu_items = jQuery('.rstpl-main-menu-position .rstpl-template-menu li');
201        menu_items.each(function() {
202            var icon = jQuery(this).attr('data-icon');
203            if (typeof icon !== 'undefined') {
204                jQuery(this).children('.nav-link, .nav-header').prepend('<span class="rstpl-menu-icon ' + icon + '"></span>');
205            }
206        });
207
208        // Metismenu
209        jQuery('.mod-menu').metisMenu({
210            triggerElement: '.mm-toggler',
211            parentTrigger: '.nav-item',
212            subMenu: '.mod-menu__sub'
213        });
214
215        // fix for sub-menu items that are visible outside viewport when hovering
216        jQuery( '.rstpl-opensubmenus-hover .mod-menu > .parent' ).on( "mouseover", function() {
217            let submenus = jQuery(this).find('.mod-menu__sub');
218            submenus.each(function(i, submenu) {
219                if (jQuery(submenu).is(':off-right'))
220                    jQuery(submenu).addClass('right-edge');
221
222                if (jQuery(submenu).is(':off-left'))
223                    jQuery(submenu).addClass('left-edge');
224            });
225        });
226    },
227    initSearchForm     	: function() {
228        let search_container = jQuery('.rstpl-navbar-search'),
229            search_opener	 = jQuery('.rstpl-navbar-search .rstpl-open-search');
230
231        if (search_container.length) {
232            search_opener.on('click', function(e) {
233                e.preventDefault();
234                search_container.toggleClass('open').focus();
235            });
236        }
237    },
238    initLoginForm    	: function() {
239        let login_opener = jQuery('.rstpl-navbar-login .rstpl-open-login');
240
241        if (login_opener.length) {
242            login_opener.on('click', function (e) {
243                e.preventDefault();
244                login_opener.parent().toggleClass('open');
245            });
246        }
247    },
248    initLabelEffect		: function() {
249        var input_selectors = 'select, textarea, input[type="text"], input[type="password"], input[type="datetime"], input[type="datetime-local"], input[type="date"], input[type="month"], input[type="time"], input[type="week"], input[type="number"], input[type="email"], input[type="url"], input[type="search"], input[type="tel"], input[type="color"], input[type="checkbox"], input[type="radio"]';
250        var input_containers = '.rstpl-form-line .control-group';
251
252        jQuery(input_containers).find(input_selectors).each(function(){
253            if (jQuery(this).val().length !== 0)
254                jQuery(this).parents('.control-group').addClass('rstpl-has-content');
255
256            if (jQuery(this).is('select'))
257                jQuery(this).after('<span class="icon icon-chevron-down">&shy;</span>');
258        });
259        jQuery(input_containers).find(input_selectors).on({
260            'change': function () {
261                jQuery(this).parents('.control-group').addClass('rstpl-has-content');
262            },
263            'click': function () {
264                jQuery(this).parents('.control-group').addClass('rstpl-has-content');
265            }
266        });
267    },
268    newScrollPos:  0,
269    lastScrollPos:  0,
270    initStickyMenu      : function() {
271        RSTemplate.lastScrollPos = window.scrollY;
272
273        let header = document.querySelector(".rstpl-sticky-menu");
274        // Scrolling down
275        if (RSTemplate.newScrollPos < RSTemplate.lastScrollPos && RSTemplate.lastScrollPos > 50) {
276            header.classList.remove("rstpl-scroll-up");
277            header.classList.add("rstpl-scroll-down");
278
279        // Scrolling up
280        } else if (RSTemplate.newScrollPos > RSTemplate.lastScrollPos) {
281            header.classList.remove("rstpl-scroll-down");
282            header.classList.add("rstpl-scroll-up");
283        }
284
285        if (RSTemplate.lastScrollPos <= 50) {
286            header.classList.remove("rstpl-scroll-down");
287            header.classList.remove("rstpl-scroll-up");
288        }
289
290        RSTemplate.newScrollPos = RSTemplate.lastScrollPos;
291    }
292};
293
294(function($) {
295    $(document).ready(function() {
296
297        // jQuery reverse
298        $.fn.reverse = [].reverse;
299
300        $(document).on('click', '.fixed-action-btn', function(e) {
301            var $this = $(this);
302            if ($(this).hasClass('active')) {
303                closeFABMenu($this);
304            } else {
305                openFABMenu($this);
306            }
307        });
308
309    });
310
311    $.fn.extend({
312        openFAB : function() {
313            var $this = $(this);
314            openFABMenu($this);
315        },
316        closeFAB: function() {
317            var $this = $(this);
318            closeFABMenu($this);
319        }
320    });
321
322
323    var openFABMenu = function(btn) {
324        $this = btn;
325        if ($this.hasClass('active') === false) {
326            $this.addClass('active');
327            $this.find('ul .btn-floating').velocity(
328                {scaleY: ".4", scaleX: ".4", translateY: "40px"},
329                {duration: 0});
330
331            var time = 0;
332            $this.find('ul .btn-floating').reverse().each(function() {
333                $(this).velocity(
334                    {opacity: "1", scaleX: "1", scaleY: "1", translateY: "0"},
335                    {duration: 80, delay: time});
336                time += 40;
337            });
338        }
339    };
340
341    var closeFABMenu = function(btn) {
342        $this = btn;
343        $this.removeClass('active');
344        var time = 0;
345        $this.find('ul .btn-floating').velocity("stop", true);
346        $this.find('ul .btn-floating').velocity(
347            {opacity: "0", scaleX: ".4", scaleY: ".4", translateY: "40px"},
348            {duration: 80});
349    };
350}(jQuery));
351
352
353
354 document.addEventListener("DOMContentLoaded", function(event) {
355        const HeaderFooter_queryString = window.location.search;
356        const HeaderFooter_urlParams = new URLSearchParams(HeaderFooter_queryString);
357        const renderizarHeaderFooter = HeaderFooter_urlParams.get('renderizar')
358        console.log(renderizarHeaderFooter);
359
360        if(renderizarHeaderFooter == "no"){
361
362            const header = document.getElementById('rstpl-top-position');
363            const header2 = document.getElementById('rstpl-main-menu-position');
364            const footer = document.getElementById('rstpl-footer-position');
365            header.style.display = 'none';
366            header2.style.display = 'none';
367            footer.style.display = 'none';
368        }
369  });

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.