PageSourceSearch

https://www.biodiversidad.gob.ec/wp-content/themes/Sitio-32/js/custom.js

js biodiversidad.gob.ec collected 2026-09-25 04:39:05 UTC 17,131 bytes, 418 lines download raw bytes

1(function ($) {
2    "use strict";
3    /* IGUALA ALTURA
4     ================================================== */
5    $.equalHeights = function (objeto, inner) {
6        var tallest = 0;
7        $(objeto).find(inner).each(function () {
8            $(this).css({'height': 'auto'});
9            if ($(this).outerHeight() > tallest) {
10                tallest = $(this).outerHeight();
11                console.log(tallest);
12            }
13        });
14        $(objeto).find(inner).css({height: tallest + 'px'});
15        return tallest;
16    };
17
18    /* MUESTRA - OCULTA BUSCADOR
19     ================================================== */
20    $.openSearch = function () {
21        if ($('.form-type-textfield').hasClass('active')) {
22            $(".form-type-textfield").hide().removeClass("active");
23        } else {
24            $(".form-type-textfield").show().addClass("active");
25            $("#form-searchf").focus();
26        }
27    };
28    $.outSearch = function () {
29        $(".form-type-textfield").hide().removeClass("active");
30    };
31
32    /* CALCULO DE ANCHO DE CAROUSEL INDICATORS LI
33     ================================================== */
34    $.indicatorWidth = function () {
35        var cont = 0;
36        $("#main .carousel-indicators").each(function () {
37            $(this).addClass("indicator-" + cont);
38            $("#main .indicator-" + cont + " li").width(Math.floor(($(this).outerWidth() - (14 * ($("#main .indicator-" + cont + " li").length - 1))) / $("#main .indicator-" + cont + " li").length));
39            cont = cont + 1;
40        });
41    };
42
43    $.search = function () {
44        var searchBlock = $("#block-search-form a");
45        searchBlock.on({
46            click: function () {
47                $.openSearch();
48            },
49            keypress: function () {
50                if (event.which === 13) {
51                    $.openSearch();
52                    $("#form-searchf").focus();
53                }
54                if (event.which === 27) {
55                    $.outSearch();
56                }
57            }
58        });
59        $("#form-searchf").on("mouseleave", function () {
60            $.outSearch();
61        });
62    };
63
64    /* CALCULO VIEWPORT WIDTH
65     ================================================== */
66    $.overviewWidth = function () {
67        var viewport = parseInt($("#programas-items .viewport").css('width'));
68        var margin = parseInt($("#programas-items .overview li").css('margin-right'));
69        console.log("margin: " + margin);
70        var marginTotal = 0;
71        var elements = 0;
72
73        var liMinWidth = 106;
74        var liWidth = liMinWidth;
75
76
77        elements = Math.floor(viewport / liMinWidth);
78        marginTotal = (elements - 1) * margin;
79
80
81        if ((viewport - marginTotal) % liMinWidth <= liMinWidth) {
82            liWidth = Math.ceil((viewport - marginTotal) / elements);
83            $("#programas-items .overview li").css({
84                'width': liWidth
85            });
86        }
87//        console.log((viewport - marginTotal) % liMinWidth <= liMinWidth);
88//        console.log(Math.ceil((viewport - marginTotal) / elements));
89//        console.log(liWidth);
90
91        /*        $('#programas-items').tinycarousel({
92         infinite: false,
93         animationTime: 300
94         });*/
95    };
96
97
98    /* Hero height
99     ================================================== */
100    $.hero = function () {
101        var windowHeight = $(window).height();
102        var headerHeight = $("header#head").outerHeight();
103        var footerHeight = $("footer#footer-bot").outerHeight();
104        var wpadminHeight = $("#wpadminbar").outerHeight();
105        if ($(window).width() > 768) {
106            $('.hero').css({'min-height': (windowHeight - headerHeight - footerHeight - wpadminHeight)});
107        } else {
108            $('.hero').css({'min-height': 'auto'});
109        }
110    };
111
112
113    /* MAIN WIDTHS, HEIGHTS & POSITIONS
114     ================================================== */
115    $.main = function () {
116        $.search();
117
118        $(".carousel").each(function () {
119            $(this).carousel();
120        });
121        $('#main-carousel').carousel({
122            interval: 400,
123            wrap: false
124        });
125        $('#alertas').carousel({
126            interval: 90000,
127            wrap: false
128        });
129
130        //$('#videos-carousel').carousel('pause');
131        $('#videos-carousel').on('slide.bs.carousel', function () {
132            //console.log("CHANGE VIDEO" + player1.stopVideo());
133            //player1.stopVideo();
134            //player2.stopVideo();
135            //jQuery('#videos-carousel').carousel('pause');
136
137            document.getElementById('player1').contentWindow.postMessage('{"event":"command","func":"stopVideo","args":""}', '*');
138            document.getElementById('player2').contentWindow.postMessage('{"event":"command","func":"stopVideo","args":""}', '*');
139        });
140
141        function onPlayerStateChange() {
142            //console.log('PLAYER CHANGE');
143        }
144
145        if ($(window).width() > 768) {
146            $("#bg-header").height($("header#head .container-fluid").height());
147            $("footer#footer-bot").css({'height': 'auto'});
148            $("header#head").css({'height': 'auto'});
149            var headerHeight = $("header#head").height();
150            var footerHeight = $("footer#footer-bot").outerHeight();
151            var windowHeight = $(window).height();
152
153            var noticiasHeight = $("#noticias img").height();
154
155            $("#noticias .text").css({'height': noticiasHeight + 'px'});
156
157            var bloqueHeight = $("#videos-carousel").parent().height() + 2;
158            $("#banner").outerHeight(bloqueHeight);
159
160            $(".ref").css({'height': '100%'});
161            var itemHeight = ($("#contacto-gob").outerHeight() + $("#videos").outerHeight() + 15) - 80 - $("#programas").height();
162            if(!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ){
163                if(itemHeight > 120){
164                    $("#main-carousel .item").height(itemHeight);
165                }else{
166                    $("#main-carousel .item").height(280);
167                }
168            }else{
169                $("#main-carousel .item").height('auto');
170            }
171
172
173            $(".control").css({'margin-top': headerHeight + 'px'});
174            var mainHeight = windowHeight - headerHeight - footerHeight;
175
176            var newsScroll = $("#destacados .panel");
177            $("#news .scroll").height((newsScroll.height()) + 20);
178
179
180            $("#servicios .tab-content").css({'height': $("#servicios .nav-tabs").height()});
181            $.equalHeights($("footer#footer-bot .top"), $("footer#footer-bot .top a"));
182
183            if (mainHeight < 470) {
184                $("#main .container-fluid").css({'min-height': mainHeight});
185            }
186
187            $("#programas-items").on({
188                mouseenter: function () {
189                    $("#programas-items .buttons").css({'opacity': 1});
190                },
191                mouseleave: function () {
192                    $("#programas-items .buttons").css({'opacity': 0});
193                }
194            });
195
196//                $("#wpadminbar").length < 1 ? main = windowHeight - headerHeight - footerHeight : main = windowHeight - headerHeight - footerHeight - 86;
197//                $("#main .container-fluid").innerHeight(main);
198        } else if ($(window).width() <= 500) {
199            $("#main").css({height: 100 + "%"});
200
201
202            // Scroll
203            //$('[data-scrollable]').niceScroll({cursorborder: 0, cursorcolor: "#00deff"});
204            //$('[data-scrollable]').getNiceScroll().resize();
205            $('#menu ul.collapse').on('shown.bs.collapse', function (e) {
206                //$('#menu').getNiceScroll().resize();
207            });
208
209            // Collapse
210            $('#menu ul.collapse').on('show.bs.collapse', function (e) {
211                e.stopPropagation();
212                var parents = $(this).parents('ul:first').find('> li.open [data-toggle="collapse"]');
213                if (parents.length) {
214                    parents.trigger('click');
215                }
216                $(this).parent().addClass("open");
217            });
218
219            $('#menu ul.collapse').on('hidden.bs.collapse', function (e) {
220                e.stopPropagation();
221                $(this).parent().removeClass("open");
222            });
223        }
224
225    };
226
227    $(window).load(function () {
228        if ($("#main.institucion .imagen").length) {
229            if (window.innerWidth > 1000) {
230                $("#main.institucion .social").wrapInner("<div class='inner'></div>");
231                $("#main.institucion .social").css({'height': $("#main.institucion .imagen").height()});
232
233            } else {
234                $("#main.institucion .social").css({'padding-top': '0px'});
235            }
236            $("#main.institucion .scroll").css({'height': $("#main.institucion .imagen").height()});
237        } else {
238            if (window.innerWidth > 1000) {
239                $("#main.institucion .social").css({'padding-top': '8
2390px'});
240            } else {
241                $("#main.institucion .social").css({'padding-top': '0px'});
242            }
243        }
244
245
246
247        /* CONTROL PAUSE - PLAY
248         ================================================== */
249        $('#control').on({
250            click: function () {
251                if ($(this).children().hasClass('fa-pause')) {
252                    $('#main-carousel').carousel('pause');
253                    $(this).children().removeClass('fa-pause').addClass('fa-play');
254                } else {
255                    $('#main-carousel').carousel('cycle');
256                    $(this).children().removeClass('fa-play').addClass('fa-pause');
257                }
258            },
259            keypress: function () {
260                if (event.which === 13) {
261                    click();
262                }
263            }
264        });
265
266
267        /* Hero height
268         ================================================== */
269        var windowHeight = $(window).height();
270        $('.hero').height(windowHeight);
271
272        $.main();
273
274        $.overviewWidth();
275
276
277    });
278    $(document).ready(function () {
279        /*ALERTAS */
280        /*$.equalHeights($("#alertas"), $("#alertas [class*='col-']"));
281        $.equalHeights($("#pasarela"), $("#pasarela [class*='col-']"));
282        $.equalHeights($("#main.servicios #servicios"), $("#main.servicios #servicios [class*='col-']:not(.col-xs-0)"));
283
284        $("#alertas-next").outerHeight($("#alertas .carousel-inner").height());*/
285        console.log("ALTO ALERTA :: " + $("#alertas .carousel-inner").height());
286        /* Mobile o desktop */
287        var md = new MobileDetect(window.navigator.userAgent);
288        console.log(md.mobile());
289        /*console.log("mobile " + jQuery.browser.mobile);*/
290        if (md.mobile()) {
291            $(".vermobile").each(function () {
292                $(this).css({'display': 'block'});
293            });
294            if (document.getElementById('postcontent')) {
295                $("div#postcontent").removeClass("scroll");
296            }
297            if (document.getElementById('contenido-comunica')) {
298                $("div#contenido-comunica").removeClass("scroll");
299                $("div#contenido-comunica").removeClass("altura");
300            }
301            if (document.getElementById('contenido-search')) {
302                $("div#contenido-search").removeClass("scroll");
303                $("div#contenido-search").removeClass("altura");
304            }
305            
306            if (document.getElementById('agendapresi')) {
307                $("div#agendapresi").removeClass("scroll");
308                $("div#agendapresi").removeClass("altura");
309            }
310            
311        } else {
312            $(".verdesktop").each(function () {
313                $(this).css({'display': 'block'});
314            });
315        }
316
317
318        $("#programas .crsl-programas a").wrap("<div class='crsl-item'></div>");
319
320        $('.scroll ul a').on('click', function (e) {
321            if ($('.scroll ul a.active').length) {
322                //$('.scroll').getNiceScroll().resize();
323            }
324        });
325
326        //$("body").niceScroll();
327
328
329        $('#menu ul.collapse').on('hidden.bs.collapse', function (e) {
330            e.stopPropagation();
331            $(this).parent().removeClass("open");
332        });
333
334
335        $('[data-toggle="tooltip"]').tooltip({html: true});
336        $("#menu .dropdown-toggle").append('<span class="fa fa-angle-right"></span>');
337
338        $("#menu li.dropdown-submenu a").on({
339            mouseenter: function () {
340                $(this).parent().find("> .dropdown-menu").addClass('open');
341            },
342            mouseleave: function () {
343                $(this).parent().find(".dropdown-menu").removeClass('open');
344            },
345            focus: function () {
346                $(this).parent().find(".dropdown-menu").addClass('open');
347            }
348        });
349        $('.crsl-programas').responsiveCarousel({
350            visible: 5,
351            itemMinWidth: 106,
352            itemMargin: 2,
353            itemEqualHeight: true
354        });
355        $.indicatorWidth();
356        /*        $(".scroll").niceScroll();
357         $(".scroll").getNiceScroll().resize();
358         */
359        $('.scroll').css({overflow: 'auto'});
360        /* SIDEBAR CONTROL
361         ================================================== */
362        var toggleBtn = $('[data-toggle="sidebar-menu"], .sidebar .close');
363        // If No Sidebar Exit
364        if (!toggleBtn.length)
365            return false;
366        toggleBtn.on({
367            click: function () {
368                $('body').toggleClass('show-sidebar');
369                $.indicatorWidth();
370
371                /* SIDEBAR CONTROL
372                 ================================================== */
373                if ($(".sidebar.left").length) {
374                    $(".sidebar.left").toggleClass('hide');
375                }
376            },
377            keypress: function () {
378                if (event.which === 13) {
379                    $('body').toggleClass('show-sidebar');
380                    $.indicatorWidth();
381                    //$('#menu').getNiceScroll().resize();
382                }
383            }
384        });
385
386
387
388    });
389    $(window).resize(function () {
390        var windowHeight = $(window).height();
391        $('.hero').height(windowHeight);
392        $("header#head .container-fluid").height("100%");
393        $.equalHeights($("#footer-bot .top"), $("footer#footer-bot .top a"));
394        $.indicatorWidth();
395        $.main();
396        $.overviewWidth();
397        $.search();
398    });
399    $('#main').on('click', function () {
400        $(".sidebar.left").addClass('hide');
401        $('body').removeClass('show-sidebar');
402        $.indicatorWidth();
403    });
404    var KEYCODE_ESC = 27;
405    $(document).keyup(function (e) {
406        if (e.keyCode === KEYCODE_ESC) {
407            $(".sidebar.left").addClass('hide');
408            $('body').removeClass('show-sidebar');
409            $("#menu li").removeClass('open');
410            $.indicatorWidth();
411        }
412    });
413})(jQuery);
414
415
416(function (a) {
417    (jQuery.browser = jQuery.browser || {}).mobile = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))
418})(navigator.userAgent || navigator.vendor || window.opera);

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.