PageSourceSearch

https://www.corrienteshoy.com/js/funciones.js

js corrienteshoy.com collected 2026-10-02 10:25:15 UTC 25,186 bytes, 721 lines download raw bytes

1$(document).on("click","[data-lazy-loader]",function () {
2
3    var button = $(this);
4    var list = $("#"+$(this).attr("data-lazy-list"));
5    var currentPage = $(this).attr("data-lazy-page");
6    var uri = $(this).attr("data-lazy-uri");
7    var animation = $(this).attr('data-lazy-animation')?$(this).attr('data-lazy-animation'):'fade';
8
9    currentPage = parseInt(currentPage) + 1;
10
11    button.addClass("lazy-loading");
12    button.css('pointer-events','none');
13    list.addClass("lazy-loading");
14
15    var url ="";
16    if(uri.indexOf("?") > - 1)
17    {
18        url = uri + "&mode=lazy&p="+currentPage;
19    }
20    else
21    {
22        url =uri + "?mode=lazy&p="+currentPage;
23    }
24    console.log(url);
25
26    $.get(url, function (html) {
27
28        button.attr("data-lazy-page",currentPage);
29        button.css('pointer-events','inherit');
30
31        button.removeClass("lazy-loading");
32        list.removeClass("lazy-loading");
33
34        if($(html).is("#"+button.attr("data-lazy-list")))
35        {
36            //Si traigo los elementos con el contenedor, lo elimino
37            html = $(html).html();
38        }
39
40        var items = $(html);
41        items.hide();
42        list.append(items);
43        switch (animation)
44        {
45            case 'fade':
46                items.fadeIn();
47                break;
48            case 'slide':
49                items.slideDown();
50                break;
51            default:
52                items.show();
53                break;
54        }
55
56        if(items.closest(".last-page").length)
57        {
58            button.fadeOut();
59            items.closest(".last-page").remove();
60        }
61
62        console.log("lazy > data-lazy-callback" + button.attr("data-lazy-callback"));
63        
64        if (button.attr("data-lazy-callback")) {
65            
66            funcOnComplete = button.attr("data-lazy-callback");
67            console.log("lazy > callback" + funcOnComplete);
68
69            window[funcOnComplete]();
70        }
71
72    });
73});
74
75
76function relativeTime(e) {
77    var t = Date.parse(e),
78        a = (Date.parse(Date()) - t) / 1e3,
79        i = "";
80    return i = 60 > a ? "hace " + a + " segundos" : 120 > a ? "hace 1 minuto" : 2700 > a ? "hace " + parseInt(a / 60, 10).toString() + " minutos" : 5400 > a ? "hace una hora" : 86400 > a ? "hace " + parseInt(a / 3600, 10).toString() + " horas" : 172800 > a ? "hace 1 dia" : "hace " + parseInt(a / 86400, 10).toString() + " dias"
81}
82
83function cPalabrasLargas(e, t) {
84    for (t = t ? t : 25, pLink = /^\[url[=]?[\w\*":.\/]*\][\w\*":.\/\[\]]+\[\/url\]$/, pImagen = /^\[img?(=left)?(=right)?\][\w:".\/]*\[\/img(=left)?(=right)?\]$/, pUrl = /^https?:\/\/[\w\.]+/, pCodigo = /^<[\w\."\'$\(\)\= #\?&%@\[\]\;]+>$/, pCodigo2 = /="[\w\.:\/\-"\+\=\?\&\#%@$'\(\)\[\]\;]+"/, pMail = /^[\w\_\.çñ]{2,255}@[\w]{2,255}\.[a-z]{1,3}\.?[a-z]{0,3}$/, palabras = e.split(/\s/), largo = palabras.length, m = 0; m < largo; m++)
85        if (palabras[m].length > t) {
86            if (pLink.test(palabras[m])) continue;
87            if (pImagen.test(palabras[m])) continue;
88            if (pUrl.test(palabras[m])) continue;
89            if (pCodigo.test(palabras[m])) continue;
90            if (pCodigo2.test(palabras[m])) continue;
91            if (pMail.test(palabras[m])) continue;
92            for (texto3 = palabras[m].substr(0, t) + " ", h = t; h < palabras[m].length; h += t) texto3 += palabras[m].substr(h, t);
93            e = e.replace(palabras[m], texto3), e = cPalabrasLargas(e, t)
94        }
95    return e
96}
97
98function css_browser_selector(e) {
99    var t = e.toLowerCase(),
100        a = function(e) {
101            return t.indexOf(e) > -1
102        },
103        i = "gecko",
104        n = "webkit",
105        r = "safari",
106        o = "chrome",
107        s = "opera",
108        l = "mobile",
109        c = 0,
110        d = window.devicePixelRatio ? (window.devicePixelRatio + "").replace(".", "_") : "1",
111        u = [!/opera|webtv/.test(t) && /msie\s(\d+)/.test(t) && (c = 1 * RegExp.$1) ? "ie ie" + c + (6 == c || 7 == c ? " ie67 ie678 ie6789" : 8 == c ? " ie678 ie6789" : 9 == c ? " ie6789 ie9m" : c > 9 ? " ie9m" : "") : /trident\/\d+.*?;\s*rv:(\d+)\.(\d+)\)/.test(t) && (c = [RegExp.$1, RegExp.$2]) ? "ie ie" + c[0] + " ie" + c[0] + "_" + c[1] + " ie9m" : /firefox\/(\d+)\.(\d+)/.test(t) && (re = RegExp) ? i + " ff ff" + re.$1 + " ff" + re.$1 + "_" + re.$2 : a("gecko/") ? i : a(s) ? s + (/version\/(\d+)/.test(t) ? " " + s + RegExp.$1 : /opera(\s|\/)(\d+)/.test(t) ? " " + s + RegExp.$2 : "") : a("konqueror") ? "konqueror" : a("blackberry") ? l + " blackberry" : a(o) || a("crios") ? n + " " + o : a("iron") ? n + " iron" : !a("cpu os") && a("applewebkit/") ? n + " " + r : a("mozilla/") ? i : "", a("android") ? l + " android" : "", a("tablet") ? "tablet" : "", a("j2me") ? l + " j2me" : a("ipad; u; cpu os") ? l + " chrome android tablet" : a("ipad;u;cpu os") ? l + " chromedef android tablet" : a("iphone") ? l + " ios iphone" : a("ipod") ? l + " ios ipod" : a("ipad") ? l + " ios ipad tablet" : a("mac") ? "mac" : a("darwin") ? "mac" : a("webtv") ? "webtv" : a("win") ? "win" + (a("windows nt 6.0") ? " vista" : "") : a("freebsd") ? "freebsd" : a("x11") || a("linux") ? "linux" : "", "1" != d ? " retina ratio" + d : "", "js portrait"].join(" ");
112    return window.jQuery && !window.jQuery.browser && (window.jQuery.browser = c ? {
113        msie: 1,
114        version: c
115    } : {}), u
116}
117
118function equalHeight(e) {
119    tallest = 0, e.each(function() {
120        thisHeight = $(this).height(), thisHeight > tallest && (tallest = thisHeight)
121    }), e.height(tallest)
122}
123
124function ventana(e, t, a, i, n) {
125    newWindow = window.open(e, t, "resizable=yes,menubar=no,location=no,toolbar=no,status=no,scrollbars=" + n + ",directories=no,width=" 
125+ a + ",height=" + i + ",left=" + (screen.availWidth - a) / 2 + ",top=" + (screen.availHeight - i) / 2)
126}
127
128
129! function($) {
130    $.fn.extend({
131        limit: function(limit, element, maximo) {
132            var interval, f, self = $(this);
133            $(this).focus(function() {
134                interval = window.setInterval(substring, 100)
135            }), $(this).blur(function() {
136                clearInterval(interval), substring()
137            }), substringFunction = "function substring(){ var val = $(self).val(); ", maximo && (substringFunction += "val = cPalabrasLargas(val, maximo); ", substringFunction += "$(self).val(val);"), substringFunction += "var length = val.length; if(length > limit){$(self).val($(self).val().substring(0,limit));}", "undefined" != typeof element && ($(element).is("input") ? substringFunction += "if($(element).val() != limit-length){$(element).val((limit-length<=0)?'0':limit-length);}" : substringFunction += "if($(element).html() != limit-length){$(element).html((limit-length<=0)?'0':limit-length);}"), substringFunction += "}", eval(substringFunction), substring()
138        }
139    })
140}(jQuery), jQuery.cookie = function(e, t, a) {
141    if ("undefined" == typeof t) {
142        var i = null;
143        if (document.cookie && "" != document.cookie)
144            for (var n = document.cookie.split(";"), r = 0; r < n.length; r++) {
145                var o = jQuery.trim(n[r]);
146                if (o.substring(0, e.length + 1) == e + "=") {
147                    i = decodeURIComponent(o.substring(e.length + 1));
148                    break
149                }
150            }
151        return i
152    }
153    a = a || {}, null === t && (t = "", a.expires = -1);
154    var s = "";
155    if (a.expires && ("number" == typeof a.expires || a.expires.toUTCString)) {
156        var l;
157        "number" == typeof a.expires ? (l = new Date, l.setTime(l.getTime() + 24 * a.expires * 60 * 60 * 1e3)) : l = a.expires, s = "; expires=" + l.toUTCString()
158    }
159    var c = a.path ? "; path=" + a.path : "",
160        d = a.domain ? "; domain=" + a.domain : "",
161        u = a.secure ? "; secure" : "";
162    document.cookie = [e, "=", encodeURIComponent(t), s, c, d, u].join("")
163},
164    function(e, t) {
165        var a = css_browser_selector(navigator.userAgent),
166            i = e.documentElement;
167        i.className += " " + a;
168        var n = a.replace(/^\s*|\s*$/g, "").split(/ +/);
169        t.CSSBS = 1;
170        for (var r = 0; r < n.length; r++) t["CSSBS_" + n[r]] = 1;
171        var o = function(t) {
172            return e.documentElement[t] || e.body[t]
173        };
174        t.jQuery && ! function(e) {
175            function a() {
176                if (0 == m) {
177                    try {
178                        var e = o("clientWidth"),
179                            t = o("clientHeight");
180                        if (e > t ? p.removeClass(r).addClass(s) : p.removeClass(s).addClass(r), e == h) return;
181                        h = e
182                    } catch (a) {}
183                    m = setTimeout(n, 100)
184                }
185            }
186
187            function n() {
188                try {
189                    p.removeClass(f), p.addClass(360 >= h ? l : 640 >= h ? c : 768 >= h ? d : 1024 >= h ? u : "pc")
190                } catch (e) {}
191                m = 0
192            }
193            var r = "portrait",
194                s = "landscape",
195                l = "smartnarrow",
196                c = "smartwide",
197                d = "tabletnarrow",
198                u = "tabletwide",
199                f = l + " " + c + " " + d + " " + u + " pc",
200                p = e(i),
201                m = 0,
202                h = 0;
203            t.CSSBS_ie ? setInterval(a, 1e3) : e(t).on("resize orientationchange", a).trigger("resize")
204        }(t.jQuery)
205    }(document, window),
206    function(e) {
207        e.fn.vAlign = function() {
208            return this.each(function(t) {
209                var a = e(this).height(),
210                    i = e(this).parent().height(),
211                    n = (i - a) / 2;
212                e(this).css("margin-top", n)
213            })
214        }
215    }(jQuery),
216    function(e) {
217        e.fn.fieldtag = function(t) {
218            var a = e.extend({
219                markedClass: "tagged",
220                standardText: !1
221            }, t);
222            return e(this).focus(function() {
223                this.changed || this.clear()
224            }).blur(function () {
225                this.changed || this.addTag()
226            }).keyup(function() {
227                this.changed = e(this).val() ? !0 : !1
228            }).each(function() {
229                if (this.title = e(this).attr("title"), e(this).val() == e(this).attr("title") && (this.changed = !1), this.clear = function() {
230                        this.changed || e(this).val("").removeClass(a.markedClass)
231                    }, this.addTag = function() {
232                        e(this).val(a.standardText === !1 ? this.title : a.standardText).addClass(a.markedClass)
233                    }, this.form) {
234                    if (this.form.tagFieldsToClear = this.form.tagFieldsToClear || [], this.form.tagFieldsToClear.push(this), this.form.tagFieldsAreCleared) return !0;
235                    this.form.tagFieldsAreCleared = !0, e(this.form).submit(function() {
236                        e(this.tagFieldsToClear).each(function() {
237                            this.clear()
238                        })
239                    })
240                }
241            }).keyup().blur(), e(this)
242        }
243    }(jQuery);
244
245
246// WAI Aria >> accesibilidad
247$('*').removeAttr('tabindex');
248$("#nav li.expand > a").attr('aria-expanded', 'false');
249$("#nav li.expand > a").attr('aria-haspopup', 'true');
250
251
252// Menú hamburguesa del sitio.
253function toggleExpand() {
254    var target = $(this).closest("li");
255    var ul = target.children("ul");
256    ul.stop();
257    ul.slideToggle('fast', function () {
258        if (ul.is(":visible")) {
259            target.addClass("is-open");
260        } else {
261            target.removeClass("is-open");
262        }
263
264    });
265}
266
267function closeExpand() {
268    var target = $(this).closest("li");
269    var ul = target.children("ul");
270    ul.stop();
271    ul.slideUp('fast', function () {
272
273        target.removeClass("is-open");
274    });
275}
276
277
278
279$(document).on('click', '.btn-buscar', function () {
280    $('.btn-buscar').toggleClass('active');
281    $('.search').toggleClass('open');
282
283    if ($(this).is('.active')) {
284        console.log('input is active');
285        $(this).parent().find("input[name='q']").focus();
286    }
287});
288
289$(document).on('click', '.icon-cerrar', function () {
290    $('.btn-buscar').removeClass('active');
291    $('.search').removeClass('open');
292});
293
294$(document).on("click", ".menu li.expand", toggleExpand);
295
296$(document).on("click", function (e) {
297    $(".menu li.expand").each(function () {
298
299        if (!$(e.target).is($(this)) && $(e.target).closest($(this)).length == 0) {
300            closeExpand.bind(this)();
301        }
302
303    });
304});
305
306
307
308/** 
309 * Muestra imagen que este difusa por contener imagenes sensibles.
310 * Utilizado en el home y el interior de las notas.
311 * ------------------------------------------------
312 */
313$(".cont-blur .advertencia a").click(function() {
314    $(this).closest(".cont-blur").hide();
315    $(this).closest(".blur").removeClass("blur");
316});
317
318
319/**
320 * Convierte todas las <a> con clase blank a target _blank 
321 * ------------------------------------------------
322 */ 
323$("a.blank").attr("target", "_blank");
324
325/**
326 * Scroll al top para cuando hace click en a.icon-up
327 */
328$("a.icon-up").click(function () {
329     $("html, body").animate({scrollTop: 0}, "slow");
330     return false;
331});    
332
333
334/**
335 * Validación de campo del buscador (top y página de buscador)
336 */
337$("form[data-buscador]").submit(function (e) {
338
339    if ($(this).find("input[name='q']").val().length < 4) {
340        alert("Debe ingresar un texto de al menos 4 caracteres");
341        return false;
342
343    }
344
345});
346
347
348$(document).ready(function () {
349    /**
350     * Instancia de Magnific Pop Up.
351     */
352    var magnificPopup = $.magnificPopup.instance;
353
354    $('.big-img').magnificPopup({type:'image'});
355
356    /**
357     * Boton de cerrar el popup.
358     */
359    $("a.mfp-close").click(function () {
360        window.parent.$.magnificPopup.close();
361    });
362});
363
364/**
365 * Menú parent active.
366 */
367$("li.active").closest("li.expand").addClass("active");
368
369
370/** 
371 * Muestra video en la imagen de las notas de portada.
372 * ---------------------------------------
373 */
374$("a[data-video-url]").click(function() {
375
376    var j = $(this).find("img");
377    w = j.width();
378    h = j.height();
379
380    url = $(this).attr("data-video-url") + '?autoplay=1&showinfo=0&enablejsapi=1&widgetid=1';
381    iframeAllow = 'allowfullscreen="1" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"';
382    iframeVideo = "<iframe src='"+url+"' "+iframeAllow+" width='"+w+"' height='"+h+"'></iframe>";
383    $(this).closest("figure").html(iframeVideo);
384    return false;
385});
386
387
388$(document).ready(function () { 
389
390    /**
391     * Muestra el reproductor de audio adjunto o embebido en las notas.
392     */
393    if ( $(".jp-jplayer").length ) {
394
395        var audioPlayerImage = $(".nota-foto img").eq(0).attr("data-src");
396
397        $(".jp-jplayer").each(function() {
398
399            audioPlayerID = '#'+$(this).attr("id"); 
400            audioContainerID = '#' + $(this).attr("data-container-id");
401            $(audioContainerID+" [data-post-image]").attr("src", audioPlayerImage);
402     
403            $(audioPlayerID).jPlayer({
404                ready: function () {
405
406                    $(this).jPlayer("setMedia", {
407                        mp3: $(this).attr("data-audio-url")
408                    });
409                },
410                cssSelectorAncestor: audioContainerID,
411                swfPath: 'js',
412                supplied: 'mp3',
413                wmode: 'window',
414                smoothPlayBar: true,
415                keyEnabled: true
416            });
417        
418        });
419    }
420
421    /**
422     * Muestra el OwnCarousel del interior de las notas.
423     */
424    if ($(".owl-slider-interior").length) {
425
426        $(".owl-slider-interior").each(function() {
427
428            var owlGal = $(this);
429            owlGal.owlCarousel({
430                autoHeight:true,
431                lazyload: true,
432                margin: 15,
433                responsive: {
434                    0: {
435                        items: 1,
436                        nav: true,
437                        slideBy: 1,
438                        smartSpeed: 750,
439                    }
440                },
441               onInitialized: function () {
442                    $(owlGal).closest(".cont-galeria").css({opacity: 1});
443                }
444            });
445
446            owlGal.on('changed.owl.carousel', function (event) {});
447
448            /*if ($(this).find(".icon-prev").length) {
449
450                $(this).find(".icon-prev").click(function (e) {
451                    owlGal.trigger('next.owl.carousel');
452                });
453            }
454            
455            if ($(this).find(".icon-next").length) {
456
457                $(this).find(".icon-next").click(function (e) {
458                    owlGal.trigger('prev.owl.carousel');
459                });
460
461            }*/
462
463        });
464    }
465
466
467
468});
469
470
471/**
472 * Fecha en el top del sitio
473 */
474
475if ($("[data-datetime-top]").length) {
476
477    mydate = new Date();
478    var myday = mydate.getDay();
479    var mymonth = mydate.getMonth() + 1;
480    var myweekday= mydate.getDate();
481    var myyear = mydate.getFullYear();
482    var myhour = mydate.getHours();
483    var myminute = mydate.getMinutes();
484    if (myminute < 10) {
485        myminute = "0" + myminute;
486    }
487    monthName= new Array("Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre");
488    dayName= new Array("Domingo","Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado");
489    
490    var myDayName = dayName[myday];
491    var myMonthName = monthName[mymonth];
492
493    $("[data-datetime-top]").each(function() {
494
495        html = $(this).html();
496        html = html.replace('{{day}}', myweekday);
497        html = html.replace('{{dayName}}', myDayName);
498        html = html.replace('{{month}}', mymonth);
499        html = html.replace('{{monthName}}', myMonthName);
500        html = html.replace('{{year}}', myyear);
501        html = html.replace('{{hour}}', myhour);
502        html = html.replace('{{minute}}', myminute);
503
504        $(this).html(html);
505        $(this).css('display', 'flex');
506    });
507
508}
509
510/**
511 * Bloques de clima del sitio.
512 */
513function cambiarClimaTop(clima_id) {
514
515    var climaUrl = '/extras/js/clima.php';
516    $.getJSON(climaUrl, function (json) {
517
518        $.each(json, function (key, val) {
519
520            if (val.id == clima_id) {
521
522                $("[data-clima]").each(function() {
523
524                    m = $(this);
525
526                    imagePath = '/images/clima/';
527                    imageExtension = '.png';
528
529                    if ($(m).attr("data-clima-image-path") !== undefined) {
530                        imagePath = $(m).attr("data-clima-image-path");
531                    }
532
533                    if ($(m).attr("data-clima-image-ext") !== undefined) {
534                        imageExtension = $(m).attr("data-clima-image-ext");
535                    }
536
537                    $(m).find("[data-clima-localidad]").html(val.localidad);
538                    $(m).find("[data-clima-temp]").html(val.temp + "°");
539                    $(m).find("[data-clima-class]").attr("class", "climaid icon-" + val.img);
540
541                    $(m).find("[data-clima-lluvia]").html(val.lluvia + "%");
542                    $(m).find("[data-clima-viento]").html(val.viento + "km/h");
543                    $(m).find("[data-clima-min]").html(val.hoy_min + "°");
544                    $(m).find("[data-clima-max]").html(val.hoy_max + "°");
545                    $(m).find("[data-clima-humedad]").html(val.humedad + "%");
546                    $(m).find("[data-clima-visibilidad]").html(val.visibilidad + "km");
547                    $(m).find("[data-clima-presion]").html(val.visibilidad + "hP");
548
549                    $(m).find("[data-clima-image]").attr("src", imagePath + val.imgName + imageExtension);
550
551                    for (i=1; i<=9; i++) {
552
553                        $(m).find("[data-clima-dia='"+i+"'] [data-clima-day-class]").attr("class", "climaid icon-" + val.day[i].img);
554                        $(m).find("[data-clima-dia='"+i+"'] [data-clima-min]").html(val.day[i].min + "°");
555                        $(m).find("[data-clima-dia='"+i+"'] [data-clima-max]").html(val.day[i].max + "°");
556                        $(m).find("[data-clima-dia='"+i+"'] [data-clima-text]").html(val.day[i].text);
557                        $(m).find("[data-clima-dia='"+i+"'] [data-clima-image]").attr("src", imagePath + val.day[i].imgName + imageExtension);
558                    }
559
560                });
561
562            }
563
564        });
565    });
566}
567
568$(document).ready(function () {
569    if (typeof climaId !== 'undefined') {
570        if ($.cookie("dataclima")) {
571            climaId = $.cookie("dataclima");
572        }
573        cambiarClimaTop(climaId);
574    }
575});
576
577$(document).on('click', '.cont-top-clima', function () {
578    $(this).toggleClass('active');
579    $(this).parent().find('.extra').toggleClass('open');
580});
581
582
583
584// Encuestas
585var pollOneClick = [];
586
587if ($("[data-encuesta]").length) {
588
589    $("[data-encuesta]").each(function() {
590
591        console.log('encuesta > load ok');
592
593        encuestaID = $(this).attr("data-encuesta-id");
594        var eCookieName = 'encuesta-new-'+encuestaID;
595
596        if ($.cookie(eCookieName)) {
597
598            console.log('encuesta > cookie exists');
599
600            pollOneClick[eCookieName] = 1;
601            $(this).addClass("ver-resultados");
602            pollProcess(encuestaID, 0);
603
604            // Ya voto.
605            encuestaYaVoto = $(this).attr("data-encuesta-text-voto");
606            console.log('encuesta > ' + encuestaYaVoto);
607            $(this).find(".error").html(encuestaYaVoto).addClass("view-error");
608        }
609
610        if ($(this).attr("data-encuesta-is-finished") == '1') {
611
612            console.log('encuesta > finish');
613
614            pollProcess(encuestaID, 0);
615            $(this).addClass("ver-resultados");
616        }
617
618    });
619
620    // Vota en una encuesta activa
621    $("[data-encuesta] .item").click(function () {
622
623        console.log('encuesta > item click');
624
625        encuestaID = $(this).attr("data-encuesta-id");
626        itemClick = 'encuesta-' + encuestaID;
627
628        if (!pollOneClick[itemClick]) {
629
630            console.log('encuesta > first item click');
631
632            pollOneClick[itemClick] = 1;
633
634            $(this).addClass("active");
635            encuestaItemID = $(this).attr("data-encuesta-item-id");
636
637        } else {
638
639            console.log('encuesta > ya voto');
640
641            encuestaYaVoto = $(this).attr("data-encuesta-text-voto");
642
643            $(this).parents(".encuesta").find(".error").html(encuestaYaVoto).addClass("view-error");
644            encuestaItemID = 0;
645        }
646
647        console.log('encuestaID:' + encuestaID + ' - encuestaItemID:' + encuestaItemID);
648
649        $(this).parents(".encuesta").addClass("ver-resultados");
650        pollProcess(encuestaID, encuestaItemID);
651
652    });
653
654    function pollShowResults(encuestaID, data) {
655
656        var total = 0;
657        var votosMinimosParaMostrar =  parseInt($("[data-encuesta-id='" + encuestaID + "']").attr("data-encuesta-min-view-votos"));
658
659        $.each(data.info.items, function (i, encItem) {
660
661            total += parseInt(encItem.cantidad);
662
663            if (data.info.max == encItem.cantidad) {
664                $("[data-encuesta-id='" + encuestaID + "'] [data-encuesta-item-id='" + i + "']").addClass("item-ganador")
665            }
666
667            $("[data-encuesta-id='" + encuestaID + "'] [data-encuesta-item-id='" + i + "'] .cant").html(encItem.porcentaje);
668            $("[data-encuesta-id='" + encuestaID + "'] [data-encuesta-item-id='" + i + "'] .borde").animate({width: encItem.porcentaje}, 1000, function () {});
669
670        });
671
672        console.log('encuesta > min votos a mostrar: ' + votosMinimosParaMostrar);
673        console.log('encuesta > total votos: ' + total);
674        if (total >= votosMinimosParaMostrar) {
675            $("[data-encuesta-id='" + encuestaID + "'] .cont-votos").html(total + ' votos');
676        }
677    }
678
679    function pollProcess(encuestaID, encuestaItemID) {
680
681        const pollURL = '/extras/encuestas/votar.php?_t=' + new Date().getTime();
682
683        $.ajax({
684            type: 'POST',
685            async: false,
686            url: pollURL,
687            dataType: 'json',
688            cache: false,
689            data: {enc: encuestaID, id: encuestaItemID},
690            success: function (data) {
691
692                console.log(data);
693
694                if (data.error) {
695
696                    encuestaYaVoto = $("[data-encuesta-id='" + encuestaID + "']").attr("data-encuesta-text-voto");
697                    $("[data-encuesta-id='" + encuestaID + "'] .error").html(encuestaYaVoto).addClass("view-error");
698
699                } else {
700
701                    eCookieName = 'encuesta-' + encuestaID;
702                    // $.cookie(eCookieName, '1', {expires: 1, path: '/'});
703                }
704
705                pollShowResults(encuestaID, data);
706
707            },
708            error: function (jqXHR, textStatus, errorThrown) {
709
710                console.log(jqXHR);
711                console.log(textStatus);
712                console.log(errorThrown);
713
714                // Error
715                $("[data-encuesta-id='" + encuestaID + "'] .error").html("Error en la encuesta").addClass("view-error");
716            }
717
718        });
719    }
720
721}

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.