/* Minification failed. Returning unminified contents. (170,54-55): run-time error JS1195: Expected expression: > (185,1-2): run-time error JS1002: Syntax error: } (187,13-14): run-time error JS1195: Expected expression: ) (187,15-16): run-time error JS1004: Expected ';': { (257,2-3): run-time error JS1195: Expected expression: ) (259,37-38): run-time error JS1195: Expected expression: ) (259,39-40): run-time error JS1004: Expected ';': { */ var $grid = $('#noticias-mais-comentadas').isotope({ // options getSortData: { total: '[data-total] parseInt' }, sortBy: 'total', sortAscending: false, itemSelector: '.item', layoutMode: 'vertical' }); $(function () { let topComentarios = $.connection.comentarioHub; topComentarios.client.notificaAtualizacaoLista = function (message) { // alert(message); processaAtualizacao(); }; topComentarios.client.notificas = function (mensage) { alert(mensage); } $.connection.hub.start(); }); var processaAtualizacao = function () { var lista = null; $.get('/home/NoticiasMaisComentadas/3').then(function (data) { lista = $(data).children('.item'); var mudancas = mudancasListaNoticias(lista); atualizaLista(lista, mudancas); }); }; var mudancasListaNoticias = function (lista) { let listaNoticiasComentadasLocal = $('#noticias-mais-comentadas > .item'); return diferencaEntreListas(listaNoticiasComentadasLocal, lista); }; var diferencaEntreListas = function (lista, lista2) { var idsLista1 = []; var idsLista2 = []; lista.map(function () { idsLista1.push($(this).data('id')); }); lista2.map(function () { idsLista2.push($(this).data('id')); }); var elementsToRemove = []; var elementsToInsert = []; var commentsToUpdate = []; idsLista1.sort(); idsLista2.sort(); lista.sort(comparaDom); lista2.sort(comparaDom); for (var i = 0; i < idsLista1.length; ++i) { if (idsLista1[i] !== idsLista2[i]) { elementsToRemove.push(idsLista1[i]); elementsToInsert.push(idsLista2[i]); } else { if (isComentarioAtualizado(lista[i], lista2[i])) { commentsToUpdate.push(lista2[i]); } } } return { elementsToRemove: elementsToRemove, elementsToInsert: elementsToInsert, commentsToUpdate: commentsToUpdate }; }; var isComentarioAtualizado = function (noticiaComentada, outraNoticiaComentada) { return $(noticiaComentada).data('id') === $(outraNoticiaComentada).data('id') & $(noticiaComentada).data('comment') !== $(outraNoticiaComentada).data('comment'); }; var atualizaLista = function (lista, mudancas) { removerNoticias(mudancas.elementsToRemove); inserirNoticias(lista, mudancas.elementsToInsert); setTimeout(function () { atualizaComentarios(mudancredepara-br.parainforma.commentsToUpdate); },1700); }; var removerNoticias = function (idsRemover) { if (idsRemover.length) { idsRemover.forEach(function (id) { removeNoticia(id); }); } }; var removeNoticia = function (id) { var $elem = $("#maiscomentadas-" + id); $elem.slideUp("slow", function () {}); }; var inserirNoticias = function (lista, idsInserir) { console.log(lista); console.log(idsInserir); lista .filter(function () { return $.inArray($(this).data('id'), idsInserir ) > - 1; }) .each(function (index, elem) { insereNoticia(elem); }); }; var insereNoticia = function (elem) { setTimeout(function () { $(elem).appendTo("#noticias-mais-comentadas").show('slide', {}, 600, ordenarNoticias); $grid.isotope('appended', elem); }, 1000); }; var ordenarNoticias = function () { $grid.isotope('updateSortData').isotope({ sortBy : 'total' }); }; var comparaDom = function (a, b) { intA = parseInt($(a).data('id')); intB = parseInt($(b).data('id')); if (intA < intB) { return -1; } if (intA > intB) { return 1; } return 0; }; var atualizaComentarios = function (commentsToUpdate) { if (commentsToUpdate.length) { $.each(commentsToUpdate, function () { var idNoticia = $(this).data('id'); var novaQuantidade = $(this).find('#quantidade').text(); var novoComentario = $(this).find('#comment_' + idNoticia); $('#maiscomentadas-' + idNoticia).find('#quantidade').text(novaQuantidade); $('#maiscomentadas-' + idNoticia).attr('data-total', '' + novaQuantidade); ordenarNoticias(); setTimeout(function () { $('#maiscomentadas-' + idNoticia).find('#comment_' + idNoticia).hide('fade', {}, 400, function () { $(this).replaceWith($(novoComentario)); $(this).show('fade', {}, 400); }); }, 1000); }); } };; var hash = window.location.hash; window.location.hash = ""; document.addEventListener('readystatechange', event => { if (event.target.readyState === "complete") { if (hash) { var target = $(hash); window.Scroll = false; $("#menuPrincipal").removeClass("nav-down").addClass("nav-up"); $('html, body').animate({ scrollTop: target.offset().top - 138 }, 1000, function () { setTimeout(function () { window.Scroll = true; }, 100); }); } } }); $(function () { $(".buscaMaisLidas").click(function () { event.preventDefault(); var dias = $(this).attr("data-dias"); $.ajax({ method: "Get", url: "/Home/GetMaisLidas?dias=" + dias, success: function (jsReturnArgs) { if (jsReturnArgs.Status === 300) { //300 is an arbitrary value I just made up right now showPopup("You do not have access to that."); } $("#getMaisLidas").html(jsReturnArgs.ViewString); //the HTML I returned from the controller }, error: function (errorData) { onError(errorData); } }); $(".buscaMaisLidas").each(function (index) { $(this).parent().removeClass("active"); }); $(this).parent().addClass("active"); return false; }); $("#tabMaislidas").click(function () { if ($('small.maislidas').hasClass('red')) { $(this).attr("href", "#noticias"); $("small.maislidas").removeClass("red"); } else { $(this).attr("href", "#maislidas"); $("small.maislidas").addClass("red"); } }); $('a[href*="#"]') .not('[href="#"]') .not('[href="#0"]') .click(function (event) { if ( location.pathname.replace(/^\//, '') === this.pathname.replace(/^\//, '') & location.hostname === this.hostname ) { // Figure out element to scroll to var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) + ']'); // Does a scroll target exist? if (target.length) { // Only prevent default if animation is actually gonna happen event.preventDefault(); window.Scroll = false; $("#menuPrincipal").removeClass("nav-down").addClass("nav-up"); var paddingTop = 85; if ($("#top-container").hasClass("affix-top")) { paddingTop = 138; } $('html, body').animate({ scrollTop: target.offset().top - paddingTop }, 1000, function () { setTimeout(function () { window.Scroll = true; }, 100); }); } } }); touchSlide(); }); window.AtivaTheiaSticky = function () { $(".areaSite").find('.tr-sticky').theiaStickySidebar(); var container = document.querySelectorAll(".areaSite"); for (var i = 0; i < container.length; i++) { var tag = container[i].querySelector('redeparaadlink'); if (tag & tag.childNodes.length === 0) { var id = tag.getAttribute('data-id'); var quantidade = tag.getAttribute('data-quantidade'); var w = tag.getAttribute('data-width'); var h = tag.getAttribute('data-height'); var iframe = tag.appendChild(document.createElement('iframe')); iframe.setAttribute('style', 'width:' + w + 'px;height:' + h + 'px;'); iframe.setAttribute('frameborder', '0'); iframe.setAttribute('scrolling', 'no'); iframe.contentWindow.location.href = uriRede + 'Zonas/ExibeLinksPatrocinadosDaZona/?idZona=' + id + '&quantidade=' + quantidade; } } }; ; 11oz