1/** 2 * Sourtech 3 * Hernan Roig -> [email protected] 4**/ 5/* 6let obsAmuraNews = document.querySelector('#obsAmuraNews'); 7let observer = new IntersectionObserver(nextNews); 8let moreNews = []; // notas relacionadas a mostrar 9let moreNews_view = 0; // contador 10*/ 11 12$(document).ready(function() { 13 adjustSize(); 14 activarVideojs(); 15 16 /* 17 if(obsAmuraNews!== null){ 18 observer.observe(obsAmuraNews); 19 20 const listItems = document.querySelectorAll('.grilla-comon figure a'); 21 Array.from(listItems).forEach((p, index) => { 22 moreNews.push(p.href); 23 }); 24 } 25 */ 26 27 stickyFooter(); 28}); 29 30$(window).resize(function() { 31 adjustSize(); 32}); 33 34function nextNews(entries, observer) { 35 for (entry of entries) { 36 if (entry.isIntersecting) { 37 getNews(); 38 console.log("view next news"); 39 // cuando llego al final del array dejo de "observar" 40 if(moreNews_view>=moreNews.length){ 41 observer.unobserve(entry.target); 42 obsAmuraNews.remove(); 43 } 44 } 45 } 46} 47 48function getNews() { 49 url = moreNews[moreNews_view]; //array de url de noticias 50 moreNews_view++; 51 $.ajax({
52 beforeSend: function() { 53 $("#more-news").addClass("disabled"); 54 }, 55 type: "GET",dataType: "html", 56 url: url, 57 timeout: 40000, 58 success: function (data) { 59 history.pushState(false, false, url); 60 var content = $(data); 61 var container = content.find('.ficha-container'); 62 63 Array.from(content).forEach((p, index) => { 64 if(p.localName=='title'){ 65 document.title = p.innerText; 66 } 67 else if(p.rel=='canonical' || p.rel=='amphtml'){ 68 $('link[rel="'+p.rel+'"]').attr('href', p.href); 69 } 70 else if(p.name){ 71 $('meta[name="'+p.name+'"]').attr('content', p.content); 72 } 73 }); 74 refreshAds(container); 75 stickyFooter(); 76 }, 77 }).always(function ( data ) { 78 $("#ama_ajaxfilter").fadeOut("slow"); 79 }); 80} 81 82function refreshAds(container){ 83 $(".statics_module").remove(); 84 container.insertBefore("#obsAmuraNews"); 85 //refresh de todas las publis 86 googletag.cmd.push(function() { 87 googletag.pubads().refresh(); 88 }); 89 90 //sumar la visita a gtag 91 gtag('event', 'page_view', { 92 page_location: location.href, 93 page_path: location.pathname, 94 page_title: document.title 95 }); 96} 97 98function stickyFooter(){ 99 let m = $(".grilla-comon").outerHeight(); 100 let f = $("footer").outerHeight(); 101 let t = m+f; 102 $(".amuraSticky").sticky({ topSpacing: 90, bottomSpacing:t, zIndex: 998 }); 103} 104 105function activarVideojs(){ 106 for (c = 0; c < $('.video-js').length; c++) { 107 var myPlayer = videojs(document.getElementsByClassName("video-js")[c], {"fluid": true, "textTrackSettings": false}, function(){ }); 108 myPlayer = addBrand(myPlayer,{ 109 image: $("#url_imgage").val() + "global/forbes.svg" 110 }); 111 } 112} 113 114function addBrand(player, options){ 115 var containerElement = document.createElement("div"); 116 containerElement.className = "vjs-brand-container"; 117 118 var imageElement = document.createElement("img"); 119 imageElement.src = options.image || defaults.image; 120 121 containerElement.appendChild(imageElement); 122 123 player.controlBar.el().insertBefore(containerElement, player.controlBar.fullscreenToggle.el()); 124 player.addClass('vjs-brand'); 125 return player; 126} 127 128function adjustSize(){ 129 var windowWidth = $(window).width(); 130 var windowHeight = $(window).height() - 128; 131 var windowHeightPosta = $(window).height(); 132 if (windowWidth>1023){ 133 $( ".bg-slide" ).css({ 134 "height": windowHeightPosta 135 }); 136 $( "#soy .top-nota-destacado.full" ).css({ 137 "height": windowHeightPosta 138 }); 139 }else if (windowWidth>767 && windowWidth<=1023){ 140 $( ".bg-slide" ).css({ 141 "height": "500px" 142 }); 143 $( ".menu-nav" ).css({ 144 "height": windowHeightPosta 145 }); 146 147 }else if (windowWidth<=767){ 148 $( ".bg-slide" ).css({ 149 "height": "430px" 150 }); 151 $( ".menu-nav" ).css({ 152 "height": windowHeightPosta 153 }); 154 } 155}
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.