let body = document.querySelector(‘body’);
let mobileViewPort = window.matchMedia(‘@media only screen and (((device-width: 428px) or (device-width: 430px) or (device-width: 440px) or (device-width: 414px))and ((device-height: 926px) or (device-height: 932px) or (device-height: 956px) or (device-height: 896px))) and (-webkit-min-device-pixel-ratio: 3) and (min-resolution: 192dpi) and (min-resolution: 2dppx), (max-width: 767px)’);
if (document.querySelector(‘body’).classList.contains(‘single’) && mobileViewPort.matches) {
let megaContainer = document.querySelector(‘#postContent .megaContainer’);
let articlePost = document.querySelector(‘article.post’);
// chequeamos que estamos en un artículo sin publi para quitarle altura a los slots
if(articlePost.classList.contains(‘tag-no-publi’)) {
megaContainer.classList.add(‘no-publi’);
} else {
// Si el artículo tiene publi, le ponemos placeholder al megaContainer
// el placeholder se queda atrás de la publi en este caso
megaContainer.classList.add(‘ad-slot-ph’);
}
if(!body.classList.contains(‘socios’)){
megaContainer.innerHTML = `
`;
}
} else {
let desktop_container = document.querySelector(‘#okd_top1_original.desktop-container’);
let mobile_container = document.querySelector(‘#okd_top1_original.mobile-container’);
if(mobileViewPort.matches) {
if(null !== desktop_container && null === mobile_container ) {
mobile_container = desktop_container;
desktop_container = null;
}
if(null !== mobile_container) {
mobile_container.innerHTML = top1Html;
}
if(null !== desktop_container) {
desktop_container.remove();
}
} else {
if(null !== desktop_container) {
desktop_container.innerHTML = top1Html;
}
if(null !== mobile_container) {
mobile_container.remove();
}
}
}
}
function sticky_top1() {
let top1Container = document.getElementById(‘okd_top1_original’);
let top1 = document.getElementById(‘top1’);
var containerStyle = top1Container.currentStyle || window.getComputedStyle(top1Container);
top1Container.setAttribute(«marginTop», containerStyle.marginTop);
if (window.innerWidth > 767 && typeof top1Container !== ‘undefined’ && top1Container !== null
&& top1 !== ‘undefined’ && top1 !== null) {
document.addEventListener(‘scroll’, function() {
top1Bottom = top1.getBoundingClientRect().bottom;
top1Top = top1.getBoundingClientRect().top;
top1ContainerBottom = top1Container.getBoundingClientRect().bottom;
top1ContainerTop = top1Container.getBoundingClientRect().top;
let header = document.getElementById(«okd-cabecera»);
headerBottom = header.getBoundingClientRect().bottom;
headerTop = header.getBoundingClientRect().top;
let containerMarginTop = top1Container.getAttribute(«marginTop»);
let marginForTop = 2;
//Si el top y el bottom del bounding client rect del top1 son iguales quiere decir que no se ha cargado el anuncio.
//Entonces no lo movemos.
if( top1Bottom > top1Top){
//console.log(«DGSTICKY header: » + headerTop + » » + headerBottom + » » + header.offsetHeight);
//console.log(«DGSTICKY top: » + top1Top + » » + top1Bottom + » » + top1.offsetHeight);
//console.log(«DGSTICKY topContainer: » + top1ContainerTop + » » + top1ContainerBottom + » » + top1Container.offsetHeight);
//console.log(«DGSTICKY scroll » + window.scrollY + » » + window.scrollX);
top1Position = 0 ;
//Si el header colapsado, 168 -128 px (top negativo) = 40px
if(headerBottom <= 40){
top1Position = 0;
//console.log(«DGSTICKY top1Position «+top1Position + » » + containerMarginTop);
//El contenedor está debajo de la cabecera
if(top1ContainerTop < headerBottom ){
//Lo colocamos en la posición de la cabecera.
top1Position += headerBottom;
//si está pegado a la cabecera le añadimos un margen
if(top1ContainerTop > marginForTop){
top1Position += marginForTop
};
//Si el contendor está fuera del viewport
if(top1ContainerTop < 0 ){
top1Position += Math.abs(top1ContainerTop) + marginForTop;
}
}
//console.log(«DGSTICKY top1Position «+top1Position);
//Si la posición más la altura excenden el contenedor, restamos a la posición para que quede al final del contenedor
if(( top1Position + top1.offsetHeight) > top1Container.offsetHeight){
top1Position -= ( top1Position + top1.offsetHeight ) – top1Container.offsetHeight ;
}
//console.log(«DGSTICKY top1Position «+top1Position);
}
top1.style.position = ‘absolute’;
top1.style.top = top1Position+’px’;
top1.style.left = «50%»;
top1.style.transform=»translate(-50%, 0)»;
}
});
}
}
function adParentClass() {
let hereAds=»»;
intexts = «, #intext1″;
if (bodyContains(‘paged’)) {
intexts=»»;
}
if (bodyContains(‘home’)) {
hereAds += «#top1, #right1, #right2, #right3, #right4, #right5, #right6, #mpu-video1, #bottom, #x01»;
} else if (inPortadilla()) {
hereAds += «#top1, #right1, #right2, #right3, #right4, #right5, #right6, #bottom, #x01»;
} else if (bodyContains(‘archive’)) {
//Se elimina #intext1 e #intext2 para que no se añada el placeholder dado que impide hacer click en los enlaces
hereAds += «#top1, #right1, #right2, #bottom, #x01» + intexts;
} else if (bodyContains(‘single’)) {
//Se elimina #intext1 e #intext2 para que no se añada el placeholder dado que impide hacer click en el link de comentarios
hereAds += «#top1, #right1, #right2, #right3, #bottom, #x01, #podcast_passback1» + intexts;
// Ajuste para tag-no-publi
let singlePostContent = document.querySelector(«#postContent>article»);
if (singlePostContent.classList.contains(«tag-no-publi»)) return true;
}
if(«» === hereAds) { return true; }
let adSlots = document.querySelectorAll(hereAds);
adSlots.forEach((ad, i) => {
ad.parentElement.classList.add(«ad-slot-ph»)
});
return true;
}
function bodyContains(className) {
let bodyEl = document.querySelector(«body»);
return bodyEl.classList.contains(className);
}
function inPortadilla() {
let portadas = [‘economia’, ‘deportes’, ‘baleares’, ‘andalucia’, ‘salud’, ‘alicante’, ‘tv’, ‘eurocopa’, ‘juegos-olimpicos’, ‘mundial’, ‘elecciones’];
let in_portadilla = false;
portadas.forEach((item, i) => {
if (bodyContains(item)) {
in_portadilla = true;
return;
}
});
return bodyContains(‘page’) && in_portadilla;
}
function scrollMundialMenu() {
let mundial_scroll = document.querySelector(‘#menu-mundial-futbol > ul’);
$(mundial_scroll).find(‘li > a.active’).each(function(){
if ($(this).hasClass(‘active’)) {
let scroll_position = Math.floor(this.getBoundingClientRect().left) – Math.floor(mundial_scroll.getBoundingClientRect().left);
mundial_scroll.scrollTo({
top: 0,
left:parseInt(scroll_position),
behavior: ‘smooth’
});
}
});
}
window.addEventListener(«DOMContentLoaded», function() {
if (!isImpertinentPage()) {
printTop1();
sticky_top1();
adParentClass();
scrollMundialMenu();
}
});
España regresa a una final de Mundial 16 años después. Después de una victoria para la historia contra Francia, los de Luis de la Fuente estarán este domingo en Nueva York para luchar por la segunda estrella de su camiseta, aunque aún la expectación es total por saber cuál será su rival para levantar la Copa del Mundo. Inglaterra o Argentina. ¿Cuál prefieres? ¡Vota en nuestra encuesta!
En cada opción hay morbo. Por un lado están los ingleses, quienes tienen sed de venganza después de perder contra España la final de la pasada Eurocopa, y una Argentina que no pudo enfrentarse a la Roja en la Finalíssima y que parte como vigente campeona desde Qatar 2022. Sea cual sea, sin duda será un rival muy duro que peleará con la misma intensidad.
