Inicio Actualidad Los OK KO del martes, 23 de abril de 2024

Los OK KO del martes, 23 de abril de 2024

Los OK KO del martes, 23 de abril de 2024

‘;
let body = document.querySelector(‘body’);
let mobileViewPort = window.matchMedia(‘@media only screen and (device-width: 428px) and (device-height: 926px) and (-webkit-device-pixel-ratio: 3), only screen and (device-width: 430px) and (device-height: 932px) and (-webkit-device-pixel-ratio: 3), (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 marginForTop){
top1Position += marginForTop
};
//Si el contendor está fuera del viewport
if(top1ContainerTop 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’, ‘jjoo’, ‘mundial’, ‘elecciones’];
let in_portadilla = false;
portadas.forEach((item, i) => {
if (bodyContains(item)) {
in_portadilla = true;
return;
}
});

return bodyContains(‘page’) && in_portadilla;
}
function scrollQatarMenu() {
let mundial_scroll = document.querySelector(‘#menu-mundial-qatar > 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() {
printTop1();
sticky_top1();
adParentClass();
scrollQatarMenu();
});

OK KO

OK: Jude Bellingham

Porque ha deslumbrado en la gala de los Premios Laureus del deporte como Deportista Revelación.

OK: Fátima Matute

Por alertar de la «antipsiquiatría» de Mónica García, por «demonizar» la enfermedad mental.

OK: Javier Milei

Por lanzar un aviso a «los traidores»: «No cederemos ante los ‘lobbies’».

OK: Pedro Piqueras

Porque ha recibido el Premio a la Trayectoria Profesional en Comunicación y en Información.

KO: Salvador Illa

Porque su declaración en el Congreso deja la sombra de la duda sobre su vínculo con Koldo.

KO: Joan Laporta

Por su ridícula reclamación para repetir el Clásico si alguna imagen demuestra que el gol fantasma fue legal.

KO: Javier Tebas 

Por no implantar una tecnología de gol, que costaría un 0,2% de los ingresos anuales de la Liga.

KO: Pedro Sánchez

Porque en 5 años destinó a investigar la ELA apenas un 10% del fichaje de Broncano: 2,8 millones.

Lo último en El OK y el KO

Últimas noticias

n’ +

Cerrar sesión

n’ +
‘n’ +
»);

let isIExplore = (/MSIE (d+.d+);/.test(navigator.userAgent) || !!navigator.userAgent.match(/Trident.*rv:11./) || navigator.userAgent.indexOf(‘Edge’) !== -1);
if (isIExplore) {
$(‘.nav-socios-menu’).css(‘margin-top’, ‘0px’);
}

$(‘#okdiario-cabecera-pagina-socios’).on(‘click’, function(event) {
event.stopPropagation();
event.preventDefault();
$(‘#menu-cabecera-pagina-socios’).toggleClass(‘hidden’);
$(‘#menu-cabecera-pagina-socios-content’).toggleClass(‘hidden’);
});

$(‘.okfaq’).on(‘click’, function (event) {
event.stopPropagation();
event.preventDefault();
window.open(this.href);
return false;
});

$(‘.changePass’).on(‘click’, function (event) {
event.preventDefault();
goToChangePasswordModal();
});

$(‘.logout’).on(‘click’, function (event) {
event.preventDefault();
logout();
});
}

function goToChangePasswordModal(){
window.location.href=»#changeModal»;
}

function activeChangePasswordForm(){
printChangePasswordForm();
$(‘#okChangePasswordBtn’).on(‘click’, function (event) {
event.preventDefault();
$(‘.ok-form-success, .ok-form-email-error, .ok-form-password-error’).addClass(‘hidden’);
let baseUrl = window.location.protocol + ‘//’ + window.location.hostname + ‘/socios/client-password’;
let email = $(‘#okChangePasswordform’).serializeArray()[0].value;
let password = $(‘#okChangePasswordform’).serializeArray()[1].value;
let repeatPassword = $(‘#okChangePasswordform’).serializeArray()[2].value;
if(validateEmail(email)){
if(validatePassword(password, repeatPassword)){
$.post(baseUrl, $(‘#okChangePasswordform’).serialize()).done(function (data) {
$(‘.ok-form-success’).removeClass(‘hidden’);
}).fail(function(data) {
$(‘.ok-form-success’).removeClass(‘hidden’);
});
}else{
$(‘.ok-form-password-error’).removeClass(‘hidden’);
}
}else{
$(‘.ok-form-email-error’).removeClass(‘hidden’);
}
});
}

function printChangePasswordForm() {
let changePasswordForm = ‘

n’ +

n’ +
Xn’ +

Cambiar password en el portal

n’ +
‘ n’ +

n’ +

n’ +

‘;
if($(«#changePasswordModal»).length == 0) {
$( «body» ).append(changePasswordForm);
}
}

function activeLoginForm() {
if ($(«.socios-link»).length) {
$(‘.nav-socios-menu, .nav-socios-menu-content’).addClass(‘hidden’);
$(‘.socios-link’).on(‘click’, function (event) {
event.preventDefault();
createLoginForm();
createRecoveryForm();
$(‘.ok-form-success’).addClass(‘hidden’);
goToLoginModal();
$(«#email»).focus();
$(‘#closeLoginFormLink’).on(‘click’, function(event) {
event.stopPropagation();
var divLoginModal = document.getElementById(‘loginModal’);
divLoginModal.parentNode.removeChild(divLoginModal);
var divRecoveryModal = document.getElementById(‘recoveryModal’);
divRecoveryModal.parentNode.removeChild(divRecoveryModal);
});
$(‘#closeRecoveryFormLink’).on(‘click’, function(event) {
event.stopPropagation();
var divLoginModal = document.getElementById(‘loginModal’);
divLoginModal.parentNode.removeChild(divLoginModal);
var divRecoveryModal = document.getElementById(‘recoveryModal’);
divRecoveryModal.parentNode.removeChild(divRecoveryModal);
});
});
}
}

function createLoginForm() {
printLoginForm();
initRememberMe();
$(‘.ok-form-error ‘).addClass(‘hidden’);

$(‘#okLoginBtn’).on(‘click’, function (event) {
event.stopPropagation();
event.preventDefault();
$(‘.ok-form-error ‘).addClass(‘hidden’);
$(‘.loginLoader’).removeClass(‘hidden’);
let baseUrl = window.location.protocol + ‘//’ + window.location.hostname + ‘/socios/client-login’;
$.post(baseUrl, $(‘#okLoginForm’).serialize()).done(function( data ) {
let cookieValue = data.expiration_at != false ? ‘b326b5062b2f0e69046810717534cb09’ : ‘ns’;
createLoginCookie(‘f2da8790d54184f6c100d431d8e45430’, data.expiration_at, cookieValue);
createLoginCookie(‘f2da8790d54184f6c100d431d8e45430[value]’,data.expiration_at, cookieValue);
setRememberMe();
window.didomiOnReady = window.didomiOnReady || [];
window.didomiOnReady.push(function (Didomi) {
let status = Didomi.getUserStatus();
if (status.vendors.consent.enabled.length === 0) { //Rechazar vendors en el cmp. Si no tiene vendors, significa que el login lo fuerza el cmp
Didomi.setUserDisagreeToAll();
}
});

window.location.replace(window.location.protocol + ‘//’ + window.location.hostname);
}).fail(function(data) {
$(‘.loginLoader’).addClass(‘hidden’);
$(‘.ok-form-error ‘).removeClass(‘hidden’);
});
});
}

function createRecoveryForm() {
printRecoveryForm();
$(‘#okRecoveryBtn’).on(‘click’, function (event) {
event.stopPropagation();
event.preventDefault();
$(‘.ok-form-success, .ok-form-error’).addClass(‘hidden’);
let baseUrl = window.location.protocol + ‘//’ + window.location.hostname + ‘/socios/client-recovery’;
let email = $(‘#okRecoveryForm’).serializeArray()[0].value;
if(validateEmail(email)){
$.post(baseUrl, $(‘#okRecoveryForm’).serialize()).done(function (data) {
$(‘.ok-form-success’).removeClass(‘hidden’);
}).fail(function(data) {
$(‘.ok-form-success’).removeClass(‘hidden’);
});
}else{
$(‘.ok-form-error-recovery’).removeClass(‘hidden’);
}
});
}

function validateEmail(email) {
const re = /^(([^()[]\.,;:s@»]+(.[^()[]\.,;:s@»]+)*)|(«.+»))@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2,}))$/;
return re.test(email);
}

function validatePassword(password, repeatPassword){
if (password === repeatPassword && password.length >= 8){
return true;
}else{
return false;
}
}

function goToLoginModal(){
var cookieSocios = (document.cookie.match(/^(?:.*;)?s*f2da8790d54184f6c100d431d8e45430s*=s*([^;]+)(?:.*)?$/)||[,null])[1];
if(cookieSocios === null || cookieSocios === »){
window.location.href = ‘#loginModal’;
}
}

function printLoginForm() {
let loginForm = ‘

n’ +

n’ +
Xn’ +

Iniciar sesión en el portal

n’ +
‘ n’ +

n’ +

n’ +

‘;
if($(«#loginModal»).length == 0) {
$( «body» ).append(loginForm);
}
}

function goToRecoveryModal(){
window.location.href = ‘#recoveryModal’;
}

function printRecoveryForm() {
let recoveryForm = ‘

n’ +

n’ +
Xn’ +

Recuperar contraseña

n’ +
‘ n’ +

n’ +

n’ +

‘;
if($(«#recoveryModal»).length == 0) {
$( «body» ).append(recoveryForm);
}
}
function setRememberMe() {
if ($(‘#rememberme’).is(‘:checked’)) {
localStorage.okusername = $(‘#email’).val();
localStorage.okpass = $(‘#password’).val();
localStorage.okchkbox = $(‘#rememberme’).val();
} else {
localStorage.okusername = »;
localStorage.okpass = »;
localStorage.okchkbox = »;
}
}

function initRememberMe() {
if (localStorage.okchkbox && localStorage.okchkbox != ») {
$(‘#rememberme’).attr(‘checked’, ‘checked’);
$(‘#email’).val(localStorage.okusername);
$(‘#password’).val(localStorage.okpass);
} else {
$(‘#rememberme’).removeAttr(‘checked’);
$(‘#email’).val(»);
$(‘#password’).val(»);
}
}

function showSociosButtons(){
fixIosSocios();
$(‘.socios-okclub’).removeClass(‘hidden’);
}

function fixIosSocios() {
let isIos = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
if (isIos && screen.width 767){
//Modificamos imagen de publicidad del MPUVideo1 si existe
if($(‘#mpu-video1’).length){
var imgSociosMpuVideo1 = document.createElement(«IMG»);
imgSociosMpuVideo1.setAttribute(«src», «/web/themes/v10/socios/_img/socios_300X250.jpg»);
document.querySelector(«#mpu-video1»).appendChild(imgSociosMpuVideo1);
}
//Obtenemos los items de publicidad.
var divsPublicidad = document.querySelectorAll(‘.publicidad’);

divsPublicidad.forEach(function(el){
//Crear variables con las imagenes de 300×600 y 300×250.
var imgSocios300x250 = document.createElement(«IMG»);
var imgSocios300x600 = document.createElement(«IMG»);
imgSocios300x250.setAttribute(«src», «/web/themes/v10/socios/_img/socios_300X250.jpg»);
imgSocios300x600.setAttribute(«src», «/web/themes/v10/socios/_img/socios_300x600.jpg»);
imgSocios300x250.setAttribute(«style», «margin: auto; display: flex; justify-content: center; align-items: center;»);
imgSocios300x600.setAttribute(«style», «margin: auto; display: flex; justify-content: center; align-items: center;»);

//Añadimos las imágenes a los huecos publicitarios de la portada.
if(el.className.includes(‘300×250’) != false){
var itemPubli = el.firstElementChild;
itemPubli.innerHTML = »;
itemPubli.appendChild(imgSocios300x250);

}else if(el.className.includes(‘300×600’) != false){
var itemPubli = el.firstElementChild;
itemPubli.innerHTML = »;
itemPubli.appendChild(imgSocios300x600);

}
});
}
}

/*Cargar publi de socios en portada, deportes y economía – END*/
function posicionate () {
var article = sessionStorage.getItem(«article»);

if (article) {
var coord = $(‘article[data-id=»‘+article+'»]’).offset();
if(typeof coord === «undefined») return;
var total = parseInt(coord.top) – parseInt($(‘.mega’).height());

window.scrollTo(0, total);
}
}

function saveArticle (article) {
var dataId = $(article).attr(‘data-id’);

sessionStorage.setItem(«article», dataId);
}

function goLink(link) {
window.location.href = link;
return false;
}

// Navegacion de los blogs
function navigateBlogs(category) {
$(‘.category-ul’).addClass(‘category-hidden’);
$(‘#images-‘+category).removeClass(‘category-hidden’);
}

//Animación de todos los valores
function tickerAnimationEconomicAll() {
var tickerContainer = $(‘.prices-data-container.economic-all’)
var tickerList = $(‘.economic-all .prices-data-list’);
var tickerItem = $(‘.economic-all .price-data-wrapper’);

//Si el primer elemento del carrusel, está fuera de la vista
if ((tickerItem.eq(0).offset().left + tickerItem.eq(0).width())
‘);
percentageChange.eq(i).addClass(«percentage-change-red»);
percentageChange.eq(i).removeClass(«percentage-change-green»);
}
//Positivo
else if (res.tickers[j].pcp.substring(0, 1) == ‘+’) {
changeDirection.eq(i).html(‘‘);
percentageChange.eq(i).addClass(«percentage-change-green»);
percentageChange.eq(i).removeClass(«percentage-change-red»);
}
}
}
}

function hideFeaturedMenu(){
$(‘.okdiario-destacados-dropdown-container’).slideUp(«normal»);
$(«.okdiario-destacados-dropdown-container, .okdiario-destacados-dropdown-top-title»).removeClass(«activa»);
//$(document).click(function (){});
}
function showFeaturedMenu(){
$(‘.okdiario-destacados-dropdown-container’).slideDown(«normal»);
$(«.okdiario-destacados-dropdown-container, .okdiario-destacados-dropdown-top-title»).addClass(«activa»);
//al pulsar fuera del menú, ocultarlo
$(document).on(«click touchend touch», function (event) {
event.stopPropagation();
// Si se ha pulsado en el boton de desplegar/ocultar el menu, entonces no se oculta
// ya que se encargara el evento de la funcion featuredMenu().
if (!$(event.target).closest(«.okdiario-destacados-dropdown-top-title»).length &&
$(‘.okdiario-destacados-dropdown-container’).hasClass(«activa»)) {
hideFeaturedMenu();
}
});
}

/*Menú de destacados, mostrar más elementos al hacer clic*/
function featuredMenu(){
$(«.okdiario-destacados-dropdown-top-title»).on(‘click’, function(event){
event.stopPropagation();

// Si esta escondido el menu.
if(!$(‘.okdiario-destacados-dropdown-container’).hasClass(«activa»)){
// Mostrar
showFeaturedMenu()
} else{
hideFeaturedMenu()
}

});
//Añado el evento onclik para todo el LI
$(«.okdiario-destacados-dropdown > li»).on(«click», function (event){
event.stopPropagation();
window.location = $(this).find(«a»).first().attr(«href»);
return false;
});
//Elementos del menú destacados

var options = $(«.okdiario-destacados-container li»).get().reverse();
if(options.length > 0){
$(options).each(
function (index, element){
//Si están ocultos (overflow)…
if (index ul > li:has(ul)’).addClass(‘desplegable’);
$(‘.okd-cabecera-inferior-izquierda-nav-menu-auxiliar > ul > li > ul > li:has(ul)’).addClass(‘desplegable-sub’);
$(‘.okd-cabecera-inferior-izquierda-nav-menu-auxiliar > ul > li.desplegable > a,.okd-cabecera-inferior-izquierda-nav-menu-auxiliar > ul > li.desplegable > span’).after(‘‘);
$(‘.desplegable-sub > a’).after(‘‘);


$(‘.desplegable-sub i’).on(‘click’, function(event) {
event.stopPropagation();
if($(this).parent().find(‘ul’).length >0){
var comprobar = $(this).next();
$(‘.menu-item-object-custom li’).removeClass(‘activa’);
$(this).closest(‘li’).addClass(‘activa’);
if((comprobar.is(‘ul’)) && (comprobar.is(‘:visible’))) {
$(this).closest(‘li’).removeClass(‘activa’);
comprobar.slideUp(‘normal’);
}
if((comprobar.is(‘ul’)) && (!comprobar.is(‘:visible’))) {
$(‘.menu-item-object-custom ul ul:visible’).slideUp(‘normal’);
comprobar.slideDown(‘normal’);
}
}
});

$(‘.okd-cabecera-inferior-izquierda-nav-menu-auxiliar > ul > li.desplegable i’).not(‘.desplegable-sub i’).on(‘click’, function(event) {
event.stopPropagation();
if($(this).parent().find(‘ul’).length >0){
var comprobar = $(this).next();
$(‘.okd-cabecera-inferior-izquierda-nav-menu-auxiliar li’).not(‘li.desplegable-sub’).removeClass(‘activa’);
$(this).closest(‘li’).addClass(‘activa’);
if((comprobar.is(‘ul’)) && (comprobar.is(‘:visible’))) {
$(this).closest(‘li’).closest(‘li’).removeClass(‘activa’);
comprobar.slideUp(‘normal’);
}
if((comprobar.is(‘ul’)) && (!comprobar.is(‘:visible’))) {
$(‘.okd-cabecera-inferior-izquierda-nav-menu-auxiliar ul ul:visible’).slideUp(‘normal’);
comprobar.slideDown(‘normal’);
}
}
});
}

function searchButton(){
/*EN LA CABECERA, TODAS LAS PAGINAS*/
$(«.okd-cabecera-inferior-izquierda-search-icon»).on(‘click’, function(event){
event.stopPropagation();
$(«.okd-cabecera-inferior-izquierda-nav-search»).toggleClass(«active»);
//$(«.okd-cabecera-inferior-izquierda-search-form»).toggleClass(«active»);
if ($(«.okd-cabecera-inferior-izquierda-nav-menu»).hasClass(«active»)){
$(«.all»).removeClass(«active»);
$(«.okd-cabecera-inferior-izquierda-nav-menu»).toggleClass(«active»);
$(«.okd-cabecera-inferior-izquierda-nav-menu»).removeClass(«active2»);
$(‘.burger-box’).removeClass(‘open’);
}
});
}

/**
* itera las porpiedades css de offsetArray para obtener los estilos computados como enteros.
* @param {array} offsetArray
* @param {HTMLObjectElement} element
* @returns Int newOffset
*/
function loopOffsets(offsetArray, element) {
// declaramos variable delimitada
let newOffset = 0;

// computed style element
let cse = window.getComputedStyle(element);

// iteramos el array con propiedades css que se pasa como parámetro
offsetArray.forEach((item, index) => {
// comprobamos que haya estilo computado
if («» != cse.getPropertyValue(item) && «undefined» != cse.getPropertyValue(item)) {
// sacamos el entero y lo sumamos
newOffset += parseInt(cse.getPropertyValue(item));
}
// comprobamos que haya estilo en el nodo, por si se le ha asignado dirante la carga
if(«» != element.style.getPropertyValue(item) && «undefined» != element.style.getPropertyValue(item)){
// sacamos el entero y lo sumamos
newOffset += parseInt(element.style.getPropertyValue(item));
}
});
return newOffset;
}
/**
* Itera los hijos del header y obtiene sus alturas, bordes y márgenes para sacar mas limpiamente el sticky-top
* @param {HTMLObjectElement} element
* @param {Integer} offset
* @returns {Integer} offset
*/
function getOffsets(element, offset) {
// declaramos un array con las propiedades
// de las que queremos obtener valor entero
let offsetArray = [
«borderTop»,
«borderBottom»,
«marginTop»,
«marginBottom»,
];

// computed style header
let csh = window.getComputedStyle(element);

// Primero sumamos la altura y los offsets del header
offset += parseInt(csh.height);
offset += loopOffsets(offsetArray, element);

// iteramos con for porque es una colección
for (let ele of element.children) {
// sacamos offsets a cada elemento y
offset += loopOffsets(offsetArray, ele);

// loopeamos sticky-container para sacar la altura de cabecera-superior
// que es el que se tiene que dejar ver
// nos metemos en sticky-container para manejar las excepciones de desktop y mobile
if (ele.classList.contains(«okd-cabecera-sticky-container»)) {
for (let e of ele.children){
// le añadimos sus offsets
offset += loopOffsets(offsetArray, e);
// Comprobamos que estamos en cabecera-superior
// para poder dejar a la vista esa franja
if (e.classList.contains(‘okd-cabecera-superior’)) {
let cssc = window.getComputedStyle(e);
// le quitamos la altura de cabecera-superior
offset -= parseInt(cssc.height) + loopOffsets(offsetArray, e);
} else if (window.innerWidth { logoLink.classList.add(item); });

if(bodyClassList.contains(‘category-corazon’)){
logoOkdScrolled = (null !== nightMode) ? ‘okdiario_sunset_logos_especiales_cabecera.png’:’logos_cabecera_especiales.png’;
backgroundSizePositionAndWidth = ‘width: 116px;background-size: 128px; background-position: center -123px;’;
}else if(bodyClassList.contains(‘category-fichajes’)){
logoOkdScrolled = (null !== nightMode) ? ‘okdiario_sunset_logos_especiales_cabecera.png’:’logos_cabecera_especiales.png’;
backgroundSizePositionAndWidth = ‘width: 116px;background-size: 128px; background-position: center -80px;’;
}else if(bodyClassList.contains(‘tv’)){
logoOkdScrolled = ‘okdiariotv-logo.svg’;
backgroundSizePositionAndWidth = ‘width:90px;background-size: 90px; background-position: center -12px;’;
}else if(bodyClassList.contains(‘happyfm’)){
logoOkdScrolled = (null !== nightMode) ? ‘logo-okd-happyfm-noche.svg’ : ‘logo-okd-happyfm.svg’;
backgroundSizePositionAndWidth = ‘background-size: 128px; background-position: center;’;
} else if (bodyClassList.contains(‘baleares’)) {
logoOkdScrolled = (null !== nightMode) ? ‘logo-baleares-night.svg’ : ‘logo-baleares.svg’;
backgroundSizePositionAndWidth = ‘background-position: center;’;
} else if (bodyClassList.contains(‘aragon’)) {
logoOkdScrolled = (null !== nightMode) ? ‘logos-okd/logo-okaragon-negativo.svg’ : ‘logos-okd/logo-okaragon.svg’;
backgroundSizePositionAndWidth = ‘background-size: auto 28px; background-position: center;’;
} else if (bodyClassList.contains(‘okgreen’) || (bodyClassList.contains(‘okclub’) && bodyClassList.contains(‘okgreen’))) {
logoOkdScrolled = (null !== nightMode) ? ‘okgreen/logo-okgreen-night.png’ : ‘okgreen/logo-okgreen.png’;
backgroundSizePositionAndWidth = ‘background-position: center; background-size: contain;’;
} else if (bodyClassList.contains(‘okclub’)) {
logoOkdScrolled = (null !== nightMode) ? ‘logo-okclub-night.svg’ : ‘logo-okclub.svg’;
backgroundSizePositionAndWidth = ‘background-position: center; background-size: contain;’;
} else if (logo.classList.contains(‘logo-hispanidad’)) {
logoOkdScrolled = (null !== nightMode) ? ‘logo-hispanidad-noche.png’ : ‘logo-hispanidad-dia.png’;
backgroundSizePositionAndWidth = ‘background-position: center; background-size: contain;’;
} else if (bodyClassList.contains(‘salud’)) {
logoOkdScrolled = (null !== nightMode) ? ‘logo-salud.png’ : ‘logo-salud-negro.png’;
backgroundSizePositionAndWidth = ‘background-position: center; background-size: 65%;’;
} else {
logoOkdScrolled = (null !== nightMode) ? ‘logo_okd_azul_night.png’ : ‘logo_okd_azul.png’;
backgroundSizePositionAndWidth = ‘background-size: contain; background-position: center;’;
}
var tickSvg = («» == tickLogoColor(bodyClassList)) ? «» : » url(‘/web/themes/v10/css/_img/»+tickLogoColor(bodyClassList)+»‘),»;
if (logo.classList.contains(‘logo-hispanidad’)){
tickSvg = »;
}
logoLink.style.cssText = «display: block; height: 40px; width: 150px; background-image:»+tickSvg+» url(‘/web/themes/v10/css/_img/»+logoOkdScrolled+»‘);»+backgroundSizePositionAndWidth+» background-repeat: no-repeat;»;

let lastScroll = window.scrollY;
let isScrollingDown = true;
let isScrollingUp = !isScrollingDown;
const cabeceraScrolledHeight = 40;
document.addEventListener(‘scroll’, function(e){
let cabeceraBottom = document.getElementById(‘okd-cabecera’).getBoundingClientRect().bottom;

if (cabeceraBottom = lastScroll;
isScrollingUp = !isScrollingDown;
lastScroll = window.scrollY;
});

}

function logoScrolled(superiorCentroInner, logoLink){
superiorCentroInner.innerHTML = »;
superiorCentroInner.appendChild(logoLink);

}

function logoTop(superiorCentroInner){
superiorCentroInner.innerHTML = ‘El sitio de los inconformistas’;
if (document.body.classList.contains(‘baleares’)) {
superiorCentroInner.innerHTML = ‘Las noticias que los demás no le contarán’;
}
}

function tickLogoColor(bodyClassList){

var tickFile = ‘tick-okd.svg’;

let clases = {
‘con_tick’ :[
‘economia’,
‘deportes’,
‘investigacion’,
‘opinion’,
‘look’,
‘trailer’,
‘sociedad’,
‘category-video’,
‘eurocopa’,
‘andalucia’,
‘okclub’,
‘juegos-olimpicos’,
‘igualdad-deporte’,
‘recetas’,
‘mundial’,
‘loteria-navidad’
],
‘sin_tick’ :[
‘category-corazon’,
‘category-fichajes’,
‘category-tv’,
‘tv’,
‘happyfm’,
‘salud’,
‘okclub’,
‘okgreen’,
‘aragon’
]
};
try {
for(classArray in clases) {
if (‘con_tick’ === classArray) {
let conTick = clases[classArray];
for(clase in conTick){
if(bodyClassList.contains(conTick[clase])){
// igualdad-deporte tiene que llevar el mismo logo y cabecera que deportes,
// así que le cambiamos la clase para el tick y prau
if («igualdad-deporte» == conTick[clase]) {
conTick[clase] = «deportes»;
}
tickFile = ‘tick-okd-‘+conTick[clase] + ‘.svg’;
if(«category-video» == conTick[clase] && (bodyClassList.contains(«archive») || bodyClassList.contains(«single»))){
tickFile = ‘tick-okd-video.svg’;
}
}
}

} else if (‘sin_tick’ === classArray){
let sinTick = clases[classArray];
for(clase in sinTick){
if(bodyClassList.contains(sinTick[clase])){
tickFile = »;
}
}

}
}

} catch (error) {
console.error(‘Error cargando el logo scrolled ‘, error);
}

return tickFile;

}

// Sticky buttons
function stickyButtons(){
var superiorDerecha = document.querySelector(‘.okd-cabecera-superior-derecha’);
var sociosOkClub = document.querySelector(‘.socios-okclub’);

var fecha = document.querySelector(‘.okd-cabecera-superior-derecha-fecha’);
var actualizacion = document.querySelector(‘.okd-cabecera-superior-derecha-actualizacion’);

var fechaClone = fecha.cloneNode(true);
var actualizacionClone = actualizacion.cloneNode(true);

var socios = document.querySelector(‘.alta’);
var donacion = document.querySelector(‘.apoyanos’);

if(null != socios && null != donacion){
var sociosClone = socios.cloneNode(true);
var donacionClone = donacion.cloneNode(true);
let nightMode = document.getElementById(‘night-mode’);

document.addEventListener(‘scroll’, function(e){
var buttonsBottom = sociosOkClub.getBoundingClientRect().bottom;
bottomValue = -35;
if(bottomValue == buttonsBottom){
buttonsScrolled(superiorDerecha, sociosOkClub, sociosClone, donacionClone, fecha, actualizacion);

}else if (bottomValue 767 && !document.querySelector(‘body’).classList.contains(‘okmotor’) && !document.querySelector(‘body’).classList.contains(‘okgreen’)){
stickyLogo();
stickyButtons();
}

function showImages() {
$(‘body:not(.home, .page.economia, .page.deportes) article’).find(‘img’).each(function() {
var imageSrc = «data-mobile»;
if ($(window).width() > 767) {
imageSrc = «data-desktop»;
}
if (this.getAttribute(imageSrc)) {
this.setAttribute(‘src’, this.getAttribute(imageSrc));
}
});
}

function scrollToTop () {
var settings = {
min: 200,
inDelay: 600,
outDelay: 400,
containerID: ‘toTop’,
scrollSpeed: 500,
};
var isHidden = true;
var toTop = $(‘#’ + settings.containerID);
var scrollPos = 0;

toTop.on(‘click’, function(e) {
e.preventDefault();
$(‘html, body’).animate( {scrollTop : 0}, settings.scrollSpeed );

});

$(window).scroll(function() {
var height = $(this).scrollTop();
if($(window).scrollTop() + $(window).height() == $(document).height()) {
toTop.css(«opacity», «1»);
isHidden = false;
} else {
if(height > scrollPos) { //scroll down
toTop.css(«opacity», «0»);
isHidden = true;
} else { //scroll up
if (height > settings.min && isHidden) {
toTop.css(«opacity», «1»);
isHidden = false;
} else if(height 1024 && $(‘.aux-col’).length && isIExplore) {
$(window).scroll(function () {
let banner = $(«#» + id);
let container = $(«#» + id).parent();
let bannerBottom = (banner.offset().top + banner.height());
let containerBottom = (container.offset().top + container.height());
if (banner.height() = containerBottom – 40);
let isInContainerTop = (banner.offset().top >= container.offset().top – 40);
//Cabecera
let okdiarioCabeceraTop = $(«#okd-cabecera»).offset().top;
let okdiarioCabeceraBottom = okdiarioCabeceraTop + $(«#okd-cabecera»).height();
if (okdiarioCabeceraBottom >= container.offset().top – 20 && okdiarioCabeceraTop container.offset().top && banner.css(«position») == «absolute») {
banner.css(«position», «fixed»);
banner.css(«top», «31px»);
banner.css(«padding-top»,»20px»);
}

//Si llega al top del container
if (okdiarioCabeceraBottom 1024 && $(‘.aux-col’).length) {
$(window).scroll(function() {

//let content_coordinates = document.getElementsByClassName(«content»)[0].getBoundingClientRect();
//if ((content_coordinates.bottom – content_coordinates.top) > 2200) {
let screenState = {
cabecera: {
top: $(«#okd-cabecera»).offset().top,
bottom: $(«#okd-cabecera»).offset().top + $(«#okd-cabecera»).height()
},
right: {
top: $(«#»+banner_id).offset().top,
bottom: $(«#»+banner_id).offset().top + $(«#»+banner_id).height()
},
rightAnterior: {
top: 0,
bottom: 0
},
lastNews: {
top: $(last_news).length ? $(last_news).offset().top : 0,
bottom: $(last_news).length ? $(last_news).offset().top + $(last_news).height() : 0,
},
lastNewsAll: {
top: $(last_news_all).length ? $(last_news_all).offset().top : 0,
bottom: $(last_news_all).length ? $(last_news_all).offset().top + $(last_news_all).height() : 0,
},
mostViewedOkgreen: {
top: $(most_viewed_okgreen).length ? $(most_viewed_okgreen).offset().top : 0,
bottom: $(most_viewed_okgreen).length ? $(most_viewed_okgreen).offset().top + $(most_viewed_okgreen).height() : 0,
},
footerPage: {
top: $(«#footerPage»).offset().top
},
adBottom: {
exists: ($(bottom_id).length && $(bottom_id).css(«display») != «nome»),
top: ($(bottom_id).length && $(bottom_id).css(«display») != «nome») ? $(bottom_id).offset().top : 0
},
adBlockHeight: $(«.ad-block:eq(«+ad_block_index+»)»).height(),
prevElementBottom: 0,
bottomElementTop: 0,
status: false,
isInBottom: false,
};

//init rightAnterior values
let adBlockIndexAnterior = ad_block_index – 1;
if(adBlockIndexAnterior != null && adBlockIndexAnterior != ‘undefined’ && adBlockIndexAnterior >= 0 && $(«.ad-block:eq(«+adBlockIndexAnterior+»)»).length){
screenState.rightAnterior.top = $(«.ad-block:eq(«+adBlockIndexAnterior+»)»).offset().top;
screenState.rightAnterior.bottom = screenState.rightAnterior.top + $(«.ad-block:eq(«+adBlockIndexAnterior+»)»).height();
}
//Init espacio disponible entre elemento anterior y bottom
screenState.prevElementBottom = Math.max(screenState.rightAnterior.bottom, screenState.lastNews.bottom, screenState.lastNewsAll.bottom);
screenState.bottomElementTop = screenState.adBottom.exists ? screenState.adBottom.top : screenState.footerPage.top;

//Compruebo que no está en el bottom, para no hacer sticky
screenState.isInBottom = (screenState.adBottom.exists && screenState.right.bottom >= screenState.adBottom.top – 40) ||
(!screenState.adBottom.exists && screenState.right.bottom >= screenState.footerPage.top -40);


//Si no hay espacio suficiente no se hace sticky
if (screenState.adBlockHeight 500 && screenState.bottomElementTop – screenState.prevElementBottom > 750)) {
// Si la cabecera llega a la posición del banner que se va a hacer sticky
if (screenState.cabecera.bottom >= screenState.right.top && screenState.cabecera.top = screenState.adBottom.top – 20) {
screenState.status = ‘AD_BOTTOM_ABSOLUTE’;
$(«.ad-block:eq(«+ad_block_index+»)»).css(«position», «absolute»);
$(«.ad-block:eq(«+ad_block_index+»)»).css(«top», screenState.right.top-(screenState.right.bottom-screenState.adBottom.top+40));
}
} else {
if (screenState.right.bottom >= screenState.footerPage.top -20) {
screenState.status = ‘PAGE_BOTTOM_ABSOLUTE’;
$(«.ad-block:eq(«+ad_block_index+»)»).css(«position», «absolute»);
$(«.ad-block:eq(«+ad_block_index+»)»).css(«top», screenState.right.top – (screenState.right.bottom – screenState.footerPage.top + 40));
}
}


// Si la cabecera deja de estar sobre el right sticky se hace sticky
if (screenState.cabecera.bottom .branded-lotusbc»).length || $(«#branded-container > .branded-jaguarbc»).length || $(«#branded-container > .branded-festinabc»).length;
let intextActive = true;
if (checkBodyClass(‘paged’)) return true;
intext1 = intextActive ? »:»;
var windowWidth = window.innerWidth;
let hasNotNoIntextTag = !document.body.classList.contains(‘tag-no-intext’);
let maxWidth1023 = window.matchMedia(‘(max-width: 1023px)’);
if( $(‘body’).hasClass(‘single’) && $(‘.content-video’).length no_intexts_bc && intextActive) {
$(‘.entry-content h3:eq(1)’).before($(‘

‘));
}
//Banner publi Right2
if ($(‘.entry-content h3:eq(2)’).length) { //Según cómo maqueten los títulos
$(‘.entry-content h3:eq(2)’).before($(‘#adAfterP2’));
}
if ($(‘.entry-content p>span.title2:eq(2)’).length) { //Según cómo maqueten los títulos
$(‘.entry-content p>span.title2:eq(2)’).parent().before($(‘#adAfterP2’));
}
//Banner publi Intext2
if (1 > no_intexts_bc) {
$(‘.entry-content’).append($(‘