En directo
Retroceder Avanzar
  • 15:00 Clásicos populares
  • 15:08 Cuídate con Radio 5
  • 15:00 Territorio 9
  • 15:00 Clásicos populares
  • 15:05 Irrepetibles a Ràdio 4
  • 15:04 Hora América
  • Suspilne Ukraine
Emisiones especiales
Retroceder Avanzar
Retroceder Avanzar
Retroceder Avanzar
Retroceder Avanzar
Retroceder Avanzar
`; const adLabel = document.createElement('div'); adLabel.classList.add(this.anchorContainer.id + '_Ad_Label'); adLabel.classList.add(this.anchorContainer.id + '_Ad_Label_Small'); adLabel.innerHTML = 'AD'; brandedTop.appendChild(adLabel); const anchorObserver = new IntersectionObserver((entries, observer) => { entries.forEach((entry) => { if (entry.isIntersecting) { if (entry.target.dataset.mixBrandedViewed === '0') { entry.target.dataset.mixBrandedViewed = '1'; if (adContent.ad_pings && Array.isArray(adContent.ad_pings) && adContent.ad_pings.length > 0) { adContent.ad_pings.forEach((adPing) => { adPing.event = 'print'; adPing.unixtime_td = this.getUtcUnixTime(); adPing.unixtime_utc_td = this.getUtcUnixTime(); this.sendPing('TD', adPing); }); adContent.ad_pings.forEach((adPing) => { adPing.event = 'show'; adPing.unixtime_td = this.getUtcUnixTime(); adPing.unixtime_utc_td = this.getUtcUnixTime(); this.sendPing('TD', adPing); }); } if (adContent.pixel_trackings && Array.isArray(adContent.pixel_trackings) && adContent.pixel_trackings.length > 0) { this.addBrandedTrackings(adContent); } } } }); }, {threshold: [0.6]}); const isMobile = this.isMobile(); anchorItems.forEach((anchorItem, anchorIndex) => { if (isMobile && adContent.top_banner.on_mobile === 'first_item' && anchorIndex > 0) { return; } else if (!isMobile && adContent.top_banner.on_desktop === 'first_item' && anchorIndex > 0) { return; } const brandedTopClone = brandedTop.cloneNode(true); anchorItem.style.position = 'relative'; anchorItem.appendChild(brandedTopClone); anchorObserver.observe(brandedTopClone); document.documentElement.style.setProperty("--MIX-branded-top-banner-height", `${brandedTopClone.offsetHeight}px`); if (anchorIndex === 0) { window.addEventListener('resize', function () { document.documentElement.style.setProperty("--MIX-branded-top-banner-height", `${brandedTopClone.offsetHeight}px`); }); let resizeInterval = null; let resizeIntervalCount = 0; resizeInterval = setInterval(() => { resizeIntervalCount++; if (resizeIntervalCount > 10) { clearInterval(resizeInterval); } window.dispatchEvent(new Event('resize')); }, 500); } const currentLink = anchorItem.querySelector('a[class$="a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_Item_Link"]'); if (currentLink) { currentLink.style.position = 'relative'; currentLink.style.borderTop = 'var(--MIX-branded-top-banner-height) solid transparent'; if (adContent.top_banner.item_url_params) { if (currentLink.href.includes('?')) { currentLink.href += `&${adContent.top_banner.item_url_params}`; } else { currentLink.href += `?${adContent.top_banner.item_url_params}`; } } } if (adContent.ad_pings && Array.isArray(adContent.ad_pings) && adContent.ad_pings.length > 0) { brandedTopClone.addEventListener('click', () => { adContent.ad_pings.forEach((adPing) => { adPing.event = 'click'; adPing.unixtime_td = this.getUtcUnixTime(); adPing.unixtime_utc_td = this.getUtcUnixTime(); this.sendPing('TD', adPing); }); }, { passive: true }); } }); } } checkAnchorTitleVariables(adContent) { if ( adContent.anchor_title.indexOf("{{DATE_COUNTER}}") > 0 && adContent.title_variable_data && adContent.title_variable_data.date && adContent.title_variable_data.endTitle ) { var endtime = adContent.title_variable_data.date; var total = Date.parse(endtime) - Date.parse(new Date()); var seconds = ('0' + (Math.floor((total / 1000) % 60))).slice(-2); var minutes = ('0' + (Math.floor((total / 1000 / 60) % 60))).slice(-2); var hours = ('0' + (Math.floor((total / (1000 * 60 * 60)) % 24))).slice(-2); var days = Math.floor(total / (1000 * 60 * 60 * 24)); var replacement = []; if (total <= 0) { replacement.push(adContent.title_variable_data.endTitle); } else if (days > 0) { replacement.push(days + 'd'); replacement.push(hours + 'h'); } else { replacement.push(hours + 'h'); replacement.push(minutes + 'm'); } adContent.anchor_title = adContent.anchor_title.replace("{{DATE_COUNTER}}", replacement.join(' ')); } return adContent.anchor_title; } addBrandedTrackings(adContent) { adContent.pixel_trackings.forEach((pixelUrl) => { const pixelImage = document.createElement('img'); pixelImage.setAttribute('class', this.anchorContainer.id + '_Branded_Tracking'); pixelImage.setAttribute('height', '1'); pixelImage.setAttribute('width', '1'); pixelImage.setAttribute('border', '0'); pixelImage.setAttribute('style', 'position:fixed!important;width:1px!important;height:1px!important;top:-100px!important;left:-100px!important;'); pixelImage.setAttribute('src', pixelUrl); this.anchorContainer.appendChild(pixelImage); }); } }}if (!window.a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_DocReady) { window.a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_DocReady = (fn) => { if (document.readyState === 'complete' || document.readyState === 'interactive') { setTimeout(fn, 1); } else { document.addEventListener('DOMContentLoaded', fn); } }}a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_DocReady(() => { try { const a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_CONTAINER = document.querySelector('#a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR:not([data-mix-init-data="1"])'); if (a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_CONTAINER) { const MIX_Script = new a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_Script(a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_CONTAINER); MIX_Script.init(); } } catch(e) { console.error('Error D001 - Internal error'); console.error(e); }});if (!window.a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_Videos) { window.a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_Videos = class a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_Videos { constructor(container) { this.anchorContainer = container; this.anchorContainer.dataset.mixInitVideos = '1'; this.anchorLinks = this.anchorContainer.querySelectorAll('.a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_Item_Container'); this.anchorVideos = this.anchorContainer.querySelectorAll('.a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_Item_Video video'); this.anchorVideosDuration = this.anchorContainer.querySelectorAll('.a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_Item_VideoDuration'); this.allVideos = []; this.videosPool = []; this.videoTimer = null; this.eventData = null; } init() { if (this.anchorVideos.length === 0 && this.anchorVideosDuration.length === 0) { return; } const anchorData = JSON.parse(atob(this.anchorContainer.dataset.mixData)); this.eventData = { mixId: anchorData.ping.anchor_id ?? null, eventId: '', origin: window.location.href, userAgent: anchorData.user_agent || (navigator.userAgent ?? '') }; const srcObserver = new IntersectionObserver((entries, observer) => { entries.forEach((entry) => { if (entry.isIntersecting) { if (!entry.target.hasAttribute('src')) { entry.target.addEventListener('loadeddata', () => { this.checkVideosPool(false); }); entry.target.src = entry.target.dataset.mixVideoSrc; } } }); }, {threshold: [0]}); const videosObserver = new IntersectionObserver((entries, observer) => { entries.forEach((entry) => { if (entry.isIntersecting) { if (entry.target === this.allVideos[0]) { this.videosPool.unshift(entry.target); } else { this.videosPool.push(entry.target); } } else { this.videosPool = this.videosPool.filter((item) => item !== entry.target); } this.checkVideosPool(entry.isIntersecting); }); }, {threshold: [1]}); this.anchorLinks.forEach((link, i) => { const video = link.querySelector('video'); if (video) { srcObserver.observe(video); let loopStart = parseInt(video.dataset.mixVideoStart || '0'); const loopDuration = parseInt(video.dataset.mixVideoLoop || '2'); const itemVideoDuration = link.querySelector('.a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_Item_VideoDuration'); video.addEventListener('loadedmetadata', () => { const videoDuration = video.duration; if (!isNaN(videoDuration) && videoDuration !== Infinity) { if (itemVideoDuration) { const minutes = Math.floor(videoDuration / 60); const seconds = Math.floor(videoDuration - (minutes * 60)); itemVideoDuration.innerHTML = `${minutes}:${seconds}`; itemVideoDuration.dataset.mixShow = '1'; } if ((loopStart + loopDuration) > videoDuration) { loopStart = videoDuration - loopDuration - 0.1; if (loopStart <= 0) { loopStart = 0; } video.addEventListener('loadeddata', () => { video.currentTime = loopStart; }); } } }); if (this.isMobile()) { this.allVideos.push(video); videosObserver.observe(video); } else { const parentLink = video.closest('a'); link.addEventListener('mouseenter', () => { if (link.classList.contains('disabled')) { video.pause(); } else { video.currentTime = loopStart; video.play().then(() => { this.videoTimer && clearInterval(this.videoTimer); this.videoTimer = setInterval(() => { video.currentTime = loopStart; }, loopDuration * 1000); parentLink && this.dispatchEvent('onVideoPlay', { ...this.eventData, storyId: parentLink.dataset.mixStoryId ?? '', itemType: parentLink.dataset.mixItemType ?? '', frameUid: parentLink.dataset.mixFrameUid ?? '', article: parentLink.dataset.mixArticle ?? '' }); }).catch(() => { }); } }); link.addEventListener('mouseleave', () => { this.videoTimer && clearInterval(this.videoTimer); video.pause(); video.currentTime = loopStart; }); } } else { const itemVideoDuration = link.querySelector('.a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_Item_VideoDuration'); if (itemVideoDuration && itemVideoDuration.dataset.mixVideoUrl) { const video = document.createElement('video'); video.addEventListener('loadedmetadata', () => { const duration = video.duration; if (!isNaN(duration) && duration !== Infinity) { const minutes = Math.floor(duration / 60); const seconds = Math.floor(duration - (minutes * 60)); itemVideoDuration.innerHTML = `${minutes}:${seconds}`; itemVideoDuration.dataset.mixShow = '1'; } }); video.src = itemVideoDuration.dataset.mixVideoUrl; } } }); } checkVideosPool(sendEvent) { if (this.videosPool.length > 0) { const video = this.videosPool[0]; const parentLink = video.closest('a'); let loopStart = parseInt(video.dataset.mixVideoStart || '0'); const loopDuration = parseInt(video.dataset.mixVideoLoop || '2'); const videoDuration = video.duration; if (!isNaN(videoDuration) && videoDuration !== Infinity) { if ((loopStart + loopDuration) > videoDuration) { loopStart = videoDuration - loopDuration - 0.1; if (loopStart <= 0) { loopStart = 0; } } } video.currentTime = loopStart; video.play().then(() => { this.videoTimer && clearInterval(this.videoTimer); this.videoTimer = setInterval(() => { video.currentTime = loopStart; }, loopDuration * 1000); if (parentLink && (sendEvent || !video.dataset.mixVideoLoaded)) { video.dataset.mixVideoLoaded = '1'; this.dispatchEvent('onVideoPlay', { ...this.eventData, storyId: parentLink.dataset.mixStoryId ?? '', itemType: parentLink.dataset.mixItemType ?? '', frameUid: parentLink.dataset.mixFrameUid ?? '', article: parentLink.dataset.mixArticle ?? '' }); } }).catch(() => { }); this.allVideos.forEach((item) => { if (item !== video) { let loopStart = parseInt(item.dataset.mixVideoStart || '0'); const loopDuration = parseInt(item.dataset.mixVideoLoop || '2'); const videoDuration = item.duration; if (!isNaN(videoDuration) && videoDuration !== Infinity) { if ((loopStart + loopDuration) > videoDuration) { loopStart = videoDuration - loopDuration - 0.1; if (loopStart <= 0) { loopStart = 0; } } } item.pause(); item.currentTime = loopStart; } }); } } isMobile() { return !!(navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/Windows Phone/i)); } dispatchEvent(eventId, eventData) { if (['onVideoPlay'].includes(eventId)) { window.dispatchEvent(new CustomEvent("MIXv2_Event", { detail: {...eventData, eventId: eventId} })); } } }}if (!window.a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_DocReady) { window.a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_DocReady = (fn) => { if (document.readyState === 'complete' || document.readyState === 'interactive') { setTimeout(fn, 1); } else { document.addEventListener('DOMContentLoaded', fn); } }}a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_DocReady(() => { try { const a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_CONTAINER = document.querySelector('#a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR:not([data-mix-init-videos="1"])'); if (a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_CONTAINER) { const MIX_Videos = new a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_Videos(a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_CONTAINER); MIX_Videos.init(); } } catch(e) { console.error('Error V001 - Internal error'); console.error(e); }});if (!window.a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_Slider) { window.a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_Slider = class a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_Slider { constructor(container) { this.anchorContainer = container; this.anchorContainer.dataset.mixInitSlider = '1'; this.anchorId = this.anchorContainer.dataset.mixId; this.anchorTitle = this.anchorContainer.querySelector('.a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_Title_Container'); this.anchorContent = this.anchorContainer.querySelector('.a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_Items_Container'); this.anchorContentInner = this.anchorContainer.querySelector('.a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_Items_Container_Inner'); this.anchorLinks = this.anchorContainer.querySelectorAll('.a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_Items_Container_Inner a'); this.mobile = this.isMobile(); this.dragType = (navigator.maxTouchPoints > 0) ? 'touch' : 'mouse'; this.dragging = false; this.sliderDirection = 0; this.clickPrevented = false; this.itemSize = { width: 0, height: 0, gap: 0 }; this.position = { startX: 0, startY: 0, clientStartX: 0, clientStartY: 0, x: 0, y: 0, clientX: 0, clientY: 0 }; this.reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)'); this.showBtns = this.anchorContainer.dataset.mixShowBtns === '1'; this.showBtnsDevices = this.anchorContainer.dataset.mixShowBtnsDevices || 'desktop'; this.btnsPosition = this.anchorContainer.dataset.mixBtnsPos; this.btnsMove = this.anchorContainer.dataset.mixBtnsMove; if (this.btnsMove !== 'pager') { this.btnsMove = parseInt(this.btnsMove); } this.btnPrev = this.btnNext = null; this.mobileScrollDuration = 800; this.mobileScrollRaf = null; this.mobileScrollTarget = 0; this._onEnd = (ev) => this.dragEnd(ev); this._onMove = (ev) => this.dragAction(ev); } init() { if (this.anchorLinks.length === 0) { return; } if (!this.anchorContentInner) { throw new Error('Error C001 - Anchor container not found'); } if (this.mobile) { this.getItemSize(); this.addCustomEvents(); if (this.showBtns && this.showBtnsOnDevice()) { this.anchorContent.style.overflowX = 'hidden'; this.anchorContentInner.style.width = '100%'; this.anchorContentInner.style.overflowX = 'auto'; this.anchorContentInner.style.overflowY = 'hidden'; this.anchorContentInner.style.scrollbarWidth = 'none'; this.addBtns(); this.updateMobileBtns(); this.anchorContentInner.addEventListener('scroll', () => this.updateMobileBtns(), { passive: true }); this.anchorContentInner.addEventListener('touchstart', () => this.stopMobileScroll(), { passive: true }); window.addEventListener('resize', () => this.updateMobileBtns()); } return; } this.anchorContent.style.overflowX = 'hidden'; this.anchorContentInner.dataset.mixDragType = this.dragType; this.anchorContentInner.style.left = '0px'; this.anchorContent.setAttribute('role', 'group'); this.anchorContent.setAttribute('aria-roledescription', 'carrusel'); this.anchorContent.setAttribute('aria-label', 'Nuestras Stories'); this.initSliderEffect(); this.getItemSize(); this.addEvents(); this.addCustomEvents(); if (this.showBtns && this.showBtnsOnDevice()) { this.addBtns(); } } initSliderEffect() { this.sliderEffect = { slider: this, lastPosition: 0, checkNewAction: true, actions: [], newAction: function (clientX) { if (this.checkNewAction) { this.checkNewAction = false; const newPosition = Math.abs(clientX) - Math.abs(this.lastPosition); this.lastPosition = clientX; this.actions.push(Math.abs(newPosition)); setTimeout(() => { this.checkNewAction = true; }, 20); } }, reset: function() { this.checkNewAction = true; this.actions = []; }, applyEffect: function (clientX) { if (this.actions.length <= 0) { return false; } const effect = (time, percent) => { this.slider.anchorContentInner.style.transition = `${time}s`; let leftMove = this.slider.position.startX + -(this.slider.position.clientStartX - clientX) + percent * (this.slider.sliderDirection < 0 ? -1 : 1); if (leftMove > 0) { leftMove = 0; } if (this.slider.anchorContentInner.parentElement.clientWidth - this.slider.anchorContentInner.clientWidth > leftMove) { leftMove = this.slider.anchorContentInner.parentElement.clientWidth - this.slider.anchorContentInner.clientWidth; } this.slider.anchorContentInner.style.left = `${leftMove}px`; setTimeout(() => { this.slider.anchorContentInner.style.transition = ''; }, (time * 1000) + 100); }; this.newAction(clientX); let tmp = 0; let progressive = 1; let lastOne = this.actions[this.actions.length - 1]; let lastAction = this.actions[this.actions.length - 1] + (this.actions[this.actions.length - 2] / 10); for (let i = this.actions.length - 1; i >= 0 && i > this.actions.length - 5; i--) { tmp += this.actions[i]; if (progressive >= 0 && this.actions[i] > lastOne + 30) { progressive--; } lastOne = this.actions[i]; } if (lastAction > 10 && tmp > 600 && progressive >= 0) { effect(0.5, tmp); } else if (lastAction > 10 && tmp > 300) { effect(0.4, tmp * 0.8); } else if (lastAction > 10 && tmp > 50) { effect(0.5, tmp * 0.6); } } } } addEvents() { this.anchorContentInner.addEventListener('mousedown', (e) => { if (e.button === 0 && this.anchorContentInner.clientWidth > this.anchorContentInner.parentElement.clientWidth) { this.dragStart(e); } }, { passive: true }); this.anchorContentInner.addEventListener('focusin', (e) => { if (this.dragType !== 'mouse') return; this.scrollItemIntoView(e.target); }); window.addEventListener('resize', () => { this.getItemSize(); if (typeof this.sliderEffect === 'undefined' && navigator.maxTouchPoints <= 0) { this.initSliderEffect(); this.dragType = 'mouse'; } else if (this.sliderEffect && navigator.maxTouchPoints > 0) { this.sliderEffect = undefined; this.dragType = 'touch'; } this.anchorContentInner.dataset.mixDragType = this.dragType; }); } addCustomEvents() { window.addEventListener('MIXv2_Event', (event) => { if (event.detail && event.detail.mixId && event.detail.mixId == this.anchorId && event.detail.eventId) { if (['BTN_PREV', 'BTN_NEXT'].includes(event.detail.eventId)) { this.onBtnClick(event.detail.eventId === 'BTN_PREV' ? 'prev' : 'next'); } } }); } addBtns() { let iconSrc = 'https://files.socy.cloud/_20/f/202407/upload/uf_1721812542tkzV0jsHV3RebrDx0IBA1Punyt.svg'; if (this.anchorContainer.dataset.mixBtnsUrl) { iconSrc = decodeURIComponent(this.anchorContainer.dataset.mixBtnsUrl); } let customBtnsHtmlStr = ''; const customBtnsHtml = document.querySelector('.a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_CustomBtnsHTML'); if (customBtnsHtml) { customBtnsHtmlStr = customBtnsHtml.innerHTML; customBtnsHtml.remove(); } let btnsTitleContainer = null; let btnsFooterContainer = null; if (this.btnsPosition === 'title' && this.anchorTitle) { btnsTitleContainer = document.createElement('div'); btnsTitleContainer.classList.add('a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_Btns_Container', 'a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_Btns_Container_Title'); this.anchorTitle.append(btnsTitleContainer); } else if (this.btnsPosition === 'footer') { btnsFooterContainer = document.createElement('div'); btnsFooterContainer.classList.add('a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_Btns_Container', 'a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_Btns_Container_Footer'); this.anchorContainer.append(btnsFooterContainer); } const prevBtn = document.createElement('div'); prevBtn.classList.add('a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_Btn'); prevBtn.classList.add('a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_Btn_Prev'); this.setBtnHide(prevBtn, true); prevBtn.dataset.mixBtnDirection = 'prev'; prevBtn.setAttribute('aria-label', 'Ver contenido previo'); if (customBtnsHtmlStr) { prevBtn.innerHTML = customBtnsHtmlStr; } else { const prevIcon = document.createElement('img'); prevIcon.src = iconSrc; prevIcon.alt = ''; prevIcon.setAttribute('aria-hidden', 'true'); prevIcon.loading = 'lazy'; prevBtn.append(prevIcon); } if (btnsTitleContainer) { btnsTitleContainer.append(prevBtn); } else if (btnsFooterContainer) { btnsFooterContainer.append(prevBtn); } else { this.anchorContent.append(prevBtn); } this.btnPrev = prevBtn; prevBtn.addEventListener('click', (evt) => { evt.cancelable && evt.preventDefault(); evt.stopPropagation(); this.onBtnClick('prev'); }, { passive: false }); const nextBtn = document.createElement('div'); nextBtn.classList.add('a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_Btn'); nextBtn.classList.add('a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_Btn_Next'); nextBtn.dataset.mixBtnDirection = 'next'; nextBtn.setAttribute('aria-label', 'Ver contenido siguiente'); if (customBtnsHtmlStr) { nextBtn.innerHTML = customBtnsHtmlStr; } else { const nextIcon = document.createElement('img'); nextIcon.src = iconSrc; nextIcon.alt = ''; nextIcon.setAttribute('aria-hidden', 'true'); nextIcon.loading = 'lazy'; nextBtn.append(nextIcon); } if (btnsTitleContainer) { btnsTitleContainer.append(nextBtn); } else if (btnsFooterContainer) { btnsFooterContainer.append(nextBtn); } else { this.anchorContent.append(nextBtn); } this.btnNext = nextBtn; nextBtn.addEventListener('click', (evt) => { evt.cancelable && evt.preventDefault(); evt.stopPropagation(); this.onBtnClick('next'); }, { passive: false }); } isMobile() { return !!(navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/Windows Phone/i)); } getItemSize() { if (this.anchorContentInner.children && this.anchorContentInner.children.length > 0) { this.itemSize.width = this.anchorContentInner.children[0].offsetWidth; this.itemSize.height = this.anchorContentInner.children[0].offsetHeight; this.itemSize.gap = parseFloat(window.getComputedStyle(this.anchorContentInner).gap); } } getClientPosition(e, xy) { if (xy === 'x') { return (e.type.includes('touch')) ? e.touches[0].clientX : e.clientX; } else if (xy === 'y') { return (e.type.includes('touch')) ? e.touches[0].clientY : e.clientY; } return false; } showBtnsOnDevice() { if (this.showBtnsDevices === 'all') { return true; } return this.showBtnsDevices === (this.mobile ? 'mobile' : 'desktop'); } onBtnClick(direction) { if (this.mobile) { this.onMobileBtnClick(direction); return; } if (this.anchorContentInner.clientWidth > this.anchorContentInner.parentElement.clientWidth) { this.getItemSize(); const itemWidth = this.itemSize.width + this.itemSize.gap; let moveItems = itemWidth; if (this.btnsMove === 'pager') { moveItems *= this.getVisibleItems(); } else { moveItems *= this.btnsMove; } const maxRight = this.anchorContentInner.offsetWidth - this.anchorContentInner.parentElement.offsetWidth - Math.abs(this.anchorContentInner.offsetLeft); const maxLeft = Math.abs(this.anchorContentInner.offsetLeft); if (direction === 'next' && moveItems >= maxRight) { moveItems = maxRight; this.setBtnHide(this.btnNext, true); this.setBtnHide(this.btnPrev, false); } else if (direction === 'prev' && moveItems >= maxLeft) { moveItems = maxLeft; this.setBtnHide(this.btnPrev, true); this.setBtnHide(this.btnNext, false); } else { this.setBtnHide(this.btnPrev, false); this.setBtnHide(this.btnNext, false); } if (direction === 'next') { moveItems *= -1; } this.anchorContentInner.style.transition = '0.8s'; this.anchorContentInner.style.left = `${this.anchorContentInner.offsetLeft + moveItems}px`; setTimeout(() => { this.anchorContentInner.style.transition = ''; }, 800); } } onMobileBtnClick(direction) { const maxScroll = this.anchorContentInner.scrollWidth - this.anchorContentInner.clientWidth; if (maxScroll <= 0) { return; } this.getItemSize(); const itemWidth = this.itemSize.width + this.itemSize.gap; let moveItems = itemWidth; if (this.btnsMove === 'pager') { moveItems *= Math.max(this.getVisibleItems(), 1); } else { moveItems *= this.btnsMove; } if (direction === 'prev') { moveItems *= -1; } const startLeft = this.anchorContentInner.scrollLeft; const fromLeft = this.mobileScrollRaf ? this.mobileScrollTarget : startLeft; const targetLeft = Math.min(Math.max(fromLeft + moveItems, 0), maxScroll); this.stopMobileScroll(); if (this.reduceMotion.matches) { this.anchorContentInner.scrollLeft = targetLeft; return; } const distance = targetLeft - startLeft; const startTime = performance.now(); this.mobileScrollTarget = targetLeft; const step = (now) => { const progress = Math.min((now - startTime) / this.mobileScrollDuration, 1); const ease = progress < 0.5 ? 2 * progress * progress : 1 - Math.pow(-2 * progress + 2, 2) / 2; this.anchorContentInner.scrollLeft = startLeft + (distance * ease); this.mobileScrollRaf = progress < 1 ? requestAnimationFrame(step) : null; }; this.mobileScrollRaf = requestAnimationFrame(step); } stopMobileScroll() { if (this.mobileScrollRaf) { cancelAnimationFrame(this.mobileScrollRaf); this.mobileScrollRaf = null; } } updateMobileBtns() { const maxScroll = this.anchorContentInner.scrollWidth - this.anchorContentInner.clientWidth; this.setBtnHide(this.btnPrev, this.anchorContentInner.scrollLeft <= 1); this.setBtnHide(this.btnNext, this.anchorContentInner.scrollLeft >= maxScroll - 1); } getVisibleItems() { const itemWidth = this.itemSize.width + this.itemSize.gap; const anchorWidth = this.anchorContentInner.parentElement.offsetWidth + this.itemSize.gap; return Math.floor(anchorWidth / itemWidth); } setBtnHide(btn, hide) { if (!btn) return; btn.classList.toggle('a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_Btn_Hide', hide); btn.toggleAttribute('inert', hide); } scrollItemIntoView(el) { this.anchorContent.scrollLeft = 0; const vRect = this.anchorContent.getBoundingClientRect(); const eRect = el.getBoundingClientRect(); let left = this.anchorContentInner.offsetLeft; const minLeft = this.anchorContent.clientWidth - this.anchorContentInner.clientWidth; if (eRect.left < vRect.left) { left += vRect.left - eRect.left; } else if (eRect.right > vRect.right) { left -= eRect.right - vRect.right; } else { return; } if (left > 0) left = 0; if (left < minLeft) left = minLeft; this.anchorContentInner.style.transition = '0.4s'; this.anchorContentInner.style.left = `${left}px`; setTimeout(() => { this.anchorContentInner.style.transition = ''; }, 500); this.setBtnHide(this.btnPrev, left >= 0); this.setBtnHide(this.btnNext, left <= minLeft); } dragStart(e) { this.mobile = this.isMobile(); if (e.type.includes('touch') || this.mobile) { return false; } this.dragging = true; this.anchorContentInner.style.transition = ''; this.position.startX = this.anchorContentInner.offsetLeft; this.position.startY = this.anchorContentInner.offsetTop; this.position.clientStartX = this.getClientPosition(e, 'x'); this.position.clientStartY = this.getClientPosition(e, 'y'); if (typeof this.sliderEffect !== 'undefined') { this.sliderEffect.reset(); } this.clickPrevented = false; this.anchorContainer.classList.add('a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_Dragging'); this.setBtnHide(this.btnPrev, false); this.setBtnHide(this.btnNext, false); document.addEventListener('mouseup', this._onEnd); document.addEventListener('mouseleave', this._onEnd); document.addEventListener('mousemove', this._onMove); this.anchorContainer.addEventListener('mouseleave', this._onEnd); } dragAction (e) { if (e.type.includes('touch') || this.mobile) { return false; } if (this.dragType === 'mouse') { const clientX = this.getClientPosition(e, 'x'); e.preventDefault(); if (!this.clickPrevented) { this.clickPrevented = true; this.anchorLinks = this.anchorContainer.querySelectorAll('.a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_Items_Container_Inner a'); this.anchorLinks.forEach((anchorLink) => { anchorLink.classList.add('a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_Item_Link_Disabled'); }); } let lastSliderDirection = this.sliderDirection; this.sliderDirection = clientX - this.position.x; if (this.anchorContentInner.parentElement.clientWidth - this.anchorContentInner.clientWidth > this.anchorContentInner.offsetLeft + 30 && this.sliderDirection < 0) { let leftPos = this.position.startX + -(this.position.clientStartX - clientX); this.anchorContentInner.style.left = `${leftPos}px`; if (typeof this.sliderEffect !== 'undefined'){ this.sliderEffect.reset(); } } else if (this.anchorContentInner.offsetLeft >= 30 && this.sliderDirection > 0) { let leftPos = this.position.startX + -(this.position.clientStartX - clientX); this.anchorContentInner.style.left = `${leftPos}px`; if (typeof this.sliderEffect !== 'undefined'){ this.sliderEffect.reset(); } } else { let leftPos = this.position.startX + -(this.position.clientStartX - clientX); this.anchorContentInner.style.left = `${leftPos}px`; if (typeof this.sliderEffect !== 'undefined'){ this.sliderEffect.newAction(clientX); if ((lastSliderDirection < 0 && this.sliderDirection > 0) || (lastSliderDirection > 0 && this.sliderDirection < 0)) { this.sliderEffect.reset(); this.sliderEffect.newAction(clientX); } } } this.position.x = clientX; } } dragEnd (e) { if (e.type.includes('touch') || this.mobile) { return false; } if (!this.dragging) { return false; } this.dragging = false; this.anchorContainer.classList.remove('a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_Dragging'); if (this.anchorContentInner.parentElement.clientWidth - this.anchorContentInner.clientWidth > this.anchorContentInner.offsetLeft) { this.anchorContentInner.style.transition = '0.5s'; this.anchorContentInner.style.left = `${this.anchorContentInner.parentElement.clientWidth - this.anchorContentInner.clientWidth}px`; setTimeout(() => { this.anchorContentInner.style.transition = ''; }, 600); this.setBtnHide(this.btnNext, true); } else if (this.anchorContentInner.offsetLeft >= 30) { this.anchorContentInner.style.transition = '0.5s'; this.anchorContentInner.style.left = '0px'; setTimeout(() => { this.anchorContentInner.style.transition = ''; }, 600); this.setBtnHide(this.btnPrev, true); } else { if (typeof this.sliderEffect !== 'undefined' && !this.reduceMotion.matches) { this.sliderEffect.applyEffect(this.getClientPosition(e, 'x')); } } this.anchorLinks = this.anchorContainer.querySelectorAll('.a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_Items_Container_Inner a'); this.anchorLinks.forEach((anchorLink) => { anchorLink.classList.remove('a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_Item_Link_Disabled'); }); document.removeEventListener('mouseup', this._onEnd); document.removeEventListener('mouseleave', this._onEnd); document.removeEventListener('mousemove', this._onMove); this.anchorContainer.removeEventListener('mouseleave', this._onEnd); } }}if (!window.a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_DocReady) { window.a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_DocReady = (fn) => { if (document.readyState === 'complete' || document.readyState === 'interactive') { setTimeout(fn, 1); } else { document.addEventListener('DOMContentLoaded', fn); } }}a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_DocReady(() => { try { const a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_CONTAINER = document.querySelector('#a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR:not([data-mix-init-slider="1"])'); if (a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_CONTAINER) { const MIX_Slider = new a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_Slider(a45bf138_2c97_4417_aceb_8d4e7efebc83_MIX_ANCHOR_CONTAINER); MIX_Slider.init(); } } catch(e) { console.error('Error S001 - Internal error'); console.error(e); }});
Noticias
Retroceder Avanzar
  • 'Rumis', una sitcom sonora con Carmen Arrufat

    • La ficción aborda el problema de la vivienda o la precariedad laboral con tono de comedia y no falta la crítica social. Cada martes, un nuevo capítulo en RNE Audio.

    + info
Retroceder Avanzar
Retroceder Avanzar
Retroceder Avanzar
Retroceder Avanzar
Retroceder Avanzar
Retroceder Avanzar
Retroceder Avanzar
Retroceder Avanzar
Retroceder Avanzar
Retroceder Avanzar
Retroceder Avanzar
Retroceder Avanzar
Retroceder Avanzar
Retroceder Avanzar