MediaWiki:Common.js: различия между версиями
Нет описания правки |
улучшенный блок обработки ошибок |
||
| Строка 195: | Строка 195: | ||
} | } | ||
}); | }); | ||
iframe.addEventListener('error', function() { | |||
clearTimeout(loadTimeout); | |||
console.error('Rutube iframe failed to load:', videoId); | |||
if (embed.parentNode && iframe.parentNode === embed) { | |||
const errorMsg = document.createElement('p'); | |||
errorMsg.textContent = 'Не удалось загрузить видео'; | |||
errorMsg.style.padding = '20px'; | |||
errorMsg.style.textAlign = 'center'; | |||
errorMsg.style.color = '#666'; | |||
embed.replaceChild(errorMsg, iframe); | |||
} | |||
}); | |||
while (embed.firstChild) { | while (embed.firstChild) { | ||