-
Notifications
You must be signed in to change notification settings - Fork 0
/
carrd-fallbacklogic.html
28 lines (24 loc) · 1.1 KB
/
carrd-fallbacklogic.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<!-- No longer used -->
<script>
document.addEventListener('DOMContentLoaded', function () {
var streamplayer = document.getElementById('streamplayer');
var streamdiv = document.getElementById('streamdiv');
var recentlyplayeddiv = document.getElementById('recentlyplayeddiv');
// var fallbackContent = document.getElementById('fallbackContent');
var loadTimeout;
// Add a load event listener to the iframe
streamplayer.addEventListener('load', function () {
// Clear the timeout if the iframe loads before 4 seconds
clearTimeout(loadTimeout);
});
// Set a timeout to check if the iframe has loaded within 4 seconds
loadTimeout = setTimeout(function () {
// Check if the body of the iframe is empty after 4 seconds
if (streamplayer.contentDocument.body.children.length === 0) {
// fallbackContent.style.display = 'block';
streamdiv.style.display = 'none';
recentlyplayeddiv.style.display = 'none';
}
}, 4000);
});
</script>