Many thanks for your effort! Unfortunately it still doesn’t work. The online status aren’t even displayed when im offline, although I copied the whole text from your code inside the “script” area as following.
<script>
fetch(
'https://api.twitch.tv/helix/streams?user_login='+nickname,
{
headers: {
'client-id': 'ls2awgx5gfg9m1q6iopdqb1b7d0y6a'
}
}
)
.then(resp => { return resp.json() })
.then(resp => {
if (resp.data && resp.data[0] {
// show if offline (unless 'Hide when not streaming' option enabled)
<?php if( get_theme_mod('sst_offline_hide') != '') { ?><?php } else { ?>jQuery('.sst-main-wrapper, .sst-main-widget-wrapper').addClass('sst-main-wrapper-active');<?php } ?>
// animations
jQuery('.sst-status-text-offline').addClass('sst-current-status');
setTimeout(function() {
jQuery('.sst-status-text-offline').addClass('sst-current-status-active');
jQuery('.sst-status-wrapper').addClass('sst-status-wrapper-active');
}, 25);
} else {
// show if online
jQuery('.sst-main-wrapper, .sst-main-widget-wrapper').addClass('sst-main-wrapper-active');
// animations
jQuery('.sst-status-text-live').addClass('sst-current-status');
setTimeout(function() {
jQuery('.sst-status-text-live').addClass('sst-current-status-active');
jQuery('.sst-status-wrapper').addClass('sst-status-wrapper-active');
}, 25);
}
})
.catch(err => { console.log(err) });
</script>
I just wonder that the first lines of the original code:
jQuery('.sst-twitch').each(function () {
var nickname = jQuery(this).data('nickname');
jQuery.getJSON
are not considered in your changes. Did you forgot this lines? I even try to re-add them before your new code but it still don’t work. 