var topTip = '';
var topCheer = '';
var lastFollow = '';
var lastSub = '';
var tipLabel, cheerLabel, tipActionLabel, cheerActionLabel;
window.addEventListener('onWidgetLoad', function (obj) {
let data = obj["detail"]["session"]["data"];
const fieldData = obj["detail"]["fieldData"];
tipLabel = fieldData["labelTip"];
cheerLabel = fieldData["labelCheer"];
tipActionLabel = fieldData["labelTipAction"];
cheerActionLabel = fieldData["labelCheerAction"];
if ( data["tip-monthly-top-donator"] != null ) {
topTip = data["tip-monthly-top-donator"]["name"];
if ( topTip.length > 0 ) {
$('#info-widgets .tips .text').text(topTip);
}
}
if ( data["cheer-monthly-top-donator"] != null ) {
topCheer = data["cheer-monthly-top-donator"]["name"];
if ( topCheer.length > 0 ) {
$('#info-widgets .cheers .text').text(topCheer);
}
}
lastFollow = data["follower-latest"]["name"];
if ( lastFollow.length > 0 ) {
$('#info-widgets .follows .text').text(lastFollow);
}
lastSub = data["subscriber-latest"]["name"];
if ( lastSub.length > 0 ) {
$('#info-widgets .subs .text').text(lastSub);
}
});
window.addEventListener('onSessionUpdate', function (obj) {
const session = obj["detail"]["session"];
if ( data["tip-monthly-top-donator"] != null ) {
topTip = session["tip-monthly-top-donator"]["name"];
if ( topTip.length == 0 ) {
topTip = session["tip-top"]["name"];
}
}
topCheer = session["cheer-monthly-top-donator"]["name"];
});
window.addEventListener('onEventReceived', function (obj) {
const listener = obj.detail.listener;
const event = obj["detail"]["event"];
if ( listener == 'follower-latest' ) {
$('#info-widgets .follows').addClass("active");
$('#info-widgets .follows .text').text(event["name"]);
setTimeout(function(){
$('#info-widgets .follows').removeClass("active");
},10000);
}
if ( listener == 'subscriber-latest' ) {
$('#info-widgets .subs').addClass("active");
$('#info-widgets .subs .text').text(event["name"]);
setTimeout(function(){
$('#info-widgets .subs').removeClass("active");
},10000);
}
if ( listener == 'tip-latest' ) {
$('#info-widgets .tips').addClass("active");
$('#info-widgets .tips .name').text(tipActionLabel);
$('#info-widgets .tips .text').text(event["name"]);
setTimeout(function(){
$('#info-widgets .tips').removeClass("active");
$('#info-widgets .tips .name').text(tipLabel);
$('#info-widgets .tips .text').text(topTip);
},20000);
}
if ( listener == 'cheer-latest' ) {
$('#info-widgets .cheers').addClass("active");
$('#info-widgets .cheers .name').text(cheerActionLabel);
$('#info-widgets .cheers .text').text(event["name"]);
setTimeout(function(){
$('#info-widgets .cheers').removeClass("active");
$('#info-widgets .cheers .name').text(cheerLabel);
$('#info-widgets .cheers .text').text(topCheer);
},20000);
}
});
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.