Skip to content

Instantly share code, notes, and snippets.

@wolfcoder
Created June 16, 2021 05:50
Show Gist options
  • Select an option

  • Save wolfcoder/925ea43e31fc6323ea9d8ed1fe9613a2 to your computer and use it in GitHub Desktop.

Select an option

Save wolfcoder/925ea43e31fc6323ea9d8ed1fe9613a2 to your computer and use it in GitHub Desktop.
script js for controling behavior
jQuery(document).ready(function () {
jQuery('#play-ad').click(
function () {
jQuery('#play-ad').remove();
jQuery('#ad-will-end, #skip-ad').show();
let adLimit = 5;
let adDuration = 24;
document.getElementById('wayang-ad').play();
let durationInterval = setInterval(function () {
if (adLimit === 0) {
jQuery('#skip-ad').html('<span class="mr-3">Skip </span><span style="font-size: 1rem"><i class="fa fa-step-forward"></i> </span>').click(function () {
clearInterval(durationInterval);
jQuery('#video-ads-insert').remove();
});
}
if (adDuration === 0) {
jQuery('#video-ads-insert').remove();
clearInterval(durationInterval);
}
jQuery('#counter-limit').text(adLimit)
jQuery('#counter-duration').text(adDuration)
// console.log(adLimit)
adLimit -= 1;
adDuration -= 1;
}, 1000)
durationInterval;
}
)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment