Created
June 16, 2021 05:50
-
-
Save wolfcoder/925ea43e31fc6323ea9d8ed1fe9613a2 to your computer and use it in GitHub Desktop.
script js for controling behavior
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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