var countDownInterval; onetwothree = {}, onetwothree.adStatus = function () { return true; }, onetwothree.adType = function () { return 2; }, onetwothree.getRandom = function (min, max) { return Math.floor(Math.random() * (max - min + 1) + min); }, onetwothree.addTag = function () { switch (onetwothree.adType()) { case 1: var banners = onetwothree.getDataBanners(); var ad_html = '
'; break; case 2: var frames = onetwothree.getDataIframe(); var ad_html = ''; break; default: break; } $("#overlay-goplugin-main").prepend(ad_html); clearInterval(countDownInterval); onetwothree.countDown(25, document.querySelector('#timer-text')); }, onetwothree.getDataBanners = function () { var banners = { images: ["https://img.123data.ru/banner/music.gif"], links: ["https://goo.gl/rdYjWo"] }; var random = onetwothree.getRandom(0, 0); return {image: banners.images[random], link: banners.links[random]}; }, onetwothree.getDataIframe = function () { var frames = [ // base_url + 'assets/invideo.html', '//4dsbanner.net/banner/player/728x90' ]; var random = onetwothree.getRandom(0, frames.length - 1); return frames[random]; }, onetwothree.removeTag = function () { $("#overlay-goplugin").remove(); }, onetwothree.adTime = function () { return {start: 5, end: 25}; }, onetwothree.mobileChecker = function () { if (jQuery.browser.mobile) { return true; } // return true; }, onetwothree.countDown = function (duration, display) { var timer = duration, minutes, seconds; countDownInterval = setInterval(function () { minutes = parseInt(timer / 60, 10); seconds = parseInt(timer % 60, 10); minutes = minutes < 10 ? "0" + minutes : minutes; seconds = seconds < 10 ? "0" + seconds : seconds; display.textContent = 'This will be closed after ' + seconds + ' seconds'; if (--timer < 0) { //onetwothree.btnCloseShow(); onetwothree.removeTag(); } }, 1000); }, onetwothree.btnCloseShow = function () { $("#remove-tag").show(); $("#timer-close").hide(); };