From 86f2b78d3ae93288edffca0dc6777955d2133c17 Mon Sep 17 00:00:00 2001 From: marco ranieri Date: Tue, 20 Sep 2022 17:22:14 +0200 Subject: [PATCH] APIDOC-448: FIX Coockies Banner + setInterval() --- lib/nexmo_developer/app/webpacker/packs/application.js | 10 ++++++++-- lib/nexmo_developer/version.rb | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/nexmo_developer/app/webpacker/packs/application.js b/lib/nexmo_developer/app/webpacker/packs/application.js index 00e91a48e..f16b036a1 100644 --- a/lib/nexmo_developer/app/webpacker/packs/application.js +++ b/lib/nexmo_developer/app/webpacker/packs/application.js @@ -165,17 +165,23 @@ $(document).ready(function() { // Manually close Coockies banner in Chrome 1 - 79 if (!!window.chrome && (!!window.chrome.webstore || !!window.chrome.runtime)) { - setTimeout(function() { + let checkCoockiesBanner = setInterval(function() { const coockiesBanner = document.querySelector('.optanon-alert-box-wrapper') if (coockiesBanner) { if (sessionStorage.getItem('coockiesBanner') === 'clicked') { coockiesBanner.style.display = 'none' + clearInterval(checkCoockiesBanner) + checkCoockiesBanner = 0 } const buttons = coockiesBanner.querySelectorAll('button') buttons.forEach((button) => { button.addEventListener('click', () => sessionStorage.setItem('coockiesBanner', 'clicked')) }) } - }, 100) + }, 50) + + setTimeout(() => { + clearInterval(checkCoockiesBanner) + }, 8000) } }); diff --git a/lib/nexmo_developer/version.rb b/lib/nexmo_developer/version.rb index 51f52bfd5..0c0d87272 100644 --- a/lib/nexmo_developer/version.rb +++ b/lib/nexmo_developer/version.rb @@ -1,3 +1,3 @@ module NexmoDeveloper - VERSION = '0.5.9'.freeze + VERSION = '0.5.10'.freeze end