Skip to content

Commit

Permalink
Merge pull request #1622 from Nexmo/APIDOC-448_coockies_fix_clearInte…
Browse files Browse the repository at this point in the history
…rval

APIDOC-448: FIX Coockies Banner + setInterval()
  • Loading branch information
marcoranieri authored Sep 20, 2022
2 parents 795d5bf + 86f2b78 commit 42f42a9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions lib/nexmo_developer/app/webpacker/packs/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
});
2 changes: 1 addition & 1 deletion lib/nexmo_developer/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module NexmoDeveloper
VERSION = '0.5.9'.freeze
VERSION = '0.5.10'.freeze
end

0 comments on commit 42f42a9

Please sign in to comment.