@@ -127,7 +127,7 @@ function PhpbbWebpush() {
127127 }
128128
129129 // Check if user declined on this browser
130- if ( localStorage . getItem ( 'wpn_popup_declined' ) === 'true' ) {
130+ if ( getDeclined ( ) === 'true' ) {
131131 return ;
132132 }
133133
@@ -169,7 +169,7 @@ function PhpbbWebpush() {
169169 if ( declineBtn ) {
170170 declineBtn . addEventListener ( 'click' , ( ) => {
171171 popup . style . display = 'none' ;
172- localStorage . setItem ( 'wpn_popup_declined' , 'true' ) ;
172+ setDeclined ( ) ;
173173 } ) ;
174174 }
175175 }
@@ -316,7 +316,7 @@ function PhpbbWebpush() {
316316 if ( 'form_tokens' in response ) {
317317 updateFormTokens ( response . form_tokens ) ;
318318 }
319- localStorage . removeItem ( 'wpn_popup_declined' ) ;
319+ resetDeclined ( ) ;
320320 const popup = document . getElementById ( 'wpn_popup_prompt' ) ;
321321 if ( popup ) {
322322 popup . style . display = 'none' ;
@@ -366,6 +366,16 @@ function PhpbbWebpush() {
366366
367367 return outputArray ;
368368 }
369+
370+ function setDeclined ( ) {
371+ localStorage . setItem ( 'wpn_popup_declined' , 'true' ) ;
372+ }
373+ function getDeclined ( ) {
374+ return localStorage . getItem ( 'wpn_popup_declined' ) ;
375+ }
376+ function resetDeclined ( ) {
377+ localStorage . removeItem ( 'wpn_popup_declined' ) ;
378+ }
369379}
370380
371381function domReady ( callBack ) {
0 commit comments