Enhance privacy notice functionality in index.html
- Updated the privacy notice button to use an ID for easier event handling. - Added an event listener to the button to manage the display of the notice and store user consent in localStorage.
This commit is contained in:
@@ -64,9 +64,16 @@
|
|||||||
notice.innerHTML = `
|
notice.innerHTML = `
|
||||||
<div style="margin-bottom: 6px; font-weight: 600; color: #fff; font-size: 1rem;">Analytics Notice</div>
|
<div style="margin-bottom: 6px; font-weight: 600; color: #fff; font-size: 1rem;">Analytics Notice</div>
|
||||||
<div style="margin-bottom: 8px; color: #f5f5f5;">This app uses Google Analytics for anonymous usage stats. No personal data is tracked.</div>
|
<div style="margin-bottom: 8px; color: #f5f5f5;">This app uses Google Analytics for anonymous usage stats. No personal data is tracked.</div>
|
||||||
<button onclick="this.parentElement.parentElement.remove(); localStorage.setItem('privacyNoticeShown', 'true');" style="padding: 5px 14px; background: #1890ff; color: white; border: none; border-radius: 3px; cursor: pointer; font-size: 0.95rem;">Got it</button>
|
<button id="analytics-notice-btn" style="padding: 5px 14px; background: #1890ff; color: white; border: none; border-radius: 3px; cursor: pointer; font-size: 0.95rem;">Got it</button>
|
||||||
`;
|
`;
|
||||||
document.body.appendChild(notice);
|
document.body.appendChild(notice);
|
||||||
|
// Add event listener to button
|
||||||
|
const btn = notice.querySelector('#analytics-notice-btn');
|
||||||
|
btn.addEventListener('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
localStorage.setItem('privacyNoticeShown', 'true');
|
||||||
|
notice.remove();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait for DOM to be ready
|
// Wait for DOM to be ready
|
||||||
|
|||||||
Reference in New Issue
Block a user