summaryrefslogtreecommitdiff
path: root/startpage/startpage.js
diff options
context:
space:
mode:
Diffstat (limited to 'startpage/startpage.js')
-rw-r--r--startpage/startpage.js87
1 files changed, 87 insertions, 0 deletions
diff --git a/startpage/startpage.js b/startpage/startpage.js
new file mode 100644
index 0000000..3fc9701
--- /dev/null
+++ b/startpage/startpage.js
@@ -0,0 +1,87 @@
+(function () {
+ function byId(id) {
+ return document.getElementById(id);
+ }
+
+ function updateClock() {
+ const dateEl = byId('realtime-date');
+ const timeEl = byId('realtime-clock');
+ if (!dateEl || !timeEl) return;
+
+ const now = new Date();
+ const options = { weekday: 'short', year: 'numeric', month: 'short', day: 'numeric' };
+ dateEl.textContent = now.toLocaleDateString(undefined, options).toUpperCase();
+ timeEl.textContent = now.toLocaleTimeString();
+ }
+
+ setInterval(updateClock, 1000);
+ updateClock();
+
+ // Age Verification System
+ let isVerified = false;
+
+ const content = byId('age-restricted-content');
+ const modal = byId('age-verification-modal');
+ const yesBtn = byId('age-verify-yes');
+ const noBtn = byId('age-verify-no');
+
+ function unlockContent() {
+ if (!content) return;
+ content.classList.remove('locked');
+ content.classList.add('unlocked');
+ content.removeEventListener('click', handleContentClick);
+ isVerified = true;
+ localStorage.setItem('ageVerified', 'true');
+ }
+
+ function showAgeModal() {
+ if (!modal) return;
+ modal.classList.remove('hidden');
+ }
+
+ function hideAgeModal() {
+ if (!modal) return;
+ modal.classList.add('hidden');
+ }
+
+ function handleContentClick(e) {
+ if (isVerified) return;
+
+ e.preventDefault();
+ e.stopPropagation();
+ showAgeModal();
+ }
+
+ function confirmAge(isOfAge) {
+ if (!modal) return;
+
+ if (isOfAge) {
+ unlockContent();
+ hideAgeModal();
+ alert('Age verified. You can now access restricted content.');
+ } else {
+ hideAgeModal();
+ window.location.href = 'https://www.google.com';
+ }
+ }
+
+ if (content && modal) {
+ const storedVerification = localStorage.getItem('ageVerified');
+ if (storedVerification === 'true') {
+ unlockContent();
+ } else {
+ showAgeModal();
+ }
+
+ content.addEventListener('click', handleContentClick);
+
+ if (yesBtn) yesBtn.addEventListener('click', function () { confirmAge(true); });
+ if (noBtn) noBtn.addEventListener('click', function () { confirmAge(false); });
+
+ document.addEventListener('keydown', function (e) {
+ if (e.altKey && e.key === 'a') {
+ showAgeModal();
+ }
+ });
+ }
+})();