2025-01-19 17:35:31 -06:00
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html lang="en">
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="UTF-8">
|
2025-01-19 23:21:32 -06:00
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
2025-01-19 22:37:40 -06:00
|
|
|
|
<title>FumbleAround</title>
|
2025-01-19 17:35:31 -06:00
|
|
|
|
<link rel="stylesheet" href="styles.css">
|
2025-01-19 22:37:40 -06:00
|
|
|
|
<link rel="icon" type="image/png" href="./Assets/smily.png">
|
2025-01-19 23:30:59 -06:00
|
|
|
|
|
|
|
|
|
<!-- PWA Meta Tags -->
|
|
|
|
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
|
|
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
|
|
|
|
<meta name="apple-mobile-web-app-title" content="FumbleAround">
|
|
|
|
|
<meta name="mobile-web-app-capable" content="yes">
|
|
|
|
|
<meta name="theme-color" content="#ffffff">
|
|
|
|
|
<meta name="application-name" content="FumbleAround">
|
|
|
|
|
|
|
|
|
|
<!-- Apple Touch Icons -->
|
|
|
|
|
<link rel="apple-touch-icon" href="./Assets/smily.png">
|
|
|
|
|
<link rel="apple-touch-icon" sizes="152x152" href="./Assets/smily.png">
|
|
|
|
|
<link rel="apple-touch-icon" sizes="180x180" href="./Assets/smily.png">
|
|
|
|
|
<link rel="apple-touch-icon" sizes="167x167" href="./Assets/smily.png">
|
|
|
|
|
|
|
|
|
|
<!-- Web Manifest -->
|
|
|
|
|
<link rel="manifest" href="manifest.json">
|
2025-01-19 17:35:31 -06:00
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
<header>
|
2025-01-19 22:37:40 -06:00
|
|
|
|
<div class="logo">
|
|
|
|
|
<img src="./Assets/smily.png" alt="FumbleAround Logo" class="logo-icon">
|
|
|
|
|
FumbleAround
|
|
|
|
|
</div>
|
2025-01-19 19:30:51 -06:00
|
|
|
|
<div class="header-buttons">
|
2025-01-19 22:37:40 -06:00
|
|
|
|
<div class="social-buttons">
|
|
|
|
|
<button id="donateButton">💝</button>
|
|
|
|
|
<button id="githubButton">
|
|
|
|
|
<svg viewBox="0 0 24 24" width="24" height="24">
|
|
|
|
|
<path fill="currentColor" d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"/>
|
|
|
|
|
</svg>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="app-controls">
|
2025-01-20 01:10:03 -06:00
|
|
|
|
<button id="settingsButton">
|
|
|
|
|
<svg viewBox="0 0 24 24" width="24" height="24">
|
|
|
|
|
<path fill="currentColor" d="M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.07.62-.07.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"/>
|
|
|
|
|
</svg>
|
|
|
|
|
</button>
|
2025-01-19 22:37:40 -06:00
|
|
|
|
<button id="fumbleButton">Fumble!</button>
|
|
|
|
|
</div>
|
2025-01-19 19:30:51 -06:00
|
|
|
|
</div>
|
2025-01-19 17:35:31 -06:00
|
|
|
|
</header>
|
2025-01-19 22:37:40 -06:00
|
|
|
|
|
2025-01-20 01:10:03 -06:00
|
|
|
|
<div id="settingsPanel" class="settings-panel">
|
|
|
|
|
<div class="settings-content">
|
|
|
|
|
<div class="settings-header">
|
|
|
|
|
<h2>Settings</h2>
|
|
|
|
|
<button class="close-settings">×</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="settings-section">
|
|
|
|
|
<h3>Display</h3>
|
|
|
|
|
<div class="setting-item">
|
|
|
|
|
<label>Dark Mode</label>
|
|
|
|
|
<button id="darkModeToggle">🌙</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="settings-section">
|
|
|
|
|
<h3>Actions</h3>
|
|
|
|
|
<div class="setting-item">
|
|
|
|
|
<button id="openInNewWindow" class="settings-button">Open in New Window</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="settings-section">
|
|
|
|
|
<h3>About</h3>
|
|
|
|
|
<div class="setting-item about-section">
|
|
|
|
|
<div class="about-content">
|
|
|
|
|
<div class="about-logo">
|
|
|
|
|
<img src="./Assets/smily.png" alt="FumbleAround Logo">
|
|
|
|
|
<h4>FumbleAround</h4>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="about-text">
|
|
|
|
|
<p>Discover the hidden gems of the internet, powered by Wiby.me's search engine.</p>
|
|
|
|
|
<div class="disclaimer">
|
|
|
|
|
<h5>Disclaimer</h5>
|
|
|
|
|
<p>We are not responsible for the content that appears. Use at your own discretion.</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="tribute">
|
|
|
|
|
<p>A homage to the classic StumbleUpon, reimagined for the modern web.</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-01-19 22:37:40 -06:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2025-01-20 00:46:14 -06:00
|
|
|
|
<div id="warningModal" class="modal warning-modal">
|
|
|
|
|
<div class="modal-content">
|
|
|
|
|
<span class="close-button" style="display: none;">×</span>
|
|
|
|
|
<h2>⚠️ Slow Down!</h2>
|
|
|
|
|
<p>Clicking too quickly may get you flagged as spam by Wiby.me.</p>
|
|
|
|
|
<p>Please wait a moment between fumbles.</p>
|
|
|
|
|
<div id="cooldownTimer" class="cooldown-timer">
|
|
|
|
|
You can close this warning in: <span id="cooldownSeconds">5</span>s
|
|
|
|
|
</div>
|
|
|
|
|
<button id="warningCloseBtn" class="warning-close-btn" disabled>I Understand</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2025-01-19 17:35:31 -06:00
|
|
|
|
<main>
|
2025-01-19 23:21:32 -06:00
|
|
|
|
<iframe
|
|
|
|
|
id="contentFrame"
|
2025-01-20 00:06:14 -06:00
|
|
|
|
src="landing.html"
|
2025-01-19 23:21:32 -06:00
|
|
|
|
title="Content"
|
|
|
|
|
sandbox="allow-scripts allow-same-origin allow-forms allow-popups"
|
|
|
|
|
></iframe>
|
2025-01-19 17:35:31 -06:00
|
|
|
|
</main>
|
|
|
|
|
|
|
|
|
|
<script>
|
2025-01-20 00:46:14 -06:00
|
|
|
|
if (performance.navigation.type === performance.navigation.TYPE_RELOAD) {
|
|
|
|
|
if (sessionStorage.getItem('hasVisited')) {
|
|
|
|
|
window.stop();
|
|
|
|
|
requestAnimationFrame(() => fumble());
|
|
|
|
|
}
|
|
|
|
|
} else if (!sessionStorage.getItem('hasVisited')) {
|
|
|
|
|
sessionStorage.setItem('hasVisited', 'true');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let lastFumbleTime = 0;
|
|
|
|
|
const cooldownPeriod = 5000; // 5 seconds cooldown
|
|
|
|
|
let cooldownTimer = null;
|
2025-01-20 01:10:03 -06:00
|
|
|
|
let currentPageUrl = null; // Add this to store the current URL
|
2025-01-20 00:46:14 -06:00
|
|
|
|
|
2025-01-19 23:21:32 -06:00
|
|
|
|
const fumble = () => {
|
2025-01-20 00:46:14 -06:00
|
|
|
|
const currentTime = Date.now();
|
|
|
|
|
const timeSinceLastFumble = currentTime - lastFumbleTime;
|
|
|
|
|
|
|
|
|
|
if (timeSinceLastFumble < cooldownPeriod) {
|
|
|
|
|
// Show warning modal
|
|
|
|
|
const warningModal = document.getElementById('warningModal');
|
|
|
|
|
const cooldownSeconds = document.getElementById('cooldownSeconds');
|
|
|
|
|
const closeBtn = document.getElementById('warningCloseBtn');
|
|
|
|
|
warningModal.classList.add('show');
|
|
|
|
|
closeBtn.disabled = true;
|
|
|
|
|
|
|
|
|
|
// Update countdown timer
|
|
|
|
|
let remainingTime = 5; // 5 second countdown for closing
|
|
|
|
|
cooldownSeconds.textContent = remainingTime;
|
|
|
|
|
|
|
|
|
|
if (cooldownTimer) clearInterval(cooldownTimer);
|
|
|
|
|
cooldownTimer = setInterval(() => {
|
|
|
|
|
remainingTime--;
|
|
|
|
|
|
|
|
|
|
if (remainingTime <= 0) {
|
|
|
|
|
cooldownSeconds.textContent = '0';
|
|
|
|
|
closeBtn.disabled = false;
|
|
|
|
|
clearInterval(cooldownTimer);
|
|
|
|
|
} else {
|
|
|
|
|
cooldownSeconds.textContent = remainingTime;
|
|
|
|
|
}
|
|
|
|
|
}, 1000);
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lastFumbleTime = currentTime;
|
2025-01-19 17:35:31 -06:00
|
|
|
|
const frame = document.getElementById('contentFrame');
|
|
|
|
|
frame.src = 'https://wiby.me/surprise/';
|
2025-01-19 23:05:49 -06:00
|
|
|
|
|
|
|
|
|
// Wait for the page to load then focus
|
|
|
|
|
frame.onload = () => {
|
2025-01-19 23:21:32 -06:00
|
|
|
|
try {
|
2025-01-20 01:10:03 -06:00
|
|
|
|
// Store the actual URL after redirect
|
|
|
|
|
currentPageUrl = frame.contentWindow.location.href;
|
|
|
|
|
|
2025-01-19 23:21:32 -06:00
|
|
|
|
const title = frame.contentWindow.document.title.toLowerCase();
|
|
|
|
|
if (title.includes('blocked') ||
|
|
|
|
|
title.includes('error') ||
|
|
|
|
|
title.includes('refused') ||
|
|
|
|
|
title.includes('cannot') ||
|
|
|
|
|
title.includes('denied')) {
|
2025-01-20 01:10:03 -06:00
|
|
|
|
currentPageUrl = null; // Reset if we hit an error
|
2025-01-19 23:21:32 -06:00
|
|
|
|
fumble();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
} catch (e) {
|
2025-01-20 01:10:03 -06:00
|
|
|
|
// Can't access due to CORS
|
|
|
|
|
currentPageUrl = null;
|
2025-01-19 23:21:32 -06:00
|
|
|
|
}
|
|
|
|
|
|
2025-01-19 23:05:49 -06:00
|
|
|
|
frame.focus();
|
|
|
|
|
try {
|
|
|
|
|
frame.contentWindow.focus();
|
|
|
|
|
} catch (e) {
|
|
|
|
|
// Ignore cross-origin errors
|
|
|
|
|
}
|
|
|
|
|
};
|
2025-01-19 23:21:32 -06:00
|
|
|
|
|
|
|
|
|
// Handle load errors
|
|
|
|
|
frame.onerror = () => {
|
|
|
|
|
fumble(); // Try again if loading fails
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
document.getElementById('fumbleButton').addEventListener('click', fumble);
|
2025-01-19 19:30:51 -06:00
|
|
|
|
|
|
|
|
|
// Dark mode toggle
|
|
|
|
|
const darkModeToggle = document.getElementById('darkModeToggle');
|
|
|
|
|
const body = document.body;
|
|
|
|
|
|
|
|
|
|
// Check for saved preference
|
|
|
|
|
if (localStorage.getItem('darkMode') === 'true') {
|
|
|
|
|
body.classList.add('dark-mode');
|
|
|
|
|
darkModeToggle.textContent = '☀️';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
darkModeToggle.addEventListener('click', () => {
|
|
|
|
|
body.classList.toggle('dark-mode');
|
|
|
|
|
const isDark = body.classList.contains('dark-mode');
|
|
|
|
|
darkModeToggle.textContent = isDark ? '☀️' : '🌙';
|
|
|
|
|
localStorage.setItem('darkMode', isDark);
|
|
|
|
|
});
|
2025-01-19 22:37:40 -06:00
|
|
|
|
|
|
|
|
|
// Add GitHub button click handler
|
|
|
|
|
document.getElementById('githubButton').addEventListener('click', () => {
|
|
|
|
|
window.open('https://git.mauix.bio/michael/FumbleAround', '_blank');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Add donate button click handler
|
|
|
|
|
document.getElementById('donateButton').addEventListener('click', () => {
|
|
|
|
|
window.open('https://wiby.me/donate/', '_blank');
|
|
|
|
|
});
|
|
|
|
|
|
2025-01-20 01:10:03 -06:00
|
|
|
|
// Add settings button click handler
|
|
|
|
|
const settingsPanel = document.getElementById('settingsPanel');
|
|
|
|
|
const settingsButton = document.getElementById('settingsButton');
|
|
|
|
|
const closeSettings = document.querySelector('.close-settings');
|
|
|
|
|
|
|
|
|
|
settingsButton.addEventListener('click', () => {
|
|
|
|
|
settingsPanel.classList.add('show');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
closeSettings.addEventListener('click', () => {
|
|
|
|
|
settingsPanel.classList.remove('show');
|
2025-01-19 22:37:40 -06:00
|
|
|
|
});
|
|
|
|
|
|
2025-01-20 01:10:03 -06:00
|
|
|
|
// Update the open in new window handler
|
|
|
|
|
document.getElementById('openInNewWindow').addEventListener('click', () => {
|
|
|
|
|
if (currentPageUrl) {
|
|
|
|
|
window.open(currentPageUrl, '_blank');
|
|
|
|
|
settingsPanel.classList.remove('show');
|
|
|
|
|
}
|
2025-01-19 22:37:40 -06:00
|
|
|
|
});
|
|
|
|
|
|
2025-01-20 00:46:14 -06:00
|
|
|
|
// Update warning modal close handler
|
|
|
|
|
const warningModal = document.getElementById('warningModal');
|
|
|
|
|
const warningCloseBtn = document.getElementById('warningCloseBtn');
|
|
|
|
|
|
|
|
|
|
warningCloseBtn.addEventListener('click', () => {
|
|
|
|
|
if (!warningCloseBtn.disabled) {
|
|
|
|
|
warningModal.classList.remove('show');
|
|
|
|
|
if (cooldownTimer) clearInterval(cooldownTimer);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Remove the click-outside-to-close functionality for warning modal
|
2025-01-19 22:37:40 -06:00
|
|
|
|
window.addEventListener('click', (event) => {
|
2025-01-20 01:10:03 -06:00
|
|
|
|
if (event.target === warningModal) { // Only for warning modal
|
|
|
|
|
warningModal.classList.remove('show');
|
2025-01-19 22:37:40 -06:00
|
|
|
|
}
|
|
|
|
|
});
|
2025-01-19 23:45:18 -06:00
|
|
|
|
|
|
|
|
|
// Add shake detection
|
|
|
|
|
let lastX = 0;
|
|
|
|
|
let lastY = 0;
|
|
|
|
|
let lastZ = 0;
|
|
|
|
|
let lastUpdate = 0;
|
|
|
|
|
const shakeThreshold = 15; // Adjust sensitivity
|
|
|
|
|
const shakeTimeout = 1000; // Prevent multiple shakes
|
|
|
|
|
let lastShake = 0;
|
|
|
|
|
|
|
|
|
|
function handleMotion(event) {
|
|
|
|
|
const current = event.accelerationIncludingGravity;
|
|
|
|
|
const currentTime = new Date().getTime();
|
|
|
|
|
const timeDiff = currentTime - lastUpdate;
|
|
|
|
|
|
|
|
|
|
if (timeDiff > 100) {
|
|
|
|
|
const deltaX = Math.abs(current.x - lastX);
|
|
|
|
|
const deltaY = Math.abs(current.y - lastY);
|
|
|
|
|
const deltaZ = Math.abs(current.z - lastZ);
|
|
|
|
|
|
|
|
|
|
if (((deltaX > shakeThreshold && deltaY > shakeThreshold) ||
|
|
|
|
|
(deltaX > shakeThreshold && deltaZ > shakeThreshold) ||
|
|
|
|
|
(deltaY > shakeThreshold && deltaZ > shakeThreshold)) &&
|
|
|
|
|
(currentTime - lastShake > shakeTimeout)) {
|
|
|
|
|
|
|
|
|
|
// Vibrate if available
|
|
|
|
|
if ('vibrate' in navigator) {
|
|
|
|
|
navigator.vibrate(200);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fumble();
|
|
|
|
|
lastShake = currentTime;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lastX = current.x;
|
|
|
|
|
lastY = current.y;
|
|
|
|
|
lastZ = current.z;
|
|
|
|
|
lastUpdate = currentTime;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Request permission and start shake detection on mobile
|
|
|
|
|
function initShakeDetection() {
|
|
|
|
|
if (typeof DeviceMotionEvent.requestPermission === 'function') {
|
|
|
|
|
// iOS 13+ requires permission
|
|
|
|
|
DeviceMotionEvent.requestPermission()
|
|
|
|
|
.then(permissionState => {
|
|
|
|
|
if (permissionState === 'granted') {
|
|
|
|
|
window.addEventListener('devicemotion', handleMotion);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch(console.error);
|
|
|
|
|
} else {
|
|
|
|
|
// Non iOS 13+ devices
|
|
|
|
|
window.addEventListener('devicemotion', handleMotion);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Initialize shake detection when page loads
|
|
|
|
|
if ('DeviceMotionEvent' in window) {
|
|
|
|
|
// Add a button to request permission on iOS
|
|
|
|
|
if (typeof DeviceMotionEvent.requestPermission === 'function') {
|
2025-01-20 01:10:03 -06:00
|
|
|
|
const settingsPanel = document.getElementById('settingsPanel');
|
|
|
|
|
const settingsContent = settingsPanel.querySelector('.settings-content');
|
2025-01-19 23:45:18 -06:00
|
|
|
|
|
|
|
|
|
const permissionButton = document.createElement('button');
|
|
|
|
|
permissionButton.textContent = 'Enable Shake to Fumble';
|
|
|
|
|
permissionButton.className = 'permission-button';
|
|
|
|
|
permissionButton.addEventListener('click', initShakeDetection);
|
|
|
|
|
|
2025-01-20 01:10:03 -06:00
|
|
|
|
settingsContent.appendChild(permissionButton);
|
2025-01-19 23:45:18 -06:00
|
|
|
|
} else {
|
|
|
|
|
// Automatically start for non-iOS devices
|
|
|
|
|
initShakeDetection();
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-01-19 17:35:31 -06:00
|
|
|
|
</script>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|