Made changes to spam protection to be less annoying but work well with
spammy behavior. Also added site disclaimer.
This commit is contained in:
parent
d951105497
commit
6418e37d67
2 changed files with 156 additions and 36 deletions
80
index.html
80
index.html
|
@ -207,56 +207,64 @@
|
||||||
<script>
|
<script>
|
||||||
if (performance.navigation.type === performance.navigation.TYPE_RELOAD) {
|
if (performance.navigation.type === performance.navigation.TYPE_RELOAD) {
|
||||||
if (sessionStorage.getItem("hasVisited")) {
|
if (sessionStorage.getItem("hasVisited")) {
|
||||||
window.stop();
|
// Instead of stopping the page load, wait for assets then redirect
|
||||||
requestAnimationFrame(() => fumble());
|
window.addEventListener('load', () => {
|
||||||
|
const frame = document.getElementById("contentFrame");
|
||||||
|
frame.src = "https://wiby.me/surprise/";
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} else if (!sessionStorage.getItem("hasVisited")) {
|
} else if (!sessionStorage.getItem("hasVisited")) {
|
||||||
sessionStorage.setItem("hasVisited", "true");
|
sessionStorage.setItem("hasVisited", "true");
|
||||||
}
|
}
|
||||||
|
|
||||||
let lastFumbleTime = 0;
|
let lastFumbleTime = 0;
|
||||||
const cooldownPeriod = 5000; // Increase to 5 seconds cooldown
|
const warningThreshold = 3; // Trigger warning after 3 rapid fumbles
|
||||||
const warningThreshold = 5; // Increase threshold to 5 quick fumbles before warning
|
const rapidPeriod = 5000; // 5 second window for counting rapid fumbles
|
||||||
let quickFumbleCount = 0;
|
const resetPeriod = 3000; // Reset counter if no rapid fumbles in 3 seconds
|
||||||
|
let fumbleTimes = []; // Track timestamps of recent fumbles
|
||||||
let cooldownTimer = null;
|
let cooldownTimer = null;
|
||||||
|
|
||||||
const fumble = () => {
|
const fumble = () => {
|
||||||
const currentTime = Date.now();
|
const currentTime = Date.now();
|
||||||
const timeSinceLastFumble = currentTime - lastFumbleTime;
|
|
||||||
|
// Add current fumble time and remove old ones (older than 5 seconds)
|
||||||
|
fumbleTimes.push(currentTime);
|
||||||
|
fumbleTimes = fumbleTimes.filter(time => currentTime - time < rapidPeriod);
|
||||||
|
|
||||||
|
// If we have 3 or more fumbles within 5 seconds, show warning
|
||||||
|
if (fumbleTimes.length >= warningThreshold) {
|
||||||
|
// 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;
|
||||||
|
|
||||||
if (timeSinceLastFumble < cooldownPeriod) {
|
// Update countdown timer
|
||||||
quickFumbleCount++;
|
let remainingTime = 5;
|
||||||
if (quickFumbleCount >= warningThreshold) {
|
cooldownSeconds.textContent = remainingTime;
|
||||||
// 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
|
if (cooldownTimer) clearInterval(cooldownTimer);
|
||||||
let remainingTime = 5; // Keep 5 second countdown for closing
|
cooldownTimer = setInterval(() => {
|
||||||
cooldownSeconds.textContent = remainingTime;
|
remainingTime--;
|
||||||
|
|
||||||
if (cooldownTimer) clearInterval(cooldownTimer);
|
if (remainingTime <= 0) {
|
||||||
cooldownTimer = setInterval(() => {
|
cooldownSeconds.textContent = '0';
|
||||||
remainingTime--;
|
closeBtn.disabled = false;
|
||||||
|
clearInterval(cooldownTimer);
|
||||||
|
fumbleTimes = []; // Reset fumble history
|
||||||
|
} else {
|
||||||
|
cooldownSeconds.textContent = remainingTime;
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (remainingTime <= 0) {
|
// If there are 2 fumbles, check if they're more than 3 seconds apart
|
||||||
cooldownSeconds.textContent = '0';
|
if (fumbleTimes.length >= 2) {
|
||||||
closeBtn.disabled = false;
|
const lastTwoInterval = fumbleTimes[fumbleTimes.length - 1] - fumbleTimes[fumbleTimes.length - 2];
|
||||||
clearInterval(cooldownTimer);
|
if (lastTwoInterval > resetPeriod) {
|
||||||
quickFumbleCount = 0; // Reset counter after warning
|
fumbleTimes = [currentTime]; // Reset to just the current fumble
|
||||||
} else {
|
|
||||||
cooldownSeconds.textContent = remainingTime;
|
|
||||||
}
|
|
||||||
}, 1000);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Only reset counter if significant time has passed (10 seconds)
|
|
||||||
if (timeSinceLastFumble > 10000) {
|
|
||||||
quickFumbleCount = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
112
landing.html
112
landing.html
|
@ -58,6 +58,83 @@
|
||||||
margin: 10px 0;
|
margin: 10px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.disclaimer-banner {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 20px;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
background: rgba(255, 69, 0, 0.95);
|
||||||
|
color: white;
|
||||||
|
padding: 15px 25px;
|
||||||
|
border-radius: 12px;
|
||||||
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
||||||
|
max-width: 90%;
|
||||||
|
width: 500px;
|
||||||
|
text-align: center;
|
||||||
|
z-index: 1000;
|
||||||
|
display: none; /* Hidden by default */
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark-mode .disclaimer-banner {
|
||||||
|
background: rgba(255, 107, 74, 0.95);
|
||||||
|
}
|
||||||
|
|
||||||
|
.disclaimer-banner.show {
|
||||||
|
display: block;
|
||||||
|
animation: slideUp 0.3s ease-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.disclaimer-content {
|
||||||
|
margin-bottom: 15px;
|
||||||
|
font-size: 0.9em;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.disclaimer-buttons {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.disclaimer-button {
|
||||||
|
padding: 8px 16px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 6px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-weight: bold;
|
||||||
|
transition: background-color 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.disclaimer-accept {
|
||||||
|
background-color: white;
|
||||||
|
color: #ff4500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.disclaimer-accept:hover {
|
||||||
|
background-color: #f0f0f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.disclaimer-info {
|
||||||
|
background-color: transparent;
|
||||||
|
border: 1px solid white;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.disclaimer-info:hover {
|
||||||
|
background-color: rgba(255, 255, 255, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes slideUp {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translate(-50%, 20px);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translate(-50%, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
body {
|
body {
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
|
@ -79,6 +156,10 @@
|
||||||
p {
|
p {
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.disclaimer-banner {
|
||||||
|
bottom: 80px; /* Adjust for mobile header */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
@ -97,5 +178,36 @@
|
||||||
<p>❓ Check the help section for more information</p>
|
<p>❓ Check the help section for more information</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="disclaimer-banner" id="disclaimerBanner">
|
||||||
|
<div class="disclaimer-content">
|
||||||
|
⚠️ Please Note: Content is randomly pulled from Wiby.me and is not curated by FumbleAround.
|
||||||
|
Some content may be sensitive or intended for mature audiences.
|
||||||
|
For the best experience, use FumbleAround on desktop or in landscape mode, as many indie websites are not optimized for mobile viewing.
|
||||||
|
</div>
|
||||||
|
<div class="disclaimer-buttons">
|
||||||
|
<button class="disclaimer-button disclaimer-accept" id="acceptDisclaimer">I Understand</button>
|
||||||
|
<button class="disclaimer-button disclaimer-info" id="moreInfo">More Info</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Show disclaimer if not previously accepted
|
||||||
|
if (!localStorage.getItem('disclaimerAccepted')) {
|
||||||
|
document.getElementById('disclaimerBanner').classList.add('show');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle disclaimer acceptance
|
||||||
|
document.getElementById('acceptDisclaimer').addEventListener('click', () => {
|
||||||
|
localStorage.setItem('disclaimerAccepted', 'true');
|
||||||
|
document.getElementById('disclaimerBanner').classList.remove('show');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Handle more info button
|
||||||
|
document.getElementById('moreInfo').addEventListener('click', () => {
|
||||||
|
// Open settings panel in main window to show full disclaimer
|
||||||
|
window.parent.document.getElementById('settingsButton').click();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
Reference in a new issue