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>
|
||||
if (performance.navigation.type === performance.navigation.TYPE_RELOAD) {
|
||||
if (sessionStorage.getItem("hasVisited")) {
|
||||
window.stop();
|
||||
requestAnimationFrame(() => fumble());
|
||||
// Instead of stopping the page load, wait for assets then redirect
|
||||
window.addEventListener('load', () => {
|
||||
const frame = document.getElementById("contentFrame");
|
||||
frame.src = "https://wiby.me/surprise/";
|
||||
});
|
||||
}
|
||||
} else if (!sessionStorage.getItem("hasVisited")) {
|
||||
sessionStorage.setItem("hasVisited", "true");
|
||||
}
|
||||
|
||||
let lastFumbleTime = 0;
|
||||
const cooldownPeriod = 5000; // Increase to 5 seconds cooldown
|
||||
const warningThreshold = 5; // Increase threshold to 5 quick fumbles before warning
|
||||
let quickFumbleCount = 0;
|
||||
const warningThreshold = 3; // Trigger warning after 3 rapid fumbles
|
||||
const rapidPeriod = 5000; // 5 second window for counting rapid fumbles
|
||||
const resetPeriod = 3000; // Reset counter if no rapid fumbles in 3 seconds
|
||||
let fumbleTimes = []; // Track timestamps of recent fumbles
|
||||
let cooldownTimer = null;
|
||||
|
||||
const fumble = () => {
|
||||
const currentTime = Date.now();
|
||||
const timeSinceLastFumble = currentTime - lastFumbleTime;
|
||||
|
||||
if (timeSinceLastFumble < cooldownPeriod) {
|
||||
quickFumbleCount++;
|
||||
if (quickFumbleCount >= 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;
|
||||
// Add current fumble time and remove old ones (older than 5 seconds)
|
||||
fumbleTimes.push(currentTime);
|
||||
fumbleTimes = fumbleTimes.filter(time => currentTime - time < rapidPeriod);
|
||||
|
||||
// Update countdown timer
|
||||
let remainingTime = 5; // Keep 5 second countdown for closing
|
||||
cooldownSeconds.textContent = remainingTime;
|
||||
// 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 (cooldownTimer) clearInterval(cooldownTimer);
|
||||
cooldownTimer = setInterval(() => {
|
||||
remainingTime--;
|
||||
// Update countdown timer
|
||||
let remainingTime = 5;
|
||||
cooldownSeconds.textContent = remainingTime;
|
||||
|
||||
if (remainingTime <= 0) {
|
||||
cooldownSeconds.textContent = '0';
|
||||
closeBtn.disabled = false;
|
||||
clearInterval(cooldownTimer);
|
||||
quickFumbleCount = 0; // Reset counter after warning
|
||||
} else {
|
||||
cooldownSeconds.textContent = remainingTime;
|
||||
}
|
||||
}, 1000);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// Only reset counter if significant time has passed (10 seconds)
|
||||
if (timeSinceLastFumble > 10000) {
|
||||
quickFumbleCount = 0;
|
||||
if (cooldownTimer) clearInterval(cooldownTimer);
|
||||
cooldownTimer = setInterval(() => {
|
||||
remainingTime--;
|
||||
|
||||
if (remainingTime <= 0) {
|
||||
cooldownSeconds.textContent = '0';
|
||||
closeBtn.disabled = false;
|
||||
clearInterval(cooldownTimer);
|
||||
fumbleTimes = []; // Reset fumble history
|
||||
} else {
|
||||
cooldownSeconds.textContent = remainingTime;
|
||||
}
|
||||
}, 1000);
|
||||
return;
|
||||
}
|
||||
|
||||
// If there are 2 fumbles, check if they're more than 3 seconds apart
|
||||
if (fumbleTimes.length >= 2) {
|
||||
const lastTwoInterval = fumbleTimes[fumbleTimes.length - 1] - fumbleTimes[fumbleTimes.length - 2];
|
||||
if (lastTwoInterval > resetPeriod) {
|
||||
fumbleTimes = [currentTime]; // Reset to just the current fumble
|
||||
}
|
||||
}
|
||||
|
||||
|
|
112
landing.html
112
landing.html
|
@ -58,6 +58,83 @@
|
|||
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) {
|
||||
body {
|
||||
padding: 15px;
|
||||
|
@ -79,6 +156,10 @@
|
|||
p {
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
.disclaimer-banner {
|
||||
bottom: 80px; /* Adjust for mobile header */
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
@ -97,5 +178,36 @@
|
|||
<p>❓ Check the help section for more information</p>
|
||||
</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>
|
||||
</html>
|
Loading…
Reference in a new issue