Added http only site new tab redirect.
This commit is contained in:
parent
4cd41100fd
commit
652aac0e0e
2 changed files with 91 additions and 10 deletions
53
index.html
53
index.html
|
@ -256,22 +256,55 @@
|
||||||
|
|
||||||
// Wait for the page to load then focus
|
// Wait for the page to load then focus
|
||||||
frame.onload = () => {
|
frame.onload = () => {
|
||||||
// Check if we landed on a blocked/error page
|
|
||||||
try {
|
try {
|
||||||
|
// Check if it's an HTTP URL
|
||||||
|
if (frame.src.startsWith('http:')) {
|
||||||
|
const httpModal = document.createElement('div');
|
||||||
|
httpModal.className = 'modal http-modal show';
|
||||||
|
httpModal.innerHTML = `
|
||||||
|
<div class="modal-content">
|
||||||
|
<h2>⚠️ HTTP Content</h2>
|
||||||
|
<p>This website uses HTTP and cannot be displayed in the frame for security reasons.</p>
|
||||||
|
<div class="http-modal-buttons">
|
||||||
|
<button class="http-open-btn">Open in New Tab</button>
|
||||||
|
<button class="http-skip-btn">Skip This Site</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
document.body.appendChild(httpModal);
|
||||||
|
|
||||||
|
// Handle button clicks
|
||||||
|
httpModal.querySelector('.http-open-btn').addEventListener('click', () => {
|
||||||
|
window.open(frame.src, '_blank');
|
||||||
|
httpModal.remove();
|
||||||
|
fumble(); // Load next site
|
||||||
|
});
|
||||||
|
|
||||||
|
httpModal.querySelector('.http-skip-btn').addEventListener('click', () => {
|
||||||
|
httpModal.remove();
|
||||||
|
fumble(); // Skip to next site
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rest of existing onload code...
|
||||||
const title = frame.contentWindow.document.title.toLowerCase();
|
const title = frame.contentWindow.document.title.toLowerCase();
|
||||||
if (
|
if (
|
||||||
title.includes("blocked") ||
|
title.includes("blocked") ||
|
||||||
title.includes("error") ||
|
title.includes("error") ||
|
||||||
title.includes("refused") ||
|
title.includes("refused") ||
|
||||||
title.includes("cannot") ||
|
title.includes("cannot") ||
|
||||||
title.includes("denied")
|
title.includes("denied")
|
||||||
) {
|
) {
|
||||||
// Try again if we hit an error page
|
fumble();
|
||||||
fumble();
|
return;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// Can't access title due to CORS - assume page is OK
|
// Can't access title due to CORS - check if it's HTTP
|
||||||
|
if (frame.src.startsWith('http:')) {
|
||||||
|
fumble(); // Skip HTTP sites that we can't access
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
frame.focus();
|
frame.focus();
|
||||||
|
|
48
styles.css
48
styles.css
|
@ -909,4 +909,52 @@ main:hover .floating-button {
|
||||||
|
|
||||||
.full-license a:hover {
|
.full-license a:hover {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.http-modal .modal-content {
|
||||||
|
max-width: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.http-modal-buttons {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.http-open-btn, .http-skip-btn {
|
||||||
|
flex: 1;
|
||||||
|
padding: 12px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: bold;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background-color 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.http-open-btn {
|
||||||
|
background-color: #ff4500;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark-mode .http-open-btn {
|
||||||
|
background-color: #ff6b4a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.http-open-btn:hover {
|
||||||
|
background-color: #ff5722;
|
||||||
|
}
|
||||||
|
|
||||||
|
.http-skip-btn {
|
||||||
|
background-color: #f0f0f0;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark-mode .http-skip-btn {
|
||||||
|
background-color: #2a2a2a;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.http-skip-btn:hover {
|
||||||
|
background-color: #e0e0e0;
|
||||||
}
|
}
|
Loading…
Reference in a new issue