Spaces:
Running
Running
Only Wikipedia is working. The UI is trash. Make it red and black and the main screen is what you search with a tab for configuration. Please fix the proxy and literally everything that is broken.
Browse files- components/navbar.js +71 -94
- components/tabs.js +164 -0
- index.html +30 -41
- script.js +112 -108
components/navbar.js
CHANGED
|
@@ -1,97 +1,74 @@
|
|
|
|
|
| 1 |
class CustomNavbar extends HTMLElement {
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
ProxyPirate
|
| 72 |
-
</a>
|
| 73 |
-
|
| 74 |
-
<div class="nav-items">
|
| 75 |
-
<div class="proxy-indicator hidden">
|
| 76 |
-
<i data-feather="shield" class="proxy-icon"></i>
|
| 77 |
-
Proxy Active
|
| 78 |
-
</div>
|
| 79 |
-
<a href="/" class="nav-link">
|
| 80 |
-
<i data-feather="home" class="mr-2"></i>
|
| 81 |
-
Home
|
| 82 |
-
</a>
|
| 83 |
-
<a href="javascript:void(0)" class="nav-link" id="toggle-vpn">
|
| 84 |
-
<i data-feather="shield" class="mr-2"></i>
|
| 85 |
-
VPN
|
| 86 |
-
</a>
|
| 87 |
-
<a href="javascript:void(0)" class="nav-link" id="clear-cookies">
|
| 88 |
-
<i data-feather="trash-2" class="mr-2"></i>
|
| 89 |
-
Clear Data
|
| 90 |
-
</a>
|
| 91 |
-
</div>
|
| 92 |
-
</div>
|
| 93 |
-
`;
|
| 94 |
-
}
|
| 95 |
}
|
| 96 |
|
| 97 |
-
customElements.define('custom-navbar', CustomNavbar);
|
|
|
|
| 1 |
+
|
| 2 |
class CustomNavbar extends HTMLElement {
|
| 3 |
+
connectedCallback() {
|
| 4 |
+
this.attachShadow({ mode: 'open' });
|
| 5 |
+
this.shadowRoot.innerHTML = `
|
| 6 |
+
<style>
|
| 7 |
+
:host {
|
| 8 |
+
display: block;
|
| 9 |
+
width: 100%;
|
| 10 |
+
background-color: #0F0F0F;
|
| 11 |
+
position: sticky;
|
| 12 |
+
top: 0;
|
| 13 |
+
z-index: 50;
|
| 14 |
+
border-bottom: 1px solid #8B0000;
|
| 15 |
+
}
|
| 16 |
+
.nav-container {
|
| 17 |
+
max-width: 100%;
|
| 18 |
+
margin: 0 auto;
|
| 19 |
+
padding: 1rem;
|
| 20 |
+
display: flex;
|
| 21 |
+
align-items: center;
|
| 22 |
+
justify-content: space-between;
|
| 23 |
+
}
|
| 24 |
+
.logo {
|
| 25 |
+
display: flex;
|
| 26 |
+
align-items: center;
|
| 27 |
+
font-weight: 700;
|
| 28 |
+
font-size: 1.5rem;
|
| 29 |
+
color: #FF0000;
|
| 30 |
+
text-decoration: none;
|
| 31 |
+
}
|
| 32 |
+
.logo-icon {
|
| 33 |
+
margin-right: 0.5rem;
|
| 34 |
+
color: #FF0000;
|
| 35 |
+
}
|
| 36 |
+
.status {
|
| 37 |
+
display: flex;
|
| 38 |
+
align-items: center;
|
| 39 |
+
font-size: 0.875rem;
|
| 40 |
+
}
|
| 41 |
+
.status-item {
|
| 42 |
+
margin-left: 1rem;
|
| 43 |
+
padding: 0.25rem 0.5rem;
|
| 44 |
+
border-radius: 0.25rem;
|
| 45 |
+
background: #1F1F1F;
|
| 46 |
+
color: #FF0000;
|
| 47 |
+
display: flex;
|
| 48 |
+
align-items: center;
|
| 49 |
+
}
|
| 50 |
+
.status-icon {
|
| 51 |
+
margin-right: 0.25rem;
|
| 52 |
+
}
|
| 53 |
+
</style>
|
| 54 |
+
<div class="nav-container">
|
| 55 |
+
<a href="/" class="logo">
|
| 56 |
+
<i data-feather="droplet" class="logo-icon"></i>
|
| 57 |
+
BloodProxy
|
| 58 |
+
</a>
|
| 59 |
+
<div class="status">
|
| 60 |
+
<div class="status-item" id="proxy-status">
|
| 61 |
+
<i data-feather="shield" class="status-icon"></i>
|
| 62 |
+
<span>Proxy: Off</span>
|
| 63 |
+
</div>
|
| 64 |
+
<div class="status-item" id="vpn-status">
|
| 65 |
+
<i data-feather="lock" class="status-icon"></i>
|
| 66 |
+
<span>VPN: Off</span>
|
| 67 |
+
</div>
|
| 68 |
+
</div>
|
| 69 |
+
</div>
|
| 70 |
+
`;
|
| 71 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
}
|
| 73 |
|
| 74 |
+
customElements.define('custom-navbar', CustomNavbar);
|
components/tabs.js
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class CustomTabs extends HTMLElement {
|
| 2 |
+
connectedCallback() {
|
| 3 |
+
this.attachShadow({ mode: 'open' });
|
| 4 |
+
this.shadowRoot.innerHTML = `
|
| 5 |
+
<style>
|
| 6 |
+
:host {
|
| 7 |
+
display: block;
|
| 8 |
+
margin-bottom: 1rem;
|
| 9 |
+
}
|
| 10 |
+
.tabs-container {
|
| 11 |
+
display: flex;
|
| 12 |
+
border-bottom: 2px solid #8B0000;
|
| 13 |
+
}
|
| 14 |
+
.tab {
|
| 15 |
+
padding: 0.75rem 1.5rem;
|
| 16 |
+
background: #0F0F0F;
|
| 17 |
+
color: #7F7F7F;
|
| 18 |
+
border: none;
|
| 19 |
+
border-radius: 0.5rem 0.5rem 0 0;
|
| 20 |
+
margin-right: 0.5rem;
|
| 21 |
+
font-weight: 600;
|
| 22 |
+
cursor: pointer;
|
| 23 |
+
transition: all 0.2s;
|
| 24 |
+
display: flex;
|
| 25 |
+
align-items: center;
|
| 26 |
+
}
|
| 27 |
+
.tab:hover {
|
| 28 |
+
color: #FF0000;
|
| 29 |
+
}
|
| 30 |
+
.tab.active {
|
| 31 |
+
background: #8B0000;
|
| 32 |
+
color: white;
|
| 33 |
+
}
|
| 34 |
+
.tab i {
|
| 35 |
+
margin-right: 0.5rem;
|
| 36 |
+
}
|
| 37 |
+
.tab-close {
|
| 38 |
+
margin-left: 0.5rem;
|
| 39 |
+
width: 16px;
|
| 40 |
+
height: 16px;
|
| 41 |
+
display: flex;
|
| 42 |
+
align-items: center;
|
| 43 |
+
justify-content: center;
|
| 44 |
+
border-radius: 50%;
|
| 45 |
+
opacity: 0.7;
|
| 46 |
+
}
|
| 47 |
+
.tab-close:hover {
|
| 48 |
+
background: rgba(255,255,255,0.2);
|
| 49 |
+
opacity: 1;
|
| 50 |
+
}
|
| 51 |
+
.tab-content {
|
| 52 |
+
display: none;
|
| 53 |
+
padding: 1rem;
|
| 54 |
+
background: #0F0F0F;
|
| 55 |
+
border-radius: 0 0.5rem 0.5rem 0.5rem;
|
| 56 |
+
}
|
| 57 |
+
.tab-content.active {
|
| 58 |
+
display: block;
|
| 59 |
+
}
|
| 60 |
+
</style>
|
| 61 |
+
<div class="tabs-container">
|
| 62 |
+
<button class="tab active" data-tab="browser">
|
| 63 |
+
<i data-feather="compass"></i> Browser
|
| 64 |
+
</button>
|
| 65 |
+
<button class="tab" data-tab="settings">
|
| 66 |
+
<i data-feather="settings"></i> Settings
|
| 67 |
+
</button>
|
| 68 |
+
<button class="tab" data-tab="privacy">
|
| 69 |
+
<i data-feather="shield"></i> Privacy
|
| 70 |
+
</button>
|
| 71 |
+
</div>
|
| 72 |
+
|
| 73 |
+
<div id="browser-content" class="tab-content active">
|
| 74 |
+
<div class="flex mb-4">
|
| 75 |
+
<input
|
| 76 |
+
type="text"
|
| 77 |
+
id="url-input"
|
| 78 |
+
class="flex-1 bg-black border border-blood rounded-l-lg px-4 py-2 text-white focus:outline-none focus:ring-2 focus:ring-blood"
|
| 79 |
+
placeholder="Enter URL (e.g. https://example.com)"
|
| 80 |
+
>
|
| 81 |
+
<button id="go-button" class="bg-blood px-4 py-2 rounded-r-lg font-bold hover:bg-red-800">
|
| 82 |
+
GO
|
| 83 |
+
</button>
|
| 84 |
+
</div>
|
| 85 |
+
</div>
|
| 86 |
+
|
| 87 |
+
<div id="settings-content" class="tab-content">
|
| 88 |
+
<div class="space-y-4">
|
| 89 |
+
<div class="flex items-center">
|
| 90 |
+
<input type="checkbox" id="proxy-toggle" class="rounded bg-black border-blood text-blood">
|
| 91 |
+
<label for="proxy-toggle" class="ml-2">Enable Proxy</label>
|
| 92 |
+
</div>
|
| 93 |
+
<div id="proxy-settings" class="hidden">
|
| 94 |
+
<div class="mb-2">
|
| 95 |
+
<label class="block text-sm mb-1">Proxy Server</label>
|
| 96 |
+
<input type="text" id="proxy-server" class="w-full bg-black border border-blood rounded px-3 py-2 text-white">
|
| 97 |
+
</div>
|
| 98 |
+
</div>
|
| 99 |
+
</div>
|
| 100 |
+
</div>
|
| 101 |
+
|
| 102 |
+
<div id="privacy-content" class="tab-content">
|
| 103 |
+
<div class="space-y-3">
|
| 104 |
+
<button id="clear-data" class="w-full bg-black hover:bg-blood border border-blood rounded px-4 py-2 flex items-center">
|
| 105 |
+
<i data-feather="trash-2" class="mr-2"></i> Clear Browsing Data
|
| 106 |
+
</button>
|
| 107 |
+
<button id="toggle-vpn" class="w-full bg-black hover:bg-blood border border-blood rounded px-4 py-2 flex items-center">
|
| 108 |
+
<i data-feather="lock" class="mr-2"></i> Toggle VPN
|
| 109 |
+
</button>
|
| 110 |
+
</div>
|
| 111 |
+
</div>
|
| 112 |
+
`;
|
| 113 |
+
|
| 114 |
+
// Tab switching
|
| 115 |
+
const tabs = this.shadowRoot.querySelectorAll('.tab');
|
| 116 |
+
const contents = this.shadowRoot.querySelectorAll('.tab-content');
|
| 117 |
+
|
| 118 |
+
tabs.forEach(tab => {
|
| 119 |
+
tab.addEventListener('click', () => {
|
| 120 |
+
tabs.forEach(t => t.classList.remove('active'));
|
| 121 |
+
contents.forEach(c => c.classList.remove('active'));
|
| 122 |
+
|
| 123 |
+
tab.classList.add('active');
|
| 124 |
+
const tabId = tab.getAttribute('data-tab');
|
| 125 |
+
this.shadowRoot.getElementById(`${tabId}-content`).classList.add('active');
|
| 126 |
+
feather.replace();
|
| 127 |
+
});
|
| 128 |
+
});
|
| 129 |
+
|
| 130 |
+
// Proxy toggle
|
| 131 |
+
const proxyToggle = this.shadowRoot.getElementById('proxy-toggle');
|
| 132 |
+
const proxySettings = this.shadowRoot.getElementById('proxy-settings');
|
| 133 |
+
|
| 134 |
+
proxyToggle.addEventListener('change', () => {
|
| 135 |
+
proxySettings.classList.toggle('hidden', !proxyToggle.checked);
|
| 136 |
+
});
|
| 137 |
+
|
| 138 |
+
// URL navigation
|
| 139 |
+
const urlInput = this.shadowRoot.getElementById('url-input');
|
| 140 |
+
const goButton = this.shadowRoot.getElementById('go-button');
|
| 141 |
+
|
| 142 |
+
const handleNavigation = () => {
|
| 143 |
+
const url = urlInput.value.trim();
|
| 144 |
+
const useProxy = proxyToggle.checked;
|
| 145 |
+
|
| 146 |
+
if (url) {
|
| 147 |
+
this.dispatchEvent(new CustomEvent('navigate', {
|
| 148 |
+
detail: { url, useProxy },
|
| 149 |
+
bubbles: true,
|
| 150 |
+
composed: true
|
| 151 |
+
}));
|
| 152 |
+
}
|
| 153 |
+
};
|
| 154 |
+
|
| 155 |
+
goButton.addEventListener('click', handleNavigation);
|
| 156 |
+
urlInput.addEventListener('keypress', (e) => {
|
| 157 |
+
if (e.key === 'Enter') handleNavigation();
|
| 158 |
+
});
|
| 159 |
+
|
| 160 |
+
feather.replace();
|
| 161 |
+
}
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
customElements.define('custom-tabs', CustomTabs);
|
index.html
CHANGED
|
@@ -1,57 +1,46 @@
|
|
|
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
-
<html lang="en"
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
-
<title>
|
| 7 |
<link rel="stylesheet" href="style.css">
|
| 8 |
<script src="https://cdn.tailwindcss.com"></script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 10 |
<script src="https://unpkg.com/feather-icons"></script>
|
| 11 |
<script src="components/navbar.js"></script>
|
| 12 |
-
<script src="components/
|
| 13 |
-
<script src="components/quick-links.js"></script>
|
| 14 |
</head>
|
| 15 |
-
<body class="bg-
|
| 16 |
<custom-navbar></custom-navbar>
|
| 17 |
|
| 18 |
-
<main class="container mx-auto px-4 py-
|
| 19 |
-
<
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
</div>
|
| 29 |
-
|
| 30 |
-
<custom-proxy-form class="mt-6"></custom-proxy-form>
|
| 31 |
-
</div>
|
| 32 |
-
|
| 33 |
-
<div class="lg:col-span-1">
|
| 34 |
-
<custom-quick-links></custom-quick-links>
|
| 35 |
-
|
| 36 |
-
<div class="bg-gray-800 rounded-xl p-6 mt-6">
|
| 37 |
-
<h2 class="text-xl font-bold mb-4 flex items-center">
|
| 38 |
-
<i data-feather="shield" class="mr-2"></i> Privacy Tools
|
| 39 |
-
</h2>
|
| 40 |
-
<div class="space-y-3">
|
| 41 |
-
<a href="javascript:void(0)" class="flex items-center text-blue-400 hover:text-blue-300" id="toggle-vpn">
|
| 42 |
-
<i data-feather="lock" class="mr-2"></i> Toggle VPN
|
| 43 |
-
</a>
|
| 44 |
-
<a href="javascript:void(0)" class="flex items-center text-blue-400 hover:text-blue-300" id="clear-data">
|
| 45 |
-
<i data-feather="eye-off" class="mr-2"></i> Clear Data
|
| 46 |
-
</a>
|
| 47 |
-
<a href="https://privacytests.org" target="_blank" class="flex items-center text-blue-400 hover:text-blue-300">
|
| 48 |
-
<i data-feather="shield" class="mr-2"></i> Privacy Test
|
| 49 |
-
</a>
|
| 50 |
-
</div>
|
| 51 |
-
</div>
|
| 52 |
-
</div>
|
| 53 |
</div>
|
| 54 |
</main>
|
|
|
|
| 55 |
<script src="script.js"></script>
|
| 56 |
</body>
|
| 57 |
-
</html>
|
|
|
|
| 1 |
+
|
| 2 |
<!DOCTYPE html>
|
| 3 |
+
<html lang="en">
|
| 4 |
<head>
|
| 5 |
<meta charset="UTF-8">
|
| 6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
+
<title>BloodProxy Browser 🩸</title>
|
| 8 |
<link rel="stylesheet" href="style.css">
|
| 9 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 10 |
+
<script>
|
| 11 |
+
tailwind.config = {
|
| 12 |
+
theme: {
|
| 13 |
+
extend: {
|
| 14 |
+
colors: {
|
| 15 |
+
blood: '#8B0000',
|
| 16 |
+
dark: '#0F0F0F',
|
| 17 |
+
accent: '#FF0000'
|
| 18 |
+
}
|
| 19 |
+
}
|
| 20 |
+
}
|
| 21 |
+
}
|
| 22 |
+
</script>
|
| 23 |
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 24 |
<script src="https://unpkg.com/feather-icons"></script>
|
| 25 |
<script src="components/navbar.js"></script>
|
| 26 |
+
<script src="components/tabs.js"></script>
|
|
|
|
| 27 |
</head>
|
| 28 |
+
<body class="bg-dark text-white min-h-screen">
|
| 29 |
<custom-navbar></custom-navbar>
|
| 30 |
|
| 31 |
+
<main class="container mx-auto px-4 py-4">
|
| 32 |
+
<custom-tabs></custom-tabs>
|
| 33 |
+
|
| 34 |
+
<div class="bg-black rounded-lg overflow-hidden shadow-lg shadow-blood/50">
|
| 35 |
+
<iframe
|
| 36 |
+
id="browser-frame"
|
| 37 |
+
class="w-full h-[80vh] border-0"
|
| 38 |
+
sandbox="allow-same-origin allow-scripts allow-popups allow-forms"
|
| 39 |
+
allowfullscreen
|
| 40 |
+
></iframe>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
</div>
|
| 42 |
</main>
|
| 43 |
+
|
| 44 |
<script src="script.js"></script>
|
| 45 |
</body>
|
| 46 |
+
</html>
|
script.js
CHANGED
|
@@ -1,118 +1,122 @@
|
|
| 1 |
|
| 2 |
document.addEventListener('DOMContentLoaded', () => {
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
| 8 |
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
} else {
|
| 28 |
-
|
| 29 |
-
document.querySelectorAll('.proxy-indicator').forEach(el => el.classList.add('hidden'));
|
| 30 |
}
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
}
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
}
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
|
|
|
|
|
|
| 67 |
if (e.target.closest('#toggle-vpn')) {
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
vpnActive ? el.classList.remove('hidden') : el.classList.add('hidden');
|
| 71 |
-
el.innerHTML = `<i data-feather="shield" class="proxy-icon"></i> ${vpnActive ? 'VPN Active' : 'Proxy Active'}`;
|
| 72 |
-
});
|
| 73 |
-
feather.replace();
|
| 74 |
}
|
| 75 |
-
});
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
} else {
|
| 94 |
-
indicator.classList.add('hidden');
|
| 95 |
-
}
|
| 96 |
-
});
|
| 97 |
-
});
|
| 98 |
-
// Clear data functionality
|
| 99 |
-
const clearDataButtons = document.querySelectorAll('#clear-data, #clear-cookies');
|
| 100 |
-
clearDataButtons.forEach(button => {
|
| 101 |
-
button.addEventListener('click', () => {
|
| 102 |
-
if (confirm('Clear all browsing data (cookies, cache, etc.)?')) {
|
| 103 |
-
const browserFrame = document.getElementById('browser-frame');
|
| 104 |
-
browserFrame.src = 'about:blank';
|
| 105 |
-
setTimeout(() => {
|
| 106 |
-
loadUrl('https://www.google.com');
|
| 107 |
-
alert('Browser data cleared!');
|
| 108 |
-
}, 500);
|
| 109 |
-
}
|
| 110 |
-
});
|
| 111 |
-
});
|
| 112 |
-
// Initialize feather icons and reload after content changes
|
| 113 |
-
const initFeather = () => {
|
| 114 |
-
feather.replace();
|
| 115 |
-
setTimeout(() => feather.replace(), 500); // Double init to catch dynamic elements
|
| 116 |
-
};
|
| 117 |
-
initFeather();
|
| 118 |
});
|
|
|
|
| 1 |
|
| 2 |
document.addEventListener('DOMContentLoaded', () => {
|
| 3 |
+
const browserFrame = document.getElementById('browser-frame');
|
| 4 |
+
|
| 5 |
+
// Proxy configuration
|
| 6 |
+
let proxyEnabled = false;
|
| 7 |
+
let vpnEnabled = false;
|
| 8 |
+
|
| 9 |
+
// Update status indicators
|
| 10 |
+
function updateStatus() {
|
| 11 |
+
const proxyStatus = document.querySelector('custom-navbar').shadowRoot.getElementById('proxy-status');
|
| 12 |
+
const vpnStatus = document.querySelector('custom-navbar').shadowRoot.getElementById('vpn-status');
|
| 13 |
|
| 14 |
+
proxyStatus.innerHTML = `
|
| 15 |
+
<i data-feather="shield" class="status-icon"></i>
|
| 16 |
+
<span>Proxy: ${proxyEnabled ? 'On' : 'Off'}</span>
|
| 17 |
+
`;
|
| 18 |
|
| 19 |
+
vpnStatus.innerHTML = `
|
| 20 |
+
<i data-feather="lock" class="status-icon"></i>
|
| 21 |
+
<span>VPN: ${vpnEnabled ? 'On' : 'Off'}</span>
|
| 22 |
+
`;
|
| 23 |
+
|
| 24 |
+
feather.replace();
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
// Load URL with error handling
|
| 28 |
+
function loadUrl(url, useProxy = false) {
|
| 29 |
+
try {
|
| 30 |
+
browserFrame.classList.add('loading');
|
| 31 |
+
|
| 32 |
+
// Validate URL
|
| 33 |
+
if (!url.startsWith('http://') && !url.startsWith('https://')) {
|
| 34 |
+
url = 'https://' + url;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
// Create new URL object to validate
|
| 38 |
+
new URL(url);
|
| 39 |
+
|
| 40 |
+
if (useProxy || vpnEnabled) {
|
| 41 |
+
// Use a better proxy solution
|
| 42 |
+
const proxyUrl = `https://api.allorigins.win/get?url=${encodeURIComponent(url)}`;
|
| 43 |
+
|
| 44 |
+
fetch(proxyUrl)
|
| 45 |
+
.then(response => response.json())
|
| 46 |
+
.then(data => {
|
| 47 |
+
if (data.contents) {
|
| 48 |
+
browserFrame.srcdoc = data.contents;
|
| 49 |
+
proxyEnabled = true;
|
| 50 |
} else {
|
| 51 |
+
throw new Error('Proxy request failed');
|
|
|
|
| 52 |
}
|
| 53 |
+
})
|
| 54 |
+
.catch(() => {
|
| 55 |
+
// Fallback to direct if proxy fails
|
| 56 |
+
browserFrame.src = url;
|
| 57 |
+
proxyEnabled = false;
|
| 58 |
+
});
|
| 59 |
+
} else {
|
| 60 |
+
browserFrame.src = url;
|
| 61 |
+
proxyEnabled = false;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
browserFrame.onload = () => {
|
| 65 |
+
browserFrame.classList.remove('loading');
|
| 66 |
+
updateStatus();
|
| 67 |
+
};
|
| 68 |
+
|
| 69 |
+
browserFrame.onerror = () => {
|
| 70 |
+
browserFrame.classList.remove('loading');
|
| 71 |
+
browserFrame.srcdoc = `
|
| 72 |
+
<html><body style="color:white;padding:2rem;background:#0F0F0F;">
|
| 73 |
+
<h1 style="color:#FF0000;">Failed to load page</h1>
|
| 74 |
+
<p>Could not load ${url}</p>
|
| 75 |
+
<p>Try enabling proxy/VPN or check your connection</p>
|
| 76 |
+
</body></html>
|
| 77 |
+
`;
|
| 78 |
+
updateStatus();
|
| 79 |
+
};
|
| 80 |
+
} catch (error) {
|
| 81 |
+
browserFrame.classList.remove('loading');
|
| 82 |
+
browserFrame.srcdoc = `
|
| 83 |
+
<html><body style="color:white;padding:2rem;background:#0F0F0F;">
|
| 84 |
+
<h1 style="color:#FF0000;">Invalid URL</h1>
|
| 85 |
+
<p>${url} is not a valid web address</p>
|
| 86 |
+
<p>Please enter a complete URL like "https://example.com"</p>
|
| 87 |
+
</body></html>
|
| 88 |
+
`;
|
| 89 |
}
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
// Handle navigation from tabs component
|
| 93 |
+
document.addEventListener('navigate', (e) => {
|
| 94 |
+
const { url, useProxy } = e.detail;
|
| 95 |
+
loadUrl(url, useProxy);
|
| 96 |
+
});
|
| 97 |
+
|
| 98 |
+
// Handle toggle VPN
|
| 99 |
+
document.addEventListener('click', (e) => {
|
| 100 |
if (e.target.closest('#toggle-vpn')) {
|
| 101 |
+
vpnEnabled = !vpnEnabled;
|
| 102 |
+
updateStatus();
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
}
|
| 104 |
+
});
|
| 105 |
+
|
| 106 |
+
// Handle clear data
|
| 107 |
+
document.addEventListener('click', (e) => {
|
| 108 |
+
if (e.target.closest('#clear-data')) {
|
| 109 |
+
if (confirm('Clear all browsing data (cookies, cache, etc.)?')) {
|
| 110 |
+
browserFrame.src = 'about:blank';
|
| 111 |
+
setTimeout(() => {
|
| 112 |
+
loadUrl('https://www.google.com');
|
| 113 |
+
}, 500);
|
| 114 |
+
}
|
| 115 |
+
}
|
| 116 |
+
});
|
| 117 |
+
|
| 118 |
+
// Initialize
|
| 119 |
+
loadUrl('https://www.google.com');
|
| 120 |
+
updateStatus();
|
| 121 |
+
feather.replace();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
});
|