bbc123321 commited on
Commit
40296ec
·
verified ·
1 Parent(s): 6a2da3c

No buttons don't work. No websites load. No settings work. NOTHING WORKS. fix it please.

Browse files
Files changed (3) hide show
  1. index.html +0 -5
  2. script.js +36 -38
  3. style.css +4 -0
index.html CHANGED
@@ -52,11 +52,6 @@
52
  </div>
53
  </div>
54
  </main>
55
-
56
  <script src="script.js"></script>
57
- <script>
58
- feather.replace();
59
- </script>
60
- <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
61
  </body>
62
  </html>
 
52
  </div>
53
  </div>
54
  </main>
 
55
  <script src="script.js"></script>
 
 
 
 
56
  </body>
57
  </html>
script.js CHANGED
@@ -20,35 +20,24 @@ document.addEventListener('DOMContentLoaded', () => {
20
  new URL(url);
21
 
22
  if (useProxy) {
23
- // Use a reliable proxy service (cors-anywhere requires activation)
24
- const proxyUrl = `https://api.allorigins.win/get?url=${encodeURIComponent(url)}`;
25
- fetch(proxyUrl)
26
- .then(response => response.json())
27
- .then(data => {
28
- const proxyDocument = browserFrame.contentDocument || browserFrame.contentWindow.document;
29
- proxyDocument.open();
30
- proxyDocument.write(data.contents);
31
- proxyDocument.close();
32
- document.querySelector('.proxy-indicator').classList.remove('hidden');
33
- })
34
- .catch(error => {
35
- console.error('Proxy error:', error);
36
- browserFrame.src = url; // Fallback to direct load
37
- document.querySelector('.proxy-indicator').classList.add('hidden');
38
- });
39
  } else {
40
  browserFrame.src = url;
41
- document.querySelector('.proxy-indicator').classList.add('hidden');
42
  }
43
 
44
  // Remove loading class when page is loaded
45
  browserFrame.onload = () => {
46
  browserFrame.classList.remove('loading');
47
  };
 
48
  browserFrame.onerror = () => {
49
  browserFrame.classList.remove('loading');
50
  browserFrame.srcdoc = `
51
- <html><body style="color:white;padding:2rem;">
52
  <h1>Failed to load page</h1>
53
  <p>Could not load ${url}</p>
54
  <p>Try enabling proxy or check your connection</p>
@@ -59,7 +48,7 @@ document.addEventListener('DOMContentLoaded', () => {
59
  console.error('URL loading error:', error);
60
  browserFrame.classList.remove('loading');
61
  browserFrame.srcdoc = `
62
- <html><body style="color:white;padding:2rem;">
63
  <h1>Invalid URL</h1>
64
  <p>${url} is not a valid web address</p>
65
  <p>Please enter a complete URL like "https://example.com"</p>
@@ -71,8 +60,20 @@ document.addEventListener('DOMContentLoaded', () => {
71
  proxyForm.addEventListener('proxy-submit', (e) => {
72
  const { url, useProxy } = e.detail;
73
  loadUrl(url, useProxy);
74
- });
75
- // Handle quick link clicks
 
 
 
 
 
 
 
 
 
 
 
 
76
  document.addEventListener('quick-link-click', (e) => {
77
  loadUrl(e.detail.url, e.detail.useProxy);
78
  });
@@ -94,27 +95,24 @@ document.addEventListener('DOMContentLoaded', () => {
94
  }
95
  });
96
  });
97
-
98
  // Clear data functionality
99
- const clearDataButtons = document.querySelectorAll('#clear-data');
100
  clearDataButtons.forEach(button => {
101
  button.addEventListener('click', () => {
102
- try {
103
- // Attempt to clear browser data
104
- if (confirm('Clear all browsing data (cookies, cache, etc.)?')) {
105
- const browserFrame = document.getElementById('browser-frame');
106
- browserFrame.src = 'about:blank';
107
- setTimeout(() => {
108
- loadUrl('https://www.google.com');
109
- alert('Browser data cleared!');
110
- }, 500);
111
- }
112
- } catch (e) {
113
- alert('Could not clear data due to browser restrictions');
114
  }
115
  });
116
  });
117
-
118
- // Initialize feather icons
119
- feather.replace();
 
 
 
120
  });
 
20
  new URL(url);
21
 
22
  if (useProxy) {
23
+ // Use a more reliable proxy service
24
+ const proxyUrl = `https://cors-anywhere.herokuapp.com/${url}`;
25
+ browserFrame.src = proxyUrl;
26
+ document.querySelectorAll('.proxy-indicator').forEach(el => el.classList.remove('hidden'));
 
 
 
 
 
 
 
 
 
 
 
 
27
  } else {
28
  browserFrame.src = url;
29
+ document.querySelectorAll('.proxy-indicator').forEach(el => el.classList.add('hidden'));
30
  }
31
 
32
  // Remove loading class when page is loaded
33
  browserFrame.onload = () => {
34
  browserFrame.classList.remove('loading');
35
  };
36
+
37
  browserFrame.onerror = () => {
38
  browserFrame.classList.remove('loading');
39
  browserFrame.srcdoc = `
40
+ <html><body style="color:white;padding:2rem;background:#111827;">
41
  <h1>Failed to load page</h1>
42
  <p>Could not load ${url}</p>
43
  <p>Try enabling proxy or check your connection</p>
 
48
  console.error('URL loading error:', error);
49
  browserFrame.classList.remove('loading');
50
  browserFrame.srcdoc = `
51
+ <html><body style="color:white;padding:2rem;background:#111827;">
52
  <h1>Invalid URL</h1>
53
  <p>${url} is not a valid web address</p>
54
  <p>Please enter a complete URL like "https://example.com"</p>
 
60
  proxyForm.addEventListener('proxy-submit', (e) => {
61
  const { url, useProxy } = e.detail;
62
  loadUrl(url, useProxy);
63
+ });
64
+
65
+ // Event delegation for dynamically added elements
66
+ document.addEventListener('click', (e) => {
67
+ if (e.target.closest('#toggle-vpn')) {
68
+ const vpnActive = document.querySelector('.proxy-indicator').classList.contains('hidden');
69
+ document.querySelectorAll('.proxy-indicator').forEach(el => {
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
+ // Handle quick link clicks
77
  document.addEventListener('quick-link-click', (e) => {
78
  loadUrl(e.detail.url, e.detail.useProxy);
79
  });
 
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
  });
style.css CHANGED
@@ -6,8 +6,12 @@ body {
6
  #browser-frame.loading {
7
  background: url('https://i.gifer.com/origin/b4/b4d657e7ef262b88eb5f7ac021edda87.gif') center center no-repeat;
8
  background-size: 50px 50px;
 
9
  }
10
 
 
 
 
11
  #browser-frame {
12
  transition: opacity 0.3s ease;
13
  }
 
6
  #browser-frame.loading {
7
  background: url('https://i.gifer.com/origin/b4/b4d657e7ef262b88eb5f7ac021edda87.gif') center center no-repeat;
8
  background-size: 50px 50px;
9
+ min-height: 70vh;
10
  }
11
 
12
+ iframe {
13
+ min-height: 70vh;
14
+ }
15
  #browser-frame {
16
  transition: opacity 0.3s ease;
17
  }