simoncck commited on
Commit
d44d184
·
verified ·
1 Parent(s): 905cff9

Update browser_automation_ui.html

Browse files
Files changed (1) hide show
  1. browser_automation_ui.html +22 -7
browser_automation_ui.html CHANGED
@@ -41,6 +41,7 @@
41
  .api-section { background:#f8fafc; border:1px solid #e2e8f0; border-radius:12px; overflow:hidden; margin-bottom:40px; }
42
  .api-header { display:flex; align-items:center; gap:10px; padding:18px 24px; background:linear-gradient(135deg,#4f46e5,#7c3aed); color:#fff; }
43
  .api-header i { font-size:20px; }
 
44
  .api-body { padding:24px; }
45
  .form-group { margin-bottom:20px; }
46
  label { display:block; margin-bottom:6px; font-weight:500; }
@@ -50,9 +51,16 @@
50
  .btn { display:inline-flex; align-items:center; gap:6px; padding:12px 24px; border:none; border-radius:8px; font-weight:500; cursor:pointer; transition:.25s; }
51
  .btn-primary { background:linear-gradient(135deg,#4f46e5,#7c3aed); color:#fff; box-shadow:0 4px 12px rgba(79,70,229,.3); }
52
  .btn-primary:hover { transform:translateY(-2px); box-shadow:0 6px 20px rgba(79,70,229,.4); }
 
 
 
 
53
  .response-area { margin-top:20px; background:#1e293b; color:#e2e8f0; font-family:'Source Code Pro',monospace; padding:16px; border-radius:8px; white-space:pre-wrap; max-height:350px; overflow-y:auto; border:1px solid #334155; }
54
  .selector-list { display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
55
  .selector-chip { background:#e0e7ff; color:#3730a3; padding:4px 8px; border-radius:6px; cursor:pointer; font-size:.8rem; }
 
 
 
56
  </style>
57
  </head>
58
  <body>
@@ -99,12 +107,12 @@
99
  <button class="btn btn-primary" onclick="takeScreenshot()"><i class="lucide lucide-camera"></i>Capture</button>
100
  <a id="downloadBtn"
101
  class="btn btn-secondary"
102
- style="display:block;margin-left:8px;"
103
  download="screenshot.png">
104
  <i class="lucide lucide-download"></i>Download
105
  </a>
106
- <div id="shotPreview" style="margin-top:16px;"></div>
107
- <div class="response-area" id="shotResp"></div>
108
  </div>
109
  </section>
110
 
@@ -233,10 +241,17 @@ All endpoints return { ok: true/false, data, error }
233
  async function takeScreenshot () {
234
  const out = await api('/browser/screenshot');
235
  alert("Your message here");
 
 
 
 
236
 
237
  // Separate the big base64 string so we don’t dump it in the response box
238
  const { b64, ...meta } = out;
239
  document.getElementById('shotResp').textContent = JSON.stringify(meta, null, 2);
 
 
 
240
 
241
  if (b64) {
242
  const dataUrl = `data:image/png;base64,${b64}`;
@@ -244,12 +259,12 @@ All endpoints return { ok: true/false, data, error }
244
  // Show thumbnail
245
  document.getElementById('shotPreview').innerHTML =
246
  `<img src="${dataUrl}" style="max-width:100%;border:1px solid #e2e8f0;border-radius:8px;">`;
 
247
 
248
  // Wire up & reveal the download button
249
- const dl = document.getElementById('downloadBtn');
250
- dl.href = dataUrl;
251
- //alert(dataUrl);
252
- dl.style.display = 'inline-flex';
253
  }
254
  }
255
 
 
41
  .api-section { background:#f8fafc; border:1px solid #e2e8f0; border-radius:12px; overflow:hidden; margin-bottom:40px; }
42
  .api-header { display:flex; align-items:center; gap:10px; padding:18px 24px; background:linear-gradient(135deg,#4f46e5,#7c3aed); color:#fff; }
43
  .api-header i { font-size:20px; }
44
+ .api-header h3 {margin: 0;font-size: 18px;font-weight: 600;}
45
  .api-body { padding:24px; }
46
  .form-group { margin-bottom:20px; }
47
  label { display:block; margin-bottom:6px; font-weight:500; }
 
51
  .btn { display:inline-flex; align-items:center; gap:6px; padding:12px 24px; border:none; border-radius:8px; font-weight:500; cursor:pointer; transition:.25s; }
52
  .btn-primary { background:linear-gradient(135deg,#4f46e5,#7c3aed); color:#fff; box-shadow:0 4px 12px rgba(79,70,229,.3); }
53
  .btn-primary:hover { transform:translateY(-2px); box-shadow:0 6px 20px rgba(79,70,229,.4); }
54
+ .btn-secondary {background: #6c757d;color: white;margin-left: 8px;}
55
+ .btn-secondary:hover {background: #545b62;transform: translateY(-1px);}
56
+ .btn i {width: 16px;height: 16px;}
57
+ #shotPreview {margin-top: 16px;min-height: 40px;border: 2px dashed #dee2e6;border-radius: 6px;display: flex;align-items: center;justify-content: center;color: #6c757d;font-style: italic;}
58
  .response-area { margin-top:20px; background:#1e293b; color:#e2e8f0; font-family:'Source Code Pro',monospace; padding:16px; border-radius:8px; white-space:pre-wrap; max-height:350px; overflow-y:auto; border:1px solid #334155; }
59
  .selector-list { display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
60
  .selector-chip { background:#e0e7ff; color:#3730a3; padding:4px 8px; border-radius:6px; cursor:pointer; font-size:.8rem; }
61
+ /* Simulate Lucide icons with simple shapes */
62
+ .lucide-camera::before {content: "📷";font-size: 16px;}
63
+ .lucide-download::before {content: "⬇️";font-size: 14px;}
64
  </style>
65
  </head>
66
  <body>
 
107
  <button class="btn btn-primary" onclick="takeScreenshot()"><i class="lucide lucide-camera"></i>Capture</button>
108
  <a id="downloadBtn"
109
  class="btn btn-secondary"
110
+ style="display:none;margin-left:8px;"
111
  download="screenshot.png">
112
  <i class="lucide lucide-download"></i>Download
113
  </a>
114
+ <div id="shotPreview" style="margin-top:16px;">Screenshot preview will appear here</div>
115
+ <div class="response-area" id="shotResp">Response messages will appear here</div>
116
  </div>
117
  </section>
118
 
 
241
  async function takeScreenshot () {
242
  const out = await api('/browser/screenshot');
243
  alert("Your message here");
244
+
245
+ const preview = document.getElementById('shotPreview');
246
+ const downloadBtn = document.getElementById('downloadBtn');
247
+ const response = document.getElementById('shotResp');
248
 
249
  // Separate the big base64 string so we don’t dump it in the response box
250
  const { b64, ...meta } = out;
251
  document.getElementById('shotResp').textContent = JSON.stringify(meta, null, 2);
252
+
253
+ const dl = document.getElementById('downloadBtn');
254
+ dl.style.display = 'inline-flex';
255
 
256
  if (b64) {
257
  const dataUrl = `data:image/png;base64,${b64}`;
 
259
  // Show thumbnail
260
  document.getElementById('shotPreview').innerHTML =
261
  `<img src="${dataUrl}" style="max-width:100%;border:1px solid #e2e8f0;border-radius:8px;">`;
262
+ //'<div style="padding: 20px; background: #e9ecef; border-radius: 4px; text-align: center;">📸 Screenshot captured!</div>';
263
 
264
  // Wire up & reveal the download button
265
+ //const dl = document.getElementById('downloadBtn');
266
+ //dl.href = dataUrl;
267
+ //dl.style.display = 'inline-flex';
 
268
  }
269
  }
270