Update index.html
Browse files- index.html +37 -40
index.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
| 6 |
<title>Pro Video Prompt Workspace</title>
|
| 7 |
<!-- Tailwind CSS -->
|
| 8 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 9 |
-
<!-- Lucide Icons
|
| 10 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/lucide/0.460.0/umd/lucide.min.js"></script>
|
| 11 |
<style>
|
| 12 |
/* Forces Android Webviews to allow long-press context menus */
|
|
@@ -136,7 +136,7 @@
|
|
| 136 |
<h3 class="font-bold text-white flex items-center gap-2">
|
| 137 |
<i data-lucide="download-cloud" class="w-5 h-5 text-blue-400"></i> Export Hub
|
| 138 |
</h3>
|
| 139 |
-
<button
|
| 140 |
<i data-lucide="x" class="w-5 h-5"></i>
|
| 141 |
</button>
|
| 142 |
</div>
|
|
@@ -149,13 +149,13 @@
|
|
| 149 |
</div>
|
| 150 |
|
| 151 |
<div class="space-y-3">
|
| 152 |
-
<button
|
| 153 |
<i data-lucide="clipboard-copy" class="w-4 h-4"></i> Copy Image to Clipboard
|
| 154 |
</button>
|
| 155 |
-
<button
|
| 156 |
<i data-lucide="share-2" class="w-4 h-4"></i> Force Native Share
|
| 157 |
</button>
|
| 158 |
-
<button
|
| 159 |
<i data-lucide="download-cloud" class="w-4 h-4"></i> Fallback Download
|
| 160 |
</button>
|
| 161 |
</div>
|
|
@@ -166,7 +166,6 @@
|
|
| 166 |
|
| 167 |
<!-- Application Logic -->
|
| 168 |
<script>
|
| 169 |
-
// Attach to window globally to ensure all mobile browsers can execute the inline onclick handlers perfectly
|
| 170 |
window.App = {
|
| 171 |
state: {
|
| 172 |
concept: '',
|
|
@@ -181,7 +180,6 @@
|
|
| 181 |
exportData: null
|
| 182 |
},
|
| 183 |
|
| 184 |
-
// Safe icon renderer to prevent crashes if CDN is blocked
|
| 185 |
refreshIcons() {
|
| 186 |
if (typeof lucide !== 'undefined') {
|
| 187 |
try { lucide.createIcons(); } catch (e) { console.warn("Icon render skipped"); }
|
|
@@ -199,6 +197,37 @@
|
|
| 199 |
document.getElementById('negativeTags').addEventListener('input', (e) => { this.state.negativeTags = e.target.value; this.renderSegments(); });
|
| 200 |
document.getElementById('customApiKey').addEventListener('input', (e) => { this.state.customApiKey = e.target.value; });
|
| 201 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 202 |
this.renderSegments();
|
| 203 |
},
|
| 204 |
|
|
@@ -296,36 +325,4 @@
|
|
| 296 |
}
|
| 297 |
},
|
| 298 |
|
| 299 |
-
|
| 300 |
-
const key = `${segmentNum}-${type}`;
|
| 301 |
-
this.state.images[key] = { status, data, errorMsg };
|
| 302 |
-
|
| 303 |
-
const boxContainer = document.getElementById(`img-box-${segmentNum}-${type.replace(/\s+/g, '-')}`);
|
| 304 |
-
if (boxContainer) {
|
| 305 |
-
boxContainer.innerHTML = this.getImageBoxInnerHtml(segmentNum, type);
|
| 306 |
-
this.refreshIcons();
|
| 307 |
-
}
|
| 308 |
-
},
|
| 309 |
-
|
| 310 |
-
openExportModal(base64Data, segmentNum, type) {
|
| 311 |
-
this.state.exportData = { base64: base64Data, segmentNum, type };
|
| 312 |
-
document.getElementById('exportModalImage').src = base64Data;
|
| 313 |
-
document.getElementById('exportModal').style.display = 'flex';
|
| 314 |
-
this.setExportStatus('');
|
| 315 |
-
},
|
| 316 |
-
|
| 317 |
-
closeExportModal() {
|
| 318 |
-
document.getElementById('exportModal').style.display = 'none';
|
| 319 |
-
},
|
| 320 |
-
|
| 321 |
-
setExportStatus(msg) {
|
| 322 |
-
const el = document.getElementById('exportStatus');
|
| 323 |
-
if (msg) {
|
| 324 |
-
el.innerText = msg;
|
| 325 |
-
el.style.display = 'block';
|
| 326 |
-
} else {
|
| 327 |
-
el.style.display = 'none';
|
| 328 |
-
}
|
| 329 |
-
},
|
| 330 |
-
|
| 331 |
-
getBlobFromBase64(base64D
|
|
|
|
| 6 |
<title>Pro Video Prompt Workspace</title>
|
| 7 |
<!-- Tailwind CSS -->
|
| 8 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 9 |
+
<!-- Lucide Icons -->
|
| 10 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/lucide/0.460.0/umd/lucide.min.js"></script>
|
| 11 |
<style>
|
| 12 |
/* Forces Android Webviews to allow long-press context menus */
|
|
|
|
| 136 |
<h3 class="font-bold text-white flex items-center gap-2">
|
| 137 |
<i data-lucide="download-cloud" class="w-5 h-5 text-blue-400"></i> Export Hub
|
| 138 |
</h3>
|
| 139 |
+
<button data-action="close-export" class="text-neutral-400 hover:text-white p-1">
|
| 140 |
<i data-lucide="x" class="w-5 h-5"></i>
|
| 141 |
</button>
|
| 142 |
</div>
|
|
|
|
| 149 |
</div>
|
| 150 |
|
| 151 |
<div class="space-y-3">
|
| 152 |
+
<button data-action="export-copy" class="w-full flex items-center justify-center gap-2 bg-blue-600 hover:bg-blue-500 text-white px-4 py-3 rounded-xl font-medium transition-colors shadow-lg">
|
| 153 |
<i data-lucide="clipboard-copy" class="w-4 h-4"></i> Copy Image to Clipboard
|
| 154 |
</button>
|
| 155 |
+
<button data-action="export-share" class="w-full flex items-center justify-center gap-2 bg-neutral-800 hover:bg-neutral-700 border border-neutral-700 text-white px-4 py-3 rounded-xl font-medium transition-colors">
|
| 156 |
<i data-lucide="share-2" class="w-4 h-4"></i> Force Native Share
|
| 157 |
</button>
|
| 158 |
+
<button data-action="export-download" class="w-full flex items-center justify-center gap-2 bg-neutral-800 hover:bg-neutral-700 border border-neutral-700 text-white px-4 py-3 rounded-xl font-medium transition-colors">
|
| 159 |
<i data-lucide="download-cloud" class="w-4 h-4"></i> Fallback Download
|
| 160 |
</button>
|
| 161 |
</div>
|
|
|
|
| 166 |
|
| 167 |
<!-- Application Logic -->
|
| 168 |
<script>
|
|
|
|
| 169 |
window.App = {
|
| 170 |
state: {
|
| 171 |
concept: '',
|
|
|
|
| 180 |
exportData: null
|
| 181 |
},
|
| 182 |
|
|
|
|
| 183 |
refreshIcons() {
|
| 184 |
if (typeof lucide !== 'undefined') {
|
| 185 |
try { lucide.createIcons(); } catch (e) { console.warn("Icon render skipped"); }
|
|
|
|
| 197 |
document.getElementById('negativeTags').addEventListener('input', (e) => { this.state.negativeTags = e.target.value; this.renderSegments(); });
|
| 198 |
document.getElementById('customApiKey').addEventListener('input', (e) => { this.state.customApiKey = e.target.value; });
|
| 199 |
|
| 200 |
+
// BYPASS BROWSER PROTECTION: Global Event Delegation (No inline onclick handlers!)
|
| 201 |
+
document.addEventListener('click', (e) => {
|
| 202 |
+
const btn = e.target.closest('[data-action]');
|
| 203 |
+
if (!btn) return;
|
| 204 |
+
|
| 205 |
+
const action = btn.dataset.action;
|
| 206 |
+
const segmentNum = btn.dataset.segment ? parseInt(btn.dataset.segment) : null;
|
| 207 |
+
const type = btn.dataset.type;
|
| 208 |
+
|
| 209 |
+
if (action === 'copy-prompt') {
|
| 210 |
+
const text = this.generatePromptText(segmentNum);
|
| 211 |
+
this.copyToClipboard(text, btn.id);
|
| 212 |
+
} else if (action === 'generate-image') {
|
| 213 |
+
this.triggerGenerate(segmentNum, type);
|
| 214 |
+
} else if (action === 'open-export') {
|
| 215 |
+
const stateKey = `${segmentNum}-${type}`;
|
| 216 |
+
const imgState = this.state.images[stateKey];
|
| 217 |
+
if (imgState && imgState.data) {
|
| 218 |
+
this.openExportModal(imgState.data, segmentNum, type);
|
| 219 |
+
}
|
| 220 |
+
} else if (action === 'close-export') {
|
| 221 |
+
this.closeExportModal();
|
| 222 |
+
} else if (action === 'export-copy') {
|
| 223 |
+
this.executeCopyImage();
|
| 224 |
+
} else if (action === 'export-share') {
|
| 225 |
+
this.executeShare();
|
| 226 |
+
} else if (action === 'export-download') {
|
| 227 |
+
this.executeDownload();
|
| 228 |
+
}
|
| 229 |
+
});
|
| 230 |
+
|
| 231 |
this.renderSegments();
|
| 232 |
},
|
| 233 |
|
|
|
|
| 325 |
}
|
| 326 |
},
|
| 327 |
|
| 328 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|