feat(bulk-api-tester): add shareable visual comparison studio with full-view interactive slider, side-by-side, and gallery

This commit is contained in:
2026-10-28 13:45:26 +05:30
parent 1bcc0d5dda
commit ad48d28310
7 changed files with 2077 additions and 2 deletions
+1
View File
@@ -17,5 +17,6 @@
/uploads/
/data/image-hoster/
/data/facial-rotation-detector/
/data/bulk-api-tester/comparisons/
/data/*/uploads/
.DS_Store
+8
View File
@@ -28,6 +28,14 @@ func registerRoutes(r chi.Router) {
r.Get("/api/last-run", getLastRunHandler)
r.Post("/api/last-run", saveLastRunHandler)
r.Get("/api/docs-data", getDocsDataHandler)
r.Post("/api/share-comparison", createComparisonShareHandler)
r.Get("/api/comparison/{id}", getComparisonDataHandler)
r.Get("/api/comparison/{id}/images/{file}", getComparisonImageHandler)
// Standalone Comparison Studio
r.Get("/compare/{id}", comparePageHandler)
r.Get("/compare", comparePageHandler)
r.Get("/compare.html", comparePageHandler)
// Direct routes for 3-file system
r.Get("/", func(w http.ResponseWriter, req *http.Request) {
+365
View File
@@ -0,0 +1,365 @@
package main
import (
"crypto/rand"
"encoding/base64"
"encoding/hex"
"encoding/json"
"fmt"
"log/slog"
"net/http"
"os"
"path/filepath"
"regexp"
"strings"
"time"
"github.com/go-chi/chi/v5"
)
var validIDRegex = regexp.MustCompile(`^[a-zA-Z0-9_\-]+$`)
type ComparisonItem struct {
Index int `json:"index"`
Status any `json:"status"`
Latency int64 `json:"latency"`
InputFilename string `json:"inputFilename"`
OutputFilename string `json:"outputFilename"`
ContentType string `json:"contentType"`
BeforeImage string `json:"beforeImage"`
AfterImage string `json:"afterImage"`
TextContent string `json:"textContent"`
HasBefore bool `json:"hasBefore"`
HasAfter bool `json:"hasAfter"`
}
type ComparisonShare struct {
ID string `json:"id"`
Title string `json:"title"`
Endpoint string `json:"endpoint"`
SpaceName string `json:"spaceName"`
CreatedAt string `json:"createdAt"`
Total int `json:"total"`
SuccessCount int `json:"successCount"`
ErrorCount int `json:"errorCount"`
AvgLatency int64 `json:"avgLatency"`
Items []ComparisonItem `json:"items"`
}
type ShareRequestItem struct {
Index int `json:"index"`
Status any `json:"status"`
Latency int64 `json:"latency"`
InputFilename string `json:"inputFilename"`
OutputFilename string `json:"outputFilename"`
ContentType string `json:"contentType"`
BeforeData string `json:"beforeData"` // base64 or data URL
AfterData string `json:"afterData"` // base64 or data URL
TextContent string `json:"textContent"`
}
type ShareRequest struct {
Title string `json:"title"`
Endpoint string `json:"endpoint"`
SpaceName string `json:"spaceName"`
Items []ShareRequestItem `json:"items"`
}
func randomHexString(n int) string {
b := make([]byte, n)
if _, err := rand.Read(b); err != nil {
return fmt.Sprintf("%d", time.Now().UnixNano())
}
return hex.EncodeToString(b)
}
func decodeImageData(dataStr string) ([]byte, string, error) {
dataStr = strings.TrimSpace(dataStr)
if dataStr == "" {
return nil, "", nil
}
ext := "png"
rawB64 := dataStr
if strings.HasPrefix(dataStr, "data:") {
idx := strings.Index(dataStr, ";base64,")
if idx != -1 {
mime := dataStr[5:idx]
rawB64 = dataStr[idx+8:]
switch mime {
case "image/jpeg", "image/jpg":
ext = "jpg"
case "image/webp":
ext = "webp"
case "image/gif":
ext = "gif"
case "image/svg+xml":
ext = "svg"
case "image/avif":
ext = "avif"
default:
ext = "png"
}
}
}
// Clean out any newlines/spaces in base64 string
rawB64 = strings.ReplaceAll(rawB64, "\r", "")
rawB64 = strings.ReplaceAll(rawB64, "\n", "")
rawB64 = strings.ReplaceAll(rawB64, " ", "")
b, err := base64.StdEncoding.DecodeString(rawB64)
if err != nil {
b, err = base64.URLEncoding.DecodeString(rawB64)
}
if err != nil {
return nil, "", err
}
return b, ext, nil
}
func createComparisonShareHandler(w http.ResponseWriter, r *http.Request) {
// Set 500MB limit on request body for batches of images
r.Body = http.MaxBytesReader(w, r.Body, 500*1024*1024)
var req ShareRequest
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
slog.Error("failed to decode share request", "error", err)
writeJSON(w, http.StatusBadRequest, map[string]any{"success": false, "error": "Invalid request body: " + err.Error()})
return
}
if len(req.Items) == 0 {
writeJSON(w, http.StatusBadRequest, map[string]any{"success": false, "error": "No items provided for comparison share"})
return
}
// Generate clean unique ID
shareID := fmt.Sprintf("cmp_%x_%s", time.Now().Unix(), randomHexString(4))
compDir := filepath.Join("data", "bulk-api-tester", "comparisons", shareID)
imagesDir := filepath.Join(compDir, "images")
if err := os.MkdirAll(imagesDir, 0755); err != nil {
slog.Error("failed to create comparison directory", "dir", compDir, "error", err)
writeJSON(w, http.StatusInternalServerError, map[string]any{"success": false, "error": "Failed to create storage directory"})
return
}
var items []ComparisonItem
var totalLatency int64
successCount := 0
errorCount := 0
for i, it := range req.Items {
itemIndex := it.Index
if itemIndex <= 0 {
itemIndex = i + 1
}
cItem := ComparisonItem{
Index: itemIndex,
Status: it.Status,
Latency: it.Latency,
InputFilename: it.InputFilename,
OutputFilename: it.OutputFilename,
ContentType: it.ContentType,
TextContent: it.TextContent,
}
// Check status code for success/error count
isSuccess := false
switch v := it.Status.(type) {
case float64:
if int(v) >= 200 && int(v) < 300 {
isSuccess = true
}
case int:
if v >= 200 && v < 300 {
isSuccess = true
}
case string:
if strings.HasPrefix(v, "2") {
isSuccess = true
}
}
if isSuccess {
successCount++
} else {
errorCount++
}
totalLatency += it.Latency
// Save Before Image if provided
if it.BeforeData != "" {
beforeBytes, ext, err := decodeImageData(it.BeforeData)
if err == nil && len(beforeBytes) > 0 {
filename := fmt.Sprintf("before_%d.%s", itemIndex, ext)
filePath := filepath.Join(imagesDir, filename)
if err := os.WriteFile(filePath, beforeBytes, 0644); err == nil {
cItem.BeforeImage = fmt.Sprintf("/api/comparison/%s/images/%s", shareID, filename)
cItem.HasBefore = true
} else {
slog.Warn("failed to write before image", "file", filename, "error", err)
}
} else if err != nil {
slog.Warn("failed to decode before image", "index", itemIndex, "error", err)
}
}
// Save After Image if provided
if it.AfterData != "" {
afterBytes, ext, err := decodeImageData(it.AfterData)
if err == nil && len(afterBytes) > 0 {
filename := fmt.Sprintf("after_%d.%s", itemIndex, ext)
filePath := filepath.Join(imagesDir, filename)
if err := os.WriteFile(filePath, afterBytes, 0644); err == nil {
cItem.AfterImage = fmt.Sprintf("/api/comparison/%s/images/%s", shareID, filename)
cItem.HasAfter = true
} else {
slog.Warn("failed to write after image", "file", filename, "error", err)
}
} else if err != nil {
slog.Warn("failed to decode after image", "index", itemIndex, "error", err)
}
}
items = append(items, cItem)
}
title := req.Title
if title == "" {
title = fmt.Sprintf("Batch Comparison (%d results)", len(items))
}
var avgLatency int64
if len(items) > 0 {
avgLatency = totalLatency / int64(len(items))
}
shareData := ComparisonShare{
ID: shareID,
Title: title,
Endpoint: req.Endpoint,
SpaceName: req.SpaceName,
CreatedAt: time.Now().UTC().Format(time.RFC3339),
Total: len(items),
SuccessCount: successCount,
ErrorCount: errorCount,
AvgLatency: avgLatency,
Items: items,
}
metaPath := filepath.Join(compDir, "meta.json")
if err := atomicWriteJSON(metaPath, shareData); err != nil {
slog.Error("failed to save comparison metadata", "path", metaPath, "error", err)
writeJSON(w, http.StatusInternalServerError, map[string]any{"success": false, "error": "Failed to save comparison meta"})
return
}
slog.Info("created shareable comparison", "share_id", shareID, "items_count", len(items))
writeJSON(w, http.StatusOK, map[string]any{
"success": true,
"shareId": shareID,
"url": "/tool/bulk-api-tester/compare/" + shareID,
"directUrl": "/compare/" + shareID,
"total": len(items),
})
}
func getComparisonDataHandler(w http.ResponseWriter, r *http.Request) {
id := chi.URLParam(r, "id")
if id == "" || !validIDRegex.MatchString(id) {
writeJSON(w, http.StatusBadRequest, map[string]any{"error": "Invalid comparison ID"})
return
}
metaPath := filepath.Join("data", "bulk-api-tester", "comparisons", id, "meta.json")
var data ComparisonShare
if err := readJSON(metaPath, &data); err != nil {
writeJSON(w, http.StatusNotFound, map[string]any{"error": "Comparison not found"})
return
}
w.Header().Set("Cache-Control", "no-cache, must-revalidate")
writeJSON(w, http.StatusOK, data)
}
func getComparisonImageHandler(w http.ResponseWriter, r *http.Request) {
id := chi.URLParam(r, "id")
file := chi.URLParam(r, "file")
if id == "" || !validIDRegex.MatchString(id) || file == "" {
http.Error(w, "Invalid parameters", http.StatusBadRequest)
return
}
cleanFile := filepath.Base(file)
if cleanFile != file {
http.Error(w, "Invalid filename", http.StatusBadRequest)
return
}
filePath := filepath.Join("data", "bulk-api-tester", "comparisons", id, "images", cleanFile)
if _, err := os.Stat(filePath); os.IsNotExist(err) {
http.Error(w, "Image not found", http.StatusNotFound)
return
}
ext := strings.ToLower(filepath.Ext(cleanFile))
contentType := "application/octet-stream"
switch ext {
case ".png":
contentType = "image/png"
case ".jpg", ".jpeg":
contentType = "image/jpeg"
case ".webp":
contentType = "image/webp"
case ".gif":
contentType = "image/gif"
case ".svg":
contentType = "image/svg+xml"
case ".avif":
contentType = "image/avif"
}
w.Header().Set("Content-Type", contentType)
w.Header().Set("Cache-Control", "public, max-age=31536000, immutable")
http.ServeFile(w, r, filePath)
}
func comparePageHandler(w http.ResponseWriter, r *http.Request) {
id := chi.URLParam(r, "id")
if id == "" {
id = r.URL.Query().Get("id")
}
workDir, _ := os.Getwd()
htmlPath := filepath.Join(workDir, "web", "bulk-api-tester", "compare.html")
htmlBytes, err := os.ReadFile(htmlPath)
if err != nil {
http.Error(w, "compare.html not found", http.StatusNotFound)
return
}
w.Header().Set("Content-Type", "text/html; charset=utf-8")
w.Header().Set("Cache-Control", "no-cache, must-revalidate")
// If valid ID provided and meta exists, inject it directly for zero-latency instant render
if id != "" && validIDRegex.MatchString(id) {
metaPath := filepath.Join("data", "bulk-api-tester", "comparisons", id, "meta.json")
if metaBytes, err := os.ReadFile(metaPath); err == nil {
injectScript := fmt.Sprintf(`<script id="comparison-initial-data" type="application/json">%s</script>`, string(metaBytes))
htmlStr := string(htmlBytes)
if strings.Contains(htmlStr, "</head>") {
htmlStr = strings.Replace(htmlStr, "</head>", injectScript+"\n</head>", 1)
w.Write([]byte(htmlStr))
return
}
}
}
w.Write(htmlBytes)
}
File diff suppressed because one or more lines are too long
+8
View File
@@ -661,6 +661,14 @@ func NewRouter(pm *ProcessManager) http.Handler {
http.Redirect(w, req, "/docs/", http.StatusTemporaryRedirect)
})
// Route /compare to /tool/bulk-api-tester/compare
r.Get("/compare", func(w http.ResponseWriter, req *http.Request) {
http.Redirect(w, req, "/tool/bulk-api-tester/compare", http.StatusTemporaryRedirect)
})
r.Get("/compare/*", func(w http.ResponseWriter, req *http.Request) {
http.Redirect(w, req, "/tool/bulk-api-tester"+req.URL.Path, http.StatusTemporaryRedirect)
})
// Special custom domain routing for Image Hoster (/hoster -> image-hoster:/files)
r.Route("/hoster", func(r chi.Router) {
r.Handle("/*", http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
+247 -1
View File
@@ -1158,6 +1158,9 @@ const App = {
</button>
</div>
<button class="btn btn-primary btn-sm" style="height:32px; background:linear-gradient(135deg, #7257ff, #5935f8);" onclick="App.createShareableComparison()" ${bulk.results.length === 0 ? 'disabled' : ''} title="Create and copy shareable comparison link">
<i class="fa-solid fa-share-nodes"></i> Share Comparison
</button>
<button class="btn btn-ghost btn-sm" style="height:32px;" onclick="App.saveAllResults()" ${bulk.results.length === 0 ? 'disabled' : ''}>
<i class="fa-solid fa-file-zipper"></i> ZIP
</button>
@@ -3012,6 +3015,245 @@ const App = {
}
},
// ── Shareable Visual Comparison Studio ─────────────────────────────────────
async createShareableComparison() {
const results = this.state.bulk.results;
if (!results || results.length === 0) {
return this.toast('No results to compare yet. Run requests or batch first.', 'warning');
}
// Create sleek progress overlay
const progressModal = document.createElement('div');
progressModal.className = 'premium-modal-overlay share-progress-overlay';
progressModal.style.zIndex = '99999';
progressModal.innerHTML = `
<div class="premium-modal-card" style="width:min(440px, 92vw); padding:26px; text-align:center;">
<div style="font-size:32px; color:var(--accent); margin-bottom:12px;">
<i class="fa-solid fa-spinner fa-spin"></i>
</div>
<h3 style="font-family:var(--font-display); font-size:16px; margin:0 0 6px 0; color:var(--text-1);">Packaging Comparison Snapshot</h3>
<p id="share-progress-text" style="font-size:12px; color:var(--text-3); margin:0 0 16px 0;">Processing result assets (0/${results.length})...</p>
<div class="progress-track" style="margin-bottom:0; height:6px;">
<div id="share-progress-fill" class="progress-fill" style="width:0%; background:linear-gradient(90deg, #7257ff, #38bdf8);"></div>
</div>
</div>
`;
document.body.appendChild(progressModal);
const updateProgress = (done, total) => {
const pText = document.getElementById('share-progress-text');
const pFill = document.getElementById('share-progress-fill');
if (pText) pText.textContent = `Processing result assets (${done}/${total})...`;
if (pFill) pFill.style.width = `${Math.round((done / total) * 100)}%`;
};
const blobToBase64 = (blob) => {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onloadend = () => resolve(reader.result);
reader.onerror = reject;
reader.readAsDataURL(blob);
});
};
try {
const items = [];
for (let i = 0; i < results.length; i++) {
const r = results[i];
updateProgress(i + 1, results.length);
let beforeData = '';
let afterData = '';
// 1. Resolve Before Image
const beforeObj = this.resolveOriginalImageForResult(r);
if (beforeObj && beforeObj.url) {
try {
const bBlob = await fetch(beforeObj.url).then(res => res.blob());
beforeData = await blobToBase64(bBlob);
} catch(e) {
console.warn("Failed to encode before image", e);
}
}
// 2. Resolve After Image
if (r.blobUrl) {
try {
const aBlob = await fetch(r.blobUrl).then(res => res.blob());
afterData = await blobToBase64(aBlob);
} catch(e) {
console.warn("Failed to encode after image", e);
}
} else if (r.binaryData) {
afterData = r.binaryData.startsWith('data:') ? r.binaryData : `data:${r.contentType || 'image/png'};base64,${r.binaryData}`;
}
items.push({
index: r.index || (i + 1),
status: r.status,
latency: r.latency || 0,
inputFilename: (beforeObj && beforeObj.name) || r.inputFilename || `input_${i+1}`,
outputFilename: this.getFinalFilename(r),
contentType: r.contentType || 'image/png',
beforeData: beforeData,
afterData: afterData,
textContent: r.fullContent || (typeof r.data === 'string' ? r.data : '')
});
}
const activeSpace = this.state.spaces.find(s => s.id === this.state.activeSpaceId);
const payload = {
title: `Batch Comparison (${results.length} results)`,
endpoint: this.state.url || '',
spaceName: activeSpace ? activeSpace.name : 'Default Space',
items: items
};
const basePath = window.location.pathname.includes('/tool/bulk-api-tester') ? '/tool/bulk-api-tester' : '';
const res = await fetch(`${basePath}/api/share-comparison`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload)
});
progressModal.remove();
if (!res.ok) {
const errJson = await res.json().catch(() => ({}));
throw new Error(errJson.error || `HTTP ${res.status}`);
}
const data = await res.json();
if (!data.success) {
throw new Error(data.error || 'Failed to create share link');
}
// Build full public URL
const origin = window.location.origin;
const shareUrl = `${origin}${basePath}/compare/${data.shareId}`;
// Automatically copy to clipboard
let copied = false;
try {
if (navigator.clipboard && navigator.clipboard.writeText) {
await navigator.clipboard.writeText(shareUrl);
copied = true;
}
} catch(_) {
// Fallback for environments without direct clipboard focus
try {
const ta = document.createElement('textarea');
ta.value = shareUrl;
ta.style.position = 'fixed';
ta.style.opacity = '0';
document.body.appendChild(ta);
ta.select();
copied = document.execCommand('copy');
ta.remove();
} catch(__) {}
}
if (copied) {
this.toast('Shareable comparison link copied to clipboard!', 'success');
} else {
this.toast('Shareable comparison link created!', 'info');
}
// Show Obsidian Liquid Glass Share Modal
this.showShareComparisonModal(shareUrl, data.shareId, results.length);
} catch (e) {
progressModal.remove();
this.toast('Failed to create comparison: ' + (e ? e.message : 'Unknown error'), 'error');
}
},
showShareComparisonModal(shareUrl, shareId, count) {
// Remove existing modal if any
const existing = document.querySelector('.comparison-share-success-modal');
if (existing) existing.remove();
const modal = document.createElement('div');
modal.className = 'premium-modal-overlay comparison-share-success-modal';
modal.style.zIndex = '99999';
modal.innerHTML = `
<div class="premium-modal-card" onclick="event.stopPropagation();" style="width:min(520px, 94vw); padding:26px; border-radius:var(--r-lg);">
<div style="display:flex; align-items:center; justify-content:space-between; margin-bottom:16px;">
<div style="display:flex; align-items:center; gap:10px;">
<div style="width:36px; height:36px; border-radius:var(--r-md); background:linear-gradient(135deg, #7257ff, #38bdf8); display:flex; align-items:center; justify-content:center; color:#fff; font-size:16px; box-shadow:0 4px 12px rgba(var(--accent-rgb), 0.4);">
<i class="fa-solid fa-share-nodes"></i>
</div>
<div>
<h3 style="margin:0; font-family:var(--font-display); font-size:16px; color:var(--text-1);">Shareable Comparison Ready</h3>
<span style="font-size:11.5px; color:var(--text-3); font-family:var(--font-mono);">${count} results packaged · ID: ${shareId}</span>
</div>
</div>
<button class="modal-close-btn" onclick="this.closest('.premium-modal-overlay').remove()">✕</button>
</div>
<p style="font-size:12.5px; color:var(--text-2); margin-bottom:16px; line-height:1.5;">
Anyone with this link can view the interactive Before & After split slider, side-by-side inspection, and download high-resolution outputs in full view.
</p>
<!-- Link Copy Box -->
<div style="display:flex; gap:8px; align-items:center; background:rgba(0,0,0,0.35); border:1px solid var(--border-2); border-radius:var(--r-md); padding:4px 6px 4px 12px; margin-bottom:18px;">
<input type="text" id="share-modal-input" readonly value="${shareUrl}"
style="flex:1; background:transparent; border:none; color:var(--cyan); font-family:var(--font-mono); font-size:12px; outline:none; text-overflow:ellipsis;"
onclick="this.select();">
<button class="btn btn-primary btn-sm" id="btn-modal-copy-link" onclick="App.copyLinkFromInput()">
<i class="fa-solid fa-copy"></i> Copy
</button>
</div>
<!-- Feature Highlights -->
<div style="display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-bottom:20px;">
<div style="background:rgba(255,255,255,0.03); border:1px solid var(--border-1); border-radius:var(--r-md); padding:10px 12px;">
<div style="font-size:12px; font-weight:700; color:var(--text-1); margin-bottom:2px;"><i class="fa-solid fa-arrows-split-up-and-left" style="color:var(--accent);"></i> Interactive Studio</div>
<div style="font-size:11px; color:var(--text-3);">Split slider, side-by-side & blink diff modes</div>
</div>
<div style="background:rgba(255,255,255,0.03); border:1px solid var(--border-1); border-radius:var(--r-md); padding:10px 12px;">
<div style="font-size:12px; font-weight:700; color:var(--text-1); margin-bottom:2px;"><i class="fa-solid fa-file-zipper" style="color:var(--cyan);"></i> Standalone ZIP</div>
<div style="font-size:11px; color:var(--text-3);">Recipients can download all results in 1 click</div>
</div>
</div>
<!-- Action Footer -->
<div style="display:flex; justify-content:flex-end; gap:10px;">
<button class="btn btn-ghost btn-sm" onclick="this.closest('.premium-modal-overlay').remove()">Close</button>
<a href="${shareUrl}" target="_blank" class="btn btn-primary btn-sm" style="text-decoration:none;">
<i class="fa-solid fa-arrow-up-right-from-square"></i> Open Comparison View
</a>
</div>
</div>
`;
document.body.appendChild(modal);
modal.onclick = () => modal.remove();
},
copyLinkFromInput() {
const input = document.getElementById('share-modal-input');
const btn = document.getElementById('btn-modal-copy-link');
if (!input) return;
input.select();
navigator.clipboard.writeText(input.value).then(() => {
this.toast('Comparison link copied to clipboard!', 'success');
if (btn) {
const orig = btn.innerHTML;
btn.innerHTML = `<i class="fa-solid fa-check"></i> Copied!`;
btn.style.background = 'var(--success)';
setTimeout(() => {
btn.innerHTML = orig;
btn.style.background = '';
}, 2000);
}
}).catch(err => {
this.toast('Failed to copy link', 'error');
});
},
// --- Rendering ---
// Debounced render — coalesces rapid successive calls (e.g., keystrokes)
@@ -3274,7 +3516,7 @@ const App = {
if (isResults && bulk.results.length > 0) {
const fp = this.state.outputFolderPath || 'None selected';
c.style.display = 'flex';
c.innerHTML = `<div class="folder-selector-container"><span class="folder-path-display" title="${fp}"><i class="fa-solid fa-folder-open"></i> ${fp}</span><button class="btn btn-ghost" style="padding:0 11px;height:100%;border:none;border-radius:0;border-left:1px solid var(--border-2);font-size:10px;" onclick="App.browseServerFolder()">Browse</button><button class="btn btn-primary" style="padding:0 11px;height:100%;border:none;border-radius:0;font-size:10px;" onclick="App.saveToServerFolder()"><i class="fa-solid fa-cloud-arrow-up"></i> Save</button></div><button class="btn btn-ghost btn-sm" style="height:30px;" onclick="App.saveAllResults()"><i class="fa-solid fa-file-zipper"></i> ZIP</button><button class="btn btn-ghost btn-sm" style="height:30px;" onclick="App.downloadHistory()"><i class="fa-solid fa-file-csv"></i> CSV</button><button class="btn btn-ghost btn-sm" style="height:30px;" onclick="App.openFullscreenResults()"><i class="fa-solid fa-maximize"></i> Expand</button><button class="btn btn-danger btn-sm" style="height:30px;" onclick="App.clearBulkResults()"><i class="fa-solid fa-trash"></i> Clear</button>`;
c.innerHTML = `<div class="folder-selector-container"><span class="folder-path-display" title="${fp}"><i class="fa-solid fa-folder-open"></i> ${fp}</span><button class="btn btn-ghost" style="padding:0 11px;height:100%;border:none;border-radius:0;border-left:1px solid var(--border-2);font-size:10px;" onclick="App.browseServerFolder()">Browse</button><button class="btn btn-primary" style="padding:0 11px;height:100%;border:none;border-radius:0;font-size:10px;" onclick="App.saveToServerFolder()"><i class="fa-solid fa-cloud-arrow-up"></i> Save</button></div><button class="btn btn-primary btn-sm" style="height:30px;background:linear-gradient(135deg,#7257ff,#5935f8);" onclick="App.createShareableComparison()" title="Create and copy shareable comparison link"><i class="fa-solid fa-share-nodes"></i> Share Comparison</button><button class="btn btn-ghost btn-sm" style="height:30px;" onclick="App.saveAllResults()"><i class="fa-solid fa-file-zipper"></i> ZIP</button><button class="btn btn-ghost btn-sm" style="height:30px;" onclick="App.downloadHistory()"><i class="fa-solid fa-file-csv"></i> CSV</button><button class="btn btn-ghost btn-sm" style="height:30px;" onclick="App.openFullscreenResults()"><i class="fa-solid fa-maximize"></i> Expand</button><button class="btn btn-danger btn-sm" style="height:30px;" onclick="App.clearBulkResults()"><i class="fa-solid fa-trash"></i> Clear</button>`;
} else {
c.style.display = 'none';
}
@@ -4305,6 +4547,9 @@ const App = {
<button class="btn btn-ghost btn-sm" onclick="App.downloadIndividualResult(${result.index})">
<i class="fa-solid fa-arrow-down"></i> Download Result
</button>
<button class="btn btn-primary btn-sm" style="background:linear-gradient(135deg,#7257ff,#5935f8);" onclick="App.createShareableComparison()">
<i class="fa-solid fa-share-nodes"></i> Share Comparison
</button>
<button class="btn btn-primary btn-sm" onclick="App.saveIndividualToServerFolder(${result.index})">
<i class="fa-solid fa-folder-plus"></i> Save to Server Folder
</button>
@@ -4520,6 +4765,7 @@ const App = {
}
};
window.App = App;
document.addEventListener('DOMContentLoaded', () => App.init());
File diff suppressed because it is too large Load Diff