From eee62fe4782aa2d7ab82a1846250e78c8ec19a07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20Kadir=20Ak=C4=B1n?= Date: Tue, 17 Jun 2025 00:26:39 +0300 Subject: [PATCH] update --- _layouts/embed-preview.html | 15 +++++++++++++-- _site/embed-preview-script.js | 29 +++++++++++++++++++++++++++++ _site/embed-preview/index.html | 15 +++++++++++++-- _site/index.html | 2 +- _site/vibe/index.html | 2 +- embed-preview-script.js | 29 +++++++++++++++++++++++++++++ 6 files changed, 86 insertions(+), 6 deletions(-) diff --git a/_layouts/embed-preview.html b/_layouts/embed-preview.html index ed906ed..0fdc3f2 100644 --- a/_layouts/embed-preview.html +++ b/_layouts/embed-preview.html @@ -30,8 +30,19 @@
- -
+ +
+ +
+ + + +
diff --git a/_site/embed-preview-script.js b/_site/embed-preview-script.js index 08c6a33..3d9dd76 100644 --- a/_site/embed-preview-script.js +++ b/_site/embed-preview-script.js @@ -177,6 +177,11 @@ class EmbedPreview { if (copyButton) { copyButton.addEventListener('click', () => this.handleCopy()); } + + const editButton = document.getElementById('edit-button'); + if (editButton) { + editButton.addEventListener('click', () => this.handleEdit()); + } } render() { @@ -353,6 +358,30 @@ class EmbedPreview { this.showNotification('Prompt copied to clipboard!'); } + handleEdit() { + // Get current query string + const queryString = window.location.search; + + // Get current URL path parts + const pathParts = window.location.pathname.split('/'); + + // Find index of 'embed-preview' and replace with 'embed' + const embedPreviewIndex = pathParts.findIndex(part => part === 'embed-preview'); + if (embedPreviewIndex !== -1) { + pathParts[embedPreviewIndex] = 'embed'; + } else { + // Fallback: just append /embed/ if embed-preview not found + pathParts.push('embed'); + } + + // Construct new URL + const newPath = pathParts.join('/'); + const newUrl = window.location.origin + newPath + queryString; + + // Open in new tab + window.open(newUrl, '_blank'); + } + async copyToClipboard(text) { if (navigator.clipboard && window.isSecureContext) { await navigator.clipboard.writeText(text); diff --git a/_site/embed-preview/index.html b/_site/embed-preview/index.html index 77e3b31..243bd53 100644 --- a/_site/embed-preview/index.html +++ b/_site/embed-preview/index.html @@ -30,8 +30,19 @@
- -
+ +
+ +
+ + + +
diff --git a/_site/index.html b/_site/index.html index c4b2c21..10538bf 100644 --- a/_site/index.html +++ b/_site/index.html @@ -25,7 +25,7 @@ - +
diff --git a/_site/vibe/index.html b/_site/vibe/index.html index 3d9208d..44208fe 100644 --- a/_site/vibe/index.html +++ b/_site/vibe/index.html @@ -25,7 +25,7 @@ - +
diff --git a/embed-preview-script.js b/embed-preview-script.js index 08c6a33..3d9dd76 100644 --- a/embed-preview-script.js +++ b/embed-preview-script.js @@ -177,6 +177,11 @@ class EmbedPreview { if (copyButton) { copyButton.addEventListener('click', () => this.handleCopy()); } + + const editButton = document.getElementById('edit-button'); + if (editButton) { + editButton.addEventListener('click', () => this.handleEdit()); + } } render() { @@ -353,6 +358,30 @@ class EmbedPreview { this.showNotification('Prompt copied to clipboard!'); } + handleEdit() { + // Get current query string + const queryString = window.location.search; + + // Get current URL path parts + const pathParts = window.location.pathname.split('/'); + + // Find index of 'embed-preview' and replace with 'embed' + const embedPreviewIndex = pathParts.findIndex(part => part === 'embed-preview'); + if (embedPreviewIndex !== -1) { + pathParts[embedPreviewIndex] = 'embed'; + } else { + // Fallback: just append /embed/ if embed-preview not found + pathParts.push('embed'); + } + + // Construct new URL + const newPath = pathParts.join('/'); + const newUrl = window.location.origin + newPath + queryString; + + // Open in new tab + window.open(newUrl, '_blank'); + } + async copyToClipboard(text) { if (navigator.clipboard && window.isSecureContext) { await navigator.clipboard.writeText(text);