Skip to content

Commit 7089927

Browse files
committed
chore: Update OG image cache key and deploy action
1 parent cfa013d commit 7089927

File tree

1 file changed

+3
-31
lines changed

1 file changed

+3
-31
lines changed

assets/js/main.js

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -185,43 +185,15 @@
185185
<img src="${img.url}" alt="OG Image Preview for ${img.label}" class="w-full rounded-md border border-border dark:border-darkmode-border shadow-md hover:shadow-lg transition-shadow">
186186
</a>
187187
<div class="mt-3">
188-
<button class="copy-og-image-btn btn btn-sm btn-outline-primary" data-url="${img.url}">
189-
<span class="copy-text">Copy Image</span>
190-
<span class="copied-text hidden">Copied!</span>
191-
</button>
188+
<a href="${img.url}" download="${img.filename}" class="btn btn-sm btn-new-primary">
189+
Download
190+
</a>
192191
</div>
193192
</div>
194193
`;
195194
modalContent.insertAdjacentHTML('beforeend', cardHTML);
196195
});
197196
}
198-
199-
modalContent.querySelectorAll('.copy-og-image-btn').forEach(button => {
200-
button.addEventListener('click', () => {
201-
const urlToCopy = button.dataset.url;
202-
fetch(urlToCopy)
203-
.then(response => response.blob())
204-
.then(blob => {
205-
const item = new ClipboardItem({ [blob.type]: blob });
206-
return navigator.clipboard.write([item]);
207-
})
208-
.then(() => {
209-
button.classList.add('copied');
210-
button.querySelector('.copy-text').classList.add('hidden');
211-
button.querySelector('.copied-text').classList.remove('hidden');
212-
setTimeout(() => {
213-
button.classList.remove('copied');
214-
button.querySelector('.copy-text').classList.remove('hidden');
215-
button.querySelector('.copied-text').classList.add('hidden');
216-
}, 2000);
217-
})
218-
.catch(err => {
219-
console.error('Failed to copy image: ', err);
220-
alert('Failed to copy image to clipboard. This feature requires a secure connection (HTTPS) and may need browser permissions.');
221-
});
222-
});
223-
});
224-
225197
showModal();
226198
};
227199

0 commit comments

Comments
 (0)