mirror of
https://github.com/olegvodyanov/instalinks.git
synced 2025-12-20 11:27:04 +03:00
Compare commits
No commits in common. "c0a8c8746247a7fbdb1ed8640192679a276dd261" and "951e777c13b6524a3dd91c43488bf6e4f53d430e" have entirely different histories.
c0a8c87462
...
951e777c13
@ -117,19 +117,34 @@ function createLinkElement(link, isWatched) {
|
|||||||
const wrapper = document.createElement('div');
|
const wrapper = document.createElement('div');
|
||||||
wrapper.className = 'mb-auto';
|
wrapper.className = 'mb-auto';
|
||||||
|
|
||||||
const blockquote = document.createElement('blockquote');
|
const reelId = extractReelId(link.url);
|
||||||
blockquote.className = 'instagram-media';
|
if (!reelId) {
|
||||||
blockquote.setAttribute('data-instgrm-permalink', link.url);
|
wrapper.innerText = 'Invalid Instagram Reel URL';
|
||||||
blockquote.style.background = '#FFF';
|
return wrapper;
|
||||||
|
}
|
||||||
|
|
||||||
const p = document.createElement('p');
|
// Clean iframe embed
|
||||||
p.innerText = 'Loading Instagram...';
|
const iframeWrapper = document.createElement('div');
|
||||||
blockquote.appendChild(p);
|
iframeWrapper.style.width = '100%';
|
||||||
wrapper.appendChild(blockquote);
|
iframeWrapper.style.height = '600px';
|
||||||
|
iframeWrapper.style.overflow = 'hidden';
|
||||||
|
iframeWrapper.style.borderRadius = '10px';
|
||||||
|
|
||||||
|
const iframe = document.createElement('iframe');
|
||||||
|
iframe.src = link.url;
|
||||||
|
iframe.width = '100%';
|
||||||
|
iframe.height = '700'; // taller to allow for cropping
|
||||||
|
iframe.style.border = 'none';
|
||||||
|
iframe.allow="fullscreen";
|
||||||
|
iframe.loading = 'lazy';
|
||||||
|
|
||||||
|
iframeWrapper.appendChild(iframe);
|
||||||
|
wrapper.appendChild(iframeWrapper);
|
||||||
|
|
||||||
const btnGroup = document.createElement('div');
|
const btnGroup = document.createElement('div');
|
||||||
btnGroup.className = 'mt-2 d-flex gap-2';
|
btnGroup.className = 'mt-2 d-flex gap-2';
|
||||||
|
|
||||||
|
|
||||||
// Button to mark watched if it's not watched
|
// Button to mark watched if it's not watched
|
||||||
if (!isWatched) {
|
if (!isWatched) {
|
||||||
const watchButton = document.createElement('button');
|
const watchButton = document.createElement('button');
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user