mirror of
https://github.com/olegvodyanov/instalinks.git
synced 2025-12-20 10:17:05 +03:00
Compare commits
2 Commits
951e777c13
...
c0a8c87462
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c0a8c87462 | ||
|
|
1ee3b23209 |
@ -117,34 +117,19 @@ function createLinkElement(link, isWatched) {
|
|||||||
const wrapper = document.createElement('div');
|
const wrapper = document.createElement('div');
|
||||||
wrapper.className = 'mb-auto';
|
wrapper.className = 'mb-auto';
|
||||||
|
|
||||||
const reelId = extractReelId(link.url);
|
const blockquote = document.createElement('blockquote');
|
||||||
if (!reelId) {
|
blockquote.className = 'instagram-media';
|
||||||
wrapper.innerText = 'Invalid Instagram Reel URL';
|
blockquote.setAttribute('data-instgrm-permalink', link.url);
|
||||||
return wrapper;
|
blockquote.style.background = '#FFF';
|
||||||
}
|
|
||||||
|
|
||||||
// Clean iframe embed
|
const p = document.createElement('p');
|
||||||
const iframeWrapper = document.createElement('div');
|
p.innerText = 'Loading Instagram...';
|
||||||
iframeWrapper.style.width = '100%';
|
blockquote.appendChild(p);
|
||||||
iframeWrapper.style.height = '600px';
|
wrapper.appendChild(blockquote);
|
||||||
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