From 1e86666e227b955f37170699452e36d2805d329d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Iranzo=20G=C3=B3mez?= Date: Fri, 7 Feb 2020 11:34:24 +0100 Subject: [PATCH] (feat) Allow combination of single or multiple galleries into one MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pablo Iranzo Gómez --- .../photoswipe-instagram-gallery.md | 13 +++ static/js/create-instagram-gallery.js | 81 +++++++++---------- 2 files changed, 53 insertions(+), 41 deletions(-) diff --git a/documentation/content/Components/photoswipe-instagram-gallery.md b/documentation/content/Components/photoswipe-instagram-gallery.md index 4997a5e1..85f04d0f 100644 --- a/documentation/content/Components/photoswipe-instagram-gallery.md +++ b/documentation/content/Components/photoswipe-instagram-gallery.md @@ -46,3 +46,16 @@ It's code is ```html
``` + +## A combined single + multiple post + +
+ +It's code is + +```html +
+``` diff --git a/static/js/create-instagram-gallery.js b/static/js/create-instagram-gallery.js index 9cd45953..73c3bc74 100644 --- a/static/js/create-instagram-gallery.js +++ b/static/js/create-instagram-gallery.js @@ -43,33 +43,47 @@ const convertInstagramToPhotoSwipe = () => { // Get div.elegant-instagram document.querySelectorAll(".elegant-instagram").forEach(ele => { // Get instagram-id - const instagramId = ele.dataset.instagramId; - - fetch(`https://www.instagram.com/p/${instagramId}/?__a=1`) - .then(response => { - response.json().then(json => { - // Get Original image from the json - const level1 = json.graphql.shortcode_media; - - let divHTML = ``; @@ -107,9 +106,9 @@ const convertInstagramToPhotoSwipe = () => { // Trigger PhotoSwipe initPhotoSwipeFromDOM(".elegant-gallery"); - }); - }) - .catch(err => console.error("Failed", err)); + } + ); + }); }); };