diff --git a/v1-com-officielle/src/data/peopleData.js b/v1-com-officielle/src/data/peopleData.js index 16d2469..c6e4859 100644 --- a/v1-com-officielle/src/data/peopleData.js +++ b/v1-com-officielle/src/data/peopleData.js @@ -22,25 +22,16 @@ function titleAndContent(str){ for(let line of contentData){ if(line.includes('http')||line.includes('@')){ let linkData = line.split("# "); - //console.log(title, linkData); + console.log(linkData[1]); let linkNoFormat; - if (linkData.includes('http')){ - linkNoFormat = linkData[1].split("\""); - } else { - linkNoFormat = linkData[0] - } let url = ""; - for(let el of linkNoFormat){ - if(el.includes('http')){ - url = el; - break - } else if(el.includes('@')){ - url = 'mailto:' + el; - break - } else { - continue - } + if (linkData[1].includes('http')){ + linkNoFormat = linkData[1].split("\""); + url = linkNoFormat[1]; + } else if (linkData[1].includes('@')){ + url = 'mailto:' + linkData[1]; } + console.log("url info", url) src.push({ caption: linkData[0], url: url @@ -70,6 +61,11 @@ function exceptionKey(user, content){ return false; } +function videoExt(str){ + let data = str.split('.'); + return data.at(-1) +} + export async function loadPeopleData() { const usernamesRes = await fetch('/DATA/peopleData.json'); const pData = await usernamesRes.json(); @@ -110,7 +106,8 @@ export async function loadPeopleData() { //console.log(pouet); //ignorer autres que images if (selectedPouet.media_attachments?.length > 0 && - !pouet.media_attachments[0].type.includes('image')) { + !pouet.media_attachments[0].type.includes('image') && + !pouet.media_attachments[0].type.includes('video')) { continue; } //ignorer réponses @@ -140,18 +137,37 @@ export async function loadPeopleData() { } else if (selectedPouet.media_attachments?.length > 0) { let textInfos = titleAndContent(selectedPouet.content); //console.log(pouet); - entry = { - id: 'img' + displayName + infos.id, - date: infos.date, - dateInfo: selectedPouet.created_at, - type: "image", - author: displayName, - caption: textInfos.title + '.star', - src: selectedPouet.media_attachments[0].url, - alt: selectedPouet.media_attachments[0].description, - description: textInfos.content, - like: selectedPouet.favourites_count, - isSelected: false + if (pouet.media_attachments[0].type.includes('image')){ + entry = { + id: 'img' + displayName + infos.id, + date: infos.date, + dateInfo: selectedPouet.created_at, + type: "image", + author: displayName, + caption: textInfos.title + '.star', + src: selectedPouet.media_attachments[0].url, + alt: selectedPouet.media_attachments[0].description, + description: textInfos.content, + like: selectedPouet.favourites_count, + isSelected: false + } + } + if (pouet.media_attachments[0].type.includes('video')){ + let videoType = videoExt(selectedPouet.media_attachments[0].url) + entry = { + id: 'vid' + displayName + infos.id, + date: infos.date, + dateInfo: selectedPouet.created_at, + type: "video", + format: selectedPouet.media_attachments[0].type + '/' + videoType, + author: displayName, + caption: textInfos.title + '.move', + src: selectedPouet.media_attachments[0].url, + alt: selectedPouet.media_attachments[0].description, + description: textInfos.content, + like: selectedPouet.favourites_count, + isSelected: false + } } } else { let textInfos = titleAndContent(selectedPouet.content); @@ -166,6 +182,7 @@ export async function loadPeopleData() { isSelected: false }; } + //console.log(entry); files[username].push(entry); } diff --git a/v1-com-officielle/src/dataExchange.js b/v1-com-officielle/src/dataExchange.js index da5fd74..e4a5e92 100644 --- a/v1-com-officielle/src/dataExchange.js +++ b/v1-com-officielle/src/dataExchange.js @@ -21,5 +21,13 @@ export const dataStorage = reactive({ selectedLink:{ linksData: [], description: '' + }, + selectedVideo: { + src: "", + caption: "", + like: 0, + alt: "", + format:"", + isLiked: false } }) diff --git a/v1-com-officielle/src/indieComponents/ArtistPannel.vue b/v1-com-officielle/src/indieComponents/ArtistPannel.vue index d63a1dc..d47c5ab 100644 --- a/v1-com-officielle/src/indieComponents/ArtistPannel.vue +++ b/v1-com-officielle/src/indieComponents/ArtistPannel.vue @@ -332,7 +332,7 @@ rootDepth: 0 } }, - emits: ['close','focus','openImg','openLink'], + emits: ['close','focus','openImg','openLink','openVideo'], methods:{ onDrag({ target, transform }) { target.style.transform = transform; @@ -393,7 +393,19 @@ caption: e.caption, description: e.description } - //console.log(dataStorage.selectedLink); + console.log(dataStorage.selectedLink); + } + if(e.type === 'video'){ + this.$emit('openVideo'); + dataStorage.selectedVideo = { + src: e.src, + caption: e.caption, + like: e.like, + alt: e.alt, + format: e.format, + isLiked: e.isLiked + } + this.displayedDescription = e.description; } this.selectFile(e); diff --git a/v1-com-officielle/src/indieComponents/DonationPannel.vue b/v1-com-officielle/src/indieComponents/DonationPannel.vue index 2dd8212..e5b40b8 100644 --- a/v1-com-officielle/src/indieComponents/DonationPannel.vue +++ b/v1-com-officielle/src/indieComponents/DonationPannel.vue @@ -20,7 +20,7 @@
Si tu penses que tu as les moyens
de nous faire une petite donation,
toute participation est la bienvenue et
ça nous aiderait bien à démarrer le projet ^^
On a besoin de ton aide !
Si tu penses que tu as les moyens
de nous faire une petite donation,
toute participation est la bienvenue et
ça nous aiderait bien à démarrer le projet ^^
+ {{selectedVideo.caption}} +
+ +{{selectedVideo.like}}
+