Format files

This commit is contained in:
dragongoose
2023-03-29 10:26:55 -04:00
parent ea4e649959
commit 143e81276b
3 changed files with 32 additions and 19 deletions

View File

@ -8,7 +8,6 @@ export default {
let frontend_url = import.meta.env.VITE_INSTANCE_URL
data.value = await res.json()
return {
data,
frontend_url,
@ -29,7 +28,7 @@ export default {
const wantedTags = toFilter.split(',').filter((v) => v.toLowerCase())
for (let category of categories as any) {
let tagElements = category.getElementsByTagName("span")
let tagElements = category.getElementsByTagName('span')
let tags = []
for (let tag of tagElements) {
@ -38,34 +37,37 @@ export default {
// Create sets from the arrays
const [set1, set2] = [new Set(wantedTags), new Set(tags)]
const common = [...set1].filter(x => set2.has(x));
const common = [...set1].filter((x) => set2.has(x))
console.log(wantedTags)
if(common.length === wantedTags.length) {
category.style.display = ""
} else if (wantedTags[0] === "") {
category.style.display = ""
if (common.length === wantedTags.length) {
category.style.display = ''
} else if (wantedTags[0] === '') {
category.style.display = ''
console.log('ok')
} else {
category.style.display = "none"
category.style.display = 'none'
}
}
},
getNextCategory() {
window.onscroll = async () => {
let bottomOfWindow = document.documentElement.scrollTop + window.innerHeight === document.documentElement.offsetHeight;
let bottomOfWindow =
document.documentElement.scrollTop + window.innerHeight ===
document.documentElement.offsetHeight
if (bottomOfWindow && this.data) {
const cursor = this.data[this.data.length - 1].cursor
if(!cursor) return
const res = await fetch(`${import.meta.env.VITE_BACKEND_URL}/api/discover/?cursor=${cursor}`)
if (!cursor) return
const res = await fetch(
`${import.meta.env.VITE_BACKEND_URL}/api/discover/?cursor=${cursor}`
)
const data = await res.json()
for (let category of data) {
this.data.push(category)
}
}
}
}
}
},