TV-BOX/hikerviewrules/IMAGE/cos.js
yuanwangokk-1 fd88dfa315 main
2025-08-11 12:28:16 +08:00

52 lines
1.7 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

let d = []
const empty = "hiker://empty"
const makeScroll = (url, cate_level) => {
let json = fetch(url)
let data = JSON.parse(json).data
if (data) {
let arr = data.files
let first = arr[0]
let cate_select = getVar("tyrantgenesis.images.cate_select_" + cate_level)
let type = true
let hasName = false
arr.forEach(item => {
if (item.type === 'FILE') type = false
if (item.name === cate_select) hasName = true
})
if (!hasName) cate_select = first.name
if (type) {
arr.forEach(cate => {
if (cate.type === 'FOLDER') {
cate.cate_level = cate_level
d.push({
title: cate_select === cate.name ? '<strong><font color="red">' + cate.name + '</font></strong>' : cate.name,
url: $(empty).lazyRule(cate => {
putVar("tyrantgenesis.images.cate_select_" + cate.cate_level, cate.name)
refreshPage(false)
return "hiker://empty"
}, cate),
col_type: 'scroll_button',
})
}
})
d.push({
col_type: "blank_block"
})
cate_level++
makeScroll(url + "%2F" + encodeURIComponent(cate_select), cate_level)
} else {
arr.forEach(cate => {
d.push({
pic_url: cate.url,
url: cate.url,
})
})
}
}
}
makeScroll("https://zfile.cosersets.com/api/list/1?path=", 1)
setResult(d);