var typeTemplate = `{{type}}`
var template = `
{{name}}
Language: {{language}}
Version: {{version}}
Authors: {{authors}}
{{types}}
{{description}}
`
var allList = []
$.getJSON( "https://raw.githubusercontent.com/recloudstream/cs-repos/master/repos-db.json",
function( data ) {
data.forEach(repoUrl => {
$.getJSON( repoUrl,
function( data ) {
data.pluginLists.forEach(pluginUrl => {
$.getJSON( pluginUrl,
function( data ) {
data.forEach(element=> allList.push(element))
})
})
})
})
})
setTimeout(function(){
$("#title").html(`( ${allList.length} Plugins )`)
allList.forEach(plugin => {
var statusColor;
var types = plugin.tvTypes?.map(tvType=> {
var whatToReturn = typeTemplate.replace("{{type}}", tvType)
if(tvType == "NSFW") whatToReturn = whatToReturn.replace("{{style}}", "color: red;font-size: 10px;font-weight: bold;")
else whatToReturn = whatToReturn.replace("{{style}}", "font-size: 10px;")
return whatToReturn
})
if(plugin?.status == 0) statusColor = "red"; else if(plugin?.status == 1) statusColor = "green"; else statusColor = "yellow"
$(".plugins > #grid").append(
template
.replace("{{icon_url}}", plugin.iconUrl?.replace("%size%", "128") ?? "https://cdn0.iconfinder.com/data/icons/file-management-system-flat/32/file_managemenr_system_icon_set_flat_style-14-512.png")
.replace("{{status}}", statusColor)
.replace("{{url}}", plugin?.repositoryUrl)
.replace("{{name}}", plugin?.name)
.replace("{{language}}", plugin?.language ?? "Not defined")
.replace("{{authors}}", plugin.authors?.join(", ") || "Not defined")
.replace("{{version}}", plugin?.version)
.replace("{{types}}", types?.join("\n") ?? "")
.replace("{{description}}", plugin?.description ?? "")
)
})
}, 1000)