var typeTemplate = `{{type}}`
var template = `
{{name}}
Language: {{language}}
Version: {{version}}
Authors: {{authors}}
{{types}}
{{description}}
`
var rawRepoUrl = "https://raw.githubusercontent.com/ImZaw/cloudstream-extensions-arabic/builds/repo.json"
const urlSearchParams = new URLSearchParams(window.location.search);
if(urlSearchParams.get("url")) rawRepoUrl = urlSearchParams.get("url")
$.getJSON( rawRepoUrl , function( data ) {
var title = data.name
data.pluginLists.forEach(url => {
$.getJSON( url , function( data ) {
$("#title").html(title + ` ( ${data.length} Plugins )`)
data.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?.url)
.replace("{{name}}", plugin?.name)
.replace("{{language}}", plugin?.language)
.replace("{{authors}}", plugin.authors?.join(", ") || "Ghost")
.replace("{{version}}", plugin?.version)
.replace("{{types}}", types?.join("\n") ?? "")
.replace("{{description}}", plugin?.description ?? "")
)
})
})
});
});