This commit is contained in:
Zaw 2022-09-13 01:00:10 +03:00
parent cef5a20646
commit 97617a906d
3 changed files with 94 additions and 4 deletions

23
docs/all.html Normal file
View file

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en" style="overflow-x:hidden;">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>All Sites</title>
<link rel="stylesheet" href="./css/index.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="./js/all.js" defer></script>
</head>
<body class="bg-slate-800 text-white m-0 mx-5">
<div class="m-0 my-4">
<div class="repoInfo p-4 h-20 bg-slate-900 rounded-full my-4 text-center border-black border-2 drop-shadow-lg">
<h1 id="title" class="text-xl"></h1>
</div>
<div class="plugins">
<div id="grid" class="grid gap-1 grid-cols-1 sm:grid-cols-4 grid-rows-3 w-10/12 m-auto">
</div>
</div>
</div>
</body>
</html>

60
docs/js/all.js Normal file
View file

@ -0,0 +1,60 @@
var typeTemplate = `<span class="font-light inline-block" style="{{style}}">{{type}}</span>`
var template = `
<div class="plugin flex justify-start flex-col items-center p-4 bg-slate-900 max-h-80 border-black border-2 rounded drop-shadow-md">
<div class="image">
<img class="rounded-full h-12 w-12 sm:h-20 sm:w-20 object-cover" src="{{icon_url}}" onerror="this.onerror=null;this.src='https://cdn0.iconfinder.com/data/icons/file-management-system-flat/32/file_managemenr_system_icon_set_flat_style-14-512.png';">
<svg class="inline relative bottom-6" height="25" width="25">
<circle cx="12.5" cy="12.5" r="10" fill="{{status}}" />
</svg>
</div>
<div class="font-medium text-center break-word">
<span><a href="{{url}}">{{name}}</a></span>
<span class="font-light text-sm block">Language: {{language}}</span>
<span class="font-light text-xs block">Version: {{version}}</span>
<span class="font-light text-xs block">Authors: {{authors}}</span>
{{types}}
<span class="font-light text-sm block">
{{description}}
</span>
</div>
</div>`
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(`<span style="display:block;"><b>( ${allList.length} Plugins )</b></span>`)
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 ?? "")
)
})
}, 400)

View file

@ -22,14 +22,21 @@ var template = `
var rawRepoUrl = "https://raw.githubusercontent.com/ImZaw/cloudstream-extensions-arabic/builds/repo.json" 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 ) { $.getJSON( rawRepoUrl , function( data ) {
var title = data.name var title = data.name
$("#title").text(title)
data.pluginLists.forEach(url => { data.pluginLists.forEach(url => {
$.getJSON( url , function( data ) { $.getJSON( url , function( data ) {
$("#title").html(title + ` <span style="display:block;"><b>( ${data.length} Plugins )</b></span>`)
data.forEach(plugin => { data.forEach(plugin => {
var statusColor; var statusColor;
var types = plugin.tvTypes?.map(tvType=> typeTemplate.replace("{{type}}", tvType)) 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" if(plugin?.status == 0) statusColor = "red"; else if(plugin?.status == 1) statusColor = "green"; else statusColor = "yellow"
$(".plugins > #grid").append( $(".plugins > #grid").append(
template template
@ -38,9 +45,9 @@ $.getJSON( rawRepoUrl , function( data ) {
.replace("{{url}}", plugin?.url) .replace("{{url}}", plugin?.url)
.replace("{{name}}", plugin?.name) .replace("{{name}}", plugin?.name)
.replace("{{language}}", plugin?.language) .replace("{{language}}", plugin?.language)
.replace("{{authors}}", plugin.authors?.join(",")) .replace("{{authors}}", plugin.authors?.join(", ") || "Ghost")
.replace("{{version}}", plugin?.version) .replace("{{version}}", plugin?.version)
.replace("{{types}}", types?.join("\n")) .replace("{{types}}", types?.join("\n") ?? "")
.replace("{{description}}", plugin?.description ?? "") .replace("{{description}}", plugin?.description ?? "")
) )
}) })