diff --git a/docs/all.html b/docs/all.html new file mode 100644 index 0000000..0234344 --- /dev/null +++ b/docs/all.html @@ -0,0 +1,23 @@ + + + + + + + All Sites + + + + + +
+
+

+
+
+
+
+
+
+ + \ No newline at end of file diff --git a/docs/js/all.js b/docs/js/all.js new file mode 100644 index 0000000..85d2d10 --- /dev/null +++ b/docs/js/all.js @@ -0,0 +1,60 @@ +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 ?? "") + ) + }) +}, 400) \ No newline at end of file diff --git a/docs/js/index.js b/docs/js/index.js index d2f857b..c321500 100644 --- a/docs/js/index.js +++ b/docs/js/index.js @@ -22,14 +22,21 @@ var template = ` 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 - $("#title").text(title) 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=> 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" $(".plugins > #grid").append( template @@ -38,9 +45,9 @@ $.getJSON( rawRepoUrl , function( data ) { .replace("{{url}}", plugin?.url) .replace("{{name}}", plugin?.name) .replace("{{language}}", plugin?.language) - .replace("{{authors}}", plugin.authors?.join(",")) + .replace("{{authors}}", plugin.authors?.join(", ") || "Ghost") .replace("{{version}}", plugin?.version) - .replace("{{types}}", types?.join("\n")) + .replace("{{types}}", types?.join("\n") ?? "") .replace("{{description}}", plugin?.description ?? "") ) })