Add temporary filter by license in Misc

This commit is contained in:
lostinlight 2023-09-29 23:20:42 +03:00
parent e18077d9cb
commit 2321786a24
3 changed files with 60 additions and 21 deletions

View File

@ -335,7 +335,7 @@
"description": "Federated, ActivityPub-compatible social network with friends, walls, and groups.",
"codeLanguage": "Java",
"techStack": "",
"license": "Unlicense (public domain)",
"license": "Public domain",
"FediAccount": "@grishka@mastodon.social",
"apClass": true,
"zotClass": false,
@ -677,7 +677,7 @@
"description": "Federating guild website using GuildWars2 API.",
"codeLanguage": "Go",
"techStack": "",
"license": "-",
"license": "Unknown",
"FediAccount": "@ben@mastodon.lubar.me",
"apClass": true,
"zotClass": false,
@ -731,7 +731,7 @@
"description": "A distributed social network by ActivityPub specification co-author Christopher Lemmer Webber.",
"codeLanguage": "Racket",
"techStack": "",
"license": "Apache-2",
"license": "Apache-2.0",
"FediAccount": "@spritelyproject@octodon.social",
"apClass": true,
"zotClass": false,
@ -1289,7 +1289,7 @@
"description": "ActivityPub compliant, Mastodon-compatible transit alerts generated from GTFS-realtime Service Alerts",
"codeLanguage": "Typescript",
"techStack": "",
"license": "",
"license": "Unknown",
"FediAccount": "",
"apClass": true,
"zotClass": false,
@ -1343,7 +1343,7 @@
"description": "Minimal ActivityPub server built with Laravel.",
"codeLanguage": "PHP",
"techStack": "Laravel",
"license": "-",
"license": "Unknown",
"FediAccount": "@bugle@bugle.lol",
"apClass": true,
"zotClass": false,
@ -1397,7 +1397,7 @@
"description": "Social networking platform compatible with Mastodon, Pleroma, etc.",
"codeLanguage": "Rust",
"techStack": "Svelte",
"license": "-",
"license": "Unknown",
"FediAccount": "",
"apClass": true,
"zotClass": false,

View File

@ -3,28 +3,48 @@ layout: layout
---
<%
function langCount(arr) {
let langs = [];
// function langCount(arr) {
// let langs = [];
// arr.forEach(function(item) {
// let lang = item.codeLanguage;
// if (!lang) {return};
// let check = langs.findIndex(function(x) {return x.language === lang});
// if (check>=0) {
// langs[check].count +=1;
// } else {
// let newLang = {};
// newLang.language = lang;
// newLang.count = 1;
// langs.push(newLang);
// }
// });
// return langs;
// }
function groupByKey(arr, key) {
let results = [];
arr.forEach(function(item) {
let lang = item.codeLanguage;
if (!lang) {return};
let check = langs.findIndex(function(x) {return x.language === lang});
let keyValue = item[key];
if (!keyValue) {return};
let check = results.findIndex(function(x) {return x.name === keyValue});
if (check>=0) {
langs[check].count +=1;
results[check].count +=1;
} else {
let newLang = {};
newLang.language = lang;
newLang.count = 1;
langs.push(newLang);
let newGroup = {};
newGroup.name = keyValue;
newGroup.count = 1;
results.push(newGroup);
}
});
return langs;
return results;
}
const apps = site.data.miscellaneous.apps;
const langList = langCount(apps).sort((a,b) => b.count - a.count);
const langList = groupByKey(apps, "codeLanguage").sort((a,b) => b.count - a.count);
const licenseList = groupByKey(apps, "license").sort((a,b) => b.count - a.count);
const byCategory = [['snMacro', 'Social network (macro)'], ['snMicro', 'Social network (micro)'], ['blogPub', 'Blog and Publishing'], ['media', 'Media sharing'], ['links', 'Link sharing'], ['evMeet', 'Events and Meetups'], ['files', 'File hosting'], ['data', 'Open data'], ['reviews', 'Reviewing'], ['games', 'Gaming'], ['dev', 'Software development'], ['extend', 'Extensions'], ['forums', 'Forums, boards'], ['other', 'Other']];
const byProtocol = [['sortDiaspora', 'diaspora'], ['sortZot', 'Zot'], ['sortAP', 'ActivityPub'], ['sortOstatus', 'OStatus']];
const pattern = /[\s0.-]/g;
%>
<%- partial('_partial/heroheader') %>
@ -46,7 +66,13 @@ layout: layout
<h4>Sort by code language:</h4>
<label class="option" for="all">All</label><input id="all" type="radio" name="radio">
<% for (i in langList) { %>
<label class="option" for="<%= langList[i].language.toLowerCase() %>"><%= langList[i].language %> <span>(<%= langList[i].count %>)</span></label><input id="<%= langList[i].language.toLowerCase() %>" type="radio" name="radio">
<label class="option" for="<%= langList[i].name.toLowerCase() %>"><%= langList[i].name %> <span>(<%= langList[i].count %>)</span></label><input id="<%= langList[i].name.toLowerCase() %>" type="radio" name="radio">
<% } %>
<h4>Sort by license:</h4>
<label class="option" for="all">All</label><input id="all" type="radio" name="radio">
<% for (i in licenseList) { %>
<label class="option" for="<%= licenseList[i].name.toLowerCase().replace(pattern, '') %>"><%= licenseList[i].name %> <span>(<%= licenseList[i].count %>)</span></label><input id="<%= licenseList[i].name.toLowerCase().replace(pattern, '') %>" type="radio" name="radio">
<% } %>
<section class="grid misc__grid cards">
@ -54,7 +80,7 @@ layout: layout
<% let type = apps[item].categories %>
<% let lang = apps[item].codeLanguage.toLowerCase() %>
<button class="card <%= lang %> <% if (apps[item].apClass) { %>ap<% } %> <% if (apps[item].zotClass) { %>zot<% } %> <% if (apps[item].diasporaClass) { %>dia<% } %> <% if (apps[item].OStatusClass) { %>os<% } %> <% for (t in type) { %> <%=type[t]%> <% } %>">
<button class="card <%= lang %> <%= apps[item].license.toLowerCase().replace(pattern, '') %> <% if (apps[item].apClass) { %>ap<% } %> <% if (apps[item].zotClass) { %>zot<% } %> <% if (apps[item].diasporaClass) { %>dia<% } %> <% if (apps[item].OStatusClass) { %>os<% } %> <% for (t in type) { %> <%=type[t]%> <% } %>">
<div class="card__content">
<div class="card__title">

View File

@ -284,7 +284,20 @@
#lisp:checked ~ .misc__grid .card:not(.lisp),
#clojure:checked ~ .misc__grid .card:not(.clojure),
#hare:checked ~ .misc__grid .card:not(.hare),
#nim:checked ~ .misc__grid .card:not(.nim) {
#nim:checked ~ .misc__grid .card:not(.nim),
#agpl3:checked ~ .misc__grid .card:not(.agpl3),
#mit:checked ~ .misc__grid .card:not(.mit),
#gpl3:checked ~ .misc__grid .card:not(.gpl3),
#apache2:checked ~ .misc__grid .card:not(.apache2),
#unknown:checked ~ .misc__grid .card:not(.unknown),
#bsd3clause:checked ~ .misc__grid .card:not(.bsd3clause),
#isc:checked ~ .misc__grid .card:not(.isc),
#publicdomain:checked ~ .misc__grid .card:not(.publicdomain),
#anticapitalist14:checked ~ .misc__grid .card:not(.anticapitalist14),
#lgpl3:checked ~ .misc__grid .card:not(.lgpl3),
#gpl2:checked ~ .misc__grid .card:not(.gpl2),
#ppl3:checked ~ .misc__grid .card:not(.ppl3),
#blueoak:checked ~ .misc__grid .card:not(.blueoak) {
display: none;
}