2021-08-19 12:01:44 -07:00
|
|
|
function addThemeTableRow(
|
|
|
|
theme,
|
|
|
|
selectedColumns,
|
|
|
|
selectedTags,
|
|
|
|
selectedFeatures
|
|
|
|
) {
|
2021-08-12 17:23:42 -07:00
|
|
|
let resultsTable = document.getElementById("resultsTable");
|
2021-08-11 11:58:10 -07:00
|
|
|
let resultsTableRow = document.createElement("tr");
|
|
|
|
|
2021-08-14 17:42:01 -07:00
|
|
|
if (selectedColumns.includes("cname")) {
|
|
|
|
let themeTD = document.createElement("td");
|
|
|
|
themeTD.innerHTML =
|
|
|
|
'<a href="' + theme.url + '" target="_blank">' + theme.cname + "</a>";
|
|
|
|
themeTD.style.minWidth = `${theme.cname.length / 6}rem`;
|
|
|
|
resultsTableRow.appendChild(themeTD);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (selectedColumns.includes("date")) {
|
|
|
|
let dateTD = document.createElement("td");
|
|
|
|
dateTD.innerHTML = theme.date;
|
|
|
|
dateTD.style.minWidth = "5rem";
|
|
|
|
resultsTableRow.appendChild(dateTD);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (selectedColumns.includes("num_stars")) {
|
|
|
|
let starsTD = document.createElement("td");
|
|
|
|
starsTD.innerHTML = theme.num_stars;
|
|
|
|
resultsTableRow.appendChild(starsTD);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (selectedColumns.includes("commit")) {
|
|
|
|
let commitTD = document.createElement("td");
|
|
|
|
commitTD.innerHTML = theme.commit;
|
|
|
|
resultsTableRow.appendChild(commitTD);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (selectedColumns.includes("min_ver")) {
|
|
|
|
let minVerTD = document.createElement("td");
|
|
|
|
minVerTD.innerHTML = theme.min_ver;
|
|
|
|
resultsTableRow.appendChild(minVerTD);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (selectedColumns.includes("license")) {
|
|
|
|
let licenseTD = document.createElement("td");
|
|
|
|
licenseTD.innerHTML = theme.license;
|
|
|
|
licenseTD.style.minWidth = `${theme.license.length / 7}rem`;
|
|
|
|
resultsTableRow.appendChild(licenseTD);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (selectedColumns.includes("desc")) {
|
|
|
|
let descTD = document.createElement("td");
|
|
|
|
descTD.innerHTML = theme.desc;
|
|
|
|
descTD.style.minWidth = `${theme.desc.length / 7}rem`;
|
|
|
|
resultsTableRow.appendChild(descTD);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (selectedColumns.includes("tags")) {
|
|
|
|
let tagsTD = document.createElement("td");
|
|
|
|
let tL = theme.tags.length - 1;
|
|
|
|
tL += theme.tags.map((x) => x.length).reduce((a, b) => a + b, 0);
|
2021-08-19 11:53:24 -07:00
|
|
|
let sTags = theme.tags.filter((x) => selectedTags.includes(x));
|
|
|
|
let nsTags = theme.tags.filter((x) => !selectedTags.includes(x));
|
|
|
|
if (sTags.length > 0 && nsTags.length > 0) {
|
|
|
|
tagsTD.innerHTML = `<span style="color: green">${sTags}</span>,${nsTags}`;
|
|
|
|
} else {
|
|
|
|
tagsTD.innerHTML = `<span style="color: green">${sTags}</span>${nsTags}`;
|
|
|
|
}
|
2021-08-14 17:42:01 -07:00
|
|
|
tagsTD.style.minWidth = `${tL / 7}rem`;
|
|
|
|
resultsTableRow.appendChild(tagsTD);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (selectedColumns.includes("features")) {
|
|
|
|
let featuresTD = document.createElement("td");
|
|
|
|
let fL = theme.features.length - 1;
|
|
|
|
fL += theme.features.map((x) => x.length).reduce((a, b) => a + b, 0);
|
2021-08-19 12:01:44 -07:00
|
|
|
let sFeatures = theme.features.filter((x) => selectedFeatures.includes(x));
|
|
|
|
let nsFeatures = theme.features.filter(
|
|
|
|
(x) => !selectedFeatures.includes(x)
|
|
|
|
);
|
|
|
|
if (sFeatures.length > 0 && nsFeatures.length > 0) {
|
|
|
|
featuresTD.innerHTML = `<span style="color: green">${sFeatures}</span>,${nsFeatures}`;
|
|
|
|
} else {
|
|
|
|
featuresTD.innerHTML = `<span style="color: green">${sFeatures}</span>${nsFeatures}`;
|
|
|
|
}
|
|
|
|
// featuresTD.innerHTML = theme.features;
|
2021-08-14 17:42:01 -07:00
|
|
|
featuresTD.style.minWidth = `${fL / 7}rem`;
|
|
|
|
resultsTableRow.appendChild(featuresTD);
|
|
|
|
}
|
2021-08-14 07:21:26 -07:00
|
|
|
|
2021-08-11 11:58:10 -07:00
|
|
|
resultsTable.appendChild(resultsTableRow);
|
2021-08-12 17:23:42 -07:00
|
|
|
}
|