mirror of
https://github.com/tycrek/degoogle.git
synced 2025-08-29 17:40:16 +02:00
Added GitHub Stars badge to build script (resolves #418)
This commit is contained in:
15
_build.js
15
_build.js
@@ -93,6 +93,9 @@ function generateServiceSection(data) {
|
|||||||
// Append the Repo badge to the name
|
// Append the Repo badge to the name
|
||||||
if (item.repo) name = name.concat('<br/>', repoLink(item.repo));
|
if (item.repo) name = name.concat('<br/>', repoLink(item.repo));
|
||||||
|
|
||||||
|
// Append the Star badge to the name
|
||||||
|
if (item.repo) name = name.concat('<br/>', starBadge(item.repo));
|
||||||
|
|
||||||
// Build the row
|
// Build the row
|
||||||
const tableItem = `| ${name} | ${eyes} | ${text} |${EOL}`;
|
const tableItem = `| ${name} | ${eyes} | ${text} |${EOL}`;
|
||||||
|
|
||||||
@@ -122,6 +125,18 @@ function repoLink(repo) {
|
|||||||
return `[](${repo})`;
|
return `[](${repo})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a badge displaying the number of GitHub Stars for a repository.
|
||||||
|
* @param {String} repo The repository url
|
||||||
|
*/
|
||||||
|
function starBadge(repo) {
|
||||||
|
if (repo.startsWith('https://github.com/')) {
|
||||||
|
const [user, repoName] = repo.split('github.com/')[1].split('/');
|
||||||
|
if (!repoName || repoName === '') return '';
|
||||||
|
return ``;
|
||||||
|
} else return '';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a badge displaying user for a Firefox addon/extension
|
* Returns a badge displaying user for a Firefox addon/extension
|
||||||
* @param {String} link URL to extension WITHOUT trailing slash
|
* @param {String} link URL to extension WITHOUT trailing slash
|
||||||
|
Reference in New Issue
Block a user