fix: 修復 GitLab 網址使用錯誤的 URL
This commit is contained in:
@@ -58,8 +58,13 @@ export function GitlabCardComponent(properties, children) {
|
||||
document.getElementById('${cardUuid}-description').innerText = data.description?.replace(/:[a-zA-Z0-9_]+:/g, '') || "Description not set";
|
||||
document.getElementById('${cardUuid}-forks').innerText = Intl.NumberFormat('en-us', { notation: "compact", maximumFractionDigits: 1 }).format(data.forks_count).replaceAll("\u202f", '');
|
||||
document.getElementById('${cardUuid}-stars').innerText = Intl.NumberFormat('en-us', { notation: "compact", maximumFractionDigits: 1 }).format(data.star_count).replaceAll("\u202f", '');
|
||||
const avatarEl = document.getElementById('${cardUuid}-avatar');
|
||||
document.getElementById('${cardUuid}-avatar').style.backgroundImage = 'url(' + data.namespace.avatar_url + ')';
|
||||
|
||||
const avatar_url = data.namespace.avatar_url;
|
||||
if (avatar_url.startsWith('/')) {
|
||||
document.getElementById('${cardUuid}-avatar').style.backgroundImage = 'url(https://gitlab.com' + avatar_url + ')';
|
||||
} else {
|
||||
document.getElementById('${cardUuid}-avatar').style.backgroundImage = 'url(' + avatar_url + ')';
|
||||
}
|
||||
document.getElementById('${cardUuid}-avatar').style.backgroundColor = 'transparent';
|
||||
document.getElementById('${cardUuid}-card').classList.remove("fetch-waiting");
|
||||
console.log("[GITLAB-CARD] Loaded card for ${repo} | ${cardUuid}.")
|
||||
|
||||
Reference in New Issue
Block a user