Skip to content

Commit e1216aa

Browse files
committed
chore: Template upgrade
1 parent 2729c22 commit e1216aa

File tree

3 files changed

+27
-22
lines changed

3 files changed

+27
-22
lines changed

.copier-answers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier
2-
_commit: 1.2.5
2+
_commit: 1.2.6
33
_src_path: gh:pawamoy/copier-pdm
44
author_email: [email protected]
55
author_fullname: Timothée Mazzucotelli

docs/insiders/index.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,10 @@ You can cancel your sponsorship anytime.[^5]
130130

131131
<hr>
132132
<div class="premium-sponsors">
133-
134-
135-
136-
<div id="bronze-sponsors"></div>
133+
<div id="gold-sponsors"></div>
134+
<div id="silver-sponsors"></div>
135+
<div id="bronze-sponsors"></div>
137136
</div>
138-
139137
<hr>
140138

141139
<div id="sponsors"></div>

docs/js/insiders.js

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,26 @@ function getJSON(url, callback) {
2121
xhr.send();
2222
}
2323

24+
function updatePremiumSponsors(dataURL, rank) {
25+
let capRank = rank.charAt(0).toUpperCase() + rank.slice(1);
26+
getJSON(dataURL + `/sponsors${capRank}.json`, function (err, sponsors) {
27+
const sponsorsDiv = document.getElementById(`${rank}-sponsors`);
28+
if (sponsors.length > 0) {
29+
let html = '';
30+
html += `<b>${capRank} sponsors</b><p>`
31+
sponsors.forEach(function (sponsor) {
32+
html += `
33+
<a href="${sponsor.url}" target="_blank" title="${sponsor.name}">
34+
<img alt="${sponsor.name}" src="${sponsor.image}" style="height: ${sponsor.imageHeight}px;">
35+
</a>
36+
`
37+
});
38+
html += '</p>'
39+
sponsorsDiv.innerHTML = html;
40+
}
41+
});
42+
}
43+
2444
function updateInsidersPage(author_username) {
2545
const sponsorURL = `https://github.com/sponsors/${author_username}`
2646
const dataURL = `https://raw.githubusercontent.com/${author_username}/sponsors/main`;
@@ -48,20 +68,7 @@ function updateInsidersPage(author_username) {
4868
}
4969
});
5070
});
51-
getJSON(dataURL + '/sponsorsBronze.json', function (err, sponsors) {
52-
const bronzeSponsors = document.getElementById("bronze-sponsors");
53-
if (sponsors) {
54-
let html = '';
55-
html += '<b>Bronze sponsors</b><p>'
56-
sponsors.forEach(function (sponsor) {
57-
html += `
58-
<a href="${sponsor.url}" target="_blank" title="${sponsor.name}">
59-
<img alt="${sponsor.name}" src="${sponsor.image}" style="height: ${sponsor.imageHeight}px;">
60-
</a>
61-
`
62-
});
63-
html += '</p>'
64-
bronzeSponsors.innerHTML = html;
65-
}
66-
});
71+
updatePremiumSponsors(dataURL, "gold");
72+
updatePremiumSponsors(dataURL, "silver");
73+
updatePremiumSponsors(dataURL, "bronze");
6774
}

0 commit comments

Comments
 (0)