Skip to content

Commit 72dbfd5

Browse files
Deploy site from fe6f8a4
1 parent 1778175 commit 72dbfd5

4 files changed

Lines changed: 82 additions & 79 deletions

File tree

assets/js/projects.js

Lines changed: 69 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,39 @@
11
// projects section script
22

33
// get project container
4-
let container = document.getElementById("project-container")
4+
let container
55
let org_name = "LizardByte"
66
let base_url = `https://app.${org_name.toLowerCase()}.dev`
77
let cache_repo = "dashboard"
88

99

10+
function onDocumentReady(callback) {
11+
if (document.readyState === "loading") {
12+
document.addEventListener("DOMContentLoaded", callback)
13+
return
14+
}
15+
16+
callback()
17+
}
18+
19+
function fetchWithNoCache(url, options = {}) {
20+
return fetch(url, {
21+
...options,
22+
cache: "no-store",
23+
})
24+
}
25+
26+
function fetchJson(url) {
27+
return fetchWithNoCache(url)
28+
.then(function (response) {
29+
if (!response.ok) {
30+
throw new Error(`Request failed for ${url}: ${response.status}`)
31+
}
32+
33+
return response.json()
34+
})
35+
}
36+
1037
function shouldProcessRepo(repo) {
1138
if (repo['archived'] === true) return false;
1239
if (repo['description'] === null) return false;
@@ -64,16 +91,13 @@ function createCardBody(repo) {
6491
}
6592

6693
function loadCommitActivity(repo, card_footer) {
67-
$.ajax({
68-
url: `${base_url}/${cache_repo}/github/commitActivity/${repo['name']}.json`,
69-
type: "GET",
70-
dataType: "json",
71-
success: function (commitActivity) {
94+
fetchJson(`${base_url}/${cache_repo}/github/commitActivity/${repo['name']}.json`)
95+
.then(function (commitActivity) {
7296
let activity_container = document.createElement("div")
7397
activity_container.className = "commit-activity-graph mt-2 mb-2 mx-3"
7498
activity_container.style.cssText = "display: flex; gap: 2px; height: 32px; align-items: flex-end;"
7599

76-
let maxCommits = Math.max(...commitActivity.map(week => week.total))
100+
let maxCommits = Math.max(...commitActivity.map(week => week.total), 0)
77101

78102
for (let week of commitActivity) {
79103
let bar = document.createElement("div")
@@ -94,11 +118,10 @@ function loadCommitActivity(repo, card_footer) {
94118
}
95119

96120
card_footer.insertBefore(activity_container, card_footer.firstChild)
97-
},
98-
error: function() {
121+
})
122+
.catch(function () {
99123
console.log(`No commit activity data available for ${repo['name']}`)
100-
}
101-
})
124+
})
102125
}
103126

104127
function createRepoDataRow(repo, card_footer, banner_link, card_title_link) {
@@ -116,14 +139,14 @@ function createRepoDataRow(repo, card_footer, banner_link, card_title_link) {
116139
github_link_image.className = "fa-fw fa-brands fa-github"
117140
github_link.prepend(github_link_image)
118141

119-
$.ajax({
120-
url: `${base_url}/${repo['name']}/`,
121-
type: "GET",
122-
success: function () {
142+
fetchWithNoCache(`${base_url}/${repo['name']}/`)
143+
.then(function (response) {
144+
if (!response.ok) return
145+
123146
banner_link.href = `${base_url}/${repo['name']}/`
124147
card_title_link.href = `${base_url}/${repo['name']}/`
125-
},
126-
})
148+
})
149+
.catch(function () {})
127150

128151
let star_link = document.createElement("a")
129152
star_link.className = "nav-link nav-link-sm project-nav-link ms-3 crowdin-ignore"
@@ -184,11 +207,8 @@ function addDocsLink(repo, readthedocs, repo_data_row) {
184207
}
185208

186209
function loadLanguageIcons(repo, card_footer) {
187-
$.ajax({
188-
url: `${base_url}/${cache_repo}/github/languages/${repo['name']}.json`,
189-
type: "GET",
190-
dataType: "json",
191-
success: function (languages) {
210+
fetchJson(`${base_url}/${cache_repo}/github/languages/${repo['name']}.json`)
211+
.then(function (languages) {
192212
let language_data_row = document.createElement("div")
193213
language_data_row.className = "card-group p-3 align-items-center"
194214
card_footer.appendChild(language_data_row)
@@ -202,8 +222,8 @@ function loadLanguageIcons(repo, card_footer) {
202222
language_icon.title = language
203223
language_data_row.append(language_icon)
204224
}
205-
}
206-
});
225+
})
226+
.catch(function () {})
207227
}
208228

209229
function buildRepoCard(repo, readthedocs) {
@@ -234,37 +254,32 @@ function buildRepoCard(repo, readthedocs) {
234254

235255

236256
// create project cards
237-
$(document).ready(function(){
238-
// Set cache = false for all jquery ajax requests.
239-
$.ajaxSetup({
240-
cache: false,
241-
});
242-
243-
// get readthedocs projects
244-
let readthedocs = []
245-
$.ajax({
246-
url: `${base_url}/${cache_repo}/readthedocs/projects.json`,
247-
type: "GET",
248-
dataType: "json",
249-
success: function (data) {
250-
for (let item in data) {
251-
readthedocs.push(data[item])
252-
}
253-
}
254-
});
255-
256-
$.ajax({
257-
url: `${base_url}/${cache_repo}/github/repos.json`,
258-
type: "GET",
259-
dataType:"json",
260-
success: function (result) {
257+
onDocumentReady(function () {
258+
container = document.getElementById("project-container")
259+
if (!container) return
260+
261+
let readthedocsRequest = fetchJson(`${base_url}/${cache_repo}/readthedocs/projects.json`)
262+
.then(function (data) {
263+
return Object.values(data)
264+
})
265+
.catch(function (error) {
266+
console.log("No ReadTheDocs project data available", error)
267+
return []
268+
})
269+
270+
let reposRequest = fetchJson(`${base_url}/${cache_repo}/github/repos.json`)
271+
272+
Promise.all([readthedocsRequest, reposRequest])
273+
.then(function ([readthedocs, result]) {
261274
let sorted = result.sort(globalThis.rankingSorter("stargazers_count", "name"))
262275

263-
for(let repo in sorted) {
264-
if (shouldProcessRepo(sorted[repo])) {
265-
buildRepoCard(sorted[repo], readthedocs)
276+
for (let repo of sorted) {
277+
if (shouldProcessRepo(repo)) {
278+
buildRepoCard(repo, readthedocs)
266279
}
267280
}
268-
}
269-
});
270-
});
281+
})
282+
.catch(function (error) {
283+
console.error("Error loading project data:", error)
284+
})
285+
})
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
$(document).ready(function(){
2-
// remove the widgetbot-crate
3-
$("widgetbot-crate").remove()
4-
});
1+
function removeWidgetbotCrates() {
2+
document.querySelectorAll("widgetbot-crate").forEach(function (crate) {
3+
crate.remove()
4+
})
5+
}
6+
7+
if (document.readyState === "loading") {
8+
document.addEventListener("DOMContentLoaded", removeWidgetbotCrates)
9+
} else {
10+
removeWidgetbotCrates()
11+
}

index.html

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -660,11 +660,6 @@ <h3 class="fw-bolder">Support Center</h3>
660660

661661

662662

663-
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js" integrity="sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g==" crossorigin="anonymous"></script>
664-
665-
666-
667-
668663
<script src="https://cdn.jsdelivr.net/npm/@lizardbyte/shared-web@2026.314.32913/dist/format-number.js"></script>
669664

670665

licenses/index.html

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ <h5 class="card-title mb-0">Dependencies</h5>
435435
<div class="d-flex justify-content-between align-items-center crowdin-ignore">
436436
<div>
437437
<strong class="crowdin-ignore">Chart.js</strong>
438-
<span class="ms-2 badge bg-secondary crowdin-ignore">4.4.9</span>
438+
<span class="ms-2 badge bg-secondary crowdin-ignore">4.5.0</span>
439439
<small class="d-block license-entry-text-muted crowdin-ignore">
440440
<a href="https://www.chartjs.org/" target="_blank" class="license-entry-link crowdin-ignore">https://www.chartjs.org/</a>
441441
</small>
@@ -473,25 +473,11 @@ <h5 class="card-title mb-0">Dependencies</h5>
473473
</li>
474474

475475

476-
<li class="list-group-item license-entry-item crowdin-ignore">
477-
<div class="d-flex justify-content-between align-items-center crowdin-ignore">
478-
<div>
479-
<strong class="crowdin-ignore">jQuery</strong>
480-
<span class="ms-2 badge bg-secondary crowdin-ignore">3.7.1</span>
481-
<small class="d-block license-entry-text-muted crowdin-ignore">
482-
<a href="https://jquery.com/" target="_blank" class="license-entry-link crowdin-ignore">https://jquery.com/</a>
483-
</small>
484-
</div>
485-
<span class="badge bg-primary crowdin-ignore">MIT</span>
486-
</div>
487-
</li>
488-
489-
490476
<li class="list-group-item license-entry-item crowdin-ignore">
491477
<div class="d-flex justify-content-between align-items-center crowdin-ignore">
492478
<div>
493479
<strong class="crowdin-ignore">Marked</strong>
494-
<span class="ms-2 badge bg-secondary crowdin-ignore">15.0.8</span>
480+
<span class="ms-2 badge bg-secondary crowdin-ignore">16.3.0</span>
495481
<small class="d-block license-entry-text-muted crowdin-ignore">
496482
<a href="https://marked.js.org/" target="_blank" class="license-entry-link crowdin-ignore">https://marked.js.org/</a>
497483
</small>

0 commit comments

Comments
 (0)