diff --git a/_data/licenses.yml b/_data/licenses.yml index 264dc591..52f455ab 100644 --- a/_data/licenses.yml +++ b/_data/licenses.yml @@ -5,11 +5,13 @@ beautiful-jekyll: license: MIT gamepad-helper: name: LizardByte/gamepad-helper + # renovate: datasource=npm depName=@lizardbyte/gamepad-helper version: '2026.219.34512' url: https://github.com/LizardByte/gamepad-helper/ license: MIT shared-web: name: LizardByte/shared-web + # renovate: datasource=npm depName=@lizardbyte/shared-web version: '2026.314.32913' url: https://github.com/LizardByte/shared-web/ license: AGPL-3.0 @@ -27,7 +29,8 @@ button-icons: license: CC BY 3.0 chartjs: name: Chart.js - version: '4.4.9' + # renovate: datasource=cdnjs depName=Chart.js packageName=Chart.js/chart.umd.min.js versioning=semver + version: '4.5.0' url: https://www.chartjs.org/ license: MIT giscus: @@ -38,13 +41,9 @@ jekyll: name: Jekyll url: https://jekyllrb.com/ license: MIT -jquery: - name: jQuery - version: '3.7.1' - url: https://jquery.com/ - license: MIT marked: name: Marked - version: '15.0.8' + # renovate: datasource=cdnjs depName=marked packageName=marked/lib/marked.umd.min.js versioning=semver + version: '16.3.0' url: https://marked.js.org/ license: MIT diff --git a/assets/js/projects.js b/assets/js/projects.js index 5663c786..ef86addf 100644 --- a/assets/js/projects.js +++ b/assets/js/projects.js @@ -1,12 +1,39 @@ // projects section script // get project container -let container = document.getElementById("project-container") +let container let org_name = "LizardByte" let base_url = `https://app.${org_name.toLowerCase()}.dev` let cache_repo = "dashboard" +function onDocumentReady(callback) { + if (document.readyState === "loading") { + document.addEventListener("DOMContentLoaded", callback) + return + } + + callback() +} + +function fetchWithNoCache(url, options = {}) { + return fetch(url, { + ...options, + cache: "no-store", + }) +} + +function fetchJson(url) { + return fetchWithNoCache(url) + .then(function (response) { + if (!response.ok) { + throw new Error(`Request failed for ${url}: ${response.status}`) + } + + return response.json() + }) +} + function shouldProcessRepo(repo) { if (repo['archived'] === true) return false; if (repo['description'] === null) return false; @@ -64,16 +91,13 @@ function createCardBody(repo) { } function loadCommitActivity(repo, card_footer) { - $.ajax({ - url: `${base_url}/${cache_repo}/github/commitActivity/${repo['name']}.json`, - type: "GET", - dataType: "json", - success: function (commitActivity) { + fetchJson(`${base_url}/${cache_repo}/github/commitActivity/${repo['name']}.json`) + .then(function (commitActivity) { let activity_container = document.createElement("div") activity_container.className = "commit-activity-graph mt-2 mb-2 mx-3" activity_container.style.cssText = "display: flex; gap: 2px; height: 32px; align-items: flex-end;" - let maxCommits = Math.max(...commitActivity.map(week => week.total)) + let maxCommits = Math.max(...commitActivity.map(week => week.total), 0) for (let week of commitActivity) { let bar = document.createElement("div") @@ -94,11 +118,10 @@ function loadCommitActivity(repo, card_footer) { } card_footer.insertBefore(activity_container, card_footer.firstChild) - }, - error: function() { + }) + .catch(function () { console.log(`No commit activity data available for ${repo['name']}`) - } - }) + }) } function createRepoDataRow(repo, card_footer, banner_link, card_title_link) { @@ -116,14 +139,14 @@ function createRepoDataRow(repo, card_footer, banner_link, card_title_link) { github_link_image.className = "fa-fw fa-brands fa-github" github_link.prepend(github_link_image) - $.ajax({ - url: `${base_url}/${repo['name']}/`, - type: "GET", - success: function () { + fetchWithNoCache(`${base_url}/${repo['name']}/`) + .then(function (response) { + if (!response.ok) return + banner_link.href = `${base_url}/${repo['name']}/` card_title_link.href = `${base_url}/${repo['name']}/` - }, - }) + }) + .catch(function () {}) let star_link = document.createElement("a") 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) { } function loadLanguageIcons(repo, card_footer) { - $.ajax({ - url: `${base_url}/${cache_repo}/github/languages/${repo['name']}.json`, - type: "GET", - dataType: "json", - success: function (languages) { + fetchJson(`${base_url}/${cache_repo}/github/languages/${repo['name']}.json`) + .then(function (languages) { let language_data_row = document.createElement("div") language_data_row.className = "card-group p-3 align-items-center" card_footer.appendChild(language_data_row) @@ -202,8 +222,8 @@ function loadLanguageIcons(repo, card_footer) { language_icon.title = language language_data_row.append(language_icon) } - } - }); + }) + .catch(function () {}) } function buildRepoCard(repo, readthedocs) { @@ -234,37 +254,32 @@ function buildRepoCard(repo, readthedocs) { // create project cards -$(document).ready(function(){ - // Set cache = false for all jquery ajax requests. - $.ajaxSetup({ - cache: false, - }); - - // get readthedocs projects - let readthedocs = [] - $.ajax({ - url: `${base_url}/${cache_repo}/readthedocs/projects.json`, - type: "GET", - dataType: "json", - success: function (data) { - for (let item in data) { - readthedocs.push(data[item]) - } - } - }); - - $.ajax({ - url: `${base_url}/${cache_repo}/github/repos.json`, - type: "GET", - dataType:"json", - success: function (result) { +onDocumentReady(function () { + container = document.getElementById("project-container") + if (!container) return + + let readthedocsRequest = fetchJson(`${base_url}/${cache_repo}/readthedocs/projects.json`) + .then(function (data) { + return Object.values(data) + }) + .catch(function (error) { + console.log("No ReadTheDocs project data available", error) + return [] + }) + + let reposRequest = fetchJson(`${base_url}/${cache_repo}/github/repos.json`) + + Promise.all([readthedocsRequest, reposRequest]) + .then(function ([readthedocs, result]) { let sorted = result.sort(globalThis.rankingSorter("stargazers_count", "name")) - for(let repo in sorted) { - if (shouldProcessRepo(sorted[repo])) { - buildRepoCard(sorted[repo], readthedocs) + for (let repo of sorted) { + if (shouldProcessRepo(repo)) { + buildRepoCard(repo, readthedocs) } } - } - }); -}); + }) + .catch(function (error) { + console.error("Error loading project data:", error) + }) +}) diff --git a/assets/js/remove-widgetbot-crate.js b/assets/js/remove-widgetbot-crate.js index fb8a679d..9de6c34e 100644 --- a/assets/js/remove-widgetbot-crate.js +++ b/assets/js/remove-widgetbot-crate.js @@ -1,4 +1,11 @@ -$(document).ready(function(){ - // remove the widgetbot-crate - $("widgetbot-crate").remove() -}); +function removeWidgetbotCrates() { + document.querySelectorAll("widgetbot-crate").forEach(function (crate) { + crate.remove() + }) +} + +if (document.readyState === "loading") { + document.addEventListener("DOMContentLoaded", removeWidgetbotCrates) +} else { + removeWidgetbotCrates() +} diff --git a/index.html b/index.html index 68b2ed75..e5b65c73 100644 --- a/index.html +++ b/index.html @@ -11,8 +11,6 @@ - /assets/img/banners/AdobeStock_306976163_1920x1280.jpg - /assets/img/banners/AdobeStock_372471479_1920x1280.jpg ext-js: - - href: "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js" - sri: "sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g==" - href: "https://cdn.jsdelivr.net/npm/@lizardbyte/shared-web@2026.314.32913/dist/format-number.js" - href: "https://cdn.jsdelivr.net/npm/@lizardbyte/shared-web@2026.314.32913/dist/ranking-sorter.js" js: