diff --git a/README.md b/README.md index 879453f..87fcaa6 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Website for NeoForged. Built using [Hugo](https://gohugo.io/). ## Development -Download or install [Hugo v0.118.2](https://github.com/gohugoio/hugo/releases/tag/v0.118.2). (The executable is self-contained.) +Download or install [Hugo](https://github.com/gohugoio/hugo/releases/latest). (The executable is self-contained.) To build the website, run `hugo`. The site files will be found in the `public` directory. diff --git a/assets/js/changelog.js b/assets/js/changelog.js index 90883d3..1d7228c 100644 --- a/assets/js/changelog.js +++ b/assets/js/changelog.js @@ -17,9 +17,9 @@ async function loadChangelog() { versionJson = await response.json(); } catch (error) { if (error instanceof SyntaxError) { - console.log('There was a SyntaxError parsing the JSON response from the maven server.', error); + console.log("There was a SyntaxError parsing the JSON response from the maven server.", error); } else { - console.log('There was an error processing the request for a new version.', error); + console.log("There was an error processing the request for a new version.", error); } } @@ -36,22 +36,43 @@ async function loadChangelog() { data.forEach(line => { if (line.startsWith(" - ")) { - line = line.replace(" - ", `
  • `); - line = line + "
  • "; + const lineVersion = line.substring(line.indexOf("`") + 1, line.indexOf("`", line.indexOf("`") + 1)); + const installerUrl = `${DOWNLOAD_URL}/${gav}/${encodeURIComponent(version)}/${fn}-${encodeURIComponent(version)}-installer.jar`; + line = line.replace("`" + lineVersion + "`", `${lineVersion}`); - const lineVersion = line.substring(line.indexOf('`') + 1, line.indexOf('`', line.indexOf('`') + 1)); - line = line.replace("`" + lineVersion + "`", `${lineVersion}`); + line = line.replace(" - ", `
  • `); + line = line + "
  • "; const pr = line.substring(line.indexOf("(#") + 2, line.indexOf(")", line.indexOf("(#"))); line = line.replace(`(#${pr})`, `(#${pr})`); const mcBadgeText = line.substring(line.indexOf("[") + 1, line.indexOf("]", line.indexOf("["))); line = line.replace(`[${mcBadgeText}]`, `${mcBadgeText}`); - } else { - line = `
  • ` + line + `
  • ` + } else if (line != "") { + if (line != " ") { + line = "▸" + line; + } + + line = `
  • ` + line + `
  • ` line = line.replace("Co-authored-by:", `Co-authored-by`) } + line = line.replace(/`([^`]+)`/g, `$1`); + + if (line.includes("#")) { + const startIndex = line.indexOf("#") + 1; + let endIndex = line.indexOf(" ", startIndex); + + if (endIndex === -1) { + endIndex = line.length - 5; // exclude + } + + const issue = line.substring(startIndex, endIndex); + if (!isNaN(issue)) { + line = line.replace(`#${issue}`, `#${issue}`); + } + } + resultArray.push(line); }); diff --git a/assets/js/neoforge.js b/assets/js/neoforge.js index 933ca14..f378ba4 100644 --- a/assets/js/neoforge.js +++ b/assets/js/neoforge.js @@ -1,8 +1,8 @@ -const VERSIONS_ENDPOINT = 'https://maven.neoforged.net/api/maven/versions/releases/' -const FORGE_GAV = 'net/neoforged/neoforge' -const LEGACY_GAV = 'net/neoforged/forge' -const LATEST_ENDPOINT = 'https://maven.neoforged.net/api/maven/latest/version/releases/' -const DOWNLOAD_URL = 'https://maven.neoforged.net/releases' +const VERSIONS_ENDPOINT = "https://maven.neoforged.net/api/maven/versions/releases/" +const FORGE_GAV = "net/neoforged/neoforge" +const LEGACY_GAV = "net/neoforged/forge" +const LATEST_ENDPOINT = "https://maven.neoforged.net/api/maven/latest/version/releases/" +const DOWNLOAD_URL = "https://maven.neoforged.net/releases" // For the latest version: https://maven.neoforged.net/api/maven/latest/version/releases/net/neoforged/neoforge // For legacy version(s): https://maven.neoforged.net/api/maven/latest/version/releases/net/neoforged/forge?filter=1.20.1 // To filter a specific MC version: https://maven.neoforged.net/api/maven/latest/version/releases/net/neoforged/neoforge?filter=20.4 @@ -26,9 +26,9 @@ async function loadLatestVersions(minecraftVersions) { versionJson = await response.json(); } catch (error) { if (error instanceof SyntaxError) { - console.log('There was a SyntaxError parsing the JSON response from the maven server.', error); + console.log("There was a SyntaxError parsing the JSON response from the maven server.", error); } else { - console.log('There was an error processing the request for a new version.', error); + console.log("There was an error processing the request for a new version.", error); } } @@ -41,7 +41,7 @@ async function loadLatestVersions(minecraftVersions) { badges_beta = `BETA`; } - const vs = `#filelist${mcVersion}`.split('.').join(""); + const vs = `#filelist${mcVersion}`.split(".").join(""); const installerUrl = `${DOWNLOAD_URL}/${gav}/${encodeURIComponent(version)}/${fn}-${encodeURIComponent(version)}-installer.jar`; document.querySelector(vs).innerHTML = ` diff --git a/themes/mainroad/assets/css/style.css b/themes/mainroad/assets/css/style.css index 5894058..3bdedf2 100644 --- a/themes/mainroad/assets/css/style.css +++ b/themes/mainroad/assets/css/style.css @@ -1162,9 +1162,21 @@ summary code:hover { font-family: monospace; } -.changelog-item-desc { +.changelog_item { + border-radius: 5px; + padding: 0 4px; +} + +.changelog_version code:hover { + text-decoration: underline; + filter: brightness(.85); +} + +.changelog_item_desc { list-style-type: none; - padding-left: 20px; + border-radius: 5px; + margin-left: 20px; + padding: 0 4px; } /* News Section */ @@ -1412,6 +1424,7 @@ a.anchor-wrapper:hover, a.anchor-wrapper:focus { --color-code-notice: #e57; --color-code-notice-background: #ffffff85; --color-code-block-background: #2e3135; + --color-changelog-background: #bdc7c7; --color-footer-text: #aab0b3; --color-footer-link-text: #bdc7c7; --color-ends-background: #323232; @@ -1442,6 +1455,7 @@ a.anchor-wrapper:hover, a.anchor-wrapper:focus { --color-code-notice: #e57; --color-code-notice-background: #2e3135; --color-code-block-background: #2e3135; + --color-changelog-background: #2e3135; --color-footer-text: #aab0b3; --color-footer-link-text: #bdc7c7; --color-ends-background: #222222; diff --git a/themes/mainroad/layouts/_default/baseof.html b/themes/mainroad/layouts/_default/baseof.html index b0c750c..53214eb 100644 --- a/themes/mainroad/layouts/_default/baseof.html +++ b/themes/mainroad/layouts/_default/baseof.html @@ -37,7 +37,7 @@ {{- end }} - {{- if not .Site.IsServer }} + {{- if not hugo.IsServer }} {{- if hasPrefix .Site.GoogleAnalytics "G-" }} {{ template "_internal/google_analytics.html" . }} {{- else }} diff --git a/themes/mainroad/layouts/partials/colors.css b/themes/mainroad/layouts/partials/colors.css index 39dbc87..d1ae9e0 100644 --- a/themes/mainroad/layouts/partials/colors.css +++ b/themes/mainroad/layouts/partials/colors.css @@ -400,7 +400,7 @@ details:hover { /* Changelogs */ .changelog_body { - background-color: var(--color-code-block-background); + background-color: var(--color-changelog-background); } .badges_mc { @@ -414,7 +414,15 @@ details:hover { color: var(--color-text); } -.changelog-item-desc { +.changelog_item:hover { + background-color: var(--color-border); +} + +.changelog_item_desc:hover { + background-color: var(--color-background); +} + +.changelog_item_desc { color: var(--color-meta-caption); } diff --git a/themes/mainroad/layouts/partials/comments.html b/themes/mainroad/layouts/partials/comments.html index 50b87a7..4cfefb5 100644 --- a/themes/mainroad/layouts/partials/comments.html +++ b/themes/mainroad/layouts/partials/comments.html @@ -1,4 +1,4 @@ -{{ if and .Site.DisqusShortname (index .Params "comments" | default "true") (not .Site.IsServer) }} +{{ if and .Site.Config.Services.Disqus.Shortname (index .Params "comments" | default "true") (not hugo.IsServer) }}
    {{ template "_internal/disqus.html" . }}