Skip to content

Commit

Permalink
slight post layout improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
3vorp committed Jul 9, 2024
1 parent 4d57df5 commit 53f47ce
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 24 deletions.
30 changes: 16 additions & 14 deletions _layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
<h2 class="red banner">This project has been discontinued.</h2>
{%- endif -%}

{%- if page.title -%}
<h2 class="display-3 my-5 text-center">{{ page.title }}</h2>
{%- else -%}
<h2 class="display-3 my-5 text-center">Unknown Title</h2>
{%- endif -%}
<h2 class="display-3 my-5 text-center">
{%- if page.title -%}
{{ page.title }}
{%- else -%}
Unknown Title
{%- endif -%}
</h2>

{%- if page.authors -%}
<h3 class="display my-5 text-center">
Expand Down Expand Up @@ -68,7 +70,7 @@ <h3 class="display my-5 text-center">
</div>

<script>
function ShowFullscreen(img_path) {
function ShowFullscreen(imgPath) {
const modal = document.getElementById('SF')
modal.style.display = 'block'

Expand All @@ -84,7 +86,7 @@ <h3 class="display my-5 text-center">

// set img in modal:
const img = document.getElementById('SF-Img')
img.src = img_path
img.src = imgPath
}
</script>
{%- endif -%}
Expand Down Expand Up @@ -142,16 +144,16 @@ <h2 class="display-4 my-5 text-center">Download</h2>
<script>
const path = "{{ page.main_changelog }}".split('.').shift();

function formatHTML(obj, lvl=3) {
function formatHTML(obj, lvl = 3) {
let result
if (Array.isArray(obj)) {
result = `<ul>${obj.map((e) => formatHTML(e, lvl+1)).join('')}</ul>`;
result = `<ul>${obj.map((e) => formatHTML(e, lvl + 1)).join('')}</ul>`;
} else if (typeof(obj) === 'string') {
result = `<li>${obj}</li>`;
} else {
result = Object.entries(obj)
.map(([key, val]) =>
`<h${lvl} class="card-title text-left">${key}:</h${lvl}>${formatHTML(val, lvl+1)}`)
`<h${lvl} class="card-title text-left">${key}:</h${lvl}>${formatHTML(val, lvl + 1)}`)
.join('');
}
console.log(obj, result);
Expand All @@ -161,11 +163,11 @@ <h2 class="display-4 my-5 text-center">Download</h2>
fetch(`{{ site.baseurl }}/${path}.json`)
.then((response) => response.json())
.then((body) => {
const beta_alpha_regex = /(Alpha|Beta)\s+\d+/;
const match = "{{ page.title }}".match(beta_alpha_regex);
const betaAlphaRegex = /(Alpha|Beta)\s+\d+/;
const match = "{{ page.title }}".match(betaAlphaRegex);
if (match) {
const my_release = body[match[0]];
document.querySelector('#changelog').innerHTML = formatHTML(my_release);
const myRelease = body[match[0]];
document.querySelector('#changelog').innerHTML = formatHTML(myRelease);
}
});
</script>
Expand Down
9 changes: 0 additions & 9 deletions css/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,3 @@
grid-column: span 2;
}
}

.button-2 {
display: flex;
gap: 5px;

& > * {
flex-grow: 1;
}
}
12 changes: 11 additions & 1 deletion css/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2166,4 +2166,14 @@ input[type=radio] {

.faq-answer {
padding-left: 20px;
}
}


.button-2 {
display: flex;
gap: 5px;

& > * {
flex-grow: 1;
}
}

0 comments on commit 53f47ce

Please sign in to comment.