Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
59 changes: 59 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Build content

on:
push:
paths:
- db/jks.csv
workflow_dispatch:

permissions:
contents: write
pull-requests: write

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
build:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.153.4
steps:
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb

- name: Checkout
uses: actions/checkout@v4
with:
# lfs: true
submodules: recursive

- name: Build piesne
working-directory: hugo
run: |
# Cleanup
rm -fr content/$CONTENT_HOME public/*

# Build
while IFS="," read -r piesen strofa text; do
text=${text//\"/}
CONTENT_FILE="${CONTENT_HOME}/${piesen}.md"

if [[ $strofa -eq 0 ]]; then
hugo new content $CONTENT_FILE -f
sed -i "s|title: .*|title: '${piesen}. ${text}'|" content/$CONTENT_FILE
continue
fi
echo "${strofa}. ${text}" >>content/$CONTENT_FILE
done <$SOURCE_DB
env:
CONTENT_HOME: piesne
SOURCE_DB: ${{ github.workspace }}/db/jks.csv

- name: Create Pull Request
uses: peter-evans/create-pull-request@v8
with:
commit-message: "chore: update content"
delete-branch: true
title: Update content
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "hugo/themes/PaperMod"]
path = hugo/themes/PaperMod
url = https://github.com/adityatelange/hugo-PaperMod.git
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions hugo/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
28 changes: 28 additions & 0 deletions hugo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/

# Go workspace file
go.work
go.work.sum

# env file
.env

.hugo_build.lock
public
9 changes: 9 additions & 0 deletions hugo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Frontend for ejks.sk in Hugo

## Development

```bash
CGO_ENABLED=1 go install -tags extended github.com/gohugoio/hugo@latest
export PATH=$HOME/go/bin:$PATH
git submodule update --init --remote
```
5 changes: 5 additions & 0 deletions hugo/archetypes/default.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
date: '{{ .Date }}'
draft: true
title: '{{ replace .File.ContentBaseName "-" " " | title }}'
---
7 changes: 7 additions & 0 deletions hugo/archetypes/piesne.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: '{{ replace .File.ContentBaseName "-" " " | title }}'
editPost:
URL: 'https://github.com/stanislavbebej/ejks?tab=readme-ov-file#prida%C5%A5-alebo-upravi%C5%A5-piese%C5%88'
Text: 'Navrhnúť opravu'
weight: {{ .File.ContentBaseName }}
---
3 changes: 3 additions & 0 deletions hugo/assets/css/extended/theme-vars-override.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[data-theme="dark"] img {
background-color: var(--primary);
}
152 changes: 152 additions & 0 deletions hugo/assets/js/fastsearch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
import * as params from '@params';

let fuse; // holds our search engine
let resList = document.getElementById('searchResults');
let sInput = document.getElementById('searchInput');
let first, last, current_elem = null
let resultsAvailable = false;

// load our search index
window.onload = function () {
let xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
let data = JSON.parse(xhr.responseText);
if (data) {
// fuse.js options; check fuse.js website for details
let options = {
distance: 100,
threshold: 0.4,
ignoreLocation: true,
keys: [
'title',
'permalink',
'summary',
'content'
]
};
if (params.fuseOpts) {
options = {
isCaseSensitive: params.fuseOpts.iscasesensitive ?? false,
includeScore: params.fuseOpts.includescore ?? false,
includeMatches: params.fuseOpts.includematches ?? false,
minMatchCharLength: params.fuseOpts.minmatchcharlength ?? 1,
shouldSort: params.fuseOpts.shouldsort ?? true,
findAllMatches: params.fuseOpts.findallmatches ?? false,
keys: params.fuseOpts.keys ?? ['title', 'permalink', 'summary', 'content'],
location: params.fuseOpts.location ?? 0,
threshold: params.fuseOpts.threshold ?? 0.4,
distance: params.fuseOpts.distance ?? 100,
ignoreLocation: params.fuseOpts.ignorelocation ?? true
}
}
fuse = new Fuse(data, options); // build the index from the json file
}
} else {
console.log(xhr.responseText);
}
}
};
xhr.open('GET', "index.json");
xhr.send();
}

function activeToggle(ae) {
document.querySelectorAll('.focus').forEach(function (element) {
// rm focus class
element.classList.remove("focus")
});
if (ae) {
ae.focus()
document.activeElement = current_elem = ae;
ae.parentElement.classList.add("focus")
} else {
document.activeElement.parentElement.classList.add("focus")
}
}

function reset() {
resultsAvailable = false;
resList.innerHTML = sInput.value = ''; // clear inputbox and searchResults
sInput.focus(); // shift focus to input box
}

// execute search as each character is typed
sInput.onkeyup = function (e) {
// run a search query (for "term") every time a letter is typed
// in the search box
if (fuse) {
let results;
if (params.fuseOpts) {
results = fuse.search(this.value.trim(), {limit: params.fuseOpts.limit}); // the actual query being run using fuse.js along with options
} else {
results = fuse.search(this.value.trim()); // the actual query being run using fuse.js
}
if (results.length !== 0) {
// build our html if result exists
let resultSet = ''; // our results bucket

for (let item in results) {
resultSet += `<li class="post-entry"><header class="entry-header">${results[item].item.title}&nbsp;»</header>` +
`<a href="${results[item].item.permalink}" aria-label="${results[item].item.title}"></a></li>`
}

resList.innerHTML = resultSet;
resultsAvailable = true;
first = resList.firstChild;
last = resList.lastChild;
} else {
resultsAvailable = false;
resList.innerHTML = '';
}
}
}

sInput.addEventListener('search', function (e) {
// clicked on x
if (!this.value) reset()
})

// kb bindings
document.onkeydown = function (e) {
let key = e.key;
let ae = document.activeElement;

let inbox = document.getElementById("searchbox").contains(ae)

if (ae === sInput) {
let elements = document.getElementsByClassName('focus');
while (elements.length > 0) {
elements[0].classList.remove('focus');
}
} else if (current_elem) ae = current_elem;

if (key === "Escape") {
reset()
} else if (!resultsAvailable || !inbox) {
return
} else if (key === "ArrowDown") {
e.preventDefault();
if (ae == sInput) {
// if the currently focused element is the search input, focus the <a> of first <li>
activeToggle(resList.firstChild.lastChild);
} else if (ae.parentElement != last) {
// if the currently focused element's parent is last, do nothing
// otherwise select the next search result
activeToggle(ae.parentElement.nextSibling.lastChild);
}
} else if (key === "ArrowUp") {
e.preventDefault();
if (ae.parentElement == first) {
// if the currently focused element is first item, go to input box
activeToggle(sInput);
} else if (ae != sInput) {
// if the currently focused element is input box, do nothing
// otherwise select the previous search result
activeToggle(ae.parentElement.previousSibling.lastChild);
}
} else if (key === "ArrowRight") {
ae.click(); // click on active link
}
}
5 changes: 5 additions & 0 deletions hugo/content/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: "Vyhľadať"
placeholder: "Hľadať podľa čísla alebo názvu piesne"
layout: "search"
---
25 changes: 25 additions & 0 deletions hugo/content/info.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
title: "O stránke"
---

Vitajte na stránke **Jednotný Katolícky Spevník** (JKS) určenej pre mobilné zariadenia. Vznikla ako moja osobná iniciatíva katolíka zvyknutého na istý komfort, ktorý mi návštevou svätej omše v inej farnosti ako mojej domácej chýbal.

Vo farnosti Habovka si totiž veriaci nepotrebujú priniesť knižku JKS, pretože piesne sa v kostole počas omše premietajú dataprojektorom na plátno. A tak sa aj veriaci, ktorí bežne so sebou JKS nenosia, zapájajú do omše svojím spevom a spievajú vždy správnu pieseň, správnu strofu a správny text. Existujú totiž staršie a novšie texty piesní a každý si potom spieva tú svoju.

Aj keď v mnohých kostoloch sú JKS k dispozícii pri vstupe do chrámu, nie je to pravidlom. Zobrať si so sebou svoj mobil však zabudnem málokedy. Chýbala mi ale funkčná a jednoduchá forma, ako doň dostať JKS. Na internete sa dá nájsť [oficiálna stránka](http://www.nws.sk/ssv/JKS/index.php?a=123) JKS od Spolku Svätého Vojtecha (SSV). Nie je však určená pre mobilné zariadenia a zrejme kvôli ochrane textov sú tieto zobrazované vo forme obrázka, ktoré okrem ostatných dekorácií, zbytočne spomaľujú jej načítanie. [Ďalší kandidát](https://spevnik.szm.com/), ktorý je zrejme tiež len súkromnou iniciatívou "nespokojného" katolíka a poslúžil ako inšpirácia pre môj projekt, postráda formu a používateľskú prívetivosť pri práci na mobilnom zariadení. Na jednej webstránke sú všetky texty, čo ju na jednej strane umožňuje otvoriť si doma a v kostole s ňou pracovať bez potreby internetu, na druhej strane jej veľkosť spomaľuje jej načítanie cez mobilný internet, ťažko sa na nej pohybuje a obsahuje reklamy.

Môj projekt [elektronickej JKS](https://www.ejks.sk/) sa snaží o stránku s textami piesní z JKS, ktorá by bola:

- prispôsobená pre mobilné zariadenia
- jednoduchá a prehľadná
- rýchla a bez zbytočných obrázkov
- prispôsobiteľná potrebám používateľa
- bez chýb a preklepov
- na ľahko zapamätateľnej adrese
- zadarmo a bez reklám

Stránku som vytvoril vo svojom voľnom čase a prevádzkujem ju z vlastných úspor. Verím, že cena webhostingu a domény nenarastie natoľko, aby som si jej prevádzku nevedel dovoliť. Dúfam, že pomôže aj ostatným častejšie sa zapájať do spevu počas svätej omše, zvlášť mladým ľuďom, ktorí knižku JKS možno v ruke nikdy nedržali, avšak ani svoj mobil nikdy z ruky nepustili :smile:.

Ak by ste stránku vedeli vylepšiť, prípadne chcete len opraviť chybu, jej zdrojový kód je voľne dostupný na [GitHub](https://github.com/stanislavbebej/ejks).

> Pôvodnú verziu stránky nájdete na [GitHub Pages](https://stanislavbebej.github.io/ejks/)
3 changes: 3 additions & 0 deletions hugo/content/noty/preludia/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: "Prelúdiá"
---
4 changes: 4 additions & 0 deletions hugo/content/noty/preludia/c-dur.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: 'C-dur'
---
![SVG](c-dur.svg)
Loading
Loading