Skip to content

Commit

Permalink
optional issue subtitle (but just in hebrew)
Browse files Browse the repository at this point in the history
  • Loading branch information
eyaler committed Jan 20, 2024
1 parent c923464 commit d1d31bb
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 33 deletions.
70 changes: 38 additions & 32 deletions resen/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const pages = {

const authors = {
"oulipoh": {
"name": {"": "כתב עת מקוון ליצירה אילוצית וחישובית בעברית (בהקמה)", "en": "An online journal for constrained and computational creation in Hebrew (under construction)"},
"name": {"": "כתב עת מקוון ליצירה אילוצית וחישובית בעברית", "en": "An online journal for constrained and computational creation in Hebrew"},
"mail": "[email protected]",
"github": "",
"sponsors": "",
Expand Down Expand Up @@ -68,28 +68,8 @@ const ui = {
const default_rows_first = true
const default_reorder_contents = true

const default_copyright_url = "https://creativecommons.org/licenses/by/4.0/"
const default_copyright_label = "(CC)(웃)"
const default_force_new_tab_for_mailto_tel = true
const default_new_tab_for_social = true
const default_new_tab_for_footer = true
const default_show_snippet = true
const default_show_author = true

let author_pages_folder = ''
author_pages_folder = author_pages_folder.replace(/^[./]+|[./]+$/g, '')

const social = {
"mail": {"url": "mailto:", "label": "✉"},
"web": {"label": "🏠︎"},
"twitter": {"url": "twitter.com", "label": "🐦"},
"github": {"url": "github.com", "label": "🐱"},
"sponsors": {"url": "github.com/sponsors", "label": "♥"},
"paypal": {"url": "www.paypal.com/donate/?hosted_button_id=", "label": "💸"},
"subscribe": {"url": "forms.gle", "label": "הרשמה לעדכונים"}
}

const kw_labels = {
0: "אפס – מלחמה",
"2d 3d": "רב־ממדי",
"biblical": "תורני",
"cipher": "צופן",
Expand All @@ -112,12 +92,33 @@ const kw_labels = {
"visual": "חזותי"
}

const social = {
"mail": {"url": "mailto:", "label": "✉"},
"web": {"label": "🏠︎"},
"twitter": {"url": "twitter.com", "label": "🐦"},
"github": {"url": "github.com", "label": "🐱"},
"sponsors": {"url": "github.com/sponsors", "label": "♥"},
"paypal": {"url": "www.paypal.com/donate/?hosted_button_id=", "label": "💸"},
"subscribe": {"url": "forms.gle", "label": "הרשמה לעדכונים"}
}

const shortcuts = {
"back": "Alt+Backspace",
"next": "Alt+PageDown",
"prev": "Alt+PageUp"
}

const default_copyright_url = "https://creativecommons.org/licenses/by/4.0/"
const default_copyright_label = "(CC)(웃)"
const default_force_new_tab_for_mailto_tel = true
const default_new_tab_for_social = true
const default_new_tab_for_footer = true
const default_show_snippet = true
const default_show_author = true

let author_pages_folder = ''
author_pages_folder = author_pages_folder.replace(/^[./]+|[./]+$/g, '')


function get_lang() {
return location.search.slice(1) in ui ? location.search.slice(1) : Object.keys(ui)[0]
Expand All @@ -128,7 +129,7 @@ const collator = Intl.Collator(document.documentElement.lang, {numeric: true})


function reorder(list_of_strings, lang='', labels=kw_labels) {
return [...new Set(list_of_strings)].map(String).sort((a, b) => {if (!lang) {a = labels[a] || a, b = labels[b] || b} return collator.compare(a, b)})
return [...new Set(list_of_strings)].map(String).sort((a, b) => {const issues = !!b.match(/^\d+$/) - !!(a.match(/^\d+$/)); if (!lang) a = labels[a] ?? a, b = labels[b] ?? b; return issues || collator.compare(a, b)})
}


Expand Down Expand Up @@ -386,6 +387,17 @@ function set_next_prev_page(page, next, prev, lang, url_kw) {
}


function get_kw_label(kw, lang='') {
let label = lang ? kw : kw_labels[kw] ?? kw
if (kw.match(/^\d+$/)) {
if (!lang && !label.includes(' – '))
label = kw + ' – ' + label
label = ui[lang].issue + ' ' + label
}
return label
}


function make_header(reorder_contents=default_reorder_contents, new_tab_for_social=default_new_tab_for_social) {
const page = get_page()
const lang = get_lang()
Expand Down Expand Up @@ -478,17 +490,11 @@ function make_header(reorder_contents=default_reorder_contents, new_tab_for_soci
keywords.forEach((kw, button_index) => {
button = document.createElement(page == '/' ? 'button' : 'a')
button.id = 'kw_' + sanitize(kw)
let label = kw_labels[kw] || kw
if (kw.match(/^\d+$/))
label = ui[lang].issue + ' ' + kw
const label = get_kw_label(kw, lang)

let alt = ''
if (trans) {
alt = kw
if (kw.match(/^\d+$/))
alt = ui[alt_langs[0]].issue + ' ' + kw
else if (lang)
[label, alt] = [alt, label]
alt = get_kw_label(kw, alt_langs[0])
if (alt == label)
alt = ''
}
Expand All @@ -506,7 +512,7 @@ function make_header(reorder_contents=default_reorder_contents, new_tab_for_soci
})
if (page == '/') {
button = document.createElement('button')
button.ariaLabel = 'אפס בחירות'
button.ariaLabel = 'אַפס בחירות'
button.id = 'kw_x'
button.innerHTML = 'X'
button.onclick = () => div.querySelectorAll('.on').forEach(e => e.click())
Expand Down
2 changes: 1 addition & 1 deletion resen/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ nav[dir=rtl] ~ footer > div {
}

.github, .paypal {
filter: invert(--invert);
filter: invert(var(--invert));
}

h1, h2 {
Expand Down

0 comments on commit d1d31bb

Please sign in to comment.