Skip to content

Commit

Permalink
change tags, add translator role, add alex's down
Browse files Browse the repository at this point in the history
  • Loading branch information
eyaler committed Jan 13, 2024
1 parent 8a545df commit a291d9f
Show file tree
Hide file tree
Showing 14 changed files with 149 additions and 45 deletions.
Binary file modified resen/achshav/snippet
Binary file not shown.
Binary file added resen/down/down.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions resen/down/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="he" dir="rtl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="preload" as="style" href="https://fonts.googleapis.com/css2?family=Miriam+Libre:wght@400;700&display=block">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Miriam+Libre:wght@400;700&display=block">
<link rel="stylesheet" href="../style.css">
<link rel="stylesheet" href="style.css">
<script src="../pages.js"></script>
<script src="script.js"></script>
<meta property="og:image" content="https://oulipoh.com/resen/cent/snippet">
<noscript><style>body {visibility: visible}</style></noscript>
</head>
<body onload="document.body.style.visibility = 'visible'">
<script>
make_header()
make_footer()
</script>
</body>
</html>
23 changes: 23 additions & 0 deletions resen/down/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
let down, origin_x, origin_y, origin_bg_pos_x, origin_bg_pos_y

document.addEventListener('pointerdown', e => {
down = true
origin_x = e.clientX
origin_y = e.clientY
})

document.addEventListener('pointerup', () => {
down = false
const style = getComputedStyle(document.body)
origin_bg_pos_x = parseInt(style.getPropertyValue('background-position-x'))
origin_bg_pos_y = parseInt(style.getPropertyValue('background-position-y'))
})

document.addEventListener('pointermove', e => {
if (!down)
return
document.body.style.backgroundPositionX = Math.max(0, Math.min((origin_x-e.clientX) / 45 + origin_bg_pos_x, 100)) + '%'
document.body.style.backgroundPositionY = Math.max(0, Math.min((origin_y-e.clientY) / 25 + origin_bg_pos_y, 100)) + '%'
})

addEventListener('load', () => document.dispatchEvent(new Event('pointerup')))
Binary file added resen/down/snippet
Binary file not shown.
21 changes: 21 additions & 0 deletions resen/down/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
html {
overscroll-behavior: none;
}

body {
background-image: url('down.jpg');
background-position: 43% 40%;
background-repeat: no-repeat;
background-size: 500%;
--fg_dim: var(--fg);
user-select: none;
-webkit-user-select: none;
}

footer, h1, h2, nav {
text-shadow: var(--bg) 0 0 2px;
}

nav {
background: none;
}
2 changes: 1 addition & 1 deletion resen/journal.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
וגיוון של קהילת הקוראים והחוקרים בתחום. יתפרסמו בו יצירות מקור, תרגומים וביצועים מחדש
של יצירות מן העולם וכן מאמרים ומסות בנושאי יצירה אילוצית וחישובית.
</p>
<p>כתב העת רֶסֶן הופק בסיוע <a href="https://culture.pais.co.il/Pages/default.aspx">מועצת הפיס לתרבות ולאומנות</a> (20,000 ש"ח), ובסיוע מענק מיוחד מטעם <a href="https://www.rabinovichfoundation.org.il/">קרן יהושע רבינוביץ לאומנויות תל-אביב</a> (8,000 ש"ח).</p>
<p>כתב העת רֶסֶן הופק בסיוע <a href="https://culture.pais.co.il/Pages/default.aspx">מועצת הפיס לתרבות ולאומנות</a> (20,000 ש"ח), ובסיוע מענק מיוחד מטעם <a href="https://www.rabinovichfoundation.org.il/">קרן יהושע רבינוביץ לאומנויות תל־אביב</a> (8,000 ש"ח).</p>
<div class="images" style="--max_height: 500px; --min_width: 200px">
<img src="media/pais.png" alt="לוגו מפעל הפיס">
<img src="media/rabinovich.png" alt="לוגו קרן רבינוביץ">
Expand Down
55 changes: 39 additions & 16 deletions resen/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,38 @@ const pages = {
"/": {title: "רֶסֶן", alt: "Resen", author: "oulipoh", skip: true},

"achshav/": {title: "אָח־שָׁב – עַכְ־שָׁו", alt: "Ach-Shav", author: "brunogrife", kw: [0, "sound"]},
"cent/": {title: "מתוך \"מאה תמונות מלחמה\"", alt: "From \"One hundred visions of war\"", author: "julienvocance", translator: "rotematar", kw: [0, "poem"]},
"cent/": {title: "מתוך מאה תמונות מלחמה", alt: "From One hundred visions of war", author: "julienvocance", translator: "rotematar", kw: [0, "poem"]},
"disappearance/": {title: "היעלמות", alt: "Disappearance", author: "rotematar", kw: [0, "story"]},
"exceeding/": {title: "מֵעֵבר לַשלם", alt: "Exceeding the entirety", author: ["mikamilgrom", "avimilgrom"], kw: [0, "audiovisual", "live code", "software"]},
"down/": {title: "רע", alt: "Down", author: "alexbenari", kw: [0, "interactive", "poem", "visual"]},
"exceeding/": {title: "מֵעֵבר לַשלם", alt: "Exceeding the entirety", author: ["mikamilgrom", "avimilgrom"], kw: [0, "live code", "visual"]},
"imagine/": {title: "דמיין", alt: "/imagine", author: "liorzalmanson", kw: [0, "poem"]},
"petri/": {title: "פואטיקת פטרי פטריוטית", alt: "Patriotic Petri Poetry", author: "eyalgruss", kw: [0, "audiovisual", "live code", "poem", "software"]},
"petri/": {title: "פואטיקת פטרי פטריוטית", alt: "Patriotic Petri Poetry", author: "eyalgruss", kw: [0, "live code", "poem", "software", "visual"]},
"things/": {title: "קורים עכשיו דברים עם השפה", alt: "Things are happening now with the language", author: "noashaham", kw: [0, "poem"]},
"systems/": {title: "מערכות", alt: "Systems", author: "noashaham", kw: [0, "poem"]},
"journal": {title: "אודות כתב העת", alt: "About this journal", author: "oulipoh"}
}

const kw_labels = {
"2d 3d": "רב־ממדי",
"audiovisual": "אורקולי",
"biblical": "תורני",
"cipher": "צופן",
"combinatorial": "קומבינטורי",
"constraint combo": "שילוב אילוצים",
"data available": "נתונים להורדה",
"discourse": "שיח באילוצים",
"hebrew cheatery": "מִרמת העברית",
"interactive": "אינטראקטיבי",
"live code": "קוד חי",
"new constraint": "אילוץ חדש",
"palindrome": "פלינדרום",
"pangram": "פנגרמה",
"poem": "שיר",
"record": "שיא",
"self-referral": "מתייחס לעצמו",
"self referral": "מתייחס לעצמו",
"software": "תוכנה",
"sound": "צלילים",
"story": "סיפור"
"story": "סיפור",
"visual": "חזותי"
}

const social = {
Expand All @@ -51,6 +53,9 @@ const authors = {
"github": "",
"subscribe": "ayPSSeHk3KL4ALGa9"
},
"alexbenari": {
"name": {"": "אלכס בן־ארי", "en": "Alex Ben Ari"}
},
"avimilgrom": {
"name": {"": "אבי מילגרום", "en": "Avi Milgrom"}
},
Expand Down Expand Up @@ -97,8 +102,8 @@ const default_copyright_url = "https://creativecommons.org/licenses/by/4.0/"
const default_copyright_symbol = "(CC)(&#xc6c3;)"

const ui = {
"": {"next": "הבא", "prev": "הקודם", "lang": "עברית", "theme_name": "עיצוב של מתכנת", "theme": "תבנית", "copyright": "", "issue": "גיליון", "translator": "תורגם על ידי"},
"en": {"next": "next", "prev": "prev", "lang": "english", "theme_name": "Designed by a programmer", "theme": "Theme", "copyright": "", "issue": "issue", "translator": "translated by", "dir": "ltr"}
"": {"next": "הבא", "prev": "הקודם", "lang": "עברית", "theme_name": "עיצוב של מתכנת", "theme": "תבנית", "copyright": "", "issue": "גיליון", "translator": "(תרגום)"},
"en": {"next": "next", "prev": "prev", "lang": "english", "theme_name": "Designed by a programmer", "theme": "Theme", "copyright": "", "issue": "issue", "translator": "(translator)", "dir": "ltr"}
}

const shortcuts = {
Expand Down Expand Up @@ -213,7 +218,12 @@ function open_internal_link(elem) {


function sanitize(kw) {
return String(kw).replace(/[^\w]/g, '').toLowerCase()
return String(kw).replace(/\W/g, '').toLowerCase()
}


function merge(...lists) {
return lists.map(list => list ?? []).flat();
}


Expand All @@ -239,7 +249,7 @@ function make_contents(show_snippet=default_show_snippet, show_author=default_sh
img.src = page + 'snippet'
}

[...new Set([pages[page].hazard ?? [], pages[page].hazards ?? []].flat())].forEach(hazard => {
[...new Set(merge(pages[page].hazard, pages[page].hazards))].forEach(hazard => {
const meta = document.createElement('meta')
meta.setAttribute('itemprop', 'accessibilityHazard')
meta.content = hazard
Expand All @@ -252,12 +262,16 @@ function make_contents(show_snippet=default_show_snippet, show_author=default_sh
p.appendChild(a)

if (show_author) {
const authors = get_make_author(page, lang)[0].map(harden)
let [authors, alt_authors] = get_make_author(page, lang)
authors = authors.map(harden)
alt_authors = alt_authors.map(harden)
if (authors && authors.join() != contents_authors) {
const span = document.createElement('span')
authors.forEach((author, i) => {
const s = document.createElement('span')
s.innerHTML = author
if (alt_authors[i] != author)
s.title = alt_authors[i]
span.appendChild(s)
})
p.appendChild(span)
Expand Down Expand Up @@ -531,7 +545,8 @@ function make_header(reorder_contents=default_reorder_contents, new_tab_for_soci
function get_make_author(page, lang, make, new_tab_for_social=default_new_tab_for_social) {
page ??= get_page()
lang ??= get_lang()
let keys = [...new Set([pages[page].author ?? [], pages[page].authors ?? [], pages[page].translator ?? [], pages[page].translators ?? []].flat())]
const translators = merge(pages[page].translator, pages[page].translators)
let keys = [...new Set(merge(pages[page].author, pages[page].authors, translators))]
if (make && authors && !keys.length)
keys = Object.keys(authors).slice(0, 1)
let all_names = []
Expand All @@ -551,9 +566,17 @@ function get_make_author(page, lang, make, new_tab_for_social=default_new_tab_fo
if (names) {
name = names[lang] || names[''] || Object.values(names)[0] || name
alt_name = Object.entries(names).filter(([k, v]) => k != lang && v).map(x => x[1])[0]
if (translators.includes(key)) {
const alt_langs = Object.keys(ui).filter(k => k != lang)
if (alt_langs.length)
alt_name += ' ' + ui[alt_langs[0]].translator
}
if (make && lang in names && alt_name)
h2.title = alt_name
}
if (translators.includes(key))
name += ' ' + ui[lang].translator

all_names.push(name)
all_alt_names.push(alt_name || name)

Expand Down Expand Up @@ -600,8 +623,8 @@ function make_footer(copyright_url=default_copyright_url, copyright_symbol=defau
let span = document.createElement('span')
span.innerHTML += ui[lang].theme + ':&nbsp;'
span.appendChild(make_link([...document.scripts].flatMap(s => s.src || [])[0], ui[lang].theme_name, 'nowrap', null, new_tab_for_footer))
const flex = document.createElement('div')
flex.appendChild(span)
const div = document.createElement('div')
div.appendChild(span)

if (ui[lang].copyright) {
span = document.createElement('span')
Expand All @@ -611,11 +634,11 @@ function make_footer(copyright_url=default_copyright_url, copyright_symbol=defau
bdi.className = 'nowrap'
bdi.innerHTML = copyright_symbol
span.appendChild(bdi)
flex.appendChild(span)
div.appendChild(span)
}

const footer = document.createElement('footer')
footer.appendChild(flex)
footer.appendChild(div)
document.body.appendChild(footer)
}

Expand Down
2 changes: 1 addition & 1 deletion resen/petri/petri.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"זעם עזה": 1
},

"labels": {"רבייה_ישראל": "BREEDING_ISRAEL", "צבא": "MILITARY", "בית עלמין עזה": "GAZA CEMETERY", "מבצע": "OPERATION", "זעם עזה": "GAZA WRATH", "ישראל": "ISRAEL", "שחרור": "DISCHARGE", "פטירה_עזה": "PASSING_GAZA", "עזה": "GAZA", "הסתה": "INCITING", "זעם ישראל": "ISRAEL WRATH", "חטיפה": "ABDUCTION", "שבי": "CAPTIVITY", "רבייה_עזה": "BREEDING_GAZA", "בית עלמין ישראל": "ISRAEL CEMETERY", "פיגוע": "TERROR ATTACK", "ארגון טרור": "TERROR GROUP", "חילוף": "EXCHANGE", "כלא": "PRISON", "פטירה_ישראל": "PASSING_ISRAEL"},
"labels": {"רבייה_ישראל": "BREEDING_ISRAEL", "צבא": "MILITARY", "בית עלמין עזה": "GAZA CEMETERY", "מבצע": "OPERATION", "זעם עזה": "GAZA WRATH", "ישראל": "ISRAEL", "שחרור": "DISCHARGE", "פטירה_עזה": "PASSING_GAZA", "עזה": "GAZA", "הסתה": "INCITEMENT", "זעם ישראל": "ISRAEL WRATH", "חטיפה": "ABDUCTION", "שבי": "CAPTIVITY", "רבייה_עזה": "BREEDING_GAZA", "בית עלמין ישראל": "ISRAEL CEMETERY", "פיגוע": "TERROR ATTACK", "ארגון טרור": "TERROR GROUP", "חילוף": "EXCHANGE", "כלא": "PRISON", "פטירה_ישראל": "PASSING_ISRAEL"},

"require": [
["ישראל", "צבא"],
Expand Down
41 changes: 24 additions & 17 deletions resen/petri/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const label_location = '' // Can be: 'half' (half above and half below, favorin
const default_token_symbol = 'o' // Cannot be of 1-9 or capital A-N
const arrow_width = 6
const arrow_height = 1
const arrow_diagonal = 4
const diagonal_offset = 19
const comp_marking = 5

const lang = get_lang()
Expand Down Expand Up @@ -43,21 +45,24 @@ function center(label, width, align_start=false) {
return label.padEnd((width+sanitized_len(label)+align_start) / 2).padStart(width)
}

function diagonals(trans, ts, te, bs, be) {
if (!ts && !te && !bs && !be)
return trans
trans_lines = trans.trim().split('\n')
const width = Math.max(...trans_lines.map(l => sanitized_len(l))) + 6
let arrow_ts = arrow_te = arrow_bs = arrow_be = ' '
function diagonal_arrows(ts, te, bs, be) {
let arrow_ts = arrow_te = arrow_bs = arrow_be = ' '.repeat(arrow_diagonal + 1)
const slashes = '/'.repeat(arrow_diagonal)
const backslashes = '\\'.repeat(arrow_diagonal)
if (ts)
arrow_ts = ts == 1 ? '//v' : '^//'
arrow_ts = ts == 1 ? 'v' + slashes : slashes + '^'
if (te)
arrow_te = te == 1 ? '\\\\v' : '^\\\\'
arrow_te = te == 1 ? 'v' + backslashes : backslashes + '^'
if (bs)
arrow_bs = bs == 1 ? '\\\\^' : 'v\\\\'
arrow_bs = bs == 1 ? '^' + backslashes : backslashes + 'v'
if (be)
arrow_be = be == 1 ? '//^' : 'v//'
return [arrow_ts[0] + ' '.repeat(width + 4) + arrow_te[0], arrow_ts[1] + ' '.repeat(width + 2) + arrow_te[1], arrow_ts[2] + ' '.repeat(width) + arrow_te[2], '', trans, '', arrow_bs[2] + ' '.repeat(width) + arrow_be[2], arrow_bs[1] + ' '.repeat(width + 2) + arrow_be[1], arrow_bs[0] + ' '.repeat(width + 4) + arrow_be[0]].join('\n')
arrow_be = be == 1 ? '^' + slashes : slashes + 'v'
diagonals = Array(3).fill('')
for (const i in arrow_ts) {
const spaces = ' '.repeat(diagonal_offset + 2*i)
diagonals = [arrow_ts[i] + spaces + arrow_te[i] , ...diagonals, arrow_bs[i] + spaces + arrow_be[i]]
}
return diagonals.join('\n')
}

function trans_hor_symbol(label, len) {
Expand Down Expand Up @@ -153,7 +158,7 @@ function step(grid, json, steps=0, max_tokens={}, result_counter={}, reset_count
const width = max_len(transitions.filter(t => !is_vertical(grid, t)), json.labels)
const height = max_len(transitions.filter(t => is_vertical(grid, t)), json.labels, true)

const long_arrows = []
const other_arrows = []
const elems = grid.querySelectorAll('pre')
let cols = grid_columns
if (comp)
Expand All @@ -178,6 +183,7 @@ function step(grid, json, steps=0, max_tokens={}, result_counter={}, reset_count
elem.style.color = enabled.includes(elem.dataset.id) ? 'var(--enabled)' : 'inherit'
let ts = te = bs = be = 0
new Set(json.transitions[elem.dataset.id].slice(0, 2).flat()).forEach(place => {
elem.firstChild.textContent = is_vertical(grid, elem.dataset.id) ? trans_ver_symbol(label, height) : trans_hor_symbol(label, width)
const inp = json.transitions[elem.dataset.id][0].filter(p => p == place).length
const out = json.transitions[elem.dataset.id][1].filter(p => p == place).length
const pelem = grid.querySelector(`[data-id="${place}"]`)
Expand All @@ -200,7 +206,7 @@ function step(grid, json, steps=0, max_tokens={}, result_counter={}, reset_count
else if (elem.parentElement.children[index + cols] == pelem)
elem.parentElement.children[index + cols].dataset.before = arrows(out, inp, 1)
else
long_arrows.push([elem, pelem, inp, out])
other_arrows.push([elem, pelem, inp, out])
} else if (!comp)
if (elem.previousSibling == pelem && index % cols)
elem.previousSibling.firstChild.dataset.after = arrows(inp, out, '')
Expand All @@ -211,9 +217,10 @@ function step(grid, json, steps=0, max_tokens={}, result_counter={}, reset_count
else if (elem.parentElement.children[index + cols] == pelem)
elem.dataset.after = arrows(out, inp)
else
long_arrows.push([elem, pelem, inp, out])
elem.textContent = diagonals(is_vertical(grid, elem.dataset.id) ? trans_ver_symbol(label, height) : trans_hor_symbol(label, width), ts, te, bs, be)
other_arrows.push([elem, pelem, inp, out])
})
if (ts || te || bs || be)
elem.firstChild.dataset.before = diagonal_arrows(ts, te, bs, be)
} else {
elem.firstChild.textContent = place_symbol(label, tokens[elem.dataset.id], elem.classList.contains('above'))
if (!steps) {
Expand Down Expand Up @@ -307,11 +314,11 @@ fetch(json_file).then(response => response.json()).then(json => {
} else {
pre.classList.add('place')
pre.addEventListener('click', () => pre.dataset.clicks = (pre.dataset.clicks | 0) + 1)
const span = document.createElement('span')
pre.appendChild(span)
if (json.above?.includes(label) || !anti_above.includes(label) && (label_location == 'above' || label_location == 'half' && index < (labels.length/cols/2 | 0) * cols))
pre.classList.add('above')
}
const span = document.createElement('span')
pre.appendChild(span)
grid.appendChild(pre)
})
step(grid, json)
Expand Down
Loading

0 comments on commit a291d9f

Please sign in to comment.