From 41c44d8ea68a66c9a7cb3cf1bc98bcd0e2b28e63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Sat, 8 Dec 2018 08:57:17 +0100 Subject: [PATCH 1/3] style.css: fix format of menu --- index.php | 3 +-- style.css | 7 ++++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/index.php b/index.php index a9ca721c..6694fdc0 100644 --- a/index.php +++ b/index.php @@ -73,8 +73,7 @@ html_export_var(array(
diff --git a/style.css b/style.css index dd79e415..bd534dc4 100644 --- a/style.css +++ b/style.css @@ -139,13 +139,18 @@ a:active { } #menu li { display: inline-block; + margin: 1px 0; } #menu li::after { - content: ' |'; + content: '|'; + margin: 1px 0.25em; } #menu li:last-of-type::after { content: ''; } +#menu li:first-of-type { + margin-left: 0.25em; +} @media all and (max-height: 400px) { #sidebar { From ac57d65acf22c4f20843da8cd85e1c1a8ecbd61a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Sat, 8 Dec 2018 08:58:21 +0100 Subject: [PATCH 2/3] state: call hook 'state-update' with final state & hash --- src/state.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/state.js b/src/state.js index 3eb0a8d1..0762058e 100644 --- a/src/state.js +++ b/src/state.js @@ -144,6 +144,8 @@ function update (state, push) { var newHash = '#' + stringify(state) + call_hooks('state-update', state, newHash) + if (push) { history.pushState(null, null, newHash) call_hooks('statePush', state, newHash) From 6213b99b2a342a6923b7ab90ff8b4062a1559932 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Sat, 8 Dec 2018 08:58:43 +0100 Subject: [PATCH 3/3] Permalink: add a permalink to the menu --- lang/ast.json | 1 + lang/ca.json | 1 + lang/cs.json | 1 + lang/da.json | 1 + lang/de.json | 1 + lang/el.json | 1 + lang/en.json | 1 + lang/es.json | 1 + lang/et.json | 1 + lang/fr.json | 1 + lang/hu.json | 1 + lang/it.json | 1 + lang/ja.json | 1 + lang/nl.json | 1 + lang/pl.json | 1 + lang/pt-br.json | 1 + lang/pt.json | 1 + lang/ro.json | 1 + lang/ru.json | 1 + lang/sr.json | 1 + lang/template.json | 1 + lang/uk.json | 1 + src/index.js | 1 + src/permalink.js | 16 ++++++++++++++++ 24 files changed, 39 insertions(+) create mode 100644 src/permalink.js diff --git a/lang/ast.json b/lang/ast.json index fd8ccbb4..f49d73dd 100644 --- a/lang/ast.json +++ b/lang/ast.json @@ -18,6 +18,7 @@ "images": "", "loading": "", "main:options": "Opciones", + "main:permalink": "", "more": "más", "more_categories": "Más categoríes", "more_categories_gitea": "", diff --git a/lang/ca.json b/lang/ca.json index f6c32022..80bf7b80 100644 --- a/lang/ca.json +++ b/lang/ca.json @@ -18,6 +18,7 @@ "images": "", "loading": "", "main:options": "Opcions", + "main:permalink": "", "more": "més", "more_categories": "Més categories", "more_categories_gitea": "", diff --git a/lang/cs.json b/lang/cs.json index 11ef151c..9dcdccce 100644 --- a/lang/cs.json +++ b/lang/cs.json @@ -18,6 +18,7 @@ "images": "", "loading": "", "main:options": "Nastavení", + "main:permalink": "", "more": "více", "more_categories": "Více kategorií", "more_categories_gitea": "", diff --git a/lang/da.json b/lang/da.json index 3b52e135..78673511 100644 --- a/lang/da.json +++ b/lang/da.json @@ -18,6 +18,7 @@ "images": "", "loading": "", "main:options": "Indstillinger", + "main:permalink": "", "more": "mere", "more_categories": "Flere kategorier", "more_categories_gitea": "", diff --git a/lang/de.json b/lang/de.json index 2ce7e3ac..844491c3 100644 --- a/lang/de.json +++ b/lang/de.json @@ -21,6 +21,7 @@ "images": "Bilder", "loading": "Laden ...", "main:options": "Optionen", + "main:permalink": "", "more": "mehr", "more_categories": "Mehr Kategorien", "more_categories_gitea": "Erstelle und verbessere Kategorien hier!", diff --git a/lang/el.json b/lang/el.json index c3c521b2..a942a1b8 100644 --- a/lang/el.json +++ b/lang/el.json @@ -18,6 +18,7 @@ "images": "", "loading": "", "main:options": "Επιλογές", + "main:permalink": "", "more": "περισσότερα", "more_categories": "Περισσότερες κατηγορίες", "more_categories_gitea": "", diff --git a/lang/en.json b/lang/en.json index 33e8ea49..079a5c21 100644 --- a/lang/en.json +++ b/lang/en.json @@ -21,6 +21,7 @@ "images": "Images", "loading": "Loading ...", "main:options": "Options", + "main:permalink": "Permalink", "more": "more", "more_categories": "More categories", "more_categories_gitea": "Create & improve categories yourself!", diff --git a/lang/es.json b/lang/es.json index e77f4819..dfdc8966 100644 --- a/lang/es.json +++ b/lang/es.json @@ -18,6 +18,7 @@ "images": "", "loading": "", "main:options": "Opciones", + "main:permalink": "", "more": "más", "more_categories": "Más categorías", "more_categories_gitea": "", diff --git a/lang/et.json b/lang/et.json index 3b11c580..1d0fb800 100644 --- a/lang/et.json +++ b/lang/et.json @@ -18,6 +18,7 @@ "images": "", "loading": "", "main:options": "Valikud", + "main:permalink": "", "more": "lisaks", "more_categories": "Rohkem kategooriaid", "more_categories_gitea": "", diff --git a/lang/fr.json b/lang/fr.json index 5a966ce6..835d1fc5 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -18,6 +18,7 @@ "images": "Images", "loading": "Chargement...", "main:options": "Options", + "main:permalink": "", "more": "plus", "more_categories": "Plus de catégories", "more_categories_gitea": "Créez et améliorez vous-mêmes les catégories !", diff --git a/lang/hu.json b/lang/hu.json index 51bde539..61500096 100644 --- a/lang/hu.json +++ b/lang/hu.json @@ -18,6 +18,7 @@ "images": "Képek", "loading": "Betöltés…", "main:options": "Beállítások", + "main:permalink": "", "more": "Több", "more_categories": "További kategóriák", "more_categories_gitea": "Hozzon létre új kategóriákat, vagy javítson a meglévőkön!", diff --git a/lang/it.json b/lang/it.json index d3dfef45..983afbcf 100644 --- a/lang/it.json +++ b/lang/it.json @@ -18,6 +18,7 @@ "images": "", "loading": "", "main:options": "Opzioni", + "main:permalink": "", "more": "altri", "more_categories": "Altre categorie", "more_categories_gitea": "", diff --git a/lang/ja.json b/lang/ja.json index 18241d5a..f7894e43 100644 --- a/lang/ja.json +++ b/lang/ja.json @@ -18,6 +18,7 @@ "images": "", "loading": "", "main:options": "オプション設定", + "main:permalink": "", "more": "もっと", "more_categories": "カテゴリを一覧から追加", "more_categories_gitea": "", diff --git a/lang/nl.json b/lang/nl.json index 406accf4..3999c7bc 100644 --- a/lang/nl.json +++ b/lang/nl.json @@ -18,6 +18,7 @@ "images": "", "loading": "", "main:options": "Opties", + "main:permalink": "", "more": "meer", "more_categories": "Meer categorieën", "more_categories_gitea": "", diff --git a/lang/pl.json b/lang/pl.json index f111410c..6a1165ae 100644 --- a/lang/pl.json +++ b/lang/pl.json @@ -18,6 +18,7 @@ "images": "", "loading": "", "main:options": "Opcje", + "main:permalink": "", "more": "więcej", "more_categories": "Więcej kategorii", "more_categories_gitea": "", diff --git a/lang/pt-br.json b/lang/pt-br.json index a2564aa5..29935b5a 100644 --- a/lang/pt-br.json +++ b/lang/pt-br.json @@ -21,6 +21,7 @@ "images": "Imagens", "loading": "Carregando...", "main:options": "Opções", + "main:permalink": "", "more": "mais", "more_categories": "Mais categorias", "more_categories_gitea": "Criar & melhorar categorias você mesmo!", diff --git a/lang/pt.json b/lang/pt.json index 67fb7536..5e0842d2 100644 --- a/lang/pt.json +++ b/lang/pt.json @@ -21,6 +21,7 @@ "images": "Imagens", "loading": "A carregar...", "main:options": "Opções", + "main:permalink": "", "more": "mais", "more_categories": "Mais categorias", "more_categories_gitea": "Criar & melhorar categorias você mesmo!", diff --git a/lang/ro.json b/lang/ro.json index 22ad5094..db15206d 100644 --- a/lang/ro.json +++ b/lang/ro.json @@ -18,6 +18,7 @@ "images": "", "loading": "", "main:options": "Optiuni", + "main:permalink": "", "more": "Mai mult", "more_categories": "Mai multe categorii", "more_categories_gitea": "", diff --git a/lang/ru.json b/lang/ru.json index b9bb37aa..5df63364 100644 --- a/lang/ru.json +++ b/lang/ru.json @@ -18,6 +18,7 @@ "images": "", "loading": "", "main:options": "Настройки", + "main:permalink": "", "more": "Ещё", "more_categories": "Больше категорий", "more_categories_gitea": "", diff --git a/lang/sr.json b/lang/sr.json index 697e39e8..cc6382e7 100644 --- a/lang/sr.json +++ b/lang/sr.json @@ -18,6 +18,7 @@ "images": "", "loading": "", "main:options": "Опције", + "main:permalink": "", "more": "још", "more_categories": "Више категорија", "more_categories_gitea": "", diff --git a/lang/template.json b/lang/template.json index 4864f0fd..70f03772 100644 --- a/lang/template.json +++ b/lang/template.json @@ -18,6 +18,7 @@ "images": "", "loading": "", "main:options": "", + "main:permalink": "", "more": "", "more_categories": "", "more_categories_gitea": "", diff --git a/lang/uk.json b/lang/uk.json index c7fd08d4..a5a6128d 100644 --- a/lang/uk.json +++ b/lang/uk.json @@ -18,6 +18,7 @@ "images": "", "loading": "", "main:options": "Налаштування", + "main:permalink": "", "more": "Ще", "more_categories": "Більше категорій", "more_categories_gitea": "", diff --git a/src/index.js b/src/index.js index ebf7bff7..917d4b8c 100644 --- a/src/index.js +++ b/src/index.js @@ -33,6 +33,7 @@ require('./categories') require('./wikipedia') require('./image') require('./addCategories') +require('./permalink') let exportAll = require('./exportAll') window.onload = function () { diff --git a/src/permalink.js b/src/permalink.js new file mode 100644 index 00000000..b1eb2831 --- /dev/null +++ b/src/permalink.js @@ -0,0 +1,16 @@ +let permalink + +register_hook('state-update', function (state, hash) { + permalink.href = hash +}) + +register_hook('init', function () { + let li = document.createElement('li') + + permalink = document.createElement('a') + li.appendChild(permalink) + permalink.innerHTML = 'Permalink' + + let menu = document.getElementById('menu') + menu.appendChild(li) +})