git ssb

10+

Matt McKegg / patchwork



Commit f35f3abb7b44bd982ed14b0000ec35da8641afe3

Add User Font Size Setting

Adds a selection for the user to change the font size from the settings
panel. Persists in localstorage and updates on changes as language and
theme. Selection range: 8,10,12,14,16,18,20 px.

Most locales updated except `ki.json` which is in english.

Font size is set in a second `style` element, appended immediately after
the theme is applied in `main-window.js`, overwriting the theme font
size. I considered finding a more clever way to replace the original
font size declaration in place but haven't got very far yet.
robjloranger committed on 11/24/2017, 9:39:38 PM
Parent: 452d3838ab4f6ffb18b71fff39793437a4d88c4e

Files changed

locales/de.jsonchanged
locales/en.jsonchanged
locales/es.jsonchanged
locales/ki.jsonchanged
locales/pt-BR.jsonchanged
locales/pt.jsonchanged
main-window.jschanged
modules/page/html/render/settings.jschanged
locales/de.jsonView
@@ -165,6 +165,7 @@
165165 "Blocked": "Blockiert",
166166 "Click to block syncing with this person and hide their posts": "Klicke hier um die synchronisation mit dieser Person zu blockieren und deren posts zu verbergen",
167167 "Block": "Blocken",
168168 "External Link": "External Link",
169- "blocked ": "blocked "
169 + "blocked ": "blocked ",
170 + "Font Size": "Schriftgröße"
170171 }
locales/en.jsonView
@@ -183,6 +183,7 @@
183183 "pt-BR": "Brazillian Portuguese",
184184 "See less": "See less",
185185 "See more": "See more",
186186 "(missing message)": "(missing message)",
187- "assigned a description to ": "assigned a description to "
187 + "assigned a description to ": "assigned a description to ",
188 + "Font Size": "Font Size"
188189 }
locales/es.jsonView
@@ -176,6 +176,7 @@
176176 "Cannot load thead": "No se puede cargar el hilo",
177177 "The author of this message could be outside of your follow range or they may be blocked.": "El autor de este mensaje podría estar fuera de su rango de seguimiento o puede estar bloqueado.",
178178 "You follow %s people that follow this person.": {"one":"Sigues a alguien que sigue a esta persona.","other":"Sigues a %s personas que siguen a esta persona."},
179179 "Followed by": "Seguido por",
180- "pt-BR": "Portugués Brasileño"
180 + "pt-BR": "Portugués Brasileño",
181 + "Font Size": "Tamaño de fuente"
181182 }
locales/ki.jsonView
@@ -79,6 +79,7 @@
7979 "Browse All": "Browse All",
8080 "Theme": "Theme",
8181 "Language": "Language",
8282 "Filters": "Filters",
83- " Hide following messages": " Hide following messages"
83 + " Hide following messages": " Hide following messages",
84 + "Font Size": "Font Size"
8485 }
locales/pt-BR.jsonView
@@ -139,6 +139,7 @@
139139 "en": "en",
140140 "on ": "on ",
141141 "Private Message": "Mensagem Privada",
142142 "Send Private Message": "Enviar Mensagem Privada",
143- "Publish Privately": "Publicar Privadamente"
143 + "Publish Privately": "Publicar Privadamente",
144 + "Font Size": "Tamanho da fonte"
144145 }
locales/pt.jsonView
@@ -140,6 +140,7 @@
140140 "en": "English",
141141 "on ": "em ",
142142 "Private Message": "Mensagem Privada",
143143 "Send Private Message": "Enviar Mensagem Privada",
144- "Publish Privately": "Publicar Privadamente"
144 + "Publish Privately": "Publicar Privadamente",
145 + "Font Size": "Tamanho da fonte"
145146 }
main-window.jsView
@@ -79,8 +79,16 @@
7979 })
8080 })
8181 )
8282
83 + document.head.appendChild(
84 + h('style', {
85 + innerHTML: computed(api.settings.obs.get('patchwork.fontSize', document.documentElement.style.fontSize), size => {
86 + return 'html, body {font-size: ' + size + ';}'
87 + })
88 + })
89 + )
90 +
8391 var container = h(`MainWindow -${process.platform}`, [
8492 h('div.top', [
8593 h('span.history', [
8694 h('a', {
modules/page/html/render/settings.jsView
@@ -21,8 +21,10 @@
2121 const currentTheme = api.settings.obs.get('patchwork.theme')
2222 const currentLang = api.settings.obs.get('patchwork.lang')
2323 const locales = api.intl.sync.locales()
2424 const localeNameLookup = api.intl.sync.localeNames()
25 + const currentFontSize = api.settings.obs.get('patchwork.fontSize')
26 + const fontSizes = ['8px', '10px', '12px', '14px', '16px', '18px', '20px']
2527 const filterFollowing = api.settings.obs.get('filters.following')
2628
2729 var prepend = [
2830 h('PageHeading', [
@@ -69,8 +71,21 @@
6971 ])
7072 ]),
7173
7274 h('section', [
75 + h('h2', i18n('Font Size')),
76 + h('select', {
77 + style: {
78 + 'font-size': '120%'
79 + },
80 + value: when(currentFontSize, currentFontSize, window.getComputedStyle(document.documentElement).fontSize),
81 + 'ev-change': (ev) => api.settings.sync.set({
82 + patchwork: {fontSize: ev.target.value}
83 + })
84 + }, fontSizes.map(size => h('option', {value: size}, size)))
85 + ]),
86 +
87 + h('section', [
7388 h('h2', i18n('Filters')),
7489 h('label', [
7590 h('input', {
7691 type: 'checkbox',

Built with git-ssb-web