diff options
Diffstat (limited to 'apps/accessibility/src')
-rw-r--r-- | apps/accessibility/src/Accessibility.vue | 168 | ||||
-rw-r--r-- | apps/accessibility/src/accessibilityoca.js | 40 | ||||
-rw-r--r-- | apps/accessibility/src/components/ItemPreview.vue | 40 | ||||
-rw-r--r-- | apps/accessibility/src/main.js | 32 |
4 files changed, 0 insertions, 280 deletions
diff --git a/apps/accessibility/src/Accessibility.vue b/apps/accessibility/src/Accessibility.vue deleted file mode 100644 index 0026e1459b0..00000000000 --- a/apps/accessibility/src/Accessibility.vue +++ /dev/null @@ -1,168 +0,0 @@ -<template> - <div id="accessibility" class="section"> - <h2>{{ t('accessibility', 'Accessibility') }}</h2> - <p v-html="description" /> - <p v-html="descriptionDetail" /> - - <div class="preview-list"> - <ItemPreview :key="highcontrast.id" - :preview="highcontrast" - :selected="selected.highcontrast" - @select="selectHighContrast" /> - <ItemPreview v-for="preview in themes" - :key="preview.id" - :preview="preview" - :selected="selected.theme" - @select="selectTheme" /> - <ItemPreview v-for="preview in fonts" - :key="preview.id" - :preview="preview" - :selected="selected.font" - @select="selectFont" /> - </div> - </div> -</template> - -<script> -import { generateUrl, generateOcsUrl } from '@nextcloud/router' -import { loadState } from '@nextcloud/initial-state' -import axios from '@nextcloud/axios' -import ItemPreview from './components/ItemPreview' - -const availableConfig = loadState('accessibility', 'available-config') -const userConfig = loadState('accessibility', 'user-config') - -export default { - name: 'Accessibility', - components: { - ItemPreview, - }, - - data() { - return { - availableConfig, - userConfig, - } - }, - - computed: { - themes() { - return this.availableConfig.themes - }, - highcontrast() { - return this.availableConfig.highcontrast - }, - fonts() { - return this.availableConfig.fonts - }, - selected() { - return { - theme: this.userConfig.theme, - highcontrast: this.userConfig.highcontrast, - font: this.userConfig.font, - } - }, - description() { - // using the `t` replace method escape html, we have to do it manually :/ - return t( - 'accessibility', - 'Universal access is very important to us. We follow web standards and check to make everything usable also without mouse, and assistive software such as screenreaders. We aim to be compliant with the {guidelines}Web Content Accessibility Guidelines{linkend} 2.1 on AA level, with the high contrast theme even on AAA level.' - ) - .replace('{guidelines}', this.guidelinesLink) - .replace('{linkend}', '</a>') - }, - guidelinesLink() { - return '<a target="_blank" href="https://www.w3.org/WAI/standards-guidelines/wcag/" rel="noreferrer nofollow">' - }, - descriptionDetail() { - return t( - 'accessibility', - 'If you find any issues, don’t hesitate to report them on {issuetracker}our issue tracker{linkend}. And if you want to get involved, come join {designteam}our design team{linkend}!' - ) - .replace('{issuetracker}', this.issuetrackerLink) - .replace('{designteam}', this.designteamLink) - .replace(/\{linkend\}/g, '</a>') - }, - issuetrackerLink() { - return '<a target="_blank" href="https://github.com/nextcloud/server/issues/" rel="noreferrer nofollow">' - }, - designteamLink() { - return '<a target="_blank" href="https://nextcloud.com/design" rel="noreferrer nofollow">' - }, - }, - methods: { - // SELECT handlers - selectHighContrast(id) { - this.selectItem('highcontrast', id) - document.body.classList.toggle('theme--highcontrast') - }, - selectTheme(id) { - const previous = this.selected.theme - if (previous) { - document.body.classList.remove(`theme--${previous}`) - } - if (id) { - document.body.classList.remove('theme--light') - document.body.classList.add(`theme--${id}`) - } else { - document.body.classList.add('theme--light') - } - - this.selectItem('theme', id) - }, - selectFont(id) { - this.selectItem('font', id) - }, - - /** - * Commit a change and force reload css - * Fetching the file again will trigger the server update - * - * @param {string} type type of the change (font, highcontrast or theme) - * @param {string} id the data of the change - */ - async selectItem(type, id) { - try { - const isDelete = id === '' - await axios({ - url: generateOcsUrl('apps/accessibility/api/v1/config/{type}', { type }), - method: isDelete ? 'DELETE' : 'PUT', - data: { - value: id, - }, - }) - - this.userConfig[type] = id - - // Remove old link - const link = document.querySelector('link[rel=stylesheet][href*=accessibility][href*=user-]') - if (!link) { - // insert new css - const link = document.createElement('link') - link.rel = 'stylesheet' - link.href = generateUrl('/apps/accessibility/css/user-style.css') + '?v=' + new Date().getTime() - document.head.appendChild(link) - } else { - // compare arrays - if ( - JSON.stringify(Object.values(this.selected)) - === JSON.stringify([false, false]) - ) { - // if nothing is selected, blindly remove the css - link.remove() - } else { - // force update - link.href - = link.href.split('?')[0] - + '?v=' - + new Date().getTime() - } - } - } catch (err) { - console.error(err, err.response) - OC.Notification.showTemporary(t('accessibility', err.response.data.ocs.meta.message + '. Unable to apply the setting.')) - } - }, - }, -} -</script> diff --git a/apps/accessibility/src/accessibilityoca.js b/apps/accessibility/src/accessibilityoca.js deleted file mode 100644 index 56c5939037f..00000000000 --- a/apps/accessibility/src/accessibilityoca.js +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @copyright Copyright (c) 2020 Roeland Jago Douma <roeland@famdouma.nl> - * - * @author Jan C. Borchardt <hey@jancborchardt.net> - * @author John Molakvoæ <skjnldsv@protonmail.com> - * - * @license AGPL-3.0-or-later - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -import { loadState } from '@nextcloud/initial-state' - -OCA.Accessibility = loadState('accessibility', 'data') -if (OCA.Accessibility.checkMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { - // Overwrite the theme for Guests based on the prefers-color-scheme - OCA.Accessibility.theme = 'dark' -} - -if (OCA.Accessibility.theme !== false) { - document.body.classList.add(`theme--${OCA.Accessibility.theme}`) -} else { - document.body.classList.add('theme--light') -} - -if (OCA.Accessibility.highcontrast !== false) { - document.body.classList.add('theme--highcontrast') -} diff --git a/apps/accessibility/src/components/ItemPreview.vue b/apps/accessibility/src/components/ItemPreview.vue deleted file mode 100644 index 1b6f3ebf01d..00000000000 --- a/apps/accessibility/src/components/ItemPreview.vue +++ /dev/null @@ -1,40 +0,0 @@ -<template> - <div :class="{preview: true}"> - <div class="preview-image" :style="{backgroundImage: 'url(' + preview.img + ')'}" /> - <div class="preview-description"> - <h3>{{ preview.title }}</h3> - <p>{{ preview.text }}</p> - <input :id="'accessibility-' + preview.id" - v-model="checked" - type="checkbox" - class="checkbox"> - <label :for="'accessibility-' + preview.id">{{ preview.enableLabel }}</label> - </div> - </div> -</template> - -<script> -export default { - name: 'ItemPreview', - props: { - preview: { - type: Object, - required: true, - }, - selected: { - type: String, - default: null, - }, - }, - computed: { - checked: { - get() { - return this.selected === this.preview.id - }, - set(checked) { - this.$emit('select', checked ? this.preview.id : '') - }, - }, - }, -} -</script> diff --git a/apps/accessibility/src/main.js b/apps/accessibility/src/main.js deleted file mode 100644 index 49a3bd83d9c..00000000000 --- a/apps/accessibility/src/main.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * @copyright Copyright (c) 2018 John Molakvoæ <skjnldsv@protonmail.com> - * - * @author John Molakvoæ <skjnldsv@protonmail.com> - * - * @license AGPL-3.0-or-later - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -import Vue from 'vue' -import App from './Accessibility.vue' - -// bind to window -Vue.prototype.OC = OC -Vue.prototype.t = t - -const View = Vue.extend(App) -const accessibility = new View() -accessibility.$mount('#accessibility') |