summaryrefslogtreecommitdiffstats
path: root/apps/accessibility/src
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-10-02 09:46:05 +0200
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-10-02 09:46:05 +0200
commitcf06e313ee7c38231099d94e6239249c2b7903b8 (patch)
tree8ef6a984600d5ccd3947c4b270ab3565a1414ce5 /apps/accessibility/src
parent77c6e4106359776bc7283801fa36008596981444 (diff)
downloadnextcloud-server-cf06e313ee7c38231099d94e6239249c2b7903b8.tar.gz
nextcloud-server-cf06e313ee7c38231099d94e6239249c2b7903b8.zip
Added cache override to ensure an always up-to-date accessibility css
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/accessibility/src')
-rw-r--r--apps/accessibility/src/App.vue31
1 files changed, 23 insertions, 8 deletions
diff --git a/apps/accessibility/src/App.vue b/apps/accessibility/src/App.vue
index 37dcc41eb2c..5de1265c2cd 100644
--- a/apps/accessibility/src/App.vue
+++ b/apps/accessibility/src/App.vue
@@ -24,7 +24,7 @@ import preview from './components/itemPreview';
import axios from 'axios';
export default {
- name: 'app',
+ name: 'Accessibility',
components: { preview },
beforeMount() {
// importing server data into the app
@@ -54,7 +54,7 @@ export default {
};
},
tokenHeaders() {
- return { headers: { requesttoken: OC.requestToken } }
+ return { headers: { requesttoken: OC.requestToken } };
}
},
methods: {
@@ -73,8 +73,11 @@ export default {
* @param {string} id the data of the change
*/
selectItem(type, id) {
- axios
- .post(OC.linkToOCS('apps/accessibility/api/v1/config', 2) + type, {value: id}, this.tokenHeaders)
+ axios.post(
+ OC.linkToOCS('apps/accessibility/api/v1/config', 2) + type,
+ { value: id },
+ this.tokenHeaders
+ )
.then(response => {
this.serverData[type] = id;
@@ -84,11 +87,23 @@ export default {
// insert new css
let link = document.createElement('link');
link.rel = 'stylesheet';
- link.href = OC.generateUrl('/apps/accessibility/css/user-style.css');
- document.head.appendChild(link)
+ link.href = OC.generateUrl('/apps/accessibility/css/user-style.css') + '?v=' + new Date().getTime();
+ document.head.appendChild(link);
} else {
- // force update
- link.href = link.href.split('?')[0] + '?v=' + new Date().getTime();
+ // 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 => {