Skip to content

Commit ecd9c4e

Browse files
committed
Comply to eslint
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
1 parent e85ad40 commit ecd9c4e

File tree

237 files changed

+11482
-13723
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

237 files changed

+11482
-13723
lines changed

apps/accessibility/.eslintrc.js

Lines changed: 0 additions & 16 deletions
This file was deleted.

apps/accessibility/js/accessibility.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/accessibility/js/accessibility.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,56 @@
11
<template>
22
<div id="accessibility" class="section">
3-
<h2>{{t('accessibility', 'Accessibility')}}</h2>
3+
<h2>{{ t('accessibility', 'Accessibility') }}</h2>
44
<p v-html="description" />
55
<p v-html="descriptionDetail" />
66

77
<div class="preview-list">
8-
<preview :preview="highcontrast"
9-
:key="highcontrast.id" :selected="selected.highcontrast"
10-
v-on:select="selectHighContrast"></preview>
11-
<preview v-for="preview in themes" :preview="preview"
12-
:key="preview.id" :selected="selected.theme"
13-
v-on:select="selectTheme"></preview>
14-
<preview v-for="preview in fonts" :preview="preview"
15-
:key="preview.id" :selected="selected.font"
16-
v-on:select="selectFont"></preview>
8+
<ItemPreview :key="highcontrast.id"
9+
:preview="highcontrast"
10+
:selected="selected.highcontrast"
11+
@select="selectHighContrast" />
12+
<ItemPreview v-for="preview in themes"
13+
:key="preview.id"
14+
:preview="preview"
15+
:selected="selected.theme"
16+
@select="selectTheme" />
17+
<ItemPreview v-for="preview in fonts"
18+
:key="preview.id"
19+
:preview="preview"
20+
:selected="selected.font"
21+
@select="selectFont" />
1722
</div>
1823
</div>
1924
</template>
2025

2126
<script>
22-
import preview from './components/itemPreview';
23-
import axios from 'nextcloud-axios';
27+
import ItemPreview from './components/ItemPreview'
28+
import axios from 'nextcloud-axios'
2429
2530
export default {
2631
name: 'Accessibility',
27-
components: { preview },
28-
beforeMount() {
29-
// importing server data into the app
30-
const serverDataElmt = document.getElementById('serverData');
31-
if (serverDataElmt !== null) {
32-
this.serverData = JSON.parse(
33-
document.getElementById('serverData').dataset.server
34-
);
35-
}
36-
},
32+
components: { ItemPreview },
3733
data() {
3834
return {
3935
serverData: []
40-
};
36+
}
4137
},
4238
computed: {
4339
themes() {
44-
return this.serverData.themes;
40+
return this.serverData.themes
4541
},
4642
highcontrast() {
47-
return this.serverData.highcontrast;
43+
return this.serverData.highcontrast
4844
},
4945
fonts() {
50-
return this.serverData.fonts;
46+
return this.serverData.fonts
5147
},
5248
selected() {
5349
return {
5450
theme: this.serverData.selected.theme,
5551
highcontrast: this.serverData.selected.highcontrast,
5652
font: this.serverData.selected.font
57-
};
53+
}
5854
},
5955
description() {
6056
// using the `t` replace method escape html, we have to do it manually :/
@@ -66,7 +62,7 @@ export default {
6662
We aim to be compliant with the {guidelines} 2.1 on AA level,
6763
with the high contrast theme even on AAA level.`
6864
)
69-
.replace('{guidelines}', this.guidelinesLink)
65+
.replace('{guidelines}', this.guidelinesLink)
7066
},
7167
guidelinesLink() {
7268
return `<a target="_blank" href="https://www.w3.org/WAI/standards-guidelines/wcag/" rel="noreferrer nofollow">${t('accessibility', 'Web Content Accessibility Guidelines')}</a>`
@@ -77,8 +73,8 @@ export default {
7773
`If you find any issues, don’t hesitate to report them on {issuetracker}.
7874
And if you want to get involved, come join {designteam}!`
7975
)
80-
.replace('{issuetracker}', this.issuetrackerLink)
81-
.replace('{designteam}', this.designteamLink)
76+
.replace('{issuetracker}', this.issuetrackerLink)
77+
.replace('{designteam}', this.designteamLink)
8278
},
8379
issuetrackerLink() {
8480
return `<a target="_blank" href="https://github.com/nextcloud/server/issues/" rel="noreferrer nofollow">${t('accessibility', 'our issue tracker')}</a>`
@@ -87,19 +83,28 @@ export default {
8783
return `<a target="_blank" href="https://nextcloud.com/design" rel="noreferrer nofollow">${t('accessibility', 'our design team')}</a>`
8884
}
8985
},
86+
beforeMount() {
87+
// importing server data into the app
88+
const serverDataElmt = document.getElementById('serverData')
89+
if (serverDataElmt !== null) {
90+
this.serverData = JSON.parse(
91+
document.getElementById('serverData').dataset.server
92+
)
93+
}
94+
},
9095
methods: {
9196
selectHighContrast(id) {
92-
this.selectItem('highcontrast', id);
97+
this.selectItem('highcontrast', id)
9398
},
9499
selectTheme(id, idSelectedBefore) {
95-
this.selectItem('theme', id);
96-
document.body.classList.remove(idSelectedBefore);
100+
this.selectItem('theme', id)
101+
document.body.classList.remove(idSelectedBefore)
97102
if (id) {
98-
document.body.classList.add(id);
103+
document.body.classList.add(id)
99104
}
100105
},
101106
selectFont(id) {
102-
this.selectItem('font', id);
107+
this.selectItem('font', id)
103108
},
104109
105110
/**
@@ -110,43 +115,40 @@ export default {
110115
* @param {string} id the data of the change
111116
*/
112117
selectItem(type, id) {
113-
axios.post(
114-
OC.linkToOCS('apps/accessibility/api/v1/config', 2) + type,
115-
{ value: id }
116-
)
118+
axios.post(OC.linkToOCS('apps/accessibility/api/v1/config', 2) + type, { value: id })
117119
.then(response => {
118-
this.serverData.selected[type] = id;
120+
this.serverData.selected[type] = id
119121
120122
// Remove old link
121-
let link = document.querySelector('link[rel=stylesheet][href*=accessibility][href*=user-]');
123+
let link = document.querySelector('link[rel=stylesheet][href*=accessibility][href*=user-]')
122124
if (!link) {
123125
// insert new css
124-
let link = document.createElement('link');
125-
link.rel = 'stylesheet';
126-
link.href = OC.generateUrl('/apps/accessibility/css/user-style.css') + '?v=' + new Date().getTime();
127-
document.head.appendChild(link);
126+
let link = document.createElement('link')
127+
link.rel = 'stylesheet'
128+
link.href = OC.generateUrl('/apps/accessibility/css/user-style.css') + '?v=' + new Date().getTime()
129+
document.head.appendChild(link)
128130
} else {
129131
// compare arrays
130132
if (
131-
JSON.stringify(Object.values(this.selected)) ===
132-
JSON.stringify([false, false])
133+
JSON.stringify(Object.values(this.selected))
134+
=== JSON.stringify([false, false])
133135
) {
134136
// if nothing is selected, blindly remove the css
135-
link.remove();
137+
link.remove()
136138
} else {
137139
// force update
138-
link.href =
139-
link.href.split('?')[0] +
140-
'?v=' +
141-
new Date().getTime();
140+
link.href
141+
= link.href.split('?')[0]
142+
+ '?v='
143+
+ new Date().getTime()
142144
}
143145
}
144146
})
145147
.catch(err => {
146-
console.log(err, err.response);
147-
OC.Notification.showTemporary(t('accessibility', err.response.data.ocs.meta.message + '. Unable to apply the setting.'));
148-
});
148+
console.error(err, err.response)
149+
OC.Notification.showTemporary(t('accessibility', err.response.data.ocs.meta.message + '. Unable to apply the setting.'))
150+
})
149151
}
150152
}
151-
};
153+
}
152154
</script>
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<template>
2+
<div :class="{preview: true}">
3+
<div class="preview-image" :style="{backgroundImage: 'url(' + preview.img + ')'}" />
4+
<div class="preview-description">
5+
<h3>{{ preview.title }}</h3>
6+
<p>{{ preview.text }}</p>
7+
<input :id="'accessibility-' + preview.id"
8+
v-model="checked"
9+
type="checkbox"
10+
class="checkbox">
11+
<label :for="'accessibility-' + preview.id">{{ t('accessibility', 'Enable') }} {{ preview.title.toLowerCase() }}</label>
12+
</div>
13+
</div>
14+
</template>
15+
16+
<script>
17+
export default {
18+
name: 'ItemPreview',
19+
props: {
20+
preview: {
21+
type: Object,
22+
required: true
23+
},
24+
selected: {
25+
type: String,
26+
default: null
27+
}
28+
},
29+
computed: {
30+
checked: {
31+
get() {
32+
return this.selected === this.preview.id
33+
},
34+
set(checked) {
35+
this.$emit('select', checked ? this.preview.id : false, this.selected)
36+
}
37+
}
38+
}
39+
}
40+
</script>

apps/accessibility/src/components/itemPreview.vue

Lines changed: 0 additions & 28 deletions
This file was deleted.

apps/accessibility/src/main.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import Vue from 'vue';
2-
import App from './App.vue';
1+
import Vue from 'vue'
2+
import App from './Accessibility.vue'
33

44
/* global t */
55
// bind to window
6-
Vue.prototype.OC = OC;
7-
Vue.prototype.t = t;
6+
Vue.prototype.OC = OC
7+
Vue.prototype.t = t
88

9-
new Vue({
9+
export default new Vue({
1010
el: '#accessibility',
1111
render: h => h(App)
12-
});
12+
})

apps/comments/js/comments.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/comments/js/comments.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/**
22
* @author Joas Schilling <coding@schilljs.com>
33
* Copyright (c) 2016
44
*
@@ -18,18 +18,18 @@
1818
* @param {jQuery} $el jQuery handle for this activity
1919
* @param {string} view The view that displayes this activity
2020
*/
21-
prepareModelForDisplay: function (model, $el, view) {
21+
prepareModelForDisplay: function(model, $el, view) {
2222
if (model.get('app') !== 'comments' || model.get('type') !== 'comments') {
23-
return;
23+
return
2424
}
2525

2626
if (view === 'ActivityTabView') {
27-
$el.addClass('comment');
27+
$el.addClass('comment')
2828
if (model.get('message') && this._isLong(model.get('message'))) {
29-
$el.addClass('collapsed');
30-
var $overlay = $('<div>').addClass('message-overlay');
31-
$el.find('.activitymessage').after($overlay);
32-
$el.on('click', this._onClickCollapsedComment);
29+
$el.addClass('collapsed')
30+
var $overlay = $('<div>').addClass('message-overlay')
31+
$el.find('.activitymessage').after($overlay)
32+
$el.on('click', this._onClickCollapsedComment)
3333
}
3434
}
3535
},
@@ -38,22 +38,21 @@
3838
* Copy of CommentsTabView._onClickComment()
3939
*/
4040
_onClickCollapsedComment: function(ev) {
41-
var $row = $(ev.target);
41+
var $row = $(ev.target)
4242
if (!$row.is('.comment')) {
43-
$row = $row.closest('.comment');
43+
$row = $row.closest('.comment')
4444
}
45-
$row.removeClass('collapsed');
45+
$row.removeClass('collapsed')
4646
},
4747

4848
/*
4949
* Copy of CommentsTabView._isLong()
5050
*/
5151
_isLong: function(message) {
52-
return message.length > 250 || (message.match(/\n/g) || []).length > 1;
52+
return message.length > 250 || (message.match(/\n/g) || []).length > 1
5353
}
54-
};
54+
}
5555

56+
})()
5657

57-
})();
58-
59-
OC.Plugins.register('OCA.Activity.RenderingPlugins', OCA.Comments.ActivityTabViewPlugin);
58+
OC.Plugins.register('OCA.Activity.RenderingPlugins', OCA.Comments.ActivityTabViewPlugin)

0 commit comments

Comments
 (0)