Skip to content

Commit e564c40

Browse files
committed
refactor: fix lint warning on public/js/cover.js
Signed-off-by: BoHong Li <[email protected]>
1 parent d387cac commit e564c40

File tree

1 file changed

+50
-50
lines changed

1 file changed

+50
-50
lines changed

public/js/cover.js

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
11
/* eslint-env browser, jquery */
22
/* global moment, serverurl */
33

4-
require('./locale')
5-
6-
require('../css/cover.css')
7-
require('../css/site.css')
8-
94
import {
10-
checkIfAuth,
11-
clearLoginState,
12-
getLoginState,
13-
resetCheckAuth,
14-
setloginStateChangeEvent
5+
checkIfAuth,
6+
clearLoginState,
7+
getLoginState,
8+
resetCheckAuth,
9+
setloginStateChangeEvent
1510
} from './lib/common/login'
1611

1712
import {
18-
clearDuplicatedHistory,
19-
deleteServerHistory,
20-
getHistory,
21-
getStorageHistory,
22-
parseHistory,
23-
parseServerToHistory,
24-
parseStorageToHistory,
25-
postHistoryToServer,
26-
removeHistory,
27-
saveHistory,
28-
saveStorageHistoryToServer
13+
clearDuplicatedHistory,
14+
deleteServerHistory,
15+
getHistory,
16+
getStorageHistory,
17+
parseHistory,
18+
parseServerToHistory,
19+
parseStorageToHistory,
20+
postHistoryToServer,
21+
removeHistory,
22+
saveHistory,
23+
saveStorageHistoryToServer
2924
} from './history'
3025

3126
import { saveAs } from 'file-saver'
3227
import List from 'list.js'
3328
import unescapeHTML from 'lodash/unescape'
3429

30+
require('./locale')
31+
32+
require('../css/cover.css')
33+
require('../css/site.css')
34+
3535
const options = {
3636
valueNames: ['id', 'text', 'timestamp', 'fromNow', 'time', 'tags', 'pinned'],
3737
item: `<li class="col-xs-12 col-sm-6 col-md-6 col-lg-4">
@@ -67,27 +67,27 @@ pageInit()
6767

6868
function pageInit () {
6969
checkIfAuth(
70-
data => {
71-
$('.ui-signin').hide()
72-
$('.ui-or').hide()
73-
$('.ui-welcome').show()
74-
if (data.photo) $('.ui-avatar').prop('src', data.photo).show()
75-
else $('.ui-avatar').prop('src', '').hide()
76-
$('.ui-name').html(data.name)
77-
$('.ui-signout').show()
78-
$('.ui-history').click()
79-
parseServerToHistory(historyList, parseHistoryCallback)
80-
},
81-
() => {
82-
$('.ui-signin').show()
83-
$('.ui-or').show()
84-
$('.ui-welcome').hide()
85-
$('.ui-avatar').prop('src', '').hide()
86-
$('.ui-name').html('')
87-
$('.ui-signout').hide()
88-
parseStorageToHistory(historyList, parseHistoryCallback)
89-
}
90-
)
70+
data => {
71+
$('.ui-signin').hide()
72+
$('.ui-or').hide()
73+
$('.ui-welcome').show()
74+
if (data.photo) $('.ui-avatar').prop('src', data.photo).show()
75+
else $('.ui-avatar').prop('src', '').hide()
76+
$('.ui-name').html(data.name)
77+
$('.ui-signout').show()
78+
$('.ui-history').click()
79+
parseServerToHistory(historyList, parseHistoryCallback)
80+
},
81+
() => {
82+
$('.ui-signin').show()
83+
$('.ui-or').show()
84+
$('.ui-welcome').hide()
85+
$('.ui-avatar').prop('src', '').hide()
86+
$('.ui-name').html('')
87+
$('.ui-signout').hide()
88+
parseStorageToHistory(historyList, parseHistoryCallback)
89+
}
90+
)
9191
}
9292

9393
$('.masthead-nav li').click(function () {
@@ -132,7 +132,7 @@ function checkHistoryList () {
132132

133133
function parseHistoryCallback (list, notehistory) {
134134
checkHistoryList()
135-
// sort by pinned then timestamp
135+
// sort by pinned then timestamp
136136
list.sort('', {
137137
sortFunction (a, b) {
138138
const notea = a.values()
@@ -152,13 +152,13 @@ function parseHistoryCallback (list, notehistory) {
152152
}
153153
}
154154
})
155-
// parse filter tags
155+
// parse filter tags
156156
const filtertags = []
157157
for (let i = 0, l = list.items.length; i < l; i++) {
158158
const tags = list.items[i]._values.tags
159159
if (tags && tags.length > 0) {
160160
for (let j = 0; j < tags.length; j++) {
161-
// push info filtertags if not found
161+
// push info filtertags if not found
162162
let found = false
163163
if (filtertags.includes(tags[j])) { found = true }
164164
if (!found) { filtertags.push(tags[j]) }
@@ -178,20 +178,20 @@ historyList.on('updated', e => {
178178
const a = itemEl.find('a')
179179
const pin = itemEl.find('.ui-history-pin')
180180
const tagsEl = itemEl.find('.tags')
181-
// parse link to element a
181+
// parse link to element a
182182
a.attr('href', `${serverurl}/${values.id}`)
183-
// parse pinned
183+
// parse pinned
184184
if (values.pinned) {
185185
pin.addClass('active')
186186
} else {
187187
pin.removeClass('active')
188188
}
189-
// parse tags
189+
// parse tags
190190
const tags = values.tags
191191
if (tags && tags.length > 0 && tagsEl.children().length <= 0) {
192192
const labels = []
193193
for (let j = 0; j < tags.length; j++) {
194-
// push into the item label
194+
// push into the item label
195195
labels.push(`<span class='label label-default'>${tags[j]}</span>`)
196196
}
197197
tagsEl.html(labels.join(' '))
@@ -328,7 +328,7 @@ $('.ui-open-history').bind('change', e => {
328328
const reader = new FileReader()
329329
reader.onload = () => {
330330
const notehistory = JSON.parse(reader.result)
331-
// console.log(notehistory);
331+
// console.log(notehistory);
332332
if (!reader.result) return
333333
getHistory(data => {
334334
let mergedata = data.concat(notehistory)

0 commit comments

Comments
 (0)