Skip to content

Commit 2b24ac7

Browse files
committed
手动修正变量定义var
1 parent 458144a commit 2b24ac7

File tree

9 files changed

+69
-69
lines changed

9 files changed

+69
-69
lines changed

src/components/EditSites.vue

+8-8
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ export default {
173173
},
174174
getFilters () {
175175
const groups = [...new Set(this.sites.map(site => site.group))]
176-
var filters = []
176+
const filters = []
177177
groups.forEach(g => {
178-
var doc = {
178+
const doc = {
179179
text: g,
180180
value: g
181181
}
@@ -327,8 +327,8 @@ export default {
327327
if (!this.checkSiteKey()) {
328328
return false
329329
}
330-
var randomstring = require('randomstring')
331-
var doc = {
330+
const randomstring = require('randomstring')
331+
const doc = {
332332
key: this.dialogType === 'edit' ? this.siteInfo.key : this.siteInfo.key ? this.siteInfo.key : randomstring.generate(6),
333333
id: this.dialogType === 'edit' ? this.siteInfo.id : this.sites.length ? this.sites[this.sites.length - 1].id + 1 : 1,
334334
name: this.siteInfo.name,
@@ -387,7 +387,7 @@ export default {
387387
remote.dialog.showOpenDialog(options).then(result => {
388388
if (!result.canceled) {
389389
result.filePaths.forEach(file => {
390-
var str = fs.readFileSync(file)
390+
const str = fs.readFileSync(file)
391391
const json = JSON.parse(str)
392392
json.forEach(ele => {
393393
if (ele.api && this.sites.filter(x => x.key === ele.key).length === 0 && this.sites.filter(x => x.name === ele.name && x.api === ele.api).length === 0) {
@@ -436,7 +436,7 @@ export default {
436436
sites.add(row)
437437
},
438438
resetId (inArray) {
439-
var id = 1
439+
let id = 1
440440
inArray.forEach(ele => {
441441
ele.id = id
442442
id += 1
@@ -446,7 +446,7 @@ export default {
446446
// 因为el-table的数据是单向绑定,我们先同步el-table里的数据和其绑定的数据
447447
this.syncTableData()
448448
sites.clear().then(res => {
449-
var id = 1
449+
let id = 1
450450
this.sites.forEach(ele => {
451451
ele.id = id
452452
id += 1
@@ -467,7 +467,7 @@ export default {
467467
return false
468468
}
469469
const tbody = document.getElementById('sites-table').querySelector('.el-table__body-wrapper tbody')
470-
var _this = this
470+
const _this = this
471471
Sortable.create(tbody, {
472472
onEnd ({ newIndex, oldIndex }) {
473473
const currRow = _this.sites.splice(oldIndex, 1)[0]

src/components/Film.vue

+6-6
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ export default {
544544
return a.localeCompare(b, 'zh')
545545
},
546546
dateFormat (row, column) {
547-
var date = row[column.property]
547+
const date = row[column.property]
548548
if (date === undefined) {
549549
return ''
550550
}
@@ -620,7 +620,7 @@ export default {
620620
// 屏蔽主分类
621621
const classToHide = ['电影', '电影片', '电视剧', '连续剧', '综艺', '动漫']
622622
zy.class(key).then(res => {
623-
var allClass = [{ name: '最新', tid: 0 }]
623+
const allClass = [{ name: '最新', tid: 0 }]
624624
res.class.forEach(element => {
625625
if (!this.setting.excludeRootClasses || !classToHide.includes(element.name)) {
626626
if (this.setting.excludeR18Films) {
@@ -640,7 +640,7 @@ export default {
640640
})
641641
},
642642
containsR18Keywords (name) {
643-
var containKeyWord = false
643+
const containKeyWord = false
644644
if (!name) {
645645
return containKeyWord
646646
}
@@ -656,7 +656,7 @@ export default {
656656
infiniteHandler ($state) {
657657
const key = this.site.key
658658
const typeTid = this.type.tid
659-
var page = this.pagecount
659+
let page = this.pagecount
660660
if (this.toFlipPagecount()) {
661661
page = this.totalpagecount - this.pagecount + 1
662662
}
@@ -759,8 +759,8 @@ export default {
759759
})
760760
},
761761
querySearch (queryString, cb) {
762-
var searchList = this.searchList.slice(0, -1)
763-
var results = queryString ? searchList.filter(this.createFilter(queryString)) : this.searchList
762+
const searchList = this.searchList.slice(0, -1)
763+
const results = queryString ? searchList.filter(this.createFilter(queryString)) : this.searchList
764764
// 调用 callback 返回建议列表的数据
765765
cb(results)
766766
},

src/components/History.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ export default {
277277
remote.dialog.showOpenDialog(options).then(result => {
278278
if (!result.canceled) {
279279
result.filePaths.forEach(file => {
280-
var str = fs.readFileSync(file)
280+
const str = fs.readFileSync(file)
281281
const json = JSON.parse(str)
282282
history.bulkAdd(json).then(res => {
283283
this.$message.success('导入成功')
@@ -298,7 +298,7 @@ export default {
298298
})
299299
},
300300
getSiteName (key) {
301-
var site = this.sites.find(e => e.key === key)
301+
const site = this.sites.find(e => e.key === key)
302302
if (site) {
303303
return site.name
304304
}
@@ -312,7 +312,7 @@ export default {
312312
},
313313
updateDatabase () {
314314
history.clear().then(res => {
315-
var id = length
315+
let id = length
316316
this.history.forEach(ele => {
317317
ele.id = id
318318
id -= 1

src/components/IPTV.vue

+10-10
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,9 @@ export default {
168168
},
169169
getFilters () {
170170
const groups = [...new Set(this.channelList.map(iptv => iptv.group))]
171-
var filters = []
171+
const filters = []
172172
groups.forEach(g => {
173-
var doc = {
173+
const doc = {
174174
text: g,
175175
value: g
176176
}
@@ -257,7 +257,7 @@ export default {
257257
},
258258
mergeChannel () {
259259
if (this.inputContent && this.multipleSelection.length) {
260-
var channels = []
260+
let channels = []
261261
const id = this.multipleSelection[0].id
262262
this.multipleSelection.forEach(ele => {
263263
channels = channels.concat(ele.channels)
@@ -320,7 +320,7 @@ export default {
320320
remote.dialog.showSaveDialog(options).then(result => {
321321
if (!result.canceled) {
322322
if (result.filePath.endsWith('m3u')) {
323-
var writer = require('m3u').extendedWriter()
323+
const writer = require('m3u').extendedWriter()
324324
this.iptvList.forEach(e => {
325325
writer.file(e.url, -1, e.name)
326326
})
@@ -364,7 +364,7 @@ export default {
364364
const urls = ele.url.split('#').filter(e => e.startsWith('http')) // 网址带#时自动分割
365365
urls.forEach(url => {
366366
if (ele.name && url && new URL.URL(url).pathname.endsWith('.m3u8')) { // 网址可能带参数
367-
var doc = {
367+
const doc = {
368368
id: id,
369369
name: ele.name,
370370
url: url,
@@ -438,12 +438,12 @@ export default {
438438
res = res.filter(o => !this.iptvList.find(e => o.url === e.url))
439439
const resClone = JSON.parse(JSON.stringify(res))
440440
const uniqueChannelName = {}
441-
for (var i = 0; i < resClone.length; i++) {
442-
var channelName = resClone[i].name.trim().replace(/[- ]?(1080p|蓝光|超清|高清|标清|hd|cq|4k)(\d{1,2})?$/i, '')
441+
for (let i = 0; i < resClone.length; i++) {
442+
let channelName = resClone[i].name.trim().replace(/[- ]?(1080p|蓝光|超清|高清|标清|hd|cq|4k)(\d{1,2})?$/i, '')
443443
if (channelName.match(/cctv/i)) channelName = channelName.replace('-', '')
444444
if (Object.keys(uniqueChannelName).some(name => channelName.match(new RegExp(`${name}(1080p|4k|(?!\\d))`, 'i')))) continue // 避免重复
445445
const matchRule = new RegExp(`${channelName}(1080p|4k|(?!\\d))`, 'i')
446-
for (var j = i; j < resClone.length; j++) {
446+
for (let j = i; j < resClone.length; j++) {
447447
if (resClone[j].name.match(/cctv/i)) {
448448
resClone[j].name = resClone[j].name.replace('-', '')
449449
}
@@ -513,7 +513,7 @@ export default {
513513
})
514514
},
515515
resetId (channelList) {
516-
var id = 1
516+
let id = 1
517517
channelList.forEach(ele => {
518518
ele.id = id
519519
id += 1
@@ -575,7 +575,7 @@ export default {
575575
})
576576
},
577577
async checkChannelsBySite (channels) {
578-
var siteList = {}
578+
const siteList = {}
579579
channels.forEach(channel => {
580580
const site = channel.url.split('/')[2]
581581
if (siteList[site]) {

src/components/Play.vue

+13-13
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ export default {
544544
const index = this.video.info.index || 0
545545
const db = await history.find({ site: this.video.key, ids: this.video.info.id })
546546
const key = this.video.key + '@' + this.video.info.id
547-
var time = this.video.info.time
547+
let time = this.video.info.time
548548
this.xg.removeAllProgressDot()
549549
this.startPosition = { min: '00', sec: '00' }
550550
this.endPosition = { min: '00', sec: '00' }
@@ -620,14 +620,14 @@ export default {
620620
this.isLive = false
621621
this.exportablePlaylist = false
622622
this.fetchPlaylist().then(async (fullList) => {
623-
var playlist = fullList[0].list // ZY支持的已移到首位
623+
let playlist = fullList[0].list // ZY支持的已移到首位
624624
// 如果设定了特定的video flag, 获取该flag下的视频列表
625625
const videoFlag = this.video.info.videoFlag
626626
if (videoFlag) {
627627
playlist = fullList.find(x => x.flag === videoFlag).list
628628
}
629629
this.right.list = playlist
630-
var url = playlist[index].split('$')[1]
630+
const url = playlist[index].split('$')[1]
631631
if (playlist.every(e => e.split('$')[1].endsWith('.m3u8'))) this.exportablePlaylist = true
632632
if (!url.endsWith('.m3u8') && !url.endsWith('.mp4')) {
633633
const currentSite = await sites.find({ key: this.video.key })
@@ -776,9 +776,9 @@ export default {
776776
},
777777
prevEvent () {
778778
if (this.video.iptv) {
779-
var index = this.channelList.findIndex(obj => obj.id === this.video.iptv.channelID)
779+
const index = this.channelList.findIndex(obj => obj.id === this.video.iptv.channelID)
780780
if (index >= 1) {
781-
var channel = this.channelList[index - 1]
781+
const channel = this.channelList[index - 1]
782782
this.playChannel(channel)
783783
} else {
784784
this.$message.warning('这已经是第一个频道了。')
@@ -794,9 +794,9 @@ export default {
794794
},
795795
nextEvent () {
796796
if (this.video.iptv) {
797-
var index = this.channelList.findIndex(obj => obj.id === this.video.iptv.channelID)
797+
const index = this.channelList.findIndex(obj => obj.id === this.video.iptv.channelID)
798798
if (index < (this.channelList.length - 1)) {
799-
var channel = this.channelList[index + 1]
799+
const channel = this.channelList[index + 1]
800800
this.playChannel(channel)
801801
} else {
802802
this.$message.warning('这已经是最后一个频道了。')
@@ -945,7 +945,7 @@ export default {
945945
this.$message.error('请设置第三方播放器路径')
946946
// 在线播放该视频
947947
if (playlistUrls[this.video.info.index].endsWith('.m3u8')) {
948-
var link = 'https://www.m3u8play.com/?play=' + playlistUrls[this.video.info.index]
948+
const link = 'https://www.m3u8play.com/?play=' + playlistUrls[this.video.info.index]
949949
const open = require('open')
950950
open(link)
951951
}
@@ -968,11 +968,11 @@ export default {
968968
const path = require('path')
969969
const os = require('os')
970970
const fs = require('fs')
971-
var filePath = path.join(os.tmpdir(), fileName + '.m3u')
971+
const filePath = path.join(os.tmpdir(), fileName + '.m3u')
972972
if (fs.existsSync(filePath)) {
973973
fs.unlinkSync(filePath)
974974
}
975-
var str = '#EXTM3U' + os.EOL
975+
let str = '#EXTM3U' + os.EOL
976976
for (let ind = startIndex; ind < m3u8Arr.length; ind++) {
977977
str += `#EXTINF: -1, 第${ind + 1}` + os.EOL
978978
str += m3u8Arr[ind] + os.EOL
@@ -1037,7 +1037,7 @@ export default {
10371037
},
10381038
listItemEvent (n) {
10391039
if (this.video.iptv) {
1040-
var channel = this.channelList[n]
1040+
const channel = this.channelList[n]
10411041
// 是直播源,直接播放
10421042
this.playChannel(channel)
10431043
} else {
@@ -1399,7 +1399,7 @@ export default {
13991399
this.channelTree = []
14001400
const groups = [...new Set(this.channelList.map(iptv => iptv.group))]
14011401
groups.forEach(g => {
1402-
var doc = {
1402+
const doc = {
14031403
label: g,
14041404
children: this.channelList.filter(x => x.group === g).map(i => { return { label: i.name, channel: i } })
14051405
}
@@ -1486,7 +1486,7 @@ export default {
14861486
this.videoStop()
14871487
return
14881488
}
1489-
var historyItem = this.right.history[0]
1489+
const historyItem = this.right.history[0]
14901490
this.video = { key: historyItem.site, info: { id: historyItem.ids, name: historyItem.name, index: historyItem.index } }
14911491
} else if (this.video.iptv && !this.isLive) {
14921492
this.playChannel(this.video.iptv)

src/components/Recommendation.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ export default {
190190
}
191191
},
192192
filteredRecommendations () {
193-
var filteredData = this.recommendations.filter(x => (this.selectedAreas.length === 0) || this.selectedAreas.includes(x.detail.area))
193+
let filteredData = this.recommendations.filter(x => (this.selectedAreas.length === 0) || this.selectedAreas.includes(x.detail.area))
194194
filteredData = filteredData.filter(x => (this.selectedTypes.length === 0) || this.selectedTypes.includes(x.detail.type))
195195
return filteredData
196196
}

src/components/Setting.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ export default {
333333
}
334334
remote.dialog.showOpenDialog(options).then(result => {
335335
if (!result.canceled) {
336-
var playerPath = result.filePaths[0].replace(/\\/g, '/')
336+
const playerPath = result.filePaths[0].replace(/\\/g, '/')
337337
this.$message.success('设定第三方播放器路径为:' + result.filePaths[0])
338338
this.d.externalPlayer = playerPath
339339
this.updateSettingEvent()

src/components/Star.vue

+8-8
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ export default {
331331
star.get(e.id).then(resStar => {
332332
if (!e.hasUpdate && e.detail.last !== doc.detail.last) {
333333
doc.hasUpdate = true
334-
var msg = `同步"${e.name}"成功, 检查到更新。`
334+
const msg = `同步"${e.name}"成功, 检查到更新。`
335335
this.$message.success(msg)
336336
} else {
337337
this.numNoUpdate += 1
@@ -340,7 +340,7 @@ export default {
340340
this.getFavorites()
341341
})
342342
} catch (err) {
343-
var msg = `同步"${e.name}"失败, 请重试。`
343+
const msg = `同步"${e.name}"失败, 请重试。`
344344
this.$message.warning(msg, err)
345345
}
346346
},
@@ -365,7 +365,7 @@ export default {
365365
if (row.site) {
366366
return row.site.name
367367
} else {
368-
var site = this.sites.find(e => e.key === row.key)
368+
const site = this.sites.find(e => e.key === row.key)
369369
if (site) {
370370
return site.name
371371
}
@@ -417,10 +417,10 @@ export default {
417417
}
418418
remote.dialog.showOpenDialog(options).then(result => {
419419
if (!result.canceled) {
420-
var starList = Array.from(this.list)
421-
var id = this.list.length + 1
420+
const starList = Array.from(this.list)
421+
let id = this.list.length + 1
422422
result.filePaths.forEach(file => {
423-
var str = fs.readFileSync(file)
423+
const str = fs.readFileSync(file)
424424
const json = JSON.parse(str)
425425
json.reverse().forEach(ele => {
426426
const starExists = starList.some(x => x.key === ele.key && x.ids === ele.ids)
@@ -435,7 +435,7 @@ export default {
435435
last: ele.last,
436436
note: ele.note
437437
}
438-
var doc = {
438+
const doc = {
439439
id: id,
440440
key: ele.key,
441441
ids: ele.ids,
@@ -468,7 +468,7 @@ export default {
468468
updateDatabase () {
469469
this.syncTableData()
470470
star.clear().then(res => {
471-
var id = this.list.length
471+
let id = this.list.length
472472
this.list.forEach(ele => {
473473
ele.id = id
474474
id -= 1

0 commit comments

Comments
 (0)