Skip to content

Commit

Permalink
style: format code with prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
HsuBot committed Nov 5, 2023
1 parent 71d07d1 commit a392bea
Showing 1 changed file with 31 additions and 28 deletions.
59 changes: 31 additions & 28 deletions src/pages/home/previews/video.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,46 +104,49 @@ const Preview = () => {
}
return false
})
if (subtitle.length != 0 ) {
if (subtitle.length != 0) {
option.subtitle = {
url: proxyLink(subtitle[0], true),
type: ext(subtitle[0].name) as any,
}
}
if (subtitle.length != 0 ) {

if (subtitle.length != 0) {
const selector = []
selector.push({
html: "Display",
tooltip: "Show",
switch : true,
onSwitch: function (item: Setting) {
item.tooltip = item.switch ? "Hide" : "Show"
this.subtitle.show = !item.switch
return !item.switch
}
selector.push({
html: "Display",
tooltip: "Show",
switch: true,
onSwitch: function (item: Setting) {
item.tooltip = item.switch ? "Hide" : "Show"
this.subtitle.show = !item.switch
return !item.switch
},
})
subtitle.map((subtitleOne, i) => {
selector.push({
default:i == 0 ? true : false,
html: subtitleOne.name.length < 30 ? subtitleOne.name : subtitleOne.name.substr(-30,30),
url: proxyLink(subtitleOne, true),
})
selector.push({
default: i == 0 ? true : false,
html:
subtitleOne.name.length < 30
? subtitleOne.name
: subtitleOne.name.substr(-30, 30),
url: proxyLink(subtitleOne, true),
})
})
option.settings.push({
html: "Subtitle",
tooltip: subtitle[0].name,
icon: '<img width="22" heigth="22" src="https://www.artplayer.org/assets/img/subtitle.svg">',
selector: selector,
onSelect: function (item: Setting) {
this.subtitle.switch(item.url, {
name: item.html,
})
return item.html
}
html: "Subtitle",
tooltip: subtitle[0].name,
icon: '<img width="22" heigth="22" src="https://www.artplayer.org/assets/img/subtitle.svg">',
selector: selector,
onSelect: function (item: Setting) {
this.subtitle.switch(item.url, {
name: item.html,
})
return item.html
},
})
}

if (danmu) {
option.plugins = [
artplayerPluginDanmuku({
Expand Down

0 comments on commit a392bea

Please sign in to comment.