Support alwaysShowDuration (fix #696)

This commit is contained in:
the1812 2021-01-07 18:37:57 +08:00
parent d58d099c41
commit acc77ca5d1
11 changed files with 34 additions and 14 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -249,6 +249,7 @@ export const settings = {
rememberVideoSpeed: false,
extendVideoSpeed: true,
customKeyBindings: {},
alwaysShowDuration: false,
cache: {},
}
const fixedSettings = {

3
src/global.d.ts vendored
View File

@ -525,7 +525,8 @@ declare global {
},
rememberVideoSpeed: boolean,
extendVideoSpeed: boolean,
customKeyBindings: { [actionName: string]: string }
customKeyBindings: { [actionName: string]: string },
alwaysShowDuration: boolean,
}
const GM_info: MonkeyInfo
function GM_xmlhttpRequest(details: MonkeyXhrDetails): { abort: () => void }

View File

@ -254,6 +254,9 @@
font-size: 16px;
}
}
body.always-show-duration & .time {
opacity: 1;
}
&:hover {
.time,
.watchlater {

View File

@ -130,6 +130,11 @@
border-radius: 8px 0 0 8px;
position: relative;
$padding: 6px;
.floating {
position: absolute;
opacity: 0;
font-size: 11px;
}
.favorite-time {
top: $padding;
left: $padding;
@ -139,11 +144,9 @@
left: $padding;
bottom: $padding;
padding: 0 6px;
}
.floating {
position: absolute;
opacity: 0;
font-size: 11px;
body.always-show-duration & {
opacity: 1;
}
}
.cover {
object-fit: cover;

View File

@ -199,6 +199,9 @@
left: $padding;
bottom: $padding;
padding: 0 6px;
body.always-show-duration & {
opacity: 1;
}
}
.progress-number {
left: $padding;

View File

@ -138,6 +138,11 @@
border-radius: 8px 0 0 8px;
position: relative;
$padding: 6px;
.floating {
position: absolute;
opacity: 0;
font-size: 11px;
}
.remove {
top: $padding;
left: $padding;
@ -150,6 +155,9 @@
left: $padding;
bottom: $padding;
padding: 0 6px;
body.always-show-duration & {
opacity: 1;
}
}
.viewed {
white-space: nowrap;
@ -157,11 +165,6 @@
top: $padding;
padding: 0 6px;
}
.floating {
position: absolute;
opacity: 0;
font-size: 11px;
}
.cover {
object-fit: cover;
}

View File

@ -196,6 +196,9 @@ export default {
.watchlater {
opacity: 0;
}
body.always-show-duration & .duration {
opacity: 1;
}
.cover-container {
grid-area: cover;

View File

@ -218,6 +218,9 @@ function setDisplayNames () {
addSettingsListener('elegantScrollbar', value => {
document.documentElement.classList.toggle('elegant-scrollbar', value)
}, true)
addSettingsListener('alwaysShowDuration', value => {
document.body.classList.toggle('always-show-duration', value)
}, true)
const settingsBox = resources.data.guiSettingsHtml.text
document.body.insertAdjacentHTML('beforeend', settingsBox)