Player statistics button can be enabled by default
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
playerDefaultQualityStore,
|
||||
playerProxyVideosStore,
|
||||
playerSavePlaybackPositionStore,
|
||||
playerStatisticsByDefault,
|
||||
playerYouTubeJsFallback,
|
||||
sponsorBlockCategoriesStore,
|
||||
sponsorBlockDisplayToastStore,
|
||||
@@ -325,6 +326,14 @@
|
||||
if ($playerDefaultPlaybackSpeed && playerElement) {
|
||||
playerElement.playbackRate = $playerDefaultPlaybackSpeed;
|
||||
}
|
||||
|
||||
if ($playerStatisticsByDefault) {
|
||||
// Appears to be no native way in shaka to toggle statistics on and off
|
||||
const shakaStatisticsButton = document.querySelector('.shaka-statistics-button') as
|
||||
| HTMLButtonElement
|
||||
| undefined;
|
||||
shakaStatisticsButton?.click();
|
||||
}
|
||||
}
|
||||
|
||||
async function reloadVideo() {
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
playerDefaultQualityStore,
|
||||
playerProxyVideosStore,
|
||||
playerSavePlaybackPositionStore,
|
||||
playerStatisticsByDefault,
|
||||
playerTheatreModeByDefaultStore,
|
||||
playerYouTubeJsAlways,
|
||||
playerYouTubeJsFallback
|
||||
@@ -239,3 +240,19 @@
|
||||
</label>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<div class="field no-margin">
|
||||
<nav class="no-padding">
|
||||
<div class="max">
|
||||
<div>{$_('layout.player.playerStatistics')}</div>
|
||||
</div>
|
||||
<label class="switch">
|
||||
<input
|
||||
type="checkbox"
|
||||
bind:checked={$playerStatisticsByDefault}
|
||||
onclick={() => playerStatisticsByDefault.set(!playerStatisticsByDefault)}
|
||||
/>
|
||||
<span></span>
|
||||
</label>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
@@ -207,7 +207,7 @@
|
||||
}
|
||||
|
||||
.shaka-overflow-button-label span:not(.shaka-current-selection-span) {
|
||||
font-weight: bold !important;
|
||||
font-weight: 200 !important;
|
||||
}
|
||||
|
||||
.youtube-theme .shaka-overflow-menu span + span {
|
||||
|
||||
@@ -33,7 +33,8 @@ import {
|
||||
synciousStore,
|
||||
themeColorStore,
|
||||
interfaceAutoExpandChapters,
|
||||
playerDefaultPlaybackSpeed
|
||||
playerDefaultPlaybackSpeed,
|
||||
playerStatisticsByDefault
|
||||
} from '$lib/store';
|
||||
import { get, type Writable } from 'svelte/store';
|
||||
|
||||
@@ -211,6 +212,11 @@ const persistedStores: {
|
||||
name: 'defaultPlaybackSpeed',
|
||||
store: playerDefaultPlaybackSpeed,
|
||||
type: 'number'
|
||||
},
|
||||
{
|
||||
name: 'playerStatistics',
|
||||
store: playerStatisticsByDefault,
|
||||
type: 'boolean'
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
@@ -151,7 +151,8 @@
|
||||
"youtubeJsFallback": "Local video processing fallback",
|
||||
"youtubeJsAlways": "Always use",
|
||||
"lockOrientation": "Orientation locked to aspect ratio",
|
||||
"defaultPlaybackSpeed": "Default playback speed"
|
||||
"defaultPlaybackSpeed": "Default playback speed",
|
||||
"playerStatistics": "Show player statistics by default"
|
||||
},
|
||||
"bookmarklet": "Bookmarklet",
|
||||
"instanceUrl": "Instance URL",
|
||||
|
||||
@@ -47,6 +47,7 @@ export const playerYouTubeJsAlways = persisted('youTubeJsAlways', false);
|
||||
export const playerAndroidLockOrientation = persisted('androidLockOrientation', true);
|
||||
export const playerDefaultLanguage = persisted('defaultLanguage', '');
|
||||
export const playerDefaultPlaybackSpeed: Writable<number> = persisted('defaultPlaybackSpeed', 1);
|
||||
export const playerStatisticsByDefault = persisted('playerStatistics', false);
|
||||
|
||||
export const returnYtDislikesStore = persisted('returnYtDislikes', false);
|
||||
export const returnYTDislikesInstanceStore: Writable<string | null | undefined> = persisted(
|
||||
|
||||
Reference in New Issue
Block a user