Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@
"device": {
"message": "Device theme"
},
"defaultPlaybackSpeed": {
"message": "Default Playback Speed"
},
"disableAmbientMode": {
"message": "Disable Ambient mode"
},
Expand Down
11 changes: 11 additions & 0 deletions options.html
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,17 @@
</svg>
<span id="videoPages">Video pages</span>
</label>
<section class="select">
<label>
<span id="defaultPlaybackSpeed">Default Playback Speed</span>
<select name="defaultPlaybackSpeed">
<option value="1.0">1.0</option>
<option value="0.5">0.5</option>
<option value="1.5">1.5</option>
<option value="2.0">2.0</option>
</select>
</label>
</section>
<section class="checkbox">
<label>
<span id="disableAutoplay">Disable Autoplay</span>
Expand Down
2 changes: 2 additions & 0 deletions options.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ for (let translationId of [
'debugManualHidingNote',
'debugNote',
'debugOptions',
'defaultPlaybackSpeed',
'disableAmbientMode',
'disableAutoplay',
'disableHomeFeed',
Expand Down Expand Up @@ -202,6 +203,7 @@ let defaultConfig = {
version: /(Android|iP(ad|hone))/.test(navigator.userAgent) ? 'mobile' : 'desktop',
alwaysShowShortsProgressBar: true,
blockAds: true,
defaultPlaybackSpeed: "1.0",
disableAmbientMode: true,
disableAutoplay: true,
disableHomeFeed: false,
Expand Down
15 changes: 15 additions & 0 deletions page.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ let defaultConfig = {
debug: false,
debugLogGridObservers: false,
debugManualHiding: false,
defaultPlaybackSpeed: "1.0",
alwaysShowShortsProgressBar: false,
alwaysShowShortsProgressBar: true,
blockAds: true,
disableAmbientMode: true,
Expand Down Expand Up @@ -3282,6 +3284,16 @@ function alwaysUseTheaterMode($player) {
}
}

async function defaultPlaybackSpeed() {
let $player = await getElement('#movie_player', {
name: 'player (defaultPlaybackSpeed)',
stopIf: currentUrlChanges(),
})
if (!$player) return
// @ts-ignore
$player.setPlaybackRate(parseFloat(config.defaultPlaybackSpeed))
}

function animateHidingHiddenItems(itemsToHide) {
function hideItem(item) {
item.classList.remove('cpfyt-vanishing-flip')
Expand Down Expand Up @@ -5573,6 +5585,9 @@ async function tweakVideoPage() {
if (config.disableAutoplay) {
disableAutoplay()
}
if (config.defaultPlaybackSpeed) {
defaultPlaybackSpeed()
}
if (desktop) {
run(async () => {
let $player = await getElement('#movie_player', {
Expand Down
1 change: 1 addition & 0 deletions types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export type SiteConfig = {
debug?: boolean
debugLogGridObservers?: boolean
debugManualHiding?: boolean
defaultPlaybackSpeed: string
alwaysShowShortsProgressBar: boolean
blockAds: boolean
disableAmbientMode: boolean
Expand Down