From 152b5f76ebe0622dff2eac5cc302a15668ad2d12 Mon Sep 17 00:00:00 2001 From: Rasz_pl Date: Sun, 7 Jul 2024 23:15:41 +0200 Subject: [PATCH 1/8] Update player.js finish fixing player_quality, optimize, reshuffle order so quality and codec settings are grouped together, hide unimplemented optimize_codec_for_hardware_acceleration --- menu/skeleton-parts/player.js | 136 ++++++++++++++-------------------- 1 file changed, 54 insertions(+), 82 deletions(-) diff --git a/menu/skeleton-parts/player.js b/menu/skeleton-parts/player.js index 8712fb82e..6e3e9c6b6 100644 --- a/menu/skeleton-parts/player.js +++ b/menu/skeleton-parts/player.js @@ -715,6 +715,19 @@ extension.skeleton.main.layers.section.player.on.click = { } } }, + mini_player: { + component: 'switch', + text: 'customMiniPlayer' + }, + forced_play_video_from_the_beginning: { + component: 'switch', + text: 'forcedPlayVideoFromTheBeginning' + }, + player_crop_chapter_titles: { + component: 'switch', + text: 'cropChapterTitles', + value: true + }, player_quality: { component: 'select', text: 'quality', @@ -758,9 +771,9 @@ extension.skeleton.main.layers.section.player.on.click = { }], on: { render: function () { - // relies on options.text above auto always starting with a number for parseInt to work + // (parseInt) relies on options.text following 'auto' always starting with a number to work const options = this.childNodes[2].options, - index = this.childNodes[2].selectedIndex; + index = this.childNodes[2].selectedIndex, cutoff = 1080; if (satus.storage.get('player_h264')) { if (parseInt(options[index].text) > cutoff) { @@ -802,7 +815,7 @@ extension.skeleton.main.layers.section.player.on.click = { } }, /* - qualityWhenRunningOnBattery: { + qualityWhenRunningOnBattery: { component: 'select', text: 'qualityWhenRunningOnBattery', options: function () { @@ -822,20 +835,7 @@ extension.skeleton.main.layers.section.player.on.click = { component: 'switch', text: 'pauseWhileIUnplugTheCharger' }, -*/ - mini_player: { - component: 'switch', - text: 'customMiniPlayer' - }, - forced_play_video_from_the_beginning: { - component: 'switch', - text: 'forcedPlayVideoFromTheBeginning' - }, - player_crop_chapter_titles: { - component: 'switch', - text: 'cropChapterTitles', - value: true - }, + */ player_codecs: { component: 'button', text: 'codecs', @@ -850,11 +850,7 @@ extension.skeleton.main.layers.section.player.on.click = { block_av1: { component: 'switch', text: 'blockAv1', - on: { - click: function () { - this.parentElement.skeleton.sanitize(); - } - } + value: false }, block_vp9: { component: 'switch', @@ -869,22 +865,12 @@ extension.skeleton.main.layers.section.player.on.click = { satus.render({ component: 'modal', variant: 'confirm', - content: 'block_Codec_Alert_VP9', - ok: function () { - where.flip(true); - where.parentElement.skeleton.sanitize(); - }, - cancel: function () { - } + content: 'block_Codec_Alert_h264', + ok: function () { where.flip(true); }, + cancel: function () {} }, extension.skeleton.rendered); - } else { - this.flip(true); - this.parentElement.skeleton.sanitize(); - } - } else { - this.flip(false); - this.parentElement.skeleton.sanitize(); - } + } else this.flip(true); + } else this.flip(false); } } }, @@ -902,32 +888,12 @@ extension.skeleton.main.layers.section.player.on.click = { component: 'modal', variant: 'confirm', content: 'block_Codec_Alert_h264', - ok: function () { - where.flip(true); - where.parentElement.skeleton.sanitize(); - }, - cancel: function () { - } + ok: function () { where.flip(true); }, + cancel: function () {} }, extension.skeleton.rendered); - } else { - this.flip(true); - this.parentElement.skeleton.sanitize(); - } - } else { - this.flip(false); - this.parentElement.skeleton.sanitize(); - } - } - } - }, - sanitize: function () { - if (satus.storage.get('player_h264')) { - if ((!satus.storage.get('block_vp9') || !satus.storage.get('block_av1') && satus.storage.get('block_h264')) || - (satus.storage.get('block_vp9') && satus.storage.get('block_av1') && satus.storage.get('block_h264'))) { - satus.storage.set('player_h264', false); + } else this.flip(true); + } else this.flip(false); } - } else if (satus.storage.get('block_vp9') && satus.storage.get('block_av1') && !satus.storage.get('block_h264')) { - satus.storage.set('player_h264', true); } } } @@ -941,18 +907,27 @@ extension.skeleton.main.layers.section.player.on.click = { }, on: { render: function () { - var codecs = (satus.storage.get('block_h264') ? '' : 'h.264 ') + (satus.storage.get('block_vp9') ? '' : 'vp9 ') + (satus.storage.get('block_av1') ? '' : 'av1'); + if (satus.storage.get('block_vp9') && satus.storage.get('block_av1') && !satus.storage.get('block_h264')) { + satus.storage.set('player_h264', true); + } else { + satus.storage.remove('player_h264'); + } + + const codecs = (satus.storage.get('block_h264') ? '' : 'h.264 ') + + (satus.storage.get('block_vp9') ? '' : 'vp9 ') + + (satus.storage.get('block_av1') ? '' : 'av1'); - if (codecs.includes('h.264') || codecs.includes('vp9')) { - this.style = ''; - this.textContent = codecs; - } else if (codecs) { + this.style = ''; + this.textContent = codecs; + if (codecs === 'av1') { this.style = 'color: red!important; font-weight: bold;'; - this.textContent = codecs; - } else { + } else if (codecs ==='') { this.style = 'color: red!important; font-weight: bold;'; this.textContent = 'none'; } + document.getElementById('player_quality').dispatchEvent(new CustomEvent('render')); + document.getElementById('player_quality_without_focus').dispatchEvent(new CustomEvent('render')); + //document.getElementById('quality_when_low_battery').dispatchEvent(new CustomEvent('render')); } } } @@ -965,14 +940,11 @@ extension.skeleton.main.layers.section.player.on.click = { custom: true, on: { click: function () { - let skeleton = this.parentNode.skeleton; - // refresh player_codecs/optimize_codec_for_hardware_acceleration elements when we change codecs - let refresh = function () { - document.getElementById('player_quality').dispatchEvent(new CustomEvent('render')); - document.getElementById('player_codecs').dispatchEvent(new CustomEvent('render')); - document.getElementById('optimize_codec_for_hardware_acceleration').dispatchEvent(new CustomEvent('render')); - document.getElementById('player_quality_without_focus').dispatchEvent(new CustomEvent('render')); - //document.getElementById('quality_when_low_battery').dispatchEvent(new CustomEvent('render')); + let skeleton = this.parentNode.skeleton, + refresh = function () { + // send signal for #player_codecs to refresh, will in turn redraw #player_quality/#player_quality_without_focus + // when we change player_h264 directly + document.getElementById('player_codecs').dispatchEvent(new CustomEvent('render')); } if (this.dataset.value === 'false') { let where = this; @@ -985,7 +957,7 @@ extension.skeleton.main.layers.section.player.on.click = { where.flip(true); satus.storage.set('block_vp9', true); satus.storage.set('block_av1', true); - satus.storage.set('block_h264', false); + satus.storage.remove('block_h264'); refresh(); }, cancel: function () { @@ -996,15 +968,15 @@ extension.skeleton.main.layers.section.player.on.click = { // manually turn switch OFF this.flip(false); // reset all codecs to unlocked state - satus.storage.set('block_vp9', false); - satus.storage.set('block_av1', false); - satus.storage.set('block_h264', false); + satus.storage.remove('block_vp9'); + satus.storage.remove('block_av1'); + satus.storage.remove('block_h264'); refresh(); } } } }, - optimize_codec_for_hardware_acceleration: { +/* optimize_codec_for_hardware_acceleration: { component: 'button', text: 'Optimize Codec for hardware acceleration', style: { @@ -1042,7 +1014,7 @@ extension.skeleton.main.layers.section.player.on.click = { } } } - }, + },*/ player_60fps: { component: 'switch', text: 'allow60fps', From 0f8ba4c2d108beafbf366f7fdce00856c1286ecb Mon Sep 17 00:00:00 2001 From: Rasz_pl Date: Sun, 7 Jul 2024 23:18:48 +0200 Subject: [PATCH 2/8] Update messages.json redundant block_Codec_Alert_VP9 --- _locales/en/messages.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 37c4cce95..a170ca02e 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -206,9 +206,6 @@ "block_Codec_Alert_h264": { "message": "You need either H.264 or VP9 enabled for Youtube to play videos." }, - "block_Codec_Alert_VP9": { - "message": "You need either VP9 or H.264 enabled for Youtube to play videos." - }, "blockAll": { "message": "Off (block or skip)" }, From 2110629562d612a553da111ac7899ed4d743a386 Mon Sep 17 00:00:00 2001 From: Rasz_pl Date: Sun, 7 Jul 2024 23:19:58 +0200 Subject: [PATCH 3/8] Update messages.json block_Codec_Alert_h264 message --- _locales/es/messages.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_locales/es/messages.json b/_locales/es/messages.json index 92e868232..f260411c8 100644 --- a/_locales/es/messages.json +++ b/_locales/es/messages.json @@ -119,7 +119,7 @@ "black": { "message": "Negro" }, - "block_Codec_Alert_VP9": { + "block_Codec_Alert_h264": { "message": "Necesita activar VP9 o H.264 para que Youtube reproduzca videos." }, "blockAll": { @@ -1109,4 +1109,4 @@ "youtubeLimitsVideoQualityTo1080pForH264Codec": { "message": "YouTube limita calidad de video a 1080p para el codec h.264" } -} \ No newline at end of file +} From f80ce73e46eddeb43216138a9fa936e0a005e553 Mon Sep 17 00:00:00 2001 From: Rasz_pl Date: Sun, 7 Jul 2024 23:20:53 +0200 Subject: [PATCH 4/8] Update messages.json redundant messages --- _locales/pt/messages.json | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/_locales/pt/messages.json b/_locales/pt/messages.json index fac33914b..5475b2f01 100644 --- a/_locales/pt/messages.json +++ b/_locales/pt/messages.json @@ -1,7 +1,4 @@ { - "2160p": { - "message": "2160p - 4K" - }, "about": { "message": "Sobre" }, @@ -161,9 +158,6 @@ "block_Codec_Alert_h264": { "message": "Você precisa ativar o H.264 ou VP9 para reproduzir vídeos." }, - "block_Codec_Alert_VP9": { - "message": "Você precisa ativar o VP9 ou H.264 para reproduzir vídeos." - }, "blockAll": { "message": "Bloquear tudo" }, @@ -1322,4 +1316,4 @@ "youtubesDark": { "message": "YouTube escuro" } -} \ No newline at end of file +} From 53bbb0ffdbb12b069cbe6735d3531cd2d9cd3797 Mon Sep 17 00:00:00 2001 From: Rasz_pl Date: Sun, 7 Jul 2024 23:21:22 +0200 Subject: [PATCH 5/8] Update messages.json redundant --- _locales/el/messages.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/_locales/el/messages.json b/_locales/el/messages.json index 8bc0fbff1..5d9e123f3 100644 --- a/_locales/el/messages.json +++ b/_locales/el/messages.json @@ -155,9 +155,6 @@ "block_Codec_Alert_h264": { "message": "Χρειάζεστε είτε το H.264 είτε το VP9 ενεργοποιημένο για να αναπαραχθούν βίντεο στο Youtube." }, - "block_Codec_Alert_VP9": { - "message": "Χρειάζεστε είτε το VP9 είτε το H.264 ενεργοποιημένο για να αναπαραχθούν βίντεο στο Youtube." - }, "blockAll": { "message": "Απενεργοποίηση (Αποκλεισμός ή Παράβλεψη)" }, @@ -1264,4 +1261,4 @@ "Youtube_Search": { "message": "Youtube-Αναζήτηση" } -} \ No newline at end of file +} From 0c63aed2b5c79355db34ec3648aaffa5373b8ce1 Mon Sep 17 00:00:00 2001 From: Rasz_pl Date: Sun, 7 Jul 2024 23:22:03 +0200 Subject: [PATCH 6/8] Update messages.json redundant --- _locales/sw_KE/messages.json | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/_locales/sw_KE/messages.json b/_locales/sw_KE/messages.json index 89970c573..c68a1bf35 100644 --- a/_locales/sw_KE/messages.json +++ b/_locales/sw_KE/messages.json @@ -1,7 +1,4 @@ { - "2160p": { - "message": "2160p - 4K" - }, "about": { "message": "Kuhusu/" }, @@ -158,9 +155,6 @@ "block_Codec_Alert_h264": { "message": "Unahitaji H.264 au VP9 kuwezeshwa kwa YouTube ili kucheza video." }, - "block_Codec_Alert_VP9": { - "message": "Unahitaji VP9 au H.264 kuwezeshwa kwa YouTube ili kucheza video." - }, "blockAll": { "message": "Imezimwa (zuia au ruka)" }, @@ -1298,4 +1292,4 @@ "youtubeLimitsVideoQualityTo1080pForH264Codec": { "message": "YouTube inaweka kikomo ubora wa video hadi 1080p kwa kodeki ya h.264" } -} \ No newline at end of file +} From a96a400adac55f3f3690ffb1b1115c512353d73b Mon Sep 17 00:00:00 2001 From: Rasz_pl Date: Sun, 7 Jul 2024 23:23:36 +0200 Subject: [PATCH 7/8] Update messages.json redundant --- _locales/ja/messages.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/_locales/ja/messages.json b/_locales/ja/messages.json index 80b65b7aa..fbfe4b2b4 100644 --- a/_locales/ja/messages.json +++ b/_locales/ja/messages.json @@ -1,7 +1,4 @@ { - "2160p": { - "message": "2160p - 4K" - }, "about": { "message": "このソフトについて" }, @@ -1049,4 +1046,4 @@ "youtubeLimitsVideoQualityTo1080pForH264Codec": { "message": "YouTubeはH.264コーデックの画質を1080pに制限しています" } -} \ No newline at end of file +} From 35609fe530fe8367259bebc15d15fbdc57843a5b Mon Sep 17 00:00:00 2001 From: Rasz_pl Date: Sun, 7 Jul 2024 23:33:41 +0200 Subject: [PATCH 8/8] Update player.js indentation --- menu/skeleton-parts/player.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/menu/skeleton-parts/player.js b/menu/skeleton-parts/player.js index 6e3e9c6b6..4a1dfd011 100644 --- a/menu/skeleton-parts/player.js +++ b/menu/skeleton-parts/player.js @@ -773,8 +773,8 @@ extension.skeleton.main.layers.section.player.on.click = { render: function () { // (parseInt) relies on options.text following 'auto' always starting with a number to work const options = this.childNodes[2].options, - index = this.childNodes[2].selectedIndex, - cutoff = 1080; + index = this.childNodes[2].selectedIndex, + cutoff = 1080; if (satus.storage.get('player_h264')) { if (parseInt(options[index].text) > cutoff) { this.childNodes[1].style = 'color: red!important; font-weight: bold;'; @@ -912,7 +912,7 @@ extension.skeleton.main.layers.section.player.on.click = { } else { satus.storage.remove('player_h264'); } - + const codecs = (satus.storage.get('block_h264') ? '' : 'h.264 ') + (satus.storage.get('block_vp9') ? '' : 'vp9 ') + (satus.storage.get('block_av1') ? '' : 'av1'); @@ -940,12 +940,12 @@ extension.skeleton.main.layers.section.player.on.click = { custom: true, on: { click: function () { - let skeleton = this.parentNode.skeleton, - refresh = function () { - // send signal for #player_codecs to refresh, will in turn redraw #player_quality/#player_quality_without_focus - // when we change player_h264 directly - document.getElementById('player_codecs').dispatchEvent(new CustomEvent('render')); - } + let refresh = function () { + // send signal for #player_codecs to refresh, will in turn redraw #player_quality/#player_quality_without_focus + // when we change player_h264 directly + document.getElementById('player_codecs').dispatchEvent(new CustomEvent('render')); + }; + if (this.dataset.value === 'false') { let where = this; satus.render({ @@ -976,7 +976,7 @@ extension.skeleton.main.layers.section.player.on.click = { } } }, -/* optimize_codec_for_hardware_acceleration: { + /*optimize_codec_for_hardware_acceleration: { component: 'button', text: 'Optimize Codec for hardware acceleration', style: {