Skip to content

Commit 00608fb

Browse files
committed
feat: add checked dark theme in edge browser
1 parent 19f99c4 commit 00608fb

File tree

1 file changed

+12
-19
lines changed

1 file changed

+12
-19
lines changed

youtube_script_new_ui.js

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
// @description:en Youtube Tools All in one local Download mp4, MP3 HIGT QUALITY
7171
// @description Youtube Tools All in one local Download mp4, MP3 HIGT QUALITY
7272
// @homepage https://github.com/DeveloperMDCM/
73-
// @version 2.3.4.1
73+
// @version 2.3.4.3
7474
// @author DeveloperMDCM
7575
// @match *://www.youtube.com/*
7676
// @exclude *://music.youtube.com/*
@@ -1670,22 +1670,15 @@
16701670

16711671

16721672

1673-
function checkDarkModeActive() {
1674-
const prefCookie = document.cookie.split('; ').find(row => row.startsWith('PREF='));
1675-
let theme = 'light';
1676-
if (prefCookie) {
1677-
const params = new URLSearchParams(prefCookie.split('&').join('&'));
1678-
const f1Value = params.get('f6');
1679-
// themes dark active os or youtube
1680-
// - 4000000
1681-
// - 40000400
1682-
// - 400
1683-
if (f1Value === '4000000' || f1Value === '40000400' || f1Value === '400') {
1684-
theme = 'dark';
1685-
}
1686-
}
1687-
return theme;
1688-
}
1673+
function checkDarkModeActive() {
1674+
const pref = document.cookie.split('; ').find(c => c.startsWith('PREF='));
1675+
if (!pref) return 'light';
1676+
1677+
const params = new URLSearchParams(pref.split('&').join('&'));
1678+
const darkModes = ['400', '4000000', '40000400', '40000000'];
1679+
return darkModes.includes(params.get('f6')) ? 'dark' : 'light';
1680+
}
1681+
16891682
let isDarkModeActive = checkDarkModeActive();
16901683

16911684

@@ -2040,7 +2033,7 @@
20402033
<div class="developer-mdcm">
20412034
Developed by <a href="https://github.com/DeveloperMDCM" target="_blank">DeveloperMDCM</a>
20422035
</div>
2043-
<span style="color: #fff" ;>v2.3.4.1</span>
2036+
<span style="color: #fff" ;>v2.3.4.2</span>
20442037
</div>
20452038
`;
20462039
const panelHTML = policy
@@ -3776,7 +3769,7 @@
37763769

37773770
console.log(
37783771
'%cYoutube Tools Extension NEW UI\n' +
3779-
'%cRun %c(v2.3.4.1)\n' +
3772+
'%cRun %c(v2.3.4.2)\n' +
37803773
'By: DeveloperMDCM.',
37813774
HEADER_STYLE,
37823775
CODE_STYLE,

0 commit comments

Comments
 (0)