-
-
Notifications
You must be signed in to change notification settings - Fork 543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Special 'satus_remove' value signaling default option, remove instead of storing #2220
Conversation
…y switch in menu skeleton
…licit declarations anymore
…th default special 'satus_remove' value
wow! 🥰 |
…hot_save_as fixed embed_subtitle setting - it wasnt working with default embed_subtitle.value: true
…ettings() subtitlesUserSettings() = ImprovedTube.subtitlesFontFamily(); ImprovedTube.subtitlesUserSettings(); ImprovedTube.subtitlesFontColor(); ImprovedTube.subtitlesFontSize(); ImprovedTube.subtitlesBackgroundColor(); ImprovedTube.subtitlesWindowColor(); ImprovedTube.subtitlesWindowOpacity(); ImprovedTube.subtitlesCharacterEdgeStyle(); ImprovedTube.subtitlesFontOpacity(); ImprovedTube.subtitlesBackgroundOpacity();
I broke half the sliders with 220d429, fixed now
… variant: 'manual' removing one redundant storage manipulation now that switches do it automatically
😏 |
Tested, working. Could be merged right now after adding code converting user configs (deleting all redundant true/false settings). |
…atically deletes unused config
we currently have: (old news:)
and
|
( satus_remove ~= default? besides youtube/menu/styles/sub-options.css Line 30 in f6b84f3
|
youtube/js&css/web-accessible/core.js Lines 234 to 235 in f6b84f3
(as of 6b56ee0: then need to search & replace |
yes but mostly no :) satus_remove makes the selection delete itself, so it works like user never touched that option in the first place.
1 ha! I was wondering why this code Line 1625 in f6b84f3
now I know 2 hmm #subtitles-language is never created youtube/menu/skeleton-parts/player.js Lines 160 to 163 in f6b84f3
we create #language_closed_caption instead, looks like this entry is corrupted? its text references "language" while it should be "language_closed_caption"? https://github.com/search?q=repo%3Acode-charity%2Fyoutube+language_closed_caption+language%3AJSON&type=code&l=JSON so this never worked to begin with :o
or CSS rule modified to reference #language_closed_caption
not gonna be a problem. User setting theme back to default will remove satus.storage.data.theme / ImprovedTube.storage.theme
when extension is first installed(or all settings reset) ImprovedTube.storage.transcript doesnt exist at all, so this is bad code? it will only work if User first flips transcript ON then OFF. It was always broken :( Another similar, but borderline working example is youtube/js&css/web-accessible/www.youtube.com/player.js Lines 642 to 656 in f6b84f3
it checks for ImprovedTube.storage.player_screenshot_save_as !== 'clipboard', and when you install extension youtube/menu/skeleton-parts/player.js Lines 1020 to 1029 in f6b84f3
its neither clipboard nor file so it works by shear luck/someone using reverse reverse logic :) 4abaeeb flips that around to straightforward check for == 'clipboard', otherwise perform default action (file) |
sorry, edit: #2220 (comment)
yes, in the section (most of core.js) is for demonstrating the effect of features immediately. youtube/js&css/web-accessible/core.js Line 176 in f6b84f3
Checking === false 17 times yet. ( one default true youtube/js&css/web-accessible/core.js Lines 190 to 191 in f6b84f3
while others could be shortened by regex
Aaand one default:true-toggle's default actually ultimately depends country youtube/menu/skeleton-parts/analyzer.js Line 30 in 427b3ed
youtube/menu/skeleton-parts/night-mode.js Line 61 in 427b3ed
youtube/menu/skeleton-parts/night-mode.js Line 69 in 427b3ed
and to be complete /mentioned before: a few Features / "Experiment Flags" might also meaningfully be stored on both sides, disable or enable - if youtube doesnt have a default like currently for |
I dont think you can regex all changes, there are logical traps like !== 'clipboard'. Anyway after good sleep I had an epiphany - Im going at it all wrong :). Magic 'satus_remove' value approach was wrong direction, we already have all what needed in current menu/*.js files as is, no need for additional magic values. Ill start again, third times a charm as they say. |
done #2262 . No more magic values, No more data markers. Every Satus function detects default value automatically and acts accordingly. |
Special 'satus_remove' value signaling default option. Storing 'satus_remove' in any config variable automagically deletes it. For example User switching player_quality back to auto will set it to 'satus_remove' value which in turn will automatically delete player_quality key from config.
Converted components.switch to only store active usage, flipping switch to default position deletes it from config. This respects skeleton.value: true witches that start as default ON like up_next_autoplay. Those only save False value and get automatically deleted when switched to True.
In principle no additional code changes should be required to \web-accessible\ side of extension, but this opens possibility of simplifying code a lot. After automatically converting all user configs on next upgrade we will no longer have to check for config_variable != 'disabled', != 'auto',=== true, === false, this.isset(option) etc.