Greasy Fork is available in English.

Wikipedia - Keep style preferences in incognito

Immediately apply the user's style preferences in incognito sessions, for a seamless experience, without needing to manually set them every time.

Autor
jackiechan285
Denne inštalácií
0
Celkový počet inštalácií
3
Hodnotenie
0 0 0
Verzia
2025-02-04.3
Vytvorené
04.02.2025
Aktualizované
04.02.2025
Veľkosť
4,1 KB
Licencia
neuvedené
Spustiť na

When you open Wikipedia in incognito, you have to manually set the styles to your preferences all over again, which may be annoying if done multiple times.

This script does it automatically, instantly, at first run, with no reload required.

It directly changes the cookie responsible for the style preferences and changes the style preference classes to apply them immediately because the changes to the cookie only take effect after reloading.

The cookies are necessary because the class changes alone do not get saved.

This is done only once per session, so it won't affect performance or be redundant. It also allows the user to change the preferences further on, and they won't be overwritten.

It sets a flag on localStorage to indicate the cookie has already been overwritten, to ensure it's only done once per session.

.

To-do

Currently, it defaults to dark theme, wide view, and small font. This can be changed by the numbers in the preference flags, both for cookies and classes.

In the future, I plan to make the preferences more clearly customizable in the script.

I also plan to implement syncing with user preferences outside of incognito mode, and make it possible to sync the modifications to the preferences made in the website's interface by saving them to the script's local storage.

.

Why Wikipedia in incognito?

I personally use incognito every time I want to search for random topics, and I don't want these polluting my history with one-off interests.

So, I always encounter the Wikipedia style preferences issue, and I found a quick solution, which can also be useful to anyone with the same issue.

As silly as this script might be, it's a fun way for me to train my coding and prompting skills, express my creativity, and get to publish somewhat useful stuff.

I also think publishing useless niche user scripts is a type of art, and I like the concept that anything we publish on the internet stays forever. We should want to make simple things that mean something to ourselves. This is good because it's a very refined implementation of a solid idea, even in the most niche applications. That's the fun of it.