Commit graph

34 commits

Author SHA1 Message Date
alistair3149 9b66b82e48
refactor(prefs): ♻️ drop mustache in favor of pure JS 2024-04-25 18:05:57 -04:00
alistair3149 241dc96cfe
feat(prefs): move page width to clientPrefs
Now all of the existing prefs are migrated to clientPrefs,
we can discard the code from the old system.
2024-04-25 17:41:22 -04:00
alistair3149 964a4a534d
feat(prefs): remove line-height customization for now
Will be re-implemented later
2024-04-25 17:22:27 -04:00
alistair3149 0d52046523
feat(prefs): migrate font size to client preferences 2024-04-25 17:06:09 -04:00
alistair3149 a741639085
feat(core): move theme preferences to clientPrefs
Since clientPrefs and other related features are not avaliable until MW 1.42,
many of them are backported as polyfill. Instead of using cookies, the polyfill
are using localStorage only like Citizen in the past.

There are many changes behind the scene, but the most important one being that
`skin-citizen-*` theme classes are now soft-deprecated, and replaced by the
standardized `skin-theme-clientpref-*` classes. There will be sufficient
time before the hard deprecation.

Related: #780
2024-04-24 20:23:54 -04:00
alistair3149 3093510fae
refactor(preferences): ♻️ use mw.storage instead of localStorage 2024-04-24 00:25:09 -04:00
alistair3149 ed226a400e
feat(preferences): implement a localStorage version of mw.user.clientPrefs
This is the first step of migrating to the clientPrefs library when it is avaliable.
Currently only themes are using it and the standard classes are added to the HTML element.

Related: #780
2024-04-24 00:21:36 -04:00
alistair3149 6cddf85131
feat(search): add clear button to search box 2023-07-10 16:23:48 -04:00
alistair3149 4ef5376cab
refactor(core): ♻️ clean up various eslint errors 2023-07-07 18:00:14 -04:00
github-actions 00f252ae26 ci: 👷 lint code to MediaWiki standards
Check commit and GitHub actions for more details
2023-07-03 12:49:36 +00:00
沈澄心 2891d042cc
fix(core): skin preference support for Safari on iOS < 12.2 (#680)
* Update skins.citizen.preferences.js

* Update skins.citizen.preferences.js

* Update inline.js

* Update SkinHooks.php

* Update skins.citizen.preferences.less

* Update variables.less

* Update theme.less

* Update theme.less

* Update skins.citizen.preferences.js

* Update skins.citizen.preferences.js

* Update skins.citizen.preferences.js

* Update skin.js
2023-07-03 08:48:41 -04:00
沈澄心 89a9957cd4
refactor(core): avoid using ES2020+ methods (#669)
Replace ??, ?., and replaceChildren() for better compatibility; hide pref panel in unsupported browsers 

* Update mixins.less

* Update Sections.less

* Update TableOfContents.less

* Update interface-edit-section-links.less

* Update mixins.less

* Update Sections.less

* Update TableOfContents.less

* Update interface-edit-section-links.less

* Update sections.js

* Update tableOfContents.js

* Update mwRestApi.js

* Update mwRestApi.js

* Update skins.citizen.preferences.js

* Update mwActionApi.js

* Update typeahead.js
2023-06-21 14:30:45 -04:00
alistair3149 2d014694a6
feat(core): migrate misc icons to use RIL icon module 2022-11-21 17:43:03 -05:00
alistair3149 e53afa51dc
fix(core): config CitizenThemeDefault should set theme correctly
Previously the config did set the theme correctly but get overridden by the inline
script to auto, this will fix it.

Closes: #418
2022-06-29 15:29:44 -04:00
alistair3149 215e043f54
style(core): minor cleanup for the preference module 2022-05-25 16:38:39 -04:00
alistair3149 23795e05e3
chore(ci): disable mediawiki/class-doc 2022-05-13 00:20:05 -04:00
alistair3149 895d7c2398
feat(core): add missing title text to preferences button 2022-05-11 18:47:02 -04:00
alistair3149 1186bdf102
feat(core): update preferences menu behavior
* Adjust font size slider range, it starts at 80% and ends at 180%
* Font size is always shown in percentage now
* Better handling of initial font size, it should now detect browser or site default correctly
* Use relative units
* Tweak styles
2022-05-10 21:45:30 -04:00
alistair3149 9a28bccd64
refactor(core): partial cleanup of header preferences
This is a part of the header refactor
* Use styles provided by header
* Clean up header-related HTML classes
2022-05-10 13:39:58 -04:00
alistair3149 105d1b9006 refactor(core): clean up inner header implementation
This is a part of the header refactor
* Add hover and active state for title button
* Clean up DOM structure
* Clean up unnessecary styles
* Clean up HTML class names
2022-05-10 10:52:36 -04:00
alistair3149 c74f1685d6
feat(core): add aria-label for preferences button 2022-04-30 18:01:38 -04:00
alistair3149 d22f562816
fix: uncaught value when no theme value is saved
Users are unable to open the preference panel when there are no theme option saved in localStorage.
It is because prefValue.theme will return null which will stop the script from executing.
Now when prefValue.theme is null, it will default to auto.
2022-04-27 16:44:53 -04:00
alistair3149 2c79c061c4 feat: pass styles as style element instead of inline 2022-04-25 20:34:40 -04:00
github-actions eddcf5b493 ci: lint code to MediaWiki standards
Check commit and GitHub actions for more details
2022-02-19 20:09:01 +00:00
alistair3149 f5a2a831d1
feat: add user customizable line height 2021-08-05 11:24:52 -04:00
alistair3149 19119f2b5d
feat: add auto theme to preferences 2021-06-09 14:40:44 -04:00
alistair3149 b32151c99a
fix: remove click eventlistener when pref panel is hidden 2021-05-18 12:27:10 -04:00
alistair3149 6264b918e2
feat: dismiss preference panel when clicked outside or esc is pressed 2021-05-10 13:25:10 -04:00
alistair3149 ac2ed38183
feat: unify header button highlight hover state (#363) 2021-05-10 12:00:04 -04:00
alistair3149 06e91bb42d
feat: improve header button behavior 2021-05-04 13:27:47 -04:00
alistair3149 7eb9b1d7a1 refactor: clean up skins.citizen.preferences 2021-04-28 12:05:52 -04:00
alistair3149 7d44d6e082 feat: added check for localStorage 2021-04-28 12:05:52 -04:00
alistair3149 6b5b6cb07a feat: tweak show/hide behavior for preference menu 2021-04-27 13:51:03 -04:00
alistair3149 51ac47691e feat: implement reading preferences
allow visitor to adjust theme, font size, and page width
2021-04-27 13:51:03 -04:00