Brad Jorsch (Anomie) wrote:
>On Wed, May 10, 2017 at 3:48 AM, Yongmin H. <[email protected]> wrote:
>> Language is hackable via JS but settings like 'set timezone to blah
>>blah, disable VE if it's enabled, disable compact language if enabled,
>>set email to plaintext only, disable xwiki notification, ...' can't be
>>done via JS hack, which is unfortunate.
>
>It probably can, almost[1] anything you can change in Special:Preferences
>could be changed via something in your global user JS calling the action
>API's action=options.
>
>The main drawback is that it wouldn't take effect on a wiki until after
>the first time you visit a page there that loads your global user JS.

Yes, but that's not so bad. After someone deleted a ton of skin user
preferences, I added this snippet to my "global.js" subpage on Meta-Wiki,
with Legoktm's help:

/* Set skin to MonoBook */
mw.loader.using("mediawiki.user", function() {
    if ( mw.user.options.get('skin') !== 'monobook' ) {
        mw.loader.load("mediawiki.notify");
        ( new mw.Api() ).postWithToken( 'options', {
            action: "options",
            change: "skin=monobook"
        } ).done( function() {
            mw.loader.using("mediawiki.notify", function(){
                mw.notify( "Skin has been changed to MonoBook. Please
refresh the page." );
            } );
        } );
    }
} );

It works pretty well. It's certainly easier than going to
Special:Preferences on each wiki. Some links:

* https://phabricator.wikimedia.org/T16950#2185759 (April 2016)
* https://phabricator.wikimedia.org/T154956#2929966 (January 2017)

MZMcBride



_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to