Skip to content
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

User:AzaToth/twinkle.js #749

Closed
siddharthvp opened this issue Nov 18, 2019 · 3 comments
Closed

User:AzaToth/twinkle.js #749

siddharthvp opened this issue Nov 18, 2019 · 3 comments

Comments

@siddharthvp
Copy link
Member

Yesterday, I updated the list of most imported scripts. It turns out that User:AzaToth/twinkle.js remains the 2nd-most installed userscript on the pedia with a whooping 5508 installs!

I suggest that the content of User:AzaToth/twinkle.js be changed to

mw.loader.using(['user.options', mediawiki.api']).then(function() {
    if (mw.user.options.get('gadget-Twinkle') === null) {
        new mw.Api().saveOption('gadget-Twinkle', '1');
    }
});

This enables the gadget, so that subsequently, the gadget is fetched directly w/o going through the userscript page. This leads to more accurate gadget usage statistics. Also, this makes the load experience consistent across all users since I guess gadgets are loaded before userscripts.

Ping @azatoth.


user.options values are string '1' for user-enabled gadgets, number 1 for default-enabled gadgets, and 0 for default gadgets disabled by user. Non-default gadgets that are not enabled aren't there in the user.options object at all. When accessed using mw.user.options.get(), it gives null.

@Amorymeltzer
Copy link
Collaborator

See also #85

@Amorymeltzer
Copy link
Collaborator

@azatoth Are you opposed to this? It's heavy-handed but would be a marginal improvement. Another option would be to use mw.notify to annoy folks until they change to the gadget.

@Amorymeltzer
Copy link
Collaborator

I've gone and done this. I considered just importing the notification note (like the submodules do) but figured it'd be simpler to just take care of it for folks, given how long it's "just worked."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants