Commit graph

28 commits

Author SHA1 Message Date
Siddharth VP 7793a9475f Add support for ES6 gadgets, but with validation disabled
Gadgets can mark themselves as ES6-only by specifying the requiresES6
boolean attribute. Syntax validation is disabled for them (as the
validator doesn't support ES6 yet), and they are loaded together in a
separate request.

The minifier doesn't reject syntax errors, and thus these would
be passed through to web clients. Hence, communities using this feature
are encouraged to use ESLint or another linter to make sure only
valid ES <= 6 code is being used.

Because of the above, this feature is only made available for
non-default gadgets.

Bug: T75714
Change-Id: Ib98ac0700471554d5721d7ab858d4660e1e0e980
2022-10-20 22:03:18 +00:00
suecarmol 14f18c3b32 Add a description for Special:Preferences
Added a description that will be displayed in Special:Preferences mobile layout

Bug: T311717
Change-Id: I494253c57ea3bb13180fbd0cea16ab4a871e1109
2022-09-27 12:51:35 -05:00
Translation updater bot 32cbc20b8c Localisation updates from https://translatewiki.net.
Change-Id: I56a2e3e9e1baadc12cfed58c55cc504c00bf0f32
2022-02-01 08:27:01 +01:00
Ammarpad 5d3a547c8b Restrict ?withgadget query parameter to opt-in gadgets.
?withgadget query parameters allows for ad-hoc loading of gadgets
(after passing all other basic checks). This was recently added in
I5b30d4e.

In T29766#7611796 Gergo raised concerns about how this can be
potentially abused.

This patch aims to restrict the feature by giving gadgets latitude
to either use it or not depending on the nature of the gadget.

The patch does so by adding `supportsUrlLoad` option that gadgets
(maybe those deemed safe) can use it to opt-in to the parameter.
By default gadgets don't support it, so it can be enabled for each
on a case-by-case basis.

Bug: T29766
Change-Id: Ie64174085e650579d76cc862774a4fe1b3d08396
2022-01-24 00:31:19 +00:00
Siddharth VP f1673c441a Avoid raising exception while trying to change content model of gadget definition
Currently, trying to change content model of a page in gadget definition namespace (via either the special page or the API) raises an exception. This uncaught exception has been replaced with a localisable error message.

Bug: T299303
Change-Id: Iad7d353d03cdfb52bf66aa2c9a12bc71a840577c
2022-01-16 22:43:37 +05:30
Translation updater bot 868591df51 Localisation updates from https://translatewiki.net.
Change-Id: Id0f8d7a3e6a3a578aed82a9a6162cbfd5770ec0f
2022-01-13 08:27:02 +01:00
Gergő Tisza 6b74e170c0
Add edit link to gadget definition in Special:Gadgets
When using the Gadget definition: namespace, link to the definition
pages from Special:Gadgets. Also change the wording of the links
to edit the names of the gadgets, to disambiguate them.

Change-Id: I327a4cfa9846edec60e1aaafc674cd66f4e0beae
2021-12-31 20:42:37 -08:00
Siddharth VP 7ead5dab61 Allow specifying page actions in definitions
Allow specifying page actions ('view', 'edit', 'history', etc) in
gadget definitions. If specified, the gadget is run only on the given
page action(s).

This is especially useful for default gadgets like RefToolbar[1] and
TextReactions[2] that only need to be loaded while editing.

[1]: https://en.wikipedia.org/wiki/WP:RefToolbar
[2]: https://en.wikipedia.org/wiki/WP:Text_reactions

Bug: T204201
Bug: T63007
Change-Id: Idde71b3f1f6c36cd21539a2312be8f12217a9acc
2022-01-01 00:41:08 +05:30
Siddharth VP 1f7b9d90df Support JSON files in gadgets
The parsed content of JSON files in the gadget is made available from the
gadget's JS files via require(). That is, MediaWiki:Gadget-data.json (or
Gadget:data.json) is available as `require('./data.json')`. This is
supported for both MediaWikiGadgetsDefinitionRepo and
GadgetDefinitionNamespaceRepo. The JSON parsing is done server-side.

JSON can only be used in "package" gadgets - in which the JS files can
also be invoked via require().

Also added a test for GadgetResourceLoaderModule.

Bug: T198758
Depends-On: Ib4556d09c4d393269e32771aab00f59a5f630e1b
Depends-On: Id4589a597ccfc4266b3e63d10f75b146aa7a287a
Change-Id: I21acb46cdd244a39b5cc6963aa763f0113bd1e38
2021-12-27 17:33:21 +00:00
Translation updater bot f7e1b0e282 Localisation updates from https://translatewiki.net.
Change-Id: Ibaf2ddc93afc93ade2cdfeac5c88c21695ed73ab
2020-04-07 08:41:13 +02:00
Translation updater bot 535ba9f30d Localisation updates from https://translatewiki.net.
Change-Id: Ib9106099c339a0a8291012804b589a25a2d41892
2020-03-12 08:42:32 +01:00
zoranzoki21 53de932571 Move all apihelp translatable messages to separate files
Bug: T189982
Change-Id: Ifc682634d8403401e2ca4667e34474ed08574f53
2019-01-29 17:11:32 +00:00
Brad Jorsch 30d8e92ba9 API: Split description messages into summary + additional text
See MediaWiki core patch I778bab2b

Change-Id: I7ed2ddd3d4df7db75872db3820189aa061fd4500
2017-06-09 11:59:25 -04:00
Translation updater bot d73427edd3 Localisation updates from https://translatewiki.net.
Change-Id: I6553dd2dd2ca5ba2ce5d1ff3c1a852b236bdc0c3
2015-12-18 23:36:07 +01:00
niharika29 75ae3558e7 Add a feature flag to turn off the 'active users' query on GadgetUsage
Currently takes >24 hours to complete on enwiki and thus isn't run
at all. Need a better optimised query. Until that happens, we can
turn it off on enwiki.

Bug: T121484
Change-Id: Idcf2a8a1cdf5ce4c2f6a631ef980be5a48ca547b
2015-12-18 19:30:45 +00:00
niharika29 0815999bec Append default gadgets to Special:GadgetUsage table with 'Default' in place of stats
Bug: T121133
Change-Id: I14cfb352d6dec9edfbb4d3ed7bd3e0545e4f1eab
2015-12-16 07:13:10 +00:00
niharika29 0c498ae7b6 Add column for active users to Special:GadgetUsage
Bug: T116894
Change-Id: Iea6db379064f7ea959a4f0f3d0010e92ea2f04a2
2015-12-07 19:53:33 +00:00
Kunal Mehta 519f30355e Implement Gadgets definition namespace repo
Implements:
* Gadget definition content and content handler
* Basic validation for gadget definition content
* GadgetDefinitionNamespace implementation of GadgetRepo
* DataUpdates upon editing/deletion of Gadget definition pages
* EditFilterMerged hook for improved error messages
* 'GadgetsRepoClass' option to switch GadgetRepo implementation used
* Lazy-load the GadgetResourceLoaderModule class so we don't need to
load each individual gadget object unless its needed

Note that Special:Gadgets's export feature intentionally doesn't work
yet, and will be fixed in a follow up patch.

Bug: T106177
Change-Id: Ib11db5fb0f7b46793bfa956cf1367f1dc1059b1c
2015-11-20 12:01:21 -06:00
Translation updater bot b95b450a01 Localisation updates from https://translatewiki.net.
Change-Id: I767a820920820d4a83474a09e97a034641469d20
2015-10-25 22:04:26 +01:00
niharika29 be8091a288 Add a special page to show number of users for each gadget on the wiki
Bug: T115152
Change-Id: Id1e245f8fdb2fc6a764682ae34937f35af24bd7c
2015-10-23 15:02:23 +00:00
jenkins-bot e8be573463 Merge "Set up "Gadget" and "Gadget definition" namespaces" 2015-08-09 02:48:00 +00:00
Kunal Mehta e6b8b57d9b Set up "Gadget" and "Gadget definition" namespaces
Register the "Gadget", "Gadget definition", and their respective talk
namespaces. It will not be possible to create any pages in the Gadget
and Gadget definition namespaces due to the "gadgets-edit" and "gadgets-
definition-edit" rights not being granted to any groups.

Depends on Iaf8b44d02adf9 in MediaWiki core.

Change-Id: Ia88c774cc0decc252a4a4277d14822048db95801
2015-08-08 01:39:56 -07:00
Timo Tijhof 29e7a9193d Don't load legacy gadget scripts
The time has come to stop supporting legacy gadgets that haven't
migrated to ResourceLoader yet.

For many Gadgets, migrating to ResourceLoader will be as easy
as adding "[ResourceLoader]" to its definition on MediaWiki:Gadgets-definition.

However for older gadgets, they may need more maintenance. Though
similarly they may've already been malfunctioning silently.

The most common techniques used by legacy scripts, and what their
equivalents are in modern JavaScript, see:
<https://www.mediawiki.org/wiki/ResourceLoader/Migration_guide_(users)>

Ref T107399.

Change-Id: Ia5f7323a40a28541515ef3a3f5079f1cc940f392
2015-08-07 01:00:40 +00:00
Translation updater bot 4af7dbf4a9 Localisation updates from https://translatewiki.net.
Change-Id: Iec9fb469d60e0327b95a74530e8d16a8d88cf449
2015-03-23 21:53:06 +01:00
Translation updater bot d449d1eabc Localisation updates from https://translatewiki.net.
Change-Id: Ia028be7c2b67388bb8a1d0e998ae391eeda8a10a
2015-02-19 22:07:26 +01:00
Brad Jorsch 48c47e1cf0 Add i18n for API module help
MediaWiki core change I04b1a384 added support for i18n of API module
help. This takes advantage of that while still maintaining backwards
compatibility with earlier versions of MediaWiki.

Once support for MediaWiki before 1.25 is dropped, the methods marked
deprecated in this patch may be removed.

Change-Id: I67395aff48185f3e09da31b51a08aa2541fe6a17
2014-10-29 16:37:38 -04:00
Translation updater bot 223ac5489a Localisation updates from https://translatewiki.net.
Change-Id: I35f7a5795b727a289368b56486df875119d192cf
2014-04-16 15:36:05 +00:00
Siebrand Mazeland 5d28ca240d Migrate to JSON i18n
Procedure per https://www.mediawiki.org/wiki/Manual:GenerateJsonI18n.php
with shim.

Change-Id: I1cc79cf4bade15ba469f5c407604416b85b74731
2014-03-27 10:02:52 +01:00