Commit graph

32 commits

Author SHA1 Message Date
Thiemo Kreuz e73f2076ad Inline/simplify smaller pieces of JavaScript code
The check if $() found an element is not needed. Method calls will
operate happily on an empty result and do nothing, as expected.

Change-Id: I985ac4623d7968f037613174b14348885afed7d1
2022-04-26 17:44:17 +02:00
Ed Sanders 3892280f1d build: Update linters
Change-Id: Icc5076d5cf757e7e70511c2b75a82b0a45cb47c9
2022-03-17 22:19:08 +00:00
Daimona Eaytoy bf9142a644 Partial integration of EditBoxBuilder with HTMLForm
This patch adds a transparent HTMLForm field that can be used to insert
the edit box inside an HTMLForm, and updates /test and /tools to use
that. The field class, together with the other editbox-related classes,
is now in a dedicated namespace. A future TODO is making it a real
HTMLForm field.

Also improve a bit the form in /test: add section labels and
avoid reusing the same label message used on Special:AbuseFilter.

Bug: T261584
Change-Id: Ib74bb5fdba4f8476169b754030fce6d4f72ce65a
2021-02-01 16:23:42 +00:00
Daimona Eaytoy c1b4f1084c ViewTools: hide the result box when empty
The <pre> element is now hidden with CSS, and is only shown after the
user clicks the "Eval" button.
Moreover, make the button primary and progressive, as to indicate that
it activates the primary function of that page.

Bug: T253492
Change-Id: I300ce6ec0a84ea73025a5af9173024df7c291e03
2020-09-19 12:37:06 +00:00
jaredblumer 12f9be5e69 eslint: Update to eslint-config-wikimedia 0.16.0
* Update ESLint config with Selenium WebdriverIO test suite
* Update modules and Selenium pageobjects and specs per ESLint
requirements
* Update grunt-eslint package to 23.0.0 as required by
eslint-config-wikimedia 0.16.0

Bug: T254495
Change-Id: Ibfcf9115adedf9f2c3e7dac1ac626b41fc97b7c4
2020-06-08 21:17:50 -04:00
Daimona Eaytoy 4c98aecf4d Improve var dumping in /details, /examine and /tools
Using var_export for better visual effect, especially for arrays.
The result from /tools is much clearer and the 'wrong syntax' message is
a bit more explicative than before.

Bug: T190653
Bug: T239972
Change-Id: I79a17305c7f19f7900f896f895e9365bb5f2fd58
2020-03-28 17:35:43 +01:00
Ed Sanders d86b74d3de eslint: Add /mediawiki rules
Change-Id: I1853e273fad3308349c79d188bc30de98fe116c4
2020-02-22 15:59:28 +00:00
TheSandDoctor 4a933e034f ext.abuseFilter.tools.js: Replace deprecated editToken with csrfToken
The editToken key of mw.users.tokens is deprecated since MediaWiki 1.27.
This commit resolves it for AbuseFilter.

Bug: T233442
Change-Id: I445313088cef40caf0d0695a64515cd16e83504d
2019-09-22 01:54:34 +00:00
Daimona Eaytoy ed2bc7badf Don't show the form for restoring autopromotion to unprivileged users
Bug: T232881
Change-Id: I80c34c823f505c81e20f83ccf5c5a99e8e69b626
2019-09-13 20:31:17 +02:00
Daimona Eaytoy b235e1040a Restyle edit box dimensions
Now it's always wider, and so is the "notes" field. Moreover, the
fallback textarea has the exact same size. Plus removed a parameter
which only made it hard to write a CSS rule for the textarea. Since the
textarea is generated by the same code, and we're always using it for
the same thing (filter syntax, regardless of the final goal), make it
always use the same name.

Bug: T230591
Change-Id: Ibb308e80d954c0e81aa09249c38c39572f157948
2019-08-17 18:53:13 +02:00
Daimona Eaytoy 6e2b66f96d build: Update eslint-config-wikimedia to 0.10.1
And exclude no-global-selectors for now...

Change-Id: I0cea497ff8d8c749ea4f365c968428af01e85d18
2019-02-18 19:26:42 +01:00
jenkins-bot 9ce4afb010 Merge "Add names to anonymous JS function" 2019-01-19 13:27:43 +00:00
jenkins-bot 575646393b Merge "Improve code readability" 2019-01-19 12:11:06 +00:00
Ed Sanders 663a66dc0a Remove obsolete aliases from closures
Bug: T208951
Change-Id: I1330672b62c9d8f49cf31264995e7a07b467178f
2018-11-23 15:44:58 +00:00
Daimona Eaytoy 7427333ed5 Improve code readability
Simplify some logic constructs, reduce the amount of return statements
inside methods, explicitly declare variables before using them, reduce
code duplication, add names to JS anonymous function to produce clearer
stack traces.

Change-Id: Ife4546a91c30d4c519d09a712ba56a2f33abe579
2018-11-19 16:01:37 +01:00
Daimona Eaytoy 9d02b3947a Add names to anonymous JS function
To have clearer stack traces.

Change-Id: Ia086cef5dc916c21a94af7856715754b6bfb496b
2018-11-19 15:46:09 +01:00
Daimona Eaytoy e60dacbbea Fix code comments
Fixed some comments adding explanations, fixing syntax, and parameter types
for docblocks. Also fixed some whitespace mess, and added a missing use
statement.

Change-Id: I3547c90bdaa2cab5443e8bf0c63b217fe6ba663f
2018-10-03 16:45:03 +02:00
Huji Lee 26c72c1cd9 Convert Special:AbuseFilter/tools to use OOUI
Bug: T132284
Change-Id: I139b30399f83d43c4da565b25726d8786d02d1ef
2018-04-02 16:31:19 +02:00
James D. Forrester de2a7b07d4 build: Replace jshint with eslint
Bug: T186753
Change-Id: I067adf86a220d59ff1693bef74d7590d4c63d3c2
2018-02-08 16:26:50 +00:00
helderwiki 20dabefe22 Improve error handling for HTTP requests
The API provides more details about HTTP errors, so show these to
the user instead of a generic "An unknown error occurred."

Bug: 68767
Change-Id: I3188b9729c815a07c65a7dbef4d40deebe29b87d
2014-08-02 11:56:32 +00:00
helderwiki 1717b743f8 Use POST method for action=abusefilterevalexpression API requests
Needed as tests take arbitrary user input through a textarea,
which can get rather big. GET cuts it off sometimes.

Follow-up to I317f5d7c372710617a7a6526cd4613de9660a40a

Bug: 47298
Bug: 68767
Change-Id: Ibab02be4c4e5640a09a1a76a4aa3e1a9520f489d
2014-07-28 20:21:14 -03:00
Marius Hoch 87094b9c0a Add .jshintrc for AbuseFilter and make it pass
Change-Id: I1cee072e6c751e441e77e6f005676fe13841283e
2013-04-17 15:03:36 +02:00
Timo Tijhof 5d50832447 JSHint: If you use 'use strict', make sure you actually pass it.
Someone added "use strict" to AbuseFilter JS files, but it didn't
actually pass in strict mode.

Change-Id: I0cf26b4dacfa88fb40d0595276db65239823763a
2013-04-02 21:44:01 +02:00
Marius Hoch e3d15fe915 Overhaul of the AbuseFilter JS
I've changed the JS of the AbuseFilter extension to match our
coding conventions and made it use mediaWiki.Api(). Furthermore
I fixed several error handlers and made some things nicer in
general while trying to not change the user appearance.

I've tested the changes as good as I could (I'm pretty sure everything
works).

Change-Id: Iaa0f99367bd7e0bfaf7249dcc9ac9ce9881b46e1
2013-03-07 14:14:25 +01:00
Marius Hoch 1958d74854 Fix AbuseFilter JS
Temp. fix, please look at https://gerrit.wikimedia.org/r/30110

Change-Id: Ic890a6f7b39618dba9f310244777e69435940cce
2012-10-26 16:21:08 +02:00
Marius Hoch f52f940ee5 Fix the AbuseFilter JS
This is bad style, but it works... please take a look at
https://gerrit.wikimedia.org/r/30110 which is much cleaner
and doesn't have the problems as well.

Change-Id: I91684de0c8594917736812846ed3782653a46e99
2012-10-26 15:57:54 +02:00
Siebrand Mazeland 176227e721 Maintenance for AbuseFilter extension.
* Replace deprecated methods.
* Remove no longer needed function fnmatch().
* Remove superfluous newlines.
* Remove unused and redundant local variables and globals.
* Deglobalization.
* Update documentation.
* Fix incorrect return values or add FIXMEs when in doubt.
* Escape output in a few places where needed.
* Remove unneeded MEDIAWIKI constant checks.
* Fix various JSHint/JSLint issues.

Patch Set 11: Merged https://gerrit.wikimedia.org/r/24701 into
this one per Siebrand's request

Change-Id: I02ba4ce31b6aca5b7324114093f8ece143abc295
2012-10-09 22:26:45 +02:00
John Du Hart f57debc190 Followup r98495, fix double escaping 2012-01-02 08:02:40 +00:00
John Du Hart 9c75f9907f Followup r95572, minor tweaks per CR 2011-09-30 00:48:00 +00:00
John Du Hart 4926aeae24 Followup r98490, since the module names changed the variable names need changing as well 2011-09-30 00:05:08 +00:00
John Du Hart 3f06314486 Followup r95572, rename API modules to reduce chance of collisions per CR 2011-09-29 23:30:42 +00:00
John Du Hart b30697e94c Adds ResourceLoader support to AbuseFilter
Rewrote javascript to use jQuery
Added API modules to replace sajax_* calls
Solves bug 29714
2011-08-26 20:12:34 +00:00