Commit graph

44 commits

Author SHA1 Message Date
Timo Tijhof c839756b32 Remove 'wgCategoryTreePageCategoryOptions' export from pageview HTML
This was internal to CategoryTree JS code and only needed on very
few pages. Export it as part of the module that needs it, instead.

Given this is computed and not a plain config var, use callback
to generate the value.

Bug: T219342
Change-Id: I790a98128b0a3317e27ac0d5fda08d48aeb640dc
2019-04-05 11:31:03 -07:00
jenkins-bot e97676459c Merge "Attach event handler for categories" 2019-01-22 05:12:20 +00:00
Fomafix eebad4e3ae Attach event handler for categories
This change is restoring the functionality on categories when
wgCategoryTreeHijackPageCategories is enabled. This functionality was
lost in 69fa92ee11.

Change-Id: I5b16bfd653bf193b15a3003628bfa2bd864b9881
2019-01-22 05:06:37 +00:00
Fomafix 095040a9e6 Remove hook SkinJoinCategoryLinks
The hook `SkinJoinCategoryLinks` is not used and not triggered.

Also remove the style for the class CategoryTreeCategoryBarItem because
it is only used in skinJoinCategoryLinks::skinJoinCategoryLinks.

Change-Id: I52e4f819ff195fc1fa8a148b0bb58d95a4bf22d7
2019-01-10 20:15:28 +01:00
Fomafix 9529dbf27b Remove support for Firefox 2 and Internet Explorer 7 and older
Change-Id: I5cb8543ab2a07db9386400382913764e182c81ae
2019-01-10 18:25:54 +00:00
Fomafix 3cdb4e95f2 Move styles that only used in JavaScript to JavaScript module
Also rename the style module from 'ext.categoryTree.css' to
'ext.categoryTree.styles'.
Keep the previous module name 'ext.categoryTree.css' for compability to
cached versions.
Also move the files of the module 'ext.categoryTree' into a
subdirectory ext.categoryTree.

Change-Id: Ie5ea28acfb43e33a94ec5824baf4f26d63d8e9e6
2019-01-10 13:38:58 +01:00
Fomafix 0a1f707f2f Remove obsolete aliases from closures
Bug: T208951
Change-Id: I963db9601a597e398187644946d83dda43568069
2018-12-06 19:55:37 +01:00
Fomafix 3232eedeb3 Clarify result handling in JavaScript
Change-Id: Id79340512854cb2e86a9275239bc9be79db26728
2018-05-24 10:33:36 +02:00
jenkins-bot 616e9e5dfe Merge "Remove error message on retry" 2018-05-24 08:16:11 +00:00
Fomafix 0d681798ce Remove error message on retry
Change-Id: Icc6fdaec6cc9289347d3065c54bdc9dd61e04ed9
2018-05-24 08:33:59 +02:00
TTO 191d1f5ec8 Fix display of categories with numeric names
Bug: T44938
Change-Id: Ib84b58451475c54bc0a59d8c6b0a9747fc59345d
2018-05-09 14:05:57 +00:00
Timo Tijhof c24e5edb2f Fix eslint no-use-before-define warning
* Re-order the functions to be defined before their first use.

* The one exception is loadChildren() which is also toggled
  indirectly from a click handle, and is thus intentionally
  recursive in nature:
  load content > attach handler > click > expand content
  > load content.

  Fix this by declaring 'loadChildren' specifically ahead of time
  and assigning it last. This declares it to be safe for use in
  any function, knowing it is only triggered indirectly from
  event handlers and not during setup.

Change-Id: If2d49e2ff5d25e330165a2d3f0860f611fc3bdb5
2018-04-17 01:31:23 +01:00
Fomafix dd5583f026 Fix sidebar tree support
Bug: T171778
Change-Id: I2a2498d2129e8bed03340cfb00f65281f7aa3d35
2018-04-17 01:01:33 +01:00
Kunal Mehta 50c10d1fcb Use standard GPL file header
Change-Id: Ic49d45d0a0cb640d40486735c95f13cc6e29063f
2018-04-16 22:38:06 +00:00
jenkins-bot 5c5da4ca9e Merge "Avoid href="#" for <a>" 2018-02-27 02:08:42 +00:00
Timo Tijhof c35519b5af Avoid parsing and re-encoding ct-options in categoryTree.js
Follows-up 680cdd688a, which accessed the data attribute
using data() instead of attr(), making it thus be parsed as JSON,
only to be re-encoded with JSON.stringify().

I considered to instead change the 'wgCategoryTreePageCategoryOptions'
mw.config var to not be double-encoded as JSON, but concluded
it actually makes sense the way it is. Right now the options are,
from the client-side perspective, considered to be a blackbox string
set on either a link attribute, or in an mw.config key, and are
to be passed as-is (in whatever format) to the 'options' parameter
of the API module.

At least until we need these values on the client (which we don't right now)
it makes more sense not to have any js for decoding and re-coding.

Change-Id: I1e1e02a13d7a5293c9ae2e0ec61575ddb7a1f286
2018-02-20 04:27:15 +00:00
James D. Forrester 120b01696b build: Bump devDependencies to latest
eslint-config-wikimedia      0.4.0  →   0.5.0
 grunt                        1.0.1  →   1.0.2
 grunt-banana-checker         0.5.0  →   0.6.0
 grunt-eslint                19.0.0  →  20.1.0
 grunt-jsonlint               1.0.8  →   1.1.0
 grunt-stylelint              0.6.0  →   0.9.0
 stylelint                    7.8.0  →   8.2.0
 stylelint-config-wikimedia   0.4.1  →   0.4.2

Change-Id: Id081b31764ae923486031255cc5f24bfd6601782
2018-02-14 09:21:40 -08:00
Fomafix e39e99b436 Avoid href="#" for <a>
The href="#" shows a status line and allows to open a new tab on middle
click.

Add tabindex="0" and role="button" instead to still allow to focus the
element with the keyboard.

Add JavaScript event handler for the return key of the keyboard to still
allow to trigger the event with the keyboard.

Change-Id: I3f4c14d335f3a06bc67f148558e5b9a1534671bf
2017-09-06 05:50:19 +02:00
Fomafix f0f7ffa6dc Add tooltips when attaching the handler
The tooltips are not right while loading and for clients with disabled
JavaScript.

Add the title attribute with JavaScript instead of PHP.

Centralize attaching in new function attachHandler.

Change-Id: I2a1b29ca204b61b5fec1d3244528e3f3d8ed6ad7
2017-09-05 11:28:58 +02:00
Fomafix 3b48d9af2c Improve CSS while loading and for non-JavaScript clients
* Hide toggle buttons for clients without JavaScript via CSS.
* This also avoids rerendering while loading for clients with JavaScript.
* Hide CategoryTreeEmptyBullet for clients without JavaScript.
* Show the normal bullets for clients without JavaScript.
* Add cursor:pointer only when JavaScript handler is attached.
* Avoid selecting the buttons as selection.

Bug: T168770
Change-Id: I42678b87af84dee49ca06d950d8beddcc3b7a9f4
2017-09-04 21:55:47 +00:00
Fomafix 19d698b422 Change from jshint to eslint
Change-Id: I9d8a31c8048f9d80e8395a637573272ca5f9fea5
2017-04-30 10:47:34 +02:00
Umherirrender 400a3ad210 Add stylelint for css files
Fixed the following rules:
color-hex-case
declaration-colon-space-after
indentation

Change-Id: I417137916607a25bab6a3c85a95b4c489fb8a8a5
2017-04-17 19:52:24 +02:00
Sébastien Santoro 070e6af90c CategoryTreeMode and CategoryTreeHidePrefix constants classes
The extension CT_* defines are replaced by class constants.

We currently keep the former defines in CategoryTree.php,
to help to set the default configuration. When the code
will be migrated to use the extension registration, we'll
remove the defines.

Bug: T87888
Change-Id: I59e6b9319fd5130c51a23f21ea81d4dbf3f28b8e
2016-04-02 01:50:18 +00:00
Fomafix 4b4a630807 Remove JavaScript side injection of message 'categorytree-expand'
The JavaScript side injection of message 'categorytree-expand' was introduced in 026cc407.
The intent of not initializing $wgLang does not work anymore, because
there are some other wfMessage() calls in the same request.

Change-Id: Idf0815654e1e095acccbe10afe0726bc8766f8ae
2016-01-31 23:45:00 +00:00
Fomafix f37ad97bb1 Trim HTML in API response on server side instead of client side
Change-Id: I9f61c98b4be2f10563e4c0d1d6165e1922bfe52c
2016-01-31 20:44:58 +00:00
Alex Monk 680cdd688a Use an API module instead of the old (to be removed) ajax functions
Also removes some stuff that appears unused.
Caching depends on Ia18874c9

Bug: T92788
Change-Id: I4d106d8fbfd799a15ef3f8eda06c437b234ec218
2016-01-25 18:26:40 +00:00
Derk-Jan Hartman 696ca276f5 Add JSHint to CategoryTree
Bug: T65112
Change-Id: Ib10f4b043fab5b3163f6e343ae5ff926300b60c8
2015-03-15 09:42:46 +01:00
Fomafix f6cb7dd261 Move comment to the right place
Change-Id: I0b0604edb22abe4fcb11acda86b756adc1fc1677
Follows-up: Ia4a19b363b49ca456efb205c082445da5e6efb47
2015-01-15 19:48:31 +00:00
Fomafix 69fa92ee11 Support for LivePreview
A solution for bug 24134 is still missing.

Change-Id: Ia4a19b363b49ca456efb205c082445da5e6efb47
2014-03-29 10:04:21 +00:00
jenkins-bot 55f53a90f6 Merge "Rework ext.categoryTree.js" 2014-03-29 00:20:43 +00:00
Fomafix ef8a9f0ba5 Use current lang, debug and skin for AJAX call
Load the subtree in the current user interface settings set by the
URL parameters debug, uselang and useskin.

Change-Id: I11c58e62b641c926a9965efb01d776851807e651
2014-02-23 09:39:34 +00:00
Fomafix 9409a256ef Rework ext.categoryTree.js
* Remove unnecessary variable categoryTree
* Escape messages
* Replace deprecated .success() and .error() by .done() and .fail()

Change-Id: I07649b820de096ad81fcaae3812dc41bbc942e8c
2014-02-21 22:33:04 +00:00
Navdeep Bagga 7daff86820 Fix CSS according to the vector layout
Bug: 41859
Change-Id: Ic936931d3aad30a76c11de06c64ca23dc2c95c7f
2013-11-09 02:08:58 +00:00
Timo Tijhof 1f21d2998a Minor clean up of css/js
* Trim trailing whitespace on lines.
* Remove css that has been commented for 5 years (63e25672).
* Remove comment about $wgCategoryTreeVersion which was
  removed 2 years ago (e77ae54).
* Add missing spaces in CSS and JS.

Change-Id: Icb28293b445880246f2b4273daab2fb21c2638df
2013-10-10 00:52:39 +02:00
This, that and the other 4b1eecbd10 Provide nice new arrows to replace bad old [+] [-] [x]
These folding arrows are based on the English Wikipedia setup, created
by Edokter. I don't see why all wikis can't benefit from them.

The only complication is with right-to-left languages, where ◄ is needed
instead of ►. I have updated the i18n file in a way that I hope is
sufficient.

When JavaScript is disabled, the fallback is a bit unintuitive, but no
worse than what is already there.

Bug: 36730
Change-Id: Ia15593ea5ee471c521820e2e69aa599fd4c4b921
2013-09-23 11:55:46 +00:00
Siebrand Mazeland 92f3e2f909 Maintenance for CategoryTree extension
* Drop MSIE 5.0 and 5.5 hack in CSS.
* Replace use of deprecated wfMsg* functions.
* Update documentation for two methods.
* Update code formatting (long lines, {}).

Change-Id: I9601e9263b9a188d4a843c3be8ee6808d2e7a117
2012-08-29 00:35:39 +02:00
Krinkle cbedb517d2 [CategoryTree]
* Fixes:
-- (bug 34880) [CategoryTree] Retry link shouldn't reset page scroll to '#' (and misses a space)
2012-03-02 00:31:33 +00:00
Krinkle 41eeac2a23 [CategoryTree] clean up JS
* 0 is falsy, cover for that case
* Add comments explaining the numbers, these come from PHP constants, via $wgCategoryTreePageCategoryOptions end up in data- attributes
* Follow-up r112849
2012-03-01 23:43:41 +00:00
Krinkle 8e90ba4c6e [CategoryTree] clean up JS, fix undefined bug
* Use dashes versions of data attributes to make it easier to find them (now the data attributes as found in PHP where no where to be found in any JS file, appeared to be bogus)
* Don't create a new <div> element ($parentTag) only to store a single string in it's data object, using local variables for ctTitle, ctMode and ctOptions instead.
2012-03-01 23:04:44 +00:00
Niklas Laxström 0495b4e230 Comment not relevant with resource loader 2012-01-24 11:34:12 +00:00
John Du Hart e1191e314d Followup r98563, improvement to javascript per CR 2011-10-02 19:25:17 +00:00
John Du Hart bac9f6d905 Followup r98563, oops, forgot to use var for Javascript variables. Yikes 2011-09-30 22:13:51 +00:00
John Du Hart 8e3523c626 Followup r98500, conversion of the Javascript to use jQuery fully. It also makes the Javascript work outside of debug=1 (oops)
There's a couple of WTF moments in the code, this is really due to some issues with the PHP side of stuff. It really needs some TLC but for right now it works, I'll come back to it before 1.19 and clean it up.
2011-09-30 21:08:28 +00:00
John Du Hart e77ae5449b Basic ResourceLoader conversion, jQuery conversion and API use will come soon 2011-09-30 02:51:53 +00:00