A categorytree can be part of the user interface (in the sidebar) or
part of the content. The user interface and the content can have a
different text direction.
This change use the usual way to of bidi flipping based on the user
interface language direction and on the content direction like the class
mw-editsection in core.
The direction of the bullets in mixed directions will be fixed in
Ibfb0cb28f0086fb1b7d0997be2246bc120eea85e.
Bug: T288910
Change-Id: Ia420ef120cf4aa66a1e63c9cf3aa2438cc68da52
`list-style: none none` was a workaround for an IE 6 & 7 rendering issue.
Same goes for `list-style-image: none; list-style-type: none;` combination.
Let's unify to shorthand `list-style: none` for any non-ancient browser.
Change-Id: If091ad82c7f73dbae826aeddc6c65c56ea92c73d
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPublic
* MediaWiki.Usage.ExtendClassUsage.FunctionConfigUsage
Additional changes:
* Dropped .inc files from .phpcs.xml (T200956).
* Added the `wikimedia/mediawiki` profile in .eslintrc.json (T262222).
* Added the `wikimedia/jquery` profile in .eslintrc.json (T262222).
* Removed global `$`, included in the `wikimedia/jquery` profile (T262222).
* Removed global `mw`, included via `wikimedia/mediawiki` profile (T262222).
* Dropped the emtpy global definition in .eslintrc.json.
Change-Id: Ib5a3697712078a4ed22195c274eae9c82ddd7227
Those combinations origin from a time when these were seen as faster
to be rendered (at least dating back to 2011). Not only is this
reason no longer true, it also holds us back to start using semantic
HTML5 sectioning elements like `nav` for `.portal`.
Bug: T248137
Change-Id: I72b180d1c8bc1b029c147483590e2fc44dd29a86
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
This change is restoring the functionality on categories when
wgCategoryTreeHijackPageCategories is enabled. This functionality was
lost in 69fa92ee11.
Change-Id: I5b16bfd653bf193b15a3003628bfa2bd864b9881
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
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
* 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
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
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
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
* 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
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
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
Load the subtree in the current user interface settings set by the
URL parameters debug, uselang and useskin.
Change-Id: I11c58e62b641c926a9965efb01d776851807e651
* 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
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
* 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
* 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
* 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.
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.