* No status line with URL and "#".
* No new tab on middle click.
tabindex="0" ensures to have the normal tab order.
role="button" according to
https://www.mediawiki.org/wiki/Accessibility_guide_for_developers
Change-Id: I82f1923b3905f111ce7719c03a3919633271720a
Only store reference to the element, where they can easily be read
when needed.
Also removed one unnecessary use of `self` as an alias.
Change-Id: I39fa897002037a6d6478a3fb1f40ac60833e392e
Follows-up 2ac8a0a4b6, which removed this method. In checking
Codesearch, I somehow missed this one call among the false positive
results for Datepicker and TMH-related calls to a different method
also called "setDefaults".
Bug: T206588
Bug: T187207
Change-Id: I4f94ce6f8f1b85c192b69c5b50c3f090f7b4bfd2
Add potential items directly to a single array with two indexOf
checks.
Previously, potential items were first put in a new temporary array,
then that array was filtered with indexOf checks into another temporary
array, and then the result of that combined with the previous results
into another temporary filtered array, and then the previous results
array replaced with the new one. This eliminates 2*2N filter+concat
calls an their overhead from calling functions, creating arrays,
copying arrays and the memory for those arrays. (Where N is the number
of language-list strategies). It also reduces the total number of
indexOf calls.
Below is a comparison of time spent in createCompactList() during
page load process, compared to master without this and the previous
commit. Measured on localhost with Vector, EventLogging, Interwiki,
and ULS installed; on a page that is a copy of en.wikipedia.org/Messier_87
and its 51 interlanguage links. This page was a featured article
last week. Its count of links seems average compared to other
featured and/or most-viewed articles last week (the other ones
I checked had 23, 43, 52, and 76 langlinks respectively).
|--------------|----------|--------|
| | Before | After |
|--------------|----------|--------|
| Chrome 69 | 77.5ms | 41.4ms |
| MacBook Pro | 57.7ms | 44.4ms |
| CPU 1/6th | 63.8ms | 45.3ms |
|--------------|----------|--------|
| Firefox 61 | 12ms | 10ms |
| | 10ms | 9ms |
| | 11ms | 8ms |
|--------------|----------|--------|
| Safari 11 | 3.5ms | 2.7ms |
| | 3.3ms | 2.6ms |
| | 3.4ms | 2.8ms |
|--------------|----------|--------|
Bug: T127328
Change-Id: I56052e7c01c6a667500773e12c755a7a5f5d9cd0
The createCompactList() function runs synchronously during the
module execution burst. Due to it visually changing the page, I
won't defer it with rIC for the time being, although that should
be considered for the future. For this commit, I'm trying to make
it fit the budget of <50ms because ULS is currently usually taking
80ms-180ms on desktop (MacBook/Chrome CPU/4), and that's during
batch execution with other modules as well, thus freezing the
UI thread for much longer than that.
constructor:
* Remove needless clone of jQuery object.
Use $foo instead of $( $foo ).
* Remove creation of 'interlanguageList' and 'compactList' objects
that are immediately removed and re-created by init().
init/getInterlanguageList:
* Use the HTMLElement.lang and HTMLAnchorElement.href properties
directly instead of the DOM getAttribute().
This means stores a full url instead of a relative url, which
should help avoid other bugs in the future.
* Remove needless jQuery() constructor and jQuery.text() call.
Use Node.textContent directly instead.
* Use HTMLElement#querySelectorAll instead of jQuery#find().
init/getCompactList/../filterByLangsInText:
* Avoid jQuery() constructor and jQuery.attr(),
use the HTMLElement.lang property directly.
* Avoid jQuery() selector, call querySelectorAll directly.
init/getCompactList/../getCommonLanguages/../getFrequentLanguageList:
* Avoid temporary array copies from concat() and function overhead
with forEach() and filter().
Instead, keep only a single array, and iterate it once.
init/getCompactList/../filterByBadges (~10m -> ~0.5ms):
* Use one query via $(), instead of two queries $()+find().
* Use $.map() directly instead of map()+fakejQueryObject+toArray().
* Use querySelector(One) for the child instead of $()+find().
* Use HTMLElement.lang property directly.
init/hideOriginal (~5m -> ~0.8ms):
* Use querySelectorAll() directly instead of jQuery find().
* Set HTMLElement.style directly instead of jQuery() css().
init/render/addTrigger:
* Use createElement() and direct properties instead of $(), addClass(),
prop() and text().
* The mw.msg() calls use text() and jqueryMsg#parser which is
expensive.
Use plain() for 'ext-uls-compact-link-info', which doesn't need parsing.
Keep text() for the other message, and document why.
init/listen:
* Use async Deferred#then() instead of sometimes-sync Deferred#done().
Bug: T127328
Change-Id: I424c34fb82c8e95407f7b934e6d42019becbf909
Rather than building the link in JS, which is delayed until the JS
code loads, we build it in PHP and hide it from no-JS users with CSS.
Change-Id: If0c3a4dc137d8bf6cf24957dd063bd0a39791d2e
'mw' are '$' are globals, always have been, and aren't going
anywhere. They're every bit as real as their longer versions.
If anything, the longer ones are less "real" or 'stable" because
they're not used internally by RL and easier to accidentally
replace or override. For anecdotes and history, see 91f950d6b0.
Change-Id: I526fb8c961d9477992d88f2780a0ff4cbdc51923
It is created, unconditionally fired only once (right after creation),
and then used only with add(), which becomes a synchronous
self-call.
I've searched in Wikimedia Git and Codesearch, and found no uses
of `logEventQueue` or `mw.uls.eventlogger` outside this file.
Change-Id: I3832bcb409fc919c2078e583d50e20413dede163
Notable changes:
* First query global preferences to detect if global language setting
is in use. If there is no global language setting, or if GlobalPreferences
extension is not installed, it will fall back to changing the language
as usual. If global language setting is found, it will add an override
instead.
* If a local override is added, the undo tooltip is different and links to
the global preferences page. The task design shows mw.notify style popup
located on a bottom right corner (LTR). I deviate from the design and
re-use the old undo tooltip with a different message instead, for
consistency. The message is chosen depending on whether local storage
value `uls-gp` is set to '1' (set in mw.uls.changeLanguage).
* I removed one use of deprecated mediawiki.api.options module. One other
use still remains.
* I changed tooltip text generation from html acrobatics to use
mw.message.parseDom. Because of that I also had to move the click handler
to avoid buildup of click handlers.
* In message documentation fixed acronym -> autonym.
Bug: T198206
Change-Id: Ie2ed792e222be919522bd1cdea98042515a0619d
* In mw.uls.addPreviousLanguage, jQuery.map was used for what is
essentially filtering, not mapping. Filtering was used to remove
one element from array. Use Array.prototype.splice instead.
* In mw.uls.getFrequentLanguageList, replace:
- jQuery.each with Array.prototype.forEach
- jQuery.inArray with Array.prototype.indexOf
- jQuery.grep with Array.prototype.filter
Change-Id: Id2208b3c89e982f91f49981d18e588ae8ce3b130
Sometimes new languages don't appear in wgULSLanguages.
For these cases, read their autonym from ULS's own langdb.
Otherwise they are not shown at all.
Bug: T198080
Change-Id: I2bef16811c6a0bdaef5db94719d7b76fe00c6e04
Since we added .i18n() call to upstream, it started overwriting
our text from the default data-i18n. Change data-i18n instead.
Bug: T188860
Change-Id: Ib7e9fb9590ace9c2a4ce2e2afb5a740ae4346be6
SPDX released version 3 of their license list (<https://spdx.org/licenses/>),
which changed the FSF licenses to explicitly end in -only or -or-later
instead of relying on an easy to miss + symbol.
Bug: T183858
Change-Id: Id75a37eab27282ca7797fa3e6ceb92750c59477f
The module 'jquery.i18n' was removed in 1312b905f2 because it is
already in core. The mapping from mw.libs.pluralRuleParser to
window.pluralRuleParser is not needed here anymore.
Change-Id: I00993d43578368ba3ebc1f4055cabf4904e45783
It's now possible to tab to "display settings" and "input settings"
and access them with enter or space. Also escape can now be used
to close the settings screen.
The ULS trigger in interlanguage position is a button to get
native accessibility features.
Also removed `mw.hook( 'mw.uls.settings.open' ).fire( 'uls' );` as
it didn't seem very useful and there wasn't immediately obvious
place to put it. The existing click handler could be removed because
the settings dialog themselves place event listeners.
The patch is a bit longer than strictly necessary because the CSS
was mess (rules in different modules, poorly organized) and I had
to bring related rules together to understand them.
Bug: T52793
Change-Id: Id37c2665b1c97b81ef57be27a1abfae0db6b34d5
If the language settings window is not visible, all calculations
will go wrong and page will scroll to 0 position.
So call scrollIntoView only when the element is visible.
The $.fn.scrollIntoView defined in jquery.uls core may be unnecessary
now since it is available natively on DOM elements.
Bug: T178188
Change-Id: I461fa9eb7c51cd277bebd3a04cfcc0eed9793c4e
* Not updated from upstream; last release is buggy as per upstream.
* Punjabi language has good font support in all modern operating
systems.
Bug: T180422
Change-Id: I323953b4c6293df89034f05e0c2e13a96b42dc34
* Store prefixes and infixes separately in the data
* First match language code, then prefixes, then infixes
* Try to use suggestion either in user language or autonym first
* use formatversion=2 to avoid escaping Unicode
Using Language::fetchLanguageName might can have a small
performance impact. On the other hand there is now check
to skip languages we already found, avoiding some fuzzy
matching.
This is in a preparation for a change in jquery.uls to use
the search API more, while trying to reduce the amount of
weird autocompletion suggestions we show to the user.
Bug: T73891
Change-Id: Id94c5352d9a591969bf90144d1d2d5e758d08301
* Unknown upstream
* Not updated for years
* ne has better support in operating systems
* Non-default font for ne
Bug: T180422
Change-Id: Ife0b81e4db3bc069752d89c53f4690ddcfad7ef3
TTF files are not removed, the entries for them from the repo
is removed. Generated CSS will also skip ttf.
TTF format is not required for any browser now a days.
https://caniuse.com/#feat=woff
Change-Id: I018e74f6a50e63f55adeca480c03124092fba015
* These fonts are with no upstream now and little known among
Tamil users.
* Tamil is very well supported in all operating systems
now a days.
* Also reduce the metadata size for fontrepo
Change-Id: I4e7afb6476a4714f8d87bd2a048309b732883b2f
* I maintain these fonts in upstream and there we several releases
since these fonts were added.
* Malayalam has better support in operating systems compared to 2012
when these fonts were added.
* Reduce font metadata size for wikipedia pages when webfonts are
enabled.
Change-Id: Ie5b54cc866b1c67849b094a9701b2c80d876b55f
* The languages covered by these fonts are now available in all
operating systems.
* These fonts are not updated for years in our repo
* Saves the amount of font repo data we deliver for *every wikipedia
page* when webfonts is enabled
Change-Id: Ia0f1b6acc4cf8b7a354671bea47b58425ab8c08e
Moving apply and cancel buttons to align with padded edge of dialog
in order for resembling “final” state of buttons better.
Bug: T175295
Change-Id: I96b8b6dc3a3fca907a8f5d2923a19b0f86172c61
Making `#language-settings-dialog` carry the same CSS class
`.language-settings-dialog` to be able to override it in theme styles
more sanely. Follow-up to Id9c8652820641d6.
Bug: T175295
Change-Id: I1aa69f8701ed6d6cb2ed59cabf11332f2a10d21f
The tooltips include the title of the target article
and the name of the language in the user's language.
Bug: T160976
Change-Id: If3dd416e4a6f13b7b1366d30a1a3807a505346cb
when appearing on right side of screen
Languageselect was mostly fixed in 354378, but I forgot the
settings ones, so the triangle just disappears when
switching dialogs currently. This follows up on that and
properly fixes it.
Sidebar callouts now appear toward content regardless of
where they're appearing from, or the language
directionality. Triangles are now consistently alligned to
the top of the callout (same position in languageselect and
compact language links) to avoid issues with it appearing
over a scrollbar.
Sideways callout triangles (carets) are consolidated into a
single rendering approach and mixin across compact language
links and toolbox language selector.
Bug: T161586
Change-Id: I7717e26525ac527ede486796f49083ed40ee7d4f
This fixes the same issue as 1d395d4966,
but for the little language change popup (shown after you change the
language) instead of the main interface.
Change-Id: I28d3e8baeebf4619f4f810869c8a2a3fb60496d9