Commit Graph

162 Commits

Author SHA1 Message Date
Fomafix
6a5b9e3164 Consistently use setTimeout, clearTimeout and location without window
Change-Id: Ie83313b3f2a7f9bc939eb19d7a82bc980f12b0b8
2019-12-16 10:19:35 +00:00
Ed Sanders
b105c2cadc build: Update linters
Change-Id: Ib83952a64224ab550f64975285e60713225b23b7
2019-11-12 14:45:01 +00:00
Ed Sanders
dae53b628c build: Update linters
Change-Id: Ib513d9fe879fb0c848cdfefaaaa753cc7279e242
2019-09-17 14:55:46 +01:00
Ed Sanders
c080452013 build: Update eslint-config-wikimedia to 0.11.0
Change-Id: Ic59891fab5f8e35420bddbed34072841883fa543
2019-03-13 23:41:14 +00:00
Niklas Laxström
e93e1bc845 Remove disabling of max-len rule and fix violations
Change-Id: I39ec2e572e569a05c11929dd17241653abf954ef
2018-12-15 17:12:18 +00:00
Fomafix
d052482cb0 Use <a> instead of <a href="#"> for JavaScript click events
* 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
2018-10-17 20:16:19 +00:00
Bartosz Dziewoński
f0ad6be4ab Avoid reflow (FOUC) due to ULS link on Special:Preferences
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
2018-09-09 10:52:17 +00:00
Timo Tijhof
4e067715dc Remove redundant closure aliases
'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
2018-09-07 19:23:17 +00:00
Fomafix
72fb42cdba Remove support for MediaWiki 1.29 and earlier
extension.json already requires "MediaWiki": ">= 1.30.0".

Change-Id: Ic460e6364967cd7b0367e66f613077c424bd8f19
2018-08-31 21:41:42 +00:00
Niklas Laxström
fa9cea4627 Support UI language change when global preferences are present
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
2018-08-30 22:40:17 +00:00
Amire80
d6630a4780 Log the context of the ULS in which no search results were found
Relies on updates to EventLogging schema. Diff:
https://meta.wikimedia.org/w/index.php?title=Schema%3AUniversalLanguageSelector&type=revision&diff=17799034&oldid=7327441

Bug: T179402
Change-Id: I2ff9ce9b40df16ed3c5e6970fb3b691af08cedec
2018-03-08 16:03:33 +02:00
Niklas Laxström
fca9b5c0e6 Make ULS trigger and settings more keyboard accessible
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
2018-02-12 17:57:04 +01:00
Fomafix
7c9e64a48a Remove support for MediaWiki version 1.26
Change-Id: I9ad5e87fa335b2b94840c3b3da4e921a41c71d9c
2017-09-24 21:53:26 +02:00
Isarra
86c636fd0a Fix directionality of ULS CLL and languageselect callouts
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
2017-08-10 23:48:34 -04:00
Bartosz Dziewoński
fa0ad11222 Fix positioning of the language change popup when sidebar is on the right
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
2017-08-10 18:32:12 -04:00
Bartosz Dziewoński
1777dc329b Fix callout positioning logic
Follow-up to 1d395d4966. We were
measuring the wrong $window, which happened to work right most
of the time but wasn't correct.

Change-Id: I50f91623b304f43be58ebac844d507757f56db45
2017-05-20 11:08:30 +02:00
Isarra
1d395d4966 Determine callout directionality based on position as opposed to language
For interlanguage toggle, interlanguage position is no longer assumed to be a
left sidebar, and is determined on the fly in order to appear correctly
regardless of where it is, and not go off the side of the page. This works
across most skins, and regardless of language directionality.

Does not necessarily resolve issues with interlanguage links appearing in the
middle of the page (header/footer), or the callout just plain not fitting for
other reasons (mobile devices).

bug: T161586
Change-Id: Icd55498a945e12c0ff79ba891c094d60ce791115
2017-05-19 04:55:24 +00:00
Niklas Laxström
4f65980301 Fix tooltip positioning in older MediaWiki versions
Bug: T164052
Change-Id: I931dff9d027bf8d8b54ed87816e2cb23c8a25f00
2017-04-28 08:30:40 +00:00
Bartosz Dziewoński
66c66f6a28 Better language change tooltip positioning in 'interlanguage' mode
Bug: T161203
Change-Id: I1c5afd64295033e2fbb0aa07601af50da8e06266
2017-04-04 17:42:49 +02:00
Bartosz Dziewoński
1414157338 Fix language change tooltip positioning
Use OOjs UI PopupWidget's new built-in positioning to position
the popup relative to the ULS trigger.

Bug: T161203
Change-Id: I3af45e2e3dbaea5f2e6435dd919a8bc7374e486e
2017-04-04 01:38:28 +02:00
jenkins-bot
7ac4ec9f19 Merge "Use an empty array instead of the uls-p-lang-dummy list item (JS)" 2017-02-06 04:56:15 +00:00
Fomafix
3ec9a325a4 Use module 'mediawiki.storage' from core to access localStorage
This change requires MediaWiki version 1.26 and removes support for lower
versions.

Bug: T153635
Change-Id: Ia74e16cb08e8cb1f15196a98329e2994b0283edb
2017-01-20 17:19:46 +01:00
Fomafix
47cfd9c1ae Replace $( document ).ready(...) by $(...)
In jQuery 3 $(document).ready(...) is deprecated.
https://jquery.com/upgrade-guide/3.0/#deprecated-document-ready-handlers-other-than-jquery-function

Change-Id: I1a9f578d8cf8fa2d9dd38a1b2d3a0b3c32914b74
2017-01-06 14:10:55 +01:00
Fomafix
f6023ec051 Use an empty array instead of the uls-p-lang-dummy list item (JS)
This change is the JavaScript part of change
I54a18f5bd85a8261a25e1160dda7a33fbdf3dd7b.

This change should get deployed when the HTML caches of change
I54a18f5bd85a8261a25e1160dda7a33fbdf3dd7b has expired.

Change-Id: Id7f429d9d1217316341102e27389711525f17b2d
2017-01-04 14:24:02 +01:00
Ed Sanders
811944c49a build: Replace jscs+jshint with eslint
Change-Id: I7f114267fbb4efd62a9162758445cff4fb3c0973
2016-11-09 15:57:38 +00:00
Niklas Laxström
41f9a6f994 Undo tooltip: position when shown, not when created
Especially on Special:CX, where page layout changes soon after load
(for example scrollbars get added when more content loads), the tooltip
would be positioned incorrectly. Now it is more likely to be positioned
correctly, and will get re-positioned again if it is shown again after
being hidden.

Bug: T145483
Change-Id: I527fc62b196e55101950cffcc6ec43926f63aa4a
2016-09-15 08:06:40 +00:00
Niklas Laxström
a94ffa4b21 Do not use tipsy class with new popup
The tipsy class has CSS styling from the tipsy module which do
not work with the OO.ui.PopupWidget. If the tipsy module gets
loaded for some other reason, the display will be slightly broken.
Fixed by renaming the class.

Bug: T96648
Change-Id: Ib0e11098506560f4de1c6402b8c980ad3ebc3879
2016-08-31 10:21:36 +02:00
eranroz
abaddfaccd Earlier evaluation of compactlinks
* Prospectively load ext.uls.init
* Prospectively check if readyState is interactive
Bug: T136463
Change-Id: Ib36ef6a2b9955189acfbe06bd6b498a66014cf06
2016-08-19 11:10:27 +00:00
jdlrobson
798874ffa0 Remove jquery.tipsy from UniversalLanguageSelector
This doesn't appear to be justified due to the one use case. This
will now be done via OOjs UI and given jquery.tipsy is deprecated
it is better to replace it (T117720).

Bug: T119417
Bug: T102922
Change-Id: I60cce248884308bf0728d153f6137a8d25e01300
2016-08-17 06:13:09 +00:00
Niklas Laxström
0784540c40 Simplify code using .one
Change-Id: I84fb5e0ade474738ff6a05c2304de351a2476186
2016-05-31 09:21:51 +05:30
Niklas Laxström
791cefeec6 Remove redundant mw.loader.using
The only caller is already loading the exact same modules right
before calling these functions.

Change-Id: I71bc682f88c45e8ff20e032c7e5ee2dc3f517baf
2016-05-30 17:07:22 +02:00
jenkins-bot
9eedc358e6 Merge "Separate ULS previous interface language from previously selected languages" 2016-05-25 06:13:13 +00:00
jenkins-bot
4b1056133f Merge "Make previous languages have most recent in the beginning" 2016-05-24 04:38:49 +00:00
Niklas Laxström
e3c2950c04 Separate ULS previous interface language from previously selected languages
Now that Compact Language Links also started to add to this list, ULS would
show incorrect language change tooltip notifications. ULS interface language
selection will still keep updating the list of previously selected languages.

Refactored the code a bit: 1) created minimal Store that wraps around plain
localStorage, since mediawiki.storage cannot be used yet. 2) Inlined the
userHasChangedLanguage function to new initTooltip function. 3) Split parts
of the huge initInterface to new initTooltip and initIme functions for
increased readability. 4) Solved a TODO for moving language change recording
out of the tooltip showing code.

Change-Id: If8478a59168d89264f4d46938ac865c0c9a04f25
2016-05-23 15:15:44 +02:00
Niklas Laxström
4f82a8650a Make previous languages have most recent in the beginning
This is already expected by the callers. Added addPreviousLanguage
to make updating the list easier.

Change-Id: Ie4f888235ea4de4a2ce6bf5a9f24955e423e8c48
2016-05-23 14:50:02 +02:00
Niklas Laxström
a19e8c0dba Update jquery.uls and adapt styling
jquery.uls.compact module is kept for now as some other
extensions depend on it. But it does not do anything
anymore.

There are some styles which should be in jquery.uls
upstream, but given the current state that is easiest
done in a follow-up later.

The main change is that language selection is now
compact by default: no heading etc.

Includes style changes for the dialogs, and especially
for the new position of the callout caret.

Bug: T85519
Change-Id: Iade8005439b4f58ab241752f69a5365d8bb88d2c
2016-05-18 11:40:58 +02:00
jenkins-bot
4c5263e3f0 Merge "Fix language undo tooltip not showing" 2016-04-12 11:28:26 +00:00
Santhosh Thottingal
7d90ecef1d Use localstorage instead of cookie for previous language autonym
Change-Id: I1025a8bbb9fad0cfd326547a09c982925a55e55d
2016-04-12 09:40:50 +02:00
Santhosh Thottingal
64eab95b94 Remove browser checks and use MediaWiki browser policy
We had a browser check to blacklist all browsers older than IE 8
IE <= 7

But that is no longer required since JS support is not there for such
browsers as per https://www.mediawiki.org/wiki/Compatibility#Modern
We can support all modern browsers listed there and we don't need
additional blacklisting now. From 1.27 onwards, there is no JS loaded
for IE 8 too. So we can just use MW browser support policy.

In this commit, the code to do brower checks removed and simplified
the initialization code. Still I am not happy with the interface module,
that need further refactoring.

Change-Id: I655826c55fb2c7c5c88f16368110142d64a96eec
2016-04-12 12:12:35 +05:30
Niklas Laxström
c0fe2d1a54 Fix language undo tooltip not showing
Test plan:
* Remove localstorage and cookies for a site
* Go the the site
* Change language and observe the undo tooltip

Change-Id: Ibecb5ea1cd537b2f019e7a9aa67ffac1a4e0923d
2016-04-12 08:22:27 +02:00
Santhosh Thottingal
d728d8c8a7 Remove logging the language selection method
Removed the code to log whether map(removed long time back), search,
common languages used for selecting the language.

This logs were introduced to measure and adapt UI effectiveness.
No longer needed now.

Change-Id: I83bdd250cb6474da4fbf22aed2011071b9f9eba4
2016-04-06 09:59:12 +05:30
Niklas Laxström
9ea6f8d6ba Add a warning about T130390
Change-Id: I872d1dc0ec8d0827c3f56aeb1474f4596e08532d
2016-03-24 11:14:17 +01:00
Siebrand Mazeland
6a2b2e0bba Update test files
- Updated versions and order of checkers.
- Some consistency updates in Gruntfile.js.
- Updates to make jscs pass.

Change-Id: I7ed93596ff383dc713bd17af2da0472be934d59d
2016-02-18 18:51:37 +00:00
Fomafix
c329f1473d Use spaces inside of brackets in JavaScript
* For consistency
* For MediaWiki coding conventions

Change-Id: I625a8ce0119b1490073f048e1b8ad4e90762d6e2
2016-02-15 13:31:45 +00:00
Fomafix
63bc85649a Ensure module 'jquery.tipsy' is loaded before using
Move the showTipsy calls into the callback.

Move the declaration of the functions hideTipsy and showTipsy before the
new call position.

Also change the order of the declaration of the functions hideTipsy and
showTipsy to avoid a forward reference in showTipsy. Spotted by JSLint.

Bug: T118507
Change-Id: I338a78cde249405459be14948b78cf59d715145a
2016-02-15 13:03:52 +00:00
Ori Livneh
02fe8719dc Only use jQuery.tipsy for undo popover
Per discussion on Gerrit about previous patch-sets in this change, only use
jQuery.tipsy for the undo popover. This means that in the common case (i.e.,
the user has not just changed languages), the ULS tooltip will be system native
tooltip.

Change-Id: I9206a79d59687930c26b7ef86d29bfba050691fe
2015-11-11 13:46:35 -08:00
Niklas Laxström
d574548d41 Refactor showULSTooltip
Makes the code easier to understand and fixes T52743

Bug: T52743
Change-Id: If508f26b5133284f3059b50d420066a8b4fefb07
2015-03-27 15:02:09 +00:00
Niklas Laxström
9bc291522b When changing language first time, language code was shown
Now it shows the language autonym as expected

Change-Id: I1f2c3bca2b5582b917d65533b08545d1332782ab
2015-03-27 14:03:52 +05:30
Niklas Laxström
231ab2dca0 Clunky workaround for putting link into escaped message
Not escaping the message trips up my unescaped message checker

Change-Id: I7e4de4c5b9008988f9d3eedd83c825b3a050849b
2015-03-26 13:26:41 +01:00
Ori Livneh
57b617f775 Don't force #p-lang to show using jQuery.fn.show
It's a performance anti-pattern; see
<https://github.com/jquery/jquery.com/issues/88#issuecomment-72400007>

Change-Id: If6e521c27975f7d64932268fde5778aa63fd08ee
2015-03-07 18:31:04 -08:00