Commit Graph

140 Commits

Author SHA1 Message Date
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
Thiemo Mättig
91018834c3 Keep Monobook skin intact
Bug: 64741
Change-Id: I5f54537f66d72785744221c64a6705d98f1689f9
2014-05-30 22:49:04 +02:00
Santhosh Thottingal
2d9a28b694 Remove unwanted anonymous functions
Change-Id: Ieefbd58fbc829182048df1d89921b97599a3392c
2014-05-26 11:51:59 +05:30
florianschmidtwelzow
2794039142 Close the tipsy tooltip when clicked on it
We want to close tipsy when user clicks on itself, not on trigger.

Bug: 65664
Change-Id: I0de52d3917a984e675e42b83b9f5b767bd7f2e4b
2014-05-26 06:14:58 +00:00
Santhosh Thottingal
e3a480205c Update the class names per update jquery.uls lib
jquery.uls renamed settings-block class to uls-settings-block.
Similarly icon-close to uls-icon-close

Change-Id: I39005ef2425c01b8623bf9df6d75c1e27f1c5bda
2014-05-22 11:27:08 +00:00
Niklas Laxström
62939949b4 Use preventDefault instead of stopPropagation
Change-Id: I9c2da14b94348cec39e6a9a1571b22de39e437f0
2014-03-08 11:04:34 +00:00
Timo Tijhof
c6d71015ff Various clean up
Files:
* Consistently have one (1) new line at EOF
  (.gitignore, *.css, *.sh)

JSHint:
* Separate the common (general Wikimedia code conventions) from
  the local more stricter rules (nice work!).

Maintenance:
* Use simplified $IP definition where getenv is only called once.
  Based on http://git.io/ve-mw-36fc3b59-makeStaticLoader

JavaScript:
* Use the same closure in all files:
  - No need for "undefined".
  - One linebreak between license header and start of closure
    (sometimes there were 1 or 2 empty lines).
  - ext.uls.ime.js: No need for "document" (redundant in general,
    but especially as it wasn't used anywhere in this file).
  - Use "$, mw" for all ext.* modules (one of them used "mw, $").

Change-Id: Iba5dab14bbc3fbfc9f8fe96dd2d95529587a69aa
2014-02-08 00:11:50 -08:00
Kartik Mistry
abd130ed64 Set tooltip load timeout later than collapsible navs
Load tooltip at 700ms on page load to give enough time for collapsible
navigation to finish altering sidebar layout.

Bug: 51170
Change-Id: I8c7666a51ffe68007c4aadb4e72aa668d0fe6164
2014-02-06 09:11:02 +00:00
Niklas Laxström
7c28df5125 Add ext.uls.messages as dependency for ext.uls.mediawiki
Turns out the messages for language selector were not loading
in Special:MainPage. This fixes that as well as cleaning up the
dependencies.

Change-Id: Ice8dcf1b2e878a0fe3cd0e002a9b1cff2f1901dd
2014-01-25 00:53:47 +00:00
Niklas Laxström
15b3c31029 Avoid loading of jquery.i18n and messages until trigger clicked
Use RL for trigger tooltip messages to avoid using jquery.i18n just
to display the triggers. Reordered dependencies so that messages
are loaded for the setting panels and ime menu.

Change-Id: Ic9518f7b63699542deb02a413e03c28344c99fa4
2014-01-23 23:35:27 +00:00
Niklas Laxström
7822d5d03b Page scrolls when opening language selector
Was happening mostly on Firefox when ULS was in personal
position and you were logged out and allowed to change language.

Loading grid here already prevents graphical glitch and delaying
the click seems to prevent scrolling to wrong position.

Bug: 56937
Change-Id: Ie9acaa5a46fd903221d30c94dbc26a83355cdb64
2013-11-12 12:50:31 +00:00
Amir E. Aharoni
97c79ec668 Fix incorrect module name
Follow up to Ic33ef034c794a523b5403867196c6098a58eb5b1.

Change-Id: I15c9e58b24bf4f43ac58f065ed42614df59e638f
2013-11-11 12:39:20 +02:00
Amir E. Aharoni
b23f937cb7 Remove the dependency on uls.data
Change-Id: I9fa103ee7d338ed8ea2032c82249a47d022d2c90
2013-11-11 09:56:55 +00:00
Santhosh Thottingal
f5ce066c80 Lazyload jquery.uls library
In the "interlanguage" position ULS is shown after 2 clicks,
so don't load it initially.

In the "personal" position ULS is shown immediately after
the language icon click, so load it, but conditionally.

The new RL module ext.uls.mediawiki is added for setting
jquery.uls defaults in a way that will lazy-load the language names.

Change-Id: Ic33ef034c794a523b5403867196c6098a58eb5b1
2013-11-11 14:13:02 +05:30
Niklas Laxström
193f69b017 Refactor ime lazy loading
* Do not load anything unless input field is focused
* Split the setup function to smaller functions
* Introduce $wgULSImeSelectors to allow configuration and avoid
  duplication of selectors in two places.

Change-Id: If5a476e66681dde9f0b72f619d35ddf6255246ac
2013-11-05 16:48:47 +05:30
Siebrand Mazeland
315cf739bc Update formatting
Change-Id: Iaee2ab4f36d3a0dce143c62965ab29de504b31ea
2013-10-09 15:40:39 +02:00
Amir E. Aharoni
a3bca89a42 Implement language-selection-method event
Change-Id: If2d207f8a221c8f2a560b1399ad69a3032b2064b
2013-08-20 05:16:35 +00:00
Amir E. Aharoni
0f34b4d934 Fixing "Common language" functionality
If was broken in
Icda498f676d1d3ddaefad75fd9212150f6966666

Bug: 53035
Change-Id: Ida29364073b07b985050565cacc6634c134f8d6c
2013-08-19 16:34:43 +03:00
Santhosh Thottingal
7649b47f5c Followup I59dfcfb25c, language change work with out event logging
In I59dfcfb25c, for logging events when page is navigating away, we
used callbacks with mw.hook. That is wrong approach. If event logging
is disabled those callbacks will never called: it broke language change
and all use cases which navigates away from current page.

Event logging should not interfere with any ULS functionality. If ULS
functionality depends on callbacks from event logging, it is wrong.

In this patch, we give a small time window to make sure event logging is
fired, but we won't wait for its success or failure.

If eventlogging is disabled, this time window does not exist.

Change-Id: I0b7d9d8b9d1d01b99422010596ebfa80b2589d04
2013-08-19 10:13:56 +00:00
Santhosh Thottingal
117cc5bf46 eventlogger module for ULS
Separating event logging out of ULS functionality. Event logging
is now loosely coupled with ULS. ULS core modules can emit an event
whenever EventLogging is required. The eventlogger module will act
on the event if configured.

Change-Id: I59dfcfb25c1acb85376b56239f2355ee7c4aff1e
2013-08-15 17:08:15 +03:00
jenkins-bot
d0b9d2717f Merge "Log settings-open event" 2013-08-14 09:36:57 +00:00
Siebrand Mazeland
e75b174b10 Make return values consistent
Tipsy does not expect a return value.

Change-Id: I9172dfe18ee1dc6d7773ce861a8a8b52638bc7b6
2013-08-05 17:20:10 +00:00
Niklas Laxström
df18f0a5ff Log settings-open event
Change-Id: I55fb9e4b8b6b210003f6bbad07486e1c2a8cba4f
2013-08-05 15:19:57 +08:00