Commit Graph

723 Commits

Author SHA1 Message Date
Santhosh Thottingal
d109bddf20 Compact links: Execute the compact strategies on need basis
We were executing all compacting strategies even when we have
more than enough items as candidates. If the strategy is expensive,
(performance wise) this is a problem.

In this commit, we execute them one by one and stop when we have enough
candidates.

The methods in CompactInterlanguageList class also arranged as
individual function declarations than comma seperated method list.

Change-Id: Idce6489387d139852125f4448d0e192f6a7e1353
2016-07-11 10:58:00 +02:00
Santhosh Thottingal
c4ce628768 Use navigator.languages as fallback for mw.uls.getAcceptLanguageList
Follow up: Ib603f836f59f7078ac5dbb7bbbb3b84ca358cb43
Bug: T137522
Change-Id: Ia5de997fe393ce99a91b16ed397811391a85bc59
2016-06-14 04:55:34 +00:00
Santhosh
09d4c149ca Merge "Show badges in ULS language list" 2016-06-09 12:01:04 +00:00
Niklas Laxström
2a6b4d0fc2 Show badges in ULS language list
Update jquery.uls to ae9dda23b71aa76fbbc13f5650

Bug: T131233
Change-Id: I7c7bafccc7d63c0a97c98b81a5b53b48c9afa527
2016-06-09 15:12:39 +05:30
Niklas Laxström
9fc215866a Have the background for input settings not run to the edge of the dialog
Bug: T136273
Change-Id: Iddc5233d840cd6f2c3e4393ea221b6882d03c531
2016-06-02 05:47:38 +00:00
Niklas Laxström
0b89c27678 Give language selection buttons more space
Let them assume normal size with regular padding. In the case that
the buttons do not fit one line, some will overflow to the second
line. In my opinion that looks less ugly than irregular padding
and truncated language names.

Bug: T136273
Change-Id: I26dd7745ac03e1b940348b318d74d0a2bd27e1a3
2016-06-02 05:47:25 +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
Niklas Laxström
b2b75b15eb Drop eot from supported webfont formats
IE9+ which is lowest that MediaWiki still supports is supposed to
support both ttf and woff par some exceptions.

This reduces uncompressed repo size almost 4000 bytes.

Change-Id: If80f4ec898d86d5fd4cf873d0d86245e66da2f0b
2016-05-24 08:06:11 +02:00
jenkins-bot
7708b8d2ff Merge "Use FormatJson in font repo generator script" 2016-05-24 05:01:41 +00:00
jenkins-bot
756b80d8a6 Merge "Increase the number of stored previously selected languages to 9" 2016-05-24 04:43:34 +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
fa7f7e8b57 Increase the number of stored previously selected languages to 9
Discussion about the magic number in the task.

Bug: T135487
Change-Id: I5d0900f191cf277faa19d73de9cf393216d5e6ea
2016-05-23 12:50:06 +00: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
e607466313 Use FormatJson in font repo generator script
The benefit of this is that '/' is no longer escaped, making
ext.uls.webfonts.repository.js file 376 bytes smaller. I expect
that the difference in compressed size is neglible.

Change-Id: I77c0b88fa23f2245f09615c354546b6a9ebf650c
2016-05-23 14:33:37 +02:00
jenkins-bot
43782e8635 Merge "Add some global fallbacks to compact language links" 2016-05-23 11:43:46 +00:00
jenkins-bot
384b109362 Merge "Update jquery.uls and adapt styling" 2016-05-23 11:09:01 +00:00
Niklas Laxström
e054af704c FontRepoCompiler now adds hash suffix to font paths
This is now new standard way of doing this in MediaWiki.

Since this makes the font repo bit longer, compensated by no
longer providing version information, which also simplifies the code.
Uncompressed increase is 542 bytes.

Depends on https://github.com/wikimedia/jquery.webfonts/pull/45

Bug: T135806
Change-Id: I1921115fc1abc20e6e756044c0a84a9fe4133884
2016-05-23 09:32:57 +02:00
Niklas Laxström
021ceadc85 Add some global fallbacks to compact language links
Bug: T135366
Change-Id: I75cc58f79cb818d8330120d996d67c6b183c0843
2016-05-20 14:51:47 +02:00
Niklas Laxström
4ff7d5adf8 Add tooltip to the "more languages" action to provide better context
Bug: T135224
Change-Id: I3c5d909ff334182e25b48fd3917260087ee276ef
2016-05-19 08:56:04 +00: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
Santhosh Thottingal
cbb46f7451 Compact language links: Delay loading of jquery.uls module
Load jquery.uls only when the trigger is clicked.
Reduces the initial footprint by 63.9 KB (uncompressed)

Bug: T135210
Change-Id: I972cb6ea1794485917ea530f7abe68bdddc2014f
2016-05-17 14:55:51 +05:30
Santhosh Thottingal
a5034fa95f Avoid references to jquery.uls RL module from ext.uls.init
Checks to see if language is supported can be also done using
jquery.uls.data

Bug: T135210
Change-Id: Ib6b0d31b33be10b38aba713c3c4ba5370a27a8f4
2016-05-17 11:50:15 +05:30
Santhosh Thottingal
a2cfd0287f Add WOFF2 version of fonts
Modern browsers will use woff2, which has smaller size than woff

Updated the README in the font repository explaining how different
file formats are produced.

Bug: T128291
Change-Id: I81c5380fdbf0ff76142b67cf8fce9db20e8164fa
2016-05-11 10:31:01 +05:30
Niklas Laxström
146949ce43 Fix fail in 1bc3f3b
Assignment got lost, so caching did not work.

Change-Id: If7f6df5b6c6d6156894803670263f34f2850a29a
2016-05-09 20:12:46 +02:00
Santhosh Thottingal
1bc3f3b065 Compact links: Avoid duplicate call of filterByCommonLanguages
It re-triggers mw.uls.getFrequentLanguageList(),
getPreviousLanguages() and localstorage read.

In this patch the result was saved and reused.

Bug: T122341
Change-Id: I14839eb611cd3e995e8d8ab729ee3f714840f9ad
2016-05-09 14:31:34 +05:30
Nikerabbit
b490829957 Merge "Compact links: Simply use the widget pattern instead of plugin" 2016-05-03 08:32:14 +00:00
Santhosh Thottingal
4150d24e67 Compact links: Simply use the widget pattern instead of plugin
We don't need plugin pattern here since it is not meant for a use
in multiple contexts. Code simplified.

Change-Id: Iee86069aaa82f5a9ab3a856c19360e9ea89211ad
2016-05-03 08:53:58 +05:30
jenkins-bot
897d4f7f72 Merge "Refactor font repo compiler so it can be reused" 2016-05-02 04:37:53 +00:00
Niklas Laxström
d2bb6e9010 Ensure ext.uls.mediawiki is loaded before use
Earlier patch loaded it too late, but it was loaded
anyway by something else.

Change-Id: Ib4cf6cd7339a5313961c84cd7904fc2ffc66a157
2016-04-22 10:56:48 +00:00
Niklas Laxström
c99a30bf80 Simplify code by using Object.keys
Guaranteed by es5-shim.

Change-Id: Ifd698dc03fd8e755e95ec6c4856ec3683cc3305d
2016-04-22 12:49:15 +02:00
Niklas Laxström
85f7ebdd4b Delay compact language links language selector creation until click
No point constructing the selector when it is used.

Task: T122341
Change-Id: I928f9041a95e2c48625dba6e11550ac6bbdcb7fd
2016-04-22 10:19:21 +00:00
Niklas Laxström
d2ef6405cb Use mw.msg rather than jquery.i18n
No need to use jquery.i18n here, and avoids going through html

Task: T122341
Change-Id: Ib04011b8c672cd50c02a73791257650fa3dfc1dd
2016-04-22 09:51:24 +00:00
Santhosh Thottingal
aca1545513 Compact links: The trigger kept pressed while the panel is open
Bug: T70078
Change-Id: Iaac9d7f2a5ec5da049b2b4c8e88a9f0bc2a91bda
2016-04-22 07:11:33 +02:00
Niklas Laxström
651f8bc1c3 Refactor font repo compiler so it can be reused
Includes changes to the generated repository file
because the script had not been run for last update.

Change-Id: I6b5d1ce980c6e5b42e36c0044729536b6b0ae4dc
2016-04-14 10:12:20 +02:00
Ed Sanders
3cfb0d67e5 Update linting tools, config, and fix subsequent failures
Change-Id: I41e080915441367b3a2ab2de7d7a096872a2f2e8
2016-04-13 17:13:06 +01: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
a29db92746 Remove the years old cookie to localstorage migration code
Change-Id: Icf82e040b7e3f015cb4cbb9b9c7ed4dee240f017
2016-04-12 06:59:12 +00: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
3e58259ca7 Clean up ULS localstorage preference saving system
These changes affect anonymous users:
* Old code to restore preferences from jStorage removed
* No cookie used anymore

Bug: T100639
Change-Id: I3cfec447703d9c67cd2310ec4acc5692ad76be8e
2016-04-11 14:45:39 +02:00
Santhosh Thottingal
a3c63f1efc Update ULS settings UI style to mediawiki.ui style
The ext.uls.buttons style can be removed but Translate extension use that.
Once it is separated we can remove it from ULS.

Testplan:
Use ULS settings and notice the style difference of buttons, checkboxes
and radio buttons. No functionality should be affected and UI should not
be broken in any ways.

This was once attempted in Id186ece6513f154e0388bc4170c21bdabb59038a
but we had to revert because of incompleteness

Bug: T52599
Bug: T127020
Change-Id: Ibbb2068b5036537f298fad6c49169a5b986304d5
2016-04-07 12:06:29 +00:00
jenkins-bot
ce6f8734a9 Merge "Correct the position the arrow of selector and add shadow" 2016-04-06 12:16:28 +00:00
Federico Leva
6ffd42c07a Resolve language code redirects before using them in ULS
Interlanguage lists can contain language codes that are redirects
in language data of ULS.
For example, sr is a redirect to sr-cyrl.

So, if sr is passes as one of the language to ULS, its region, script
grouping is failing and the end result will be missing them in the ULS
language list. This should be properly fixed in jquery.uls library.
Tracked at https://github.com/wikimedia/jquery.uls/issues/207

In this patch we are following a simple approach of passing the language
codes to ULS as redirect resolved.

Bug: T100002
Bug: T131005
Bug: T126909
Bug: T123834
Change-Id: I8b89edb60b4d2c6f2b25c8589569f748c5523722
2016-04-06 10:42:43 +02:00
Santhosh Thottingal
d5f6930cb4 Correct the position the arrow of selector and add shadow
The pointer arrow of the ULS was not aligned with the 'x more' trigger
and it missed shadow. This commit fixes it.

Notably, we replace the old arrow with a box rotated 45 degree so that
we can apply the shadow very easily.

Bug: T130633
Change-Id: I4d36f3ee9fcfea932e10208518a03e7b246a7abe
2016-04-06 09:43:39 +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