Commit Graph

122 Commits

Author SHA1 Message Date
Pl217
819b3b0414 Make ULS responsive
* Make ULS responsive
* Depend on both screen size and number of languages when calculating
ULS menu width.
* Introduce resize listener to responsively recreate ULS when screen
size changes.
2018-02-07 17:30:52 +05:30
Pl217
54a466ee52 Merge pull request #283 from santhoshtr/keydown-simplify
Simplify key press event handlers
2018-02-06 11:19:45 +01:00
Niklas Laxström
d349937772 Do not group search results by region
* Documentation updates
* Do not group search results by region
* Disable grouping by script when region grouping is disabled
* Add docs, clarify names per code review
* Fix bool -> boolean for consistency
2018-01-16 17:04:29 +05:30
Santhosh Thottingal
2aa43148bb Custom no-results message support (#286)
* Custom no-results message support
* Refactoring and clean up for LanguageCategoryDisplay class
* Document the options for LanguageCategoryDisplay class
* Reduce the spreading of no results handler code
* Add an option to accept no results template
* Remove unwanted, unused constructor too
* Use CSS to hide or show the no-results view
* Remove the unwanted noresults method in jquery.uls.core, directly
  call the same method of lcd.
* Add an example
* Support a function returning jquery element as the no-result handler
2018-01-12 16:05:11 +02:00
Santhosh Thottingal
bccf103900 Removing assigned ids to elements that are not guaranteed to be unique (#284)
It is a bad practice to assign id attributes when there is no guarantee
about the uniqueness of element. ULS should function even if there are
more than one instance of it is present in a page.
2018-01-09 09:47:47 +02:00
Santhosh Thottingal
f46aad0a01 Use .on('event', handler) pattern instead of .event(handler) 2018-01-08 12:22:02 +05:30
Santhosh Thottingal
e67e1e42ee Simplify key press event handlers
Remove eventSupported checks and just rely on jquery.keydown
2018-01-05 15:00:31 +05:30
Santhosh Thottingal
2a77df6c41 Use eslint and stylelint, fix all errors (#282)
* Use eslint and stylelint, fix all errors

* Remove jshint, jsbeautify
* Use Object.keys directly since that is available in all major browsers
* Fixes for eslint, stylelint errors
* stylelint is not included in grunt test yet because jquery.uls.mobile.css
  has so many !important and need to figure out whether they are really needed
2018-01-04 15:58:35 +02:00
Niklas Laxström
ca550e22cd Improve how "no search results" is handled
* Drop the ugly height: 100% hack and do it properly and remove TODO
* after( $suggestions.show() ) seems to not work as expected in recent
  jQuery versions. Changed it to manipulate the presence of 'hide'
  class properly.
* Consistency fix in a comment
* Fixed a bug where creating multiple ULS instances would break the
  "no search results" functionality. This is because we were appending
  a jQuery element wrapped in a $(). This is obviously a no-op and a
  regression when the template actually was a string and not jQuery.
  Fixed by using clone() on it.

https://phabricator.wikimedia.org/T175233
2017-09-07 11:22:26 +02:00
Amire80
d191a1f6e6 Change "Language search" to "Search for a language"
Suggested at https://phabricator.wikimedia.org/T138235 .
This brings ULS closer to the mobile language search interface
in MediaWiki.
2016-09-13 10:46:41 +03:00
Marius Hoch
6ebd1b413c Use an empty array for quickList everywhere, not false/null
Also fix one type quicklist -> quickList, per @edg2s.

Follows cb85cda10e.

https://phabricator.wikimedia.org/T144871
2016-09-07 02:46:32 +02:00
Niklas Laxström
7a0b336010 Go back to 100 for threshold for wide
Also fixed one whitespace issue in previous commit.
2016-08-29 10:58:16 +02:00
Niklas Laxström
f5ff66eb63 Increase breakpoints for different number of columns
https://phabricator.wikimedia.org/T138235#2560677

Also, update the default position to be centered on the page. The
original 25% was pretty close to this for the wide option, but now
that shorter lists are more common, it is no longer sufficient and
replaced with a better code.
2016-08-17 16:29:08 +02:00
Niklas Laxström
8a8f502de7 Style changes to lcd
This change is larger than it should because I came across lots of
unused CSS which I removed or simplified.

https://phabricator.wikimedia.org/T138235
2016-08-17 16:29:08 +02:00
Santhosh Thottingal
11b87cb5be Remove the regionfilter module
It has lot of redundant and unused code used when we had the map.
Removing it. No change in functionality is expected

Change-Id: I278ef63b7756b5061c0b6638ba4e7b7deebf5a0d
2016-05-09 17:03:37 +05:30
Santhosh Thottingal
0cc7f2f54b Call onCancel from hide
See issue #215

The cancel, hide methods are still confusing, may be in some other patch
we need clean up this. A grep shows ULS use onCancel only with compact
language links.

Change-Id: I0e08d169952945237efce9108d51cb68c4a29ad5
2016-05-02 17:27:18 +05:30
Niklas Laxström
2a538b78e1 Remove compact mode
Make the regular mode look like compact mode
2016-04-21 15:27:49 +05:30
Niklas Laxström
20d5e431a3 Some cleanup to the language filter
No longer using grid to position the icon, but nested divs instead.

Tweaked some padding etc. related cleanup.
2016-04-06 17:26:44 +03:00
This, that and the other
f53de5469b Fix the cancel event function to prevent erroneous close
Changed the conditions for the cancel event function so that the ULS popup does not close when a descendant element of the trigger is clicked.

Was erroneously merged to gerrit as https://gerrit.wikimedia.org/r/#/c/261810/, I forgot that this was an upstream library.

https://phabricator.wikimedia.org/T122722
2016-01-02 02:25:23 +11:00
Santhosh Thottingal
d4de09ffb9 Improve the hide-show logic of ULS
* The events are suppressed on click of ULS trigger, it is an anti
  pattern. It can cause other overlay dialogs, if any, to stay with
  ULS and causes UI glitch. This patch just propagates the events and not
  eats up.
* The show method was hiding all other ULS dialoges open using a
  global $('.uls-menu').hide(). This is again not a good pattern.
  A plugin instance should not interfere with other instance's state.
  More over, calling jQuery hide() method on menu instead of plugin's
  hide method leaves the other plugin instance in a corrupted state.
  The plugin hide method does more things than just hiding the menu.
  It has a 'shown' book keeping property to update. This kind of
  corrupted state was causing bugs like https://phabricator.wikimedia.org/T114123
* While avoiding the above two antipatterns, the way ULS was hidden when
  clicked on any 'other' part of body was improved. It now uses event.target
  to correctly handle the 'click-outside-hide' logic

All these above changes does not change any existing UX.

Change-Id: I40b355115cbda54a68e8d58d3750fb9f1c3b6920
2015-10-06 10:35:05 +05:30
Amir E. Aharoni
f724e4a289 Remove unnecessary semicolon 2015-04-08 09:41:17 +03:00
Amir E. Aharoni
eb4f8ff251 Make language count calculation only in core.js 2015-03-31 10:20:34 +03:00
Amir E. Aharoni
c81561b3fc Refactor the object keys counter function 2015-03-14 23:20:09 +02:00
Amir E. Aharoni
b6a30c3d44 Restore support for IE8
IE8 does not support Object.keys.

https://phabricator.wikimedia.org/T86516

Copying the patch from Gerrit:
https://gerrit.wikimedia.org/r/#/c/184316/
2015-02-26 10:46:35 +02:00
thiemowmde
5e1a17c78c Make magnifying glass icon clickable
This makes the magnifying glass icon (search.svg) clickable. Clicking focuses the input field next to the icon, which is the expected, helpful behaviour in my opinion. This is especially helpful with the "compact links" beta feature where the input box is completely invisible and the only remaining indicator that the user can type something is the blinking cursor. If the focus is lost for some reason, this patch allows the user to click the magnifying icon and re-focus the input field again.
2015-01-30 12:05:35 +01:00
Santhosh Thottingal
3469f31235 Remove a dangling comment line
Change-Id: I7106f64b553e167554424e9a3d8687d22d8e4f82
2014-12-23 15:23:45 +05:30
Santhosh Thottingal
10777bb25e Remove unused region filter reference
Change-Id: I130e03bb7ea8bf24e6681fdd8a329c25941ca035
2014-12-22 16:40:20 +05:30
Santhosh Thottingal
107621319d Reduce the title height by moving close button to same row
Change-Id: Id5af0c0bc5654f4ef7decf4712d8eb46ef70933c
2014-12-22 16:39:44 +05:30
Santhosh Thottingal
499c30d0ea Merge branch 'uls-remove-map' of https://github.com/santhoshtr/jquery.uls into santhoshtr-uls-remove-map
Change-Id: Ie59e2a59225873b5cf432df526cbfc135e539d32
2014-12-22 14:51:46 +05:30
Amir E. Aharoni
f21f103de3 Simplify getMenuWidth() 2014-12-09 13:57:03 +02:00
Amir E. Aharoni
3c93da564c Select the menu width automatically
A follow-up to https://phabricator.wikimedia.org/T76196 .
2014-12-09 13:18:21 +02:00
Amir E. Aharoni
b55bc61dc7 Grid-compatible adjustable columns 2014-12-02 22:16:09 +02:00
Amir E. Aharoni
752a295ee2 Allow sending the number of lcd columns as a parameter
This is needed for https://phabricator.wikimedia.org/T76196
and may also nbe useful for many other features.
2014-12-02 13:23:22 +02:00
Santhosh Thottingal
7346469e20 Add decorator option for language links
Callback function to be called when a language link is prepared
Can be used for custom decoration.
Arguments:
(a) the $language - the language link jQuery object
(b) languageCode

The function can do any styling, changing properites etc on the passed link.
See examples/decorator.html for example usage.

Change-Id: I5a67654440a07cf7dfac683e22dcb5000ded0bfe
2014-09-22 12:32:05 +05:30
Santhosh Thottingal
c2b68e8cbc Remove the region selector feature
* Maps removed from UI
* From no-results UI, removed the links to navigate by clicking region names
* Removed the $.fn.regionSelctor plugin, Retained the RegionSelector class
* Removed all related css for the removed UI parts
* Reduced the padding for main ULS title so that the top header takes less height
* And a dozen of related changes

Change-Id: I8ac89ebe380047ca267e5c7720c2eaa3da080e9d
2014-07-27 20:29:01 +05:30
Santhosh Thottingal
abc82945c1 Bring back the clear icon for clearing the search
Caused by a class rename

Change-Id: If4fa0bc14ca890e43182993f8bdd5ddb9de62417
2014-06-03 09:28:43 +05:30
Santhosh Thottingal
36478fa55a Fix css class names in the template
Somehow missed in previous merges

Change-Id: I700f53b6d9d78f7b5db88d880c151139bfb7e4dc
2014-05-22 09:33:12 +05:30
Santhosh Thottingal
7d38ed9bde Merge branch 'master' of github.com:wikimedia/jquery.uls 2014-05-18 10:21:39 +05:30
Santhosh Thottingal
9599ed7d26 Fix the jQuery migration warnings
Remove the spaces in the beginning of html template strings.
$( html ) require html to start with  '<'

See https://bugzilla.wikimedia.org/show_bug.cgi?id=65400

Change-Id: I93eaf41390ab72fcae1b8d4015585bc4f82e6f8a
2014-05-18 10:20:07 +05:30
Santhosh Thottingal
d352b73c37 Merge pull request #145 from edg2s/patch-3
Consistently use this when scope allows it
2014-04-29 09:16:10 +05:30
Santhosh Thottingal
c7c938cf4c Merge pull request #143 from edg2s/patch-1
Always close with 'cancel' method
2014-04-26 16:59:26 +05:30
Santhosh Thottingal
04d11ea53f Remove the unused option menu
Fixes issue #140

Change-Id: Idc04a45b97837c5f9bd1f975b6668b6539df0752
2014-04-26 16:57:23 +05:30
Ed S
f0be8b5425 Consistently use this when scope allows it
We have uls = this for scoping, but then we randomly switch between the two, even when 'this' is allowed. We only need to used the local variable in un-proxied anonymous functions.
2014-04-22 14:59:46 -07:00
Ed S
2c0f4e1114 Only use default pos if top/left are undefined
Allows 0 (which is falsey) to be passed as an offsets. Fixes #141
2014-04-22 00:23:38 -07:00
Ed S
ad1be8c0af Always close with 'cancel' method
So that the onCancel callback is useful. Fixes #142
2014-04-22 00:14:39 -07:00
Santhosh Thottingal
cfba32afb5 Remove developer console logs when unknown language found
They are happening whenever ULS triggers, or maybe whenever it loads. It's
pretty annoying.

See https://bugzilla.wikimedia.org/show_bug.cgi?id=45047

Change-Id: Ia58083f02d61e3b621112352e88d9e7cbfb2f0c0
2013-11-25 20:08:40 +05:30
Santhosh Thottingal
33ec9285e3 Use events instead of callbacks for success or no results
Allows extension users to bind for this event, also reduces callbacks

Change-Id: I14cc6d51ad23432956e3ea3275c72db26d71a8c8
2013-08-15 12:16:12 +05:30
Amir E. Aharoni
601a5256b8 Add missing semicolon 2013-07-08 00:23:54 +03:00
MatmaRex
8a1e3eb18e Remove lazyload functionality entirely
It was merely a stopgap solution to the problem of the dialog taking
forever to load. With that problem solved all of this awful code is no
longer needed.
2013-06-27 16:31:50 +05:30
MatmaRex
8341bb8e21 Disable lazyload for language list
The loading should be fast enough now after Id9397631 is merged,
taking no more than a second or two to render entirely. We could
consider showing a spinner while it's loading, but it doesn't seem
necessary.

This makes bug 39923 invalid.
2013-06-27 16:30:17 +05:30