This input field is only for language names. There's no reason for it
to have something longer. Looking at the logs of searches,
people sometimes write very long things there: gibberish,
URLs, inappropriate search strings, mistaken pastes from other places,
and so on.
So it should be limited by maxlength.
It's practically never useful after 20 characters, but setting at 40
just to be on the safe side. The longest language name in langdb is 34.
Add the ulsPurpose option. Empty string by default.
This is useful for web application that use ULS in several different context,
and need to distinguish what was the purpose of the particular ULS panel.
An example of usage can be found at
https://phabricator.wikimedia.org/T179402
* 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.
* 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
* 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
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.
* 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
* 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
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.
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
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
* 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
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.
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
* 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
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