Commit Graph

95 Commits

Author SHA1 Message Date
Amire80
1120ab276c Update the argument for noResults in lcd
Follow up to #306.
2018-03-15 17:05:01 +02:00
Santhosh Thottingal
1f900843fe i18n for the noResultsTemplate
See https://phabricator.wikimedia.org/T187390
2018-02-16 09:34:54 +05:30
Santhosh Thottingal
081310b45e Style adjustments for no-results
* 20px spacing above and below the "No results found" message.
* 12px spacing above and below the search indications ("You can search by...")
* Adjusting the text color to use Base20 (#54595D)
* Adjust the background to use the same background color as the area above it (#FCFCFC).
* Add a top border in Base80 (#EAECF0) to separate both areas.

See https://phabricator.wikimedia.org/T175235
2018-01-30 12:52:47 +05:30
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
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
cafe908d07 Move the message attribute to the correct element
Follow up to https://github.com/wikimedia/jquery.uls/pull/243 ,
addressing a comment by @Nikerabbit.
2016-12-04 11:40:45 +02:00
Amire80
7d9d2b7947 Using the message uls-search-help in the code
The translatable message uls-search-help was available in
the i18n files, but it was not actually used in the code,
so it was always shown in English.

This patch adds it to the JS code.
2016-11-28 15:53:55 +02: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
cb85cda10e Avoid showing suggested languages header if the list is empty 2016-09-02 15:45:14 +02:00
Niklas Laxström
0e253cb312 In narrow mode, print "All languages" heading if suggested languages are given
Also changed one instance of "Common languages" to "Suggested languages" in
the no-i18n fallback code.
2016-08-30 15:12:46 +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
bb4d96c33a List the languages in Worldwide in their respective regions too
Fix for https://phabricator.wikimedia.org/T137868
This was a wrong solution for https://phabricator.wikimedia.org/T41921

Change-Id: Ib920e75fca71716d14aecd25c163f0c1e8e63270
2016-07-20 09:55:24 +05:30
Niklas Laxström
25775dd147 Adjust styles and code to support custom list bullets
Tweak specificty of the rule that hides bullets so that it is easy
to override.

Move dir and lang attributes from <li> to <a> so that the bullets
appear on the correct side for reverse directionality scripts.

Change-Id: Ic0d0c5220b0b374c2a3a19023c40d81f3e20007c
2016-06-09 15:08:15 +05:30
Santhosh Thottingal
e9c0f3e4db Show "You may be interested in" section when no results found
This was broken long time back

Change-Id: I15f715067d82fb61959763824183a6813536e94e
2016-05-09 17:09:06 +05:30
Santhosh Thottingal
8b3d77dae1 Support language codes that are redirects
Addressing issue #207

Such language codes were not listed in ULS language list.

Root cause was $.uls.data.getLanguagesByScriptGroup was returning
a map of script groups, which contained only resolved language codes.
And later in append method of jquery.uls.lcd.js, there is a check if
that language code is part of languages list passed as option to uls()
call. This test fails and the language code does not get added to display.

Change-Id: Iec914a9694a46eef5750ef3af7346d66e052ab77
2016-04-05 09:17:09 +05:30
Prateek Saxena
0973ddf299 Construct DOM using jQuery instead of an HTML String 2015-01-26 09:26:57 -08:00
Santhosh Thottingal
f417707d67 Remove the unused code to sync region highlight on scroll
Change-Id: Id779c25237584f90ab9132fe24f6cbade1b58da7
2014-12-22 16:38:03 +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
f44302106b For narrow ULS show one column without separators 2014-12-22 11:09:48 +05:30
Amir E. Aharoni
6d72638d6f A more explicit support for valid columns number
Only 1, 2 or 4.
2014-12-15 11:27:44 +02:00
Amir E. Aharoni
dd59d4d0c8 CSS tweaks for narrow ULS 2014-12-04 00:39:57 +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
022efabf38 Minor formatting changes
Change-Id: I3ffd7029165ff614c13000b333ed30d3874fba28
2014-09-23 16:16:44 +05:30
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
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
Niklas Laxström
78e9b83c6b Make ULS language selector appear faster after clicking trigger
* Removed unused class end.
* Class uls-lcd-region-section was used in two different elements,
  retained it on the outer one.
* Build a list of languages per region, once done render the regions at once.
* Use direct dom manipulation in hot spots.
* Use shorter selectors like children instead of find and dropping the tag name.
* Fixed mismatch when there were no results and when the message was shown.
* Less flickering by not hiding or showing regions unnecessary
* Cache the common languages "quicklist"
* Added itemsPerColumn as an option

Reduces time used to show language selector after clicking the trigger on my
machine from about 1.8s to about 380 ms (JS execution times, actual times are
about the same but little bigger. The actual rendering is now less than 100ms,
the rest is other setup overheard and $.fn.scrollIntoView which can take many
hundreds of milliseconds.
2013-12-20 10:31:04 +00:00
Niklas Laxström
9d77cfb76f Fix typo 2013-11-19 11:16:14 +00:00
Santhosh Thottingal
623cdb605a Validate whether the language from API is known while trying to display
See https://bugzilla.wikimedia.org/show_bug.cgi?id=54725

Change-Id: Ie77f7cd02d37338a6b65db653c2ba3b35906dac0
2013-11-15 15:15:00 +05:30
Santhosh Thottingal
49497d7078 Avoid overriding grid css for language list
Change-Id: I7606c5af716f2094bc1766a95123a68413634c91
2013-11-05 19:49:38 +05:30
Santhosh Thottingal
5444e17727 Avoid 'recalculate style' by conditionally change classes while scrolling
Change-Id: I71b42f9f974a1367700283ad55013e9e6a036827
2013-11-01 11:08:15 +05:30
Santhosh Thottingal
a985d33d4b Use attr and prop consistently
Change-Id: If650d07686cafb6fceba60186843b5599404846c
2013-11-01 10:47:16 +05:30
Santhosh Thottingal
9ae403b671 Remove unnecessary object instance
Change-Id: I078a3a107d154bbcba7e1d49cbd6470b026ff869
2013-11-01 10:45:46 +05:30
Santhosh Thottingal
522b14fb23 Use text() instead of html() to set language names
Change-Id: I1374ac3ed9273302ea268596918a72c6b7a48579
2013-11-01 10:33:36 +05:30
Santhosh Thottingal
c5b11eabc9 Merge pull request #106 from siebrand/3
Update code formatting
2013-10-23 06:38:37 -07:00
Santhosh Thottingal
e83494cab1 Formatting fixes
Change-Id: I75173f09527f84419d1b807e9e33ff673e0f5d1c
2013-10-17 14:50:09 +05:30
Santhosh Thottingal
e54d85a124 Use Autonym font for autonyms
Change-Id: I5224cd020a6c6ba4f52f2be3a318216111b39394
2013-09-15 14:48:36 -07:00
Siebrand Mazeland
078448a659 Update code formatting
Changes suggested by CodeSniffer.
2013-08-02 15:38:12 +02: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
Santhosh Thottingal
7c47112ae6 Fix: IE 8 not displaying the section titles for language lists
Changed the way those elements were constructed using jQuery

Change-Id: Ib2b7f454dd0cc1ff38342cf7cc2c6c73a4796c6c
2013-06-12 10:55:32 +05:30
Santhosh Thottingal
05e34d5dfa Fix two js error possibilities
Change-Id: I92ed487e7b5c70ef7851575eec676276e1ea905b
2013-06-10 14:33:17 +05:30
Amir E. Aharoni
62cab27eb2 Leave only one var statement per scope 2013-04-22 14:40:12 +03:00
Amir E. Aharoni
31cd276019 JSHint cleanup 2013-01-13 23:20:05 +02:00
Santhosh Thottingal
ca18edd0dd Merge pull request #63 from amire80/bug_43568
Render every region only once
2013-01-07 06:44:04 -08:00
Santhosh Thottingal
0e61876af5 Merge branch 'extra_languages' of git://github.com/amire80/jquery.uls into amire80-extra_languages
Conflicts:
	src/jquery.uls.data.js
	src/jquery.uls.data.utils.js

Change-Id: I9c321891707b0d68328f4e4c8be1bd451794072d
2013-01-07 15:45:48 +05:30