Commit Graph

74 Commits

Author SHA1 Message Date
Amir E. Aharoni
c10140c12b Upgrade eslint-config-wikimedia to 0.21.0
JavaScript code and comments changes:
* Remove no-multi-str disabling.
* Document $ parameter.
* Replace .substring() with .slice().
* Change assert.ok() to assert.strictEqual() in a test.
2022-01-31 11:13:58 +02:00
Ed S
7a6e559fe5 Update eslint and other devDependencies (#391)
* Update eslint and other devDependencies

* Lint JS in examples/ using eslint-plugin-html (#392)
2021-05-14 15:18:37 +05:30
jdlrobson
967eec093e Always send event when triggering onSelect
The $.uls function in jquery.uls.core in createLanguageFilter
passes the onSelect function to the
$.fn.languagefilter so the onSelect there should be made
compatible.

Bug: T261973
2020-11-05 11:06:36 +02:00
Ed Sanders
d53beca719 Update linters
* Update eslint and stylelint config
* Fix Gruntfile.js to actually run stylelint
2019-11-13 04:14:16 +02:00
Kartik Mistry
27c21219b4 Update package.json and fix eslint issues (#322) 2018-09-06 15:41:27 +05:30
Pl217
44bd07f038 Fix onInputChange being called twice
ULS input element had onInputChange() handler attached to
change, textInput and input events.

That caused onInputChange() to be called twice when there is user
input and ULS gets closed, since 'change' event fires when
<input type="text"> element loses focus.

Registering handler only for 'input' is sufficient for the intent.
2018-05-29 15:21:11 +03:00
Pl217
5dfca5fd8a Replace jQuery.proxy() with Function.prototype.bind() 2018-05-28 12:06:38 +03:00
Amire80
970d073efa Send a data object in $.trigger
There was a mistake in #299: the $.trigger() must take only one argument
for extraParameters. Sending another parameter causes NULL to be logged in
EventLogging for ulsPurpose.
2018-03-15 11:57:02 +02:00
Amire80
00ff49e190 Convert ulsPurpose from a data attribute to an languagefilter option 2018-03-05 12:58:00 +02:00
Amire80
ddb691a918 Allow identifying the context of the different ULS panels within one app
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
2018-03-04 23:01:35 +02:00
Pl217
4cb4fe2370 Merge pull request #275 from wikimedia/srpski
Fix "srpski" not finding results in Wikipedia compact links
2018-02-08 15:52:03 +01:00
Niklas Laxström
eccd0e1945 Change code structure a bit per code review comments 2018-02-08 15:26:15 +02:00
Niklas Laxström
0352b3df0d Fix to avoid displaying duplicate results caused by redirects 2018-02-07 15:24:15 +02:00
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
Niklas Laxström
9fba3ab728 Fix my broken merge conflict result 2018-02-06 16:41:26 +02:00
Niklas Laxström
2b1cc8678f Merge branch 'master' into srpski 2018-02-06 16:31:46 +02:00
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
bb8b48aa38 Stop rendering languages twice on initial display
The resultHandler is responsible for updating the `LanguageCategoryDisplay`, so we should not call `render` separately in `search` when there is no search query.

https://phabricator.wikimedia.org/T185086
2018-01-31 16:52:23 +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
37c9d66a2b Use .siblings to locate the suggestions, clear elements for efficiency (#285) 2018-01-10 09:13:56 +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
7119bdff5c Ensure autofillLabel is undefined if searchApi fails 2017-11-29 10:31:55 +02:00
Niklas Laxström
82eee93dbd Improve search code
* Always use searchAPI if provided
* Clean up code flow to be easier to follow

https://phabricator.wikimedia.org/T73891
2017-11-27 14:22:01 +01:00
Niklas Laxström
1dcb533b42 Fix "srpski" not finding results in Wikipedia compact links
See also https://phabricator.wikimedia.org/T178996
2017-10-27 12:12:49 +03:00
Santhosh Thottingal
0a06f4e986 Avoid calling searchAPI more than once
The calling code should not be in loop

Change-Id: Ib8433115bf9bf18827ad13bcfb3299a846ae98b3
2016-05-25 16:39:17 +05:30
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
29f28a1f50 Clean up code formatting, add .jsbeautifyrc
Change-Id: Iafcc8084d87d8f2323d97bb4446e031951820d41
2016-05-09 16:41:31 +05:30
Santhosh Thottingal
bf0c555b8c Remove unwanted script related code in search method
Fixes issue #209

Change-Id: I33345fe553abcc9bfd6288fe579878a2cf307e8f
2016-04-06 16:38:44 +05:30
Santhosh Thottingal
7b3cd3d885 Fix: search using API does not respect the passed language list
If there is a search api configured, ULS list all languages that
pass the search irrespective of whether a language is present in
options.languages

Change-Id: I0be80397bb5b4071bc7bc5e787fe107c98e3d912
2016-04-06 15:21:33 +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
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
Siebrand Mazeland
658914a984 Update code formatting 2013-10-08 23:59:40 +02:00
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
Santhosh Thottingal
5f2b646c42 Do not propagate enter event to parent page elements from ULS search box
Change-Id: I18b8b746ed8bff2b0e06a8b05a2c6e69c7899293
2013-06-10 14:34:08 +05:30
Santhosh Thottingal
05e34d5dfa Fix two js error possibilities
Change-Id: I92ed487e7b5c70ef7851575eec676276e1ea905b
2013-06-10 14:33:17 +05:30
Amir E. Aharoni
851e2e84bc Remove an extra var statement 2013-04-23 17:56:59 +03:00
Amir E. Aharoni
62cab27eb2 Leave only one var statement per scope 2013-04-22 14:40:12 +03:00
Amir E. Aharoni
d410338c93 Don't ignore backspace in the search box 2013-04-10 18:57:20 +03:00
Amir E. Aharoni
9147af93d7 JSHint, whitespace, quotes 2013-01-13 23:24:47 +02:00
Siebrand Mazeland
d2d287fbc4 Update docs 2012-12-27 21:58:54 +01:00
Siebrand Mazeland
f9111d5e39 Simplify if statement 2012-12-27 21:45:35 +01:00
Santhosh Thottingal
8c54381e58 Change double quotes to single quotes
Change-Id: I4684a4bc4ac26fffba7310891106d254e893dd63
2012-12-24 16:29:14 +05:30
Amir E. Aharoni
7a04c3c6e0 Rename "that = this" to meaningful names 2012-11-29 10:40:24 +02:00
Santhosh Thottingal
04edfa90c8 Ignore control characters in typeahead
Fix https://bugzilla.wikimedia.org/show_bug.cgi?id=40171
2012-11-19 12:12:25 +05:30
Santhosh Thottingal
5626a4cf92 Some minor changes for code readability 2012-11-19 11:15:44 +05:30
Amir E. Aharoni
ba6a1e5eec Spelling of event name 2012-11-16 14:09:45 +02:00
Santhosh Thottingal
8c3b61b1a1 Fix issue #32 - Clicking a region on map sets focus in search bar; onscreen keyboard covers list
Change-Id: I15703614b5fdb2201f7dcbfd47a5095e033032f3
2012-11-13 14:22:10 +05:30