Commit Graph

75 Commits

Author SHA1 Message Date
Jdlrobson
6f9ffac1c3 Use Codex styles for buttons in language overlay (attempt 2)
* Replace all instances of mw-ui markup with Codex markup
* Use codex-search-styles
* Where codex-search-styles is not installed (e.g. 1.39)
register an alias which points to @wikimedia/codex as that is
available.

Bug: T340255
Bug: T340257
Change-Id: I4f3ddfb68ea6c033ee7a49729187f4ddbc8abe5c
2023-12-20 18:53:41 +05:30
Niklas Laxström
4fc7bc9200 Handle corrupted values in input preferences
Bug: T246370
Change-Id: I13c730a6d584ad2f73807e11d5ceadfcb16a6040
2021-01-19 08:45:05 +00:00
jdlrobson
f8fde38197 Use require to clarify ext.uls.preferences
ext.uls.preferences only depended on ext.uls.common because of its
use of the uls global. This is unnecessary, and made clearer by using
require and module.exports to access it.

Change-Id: Ied2a1b560d19a18529fd766ced778c912199fa2f
2020-10-20 16:08:59 +00:00
jdlrobson
5cd10ce862 Reduce JS loaded on critical path
As a precursor to incorporating a new language switcher in the new
version of Vector I'd like to improve the performance of loading
the switcher.

It seems most code can be deferred until the language selector
button is clicked.

This shaves around 30kb of resources off the critical path for
most users. There's potential here for a positive performance
impact so we should follow up the deployment by checking the
associated performance graphs to see if there's improvement.

Note, if the compact personal links feature is enabled
there is no performance saving for now. This will be addressed in follow
ups.

Bug: T153844
Bug: T153845
Bug: T237061
Change-Id: I740600d18859422b2f98a5ef92d0321f6e9615a2
2020-10-20 13:40:49 +00:00
Ed Sanders
e128c51356 build: Update eslint-config-wikimedia to 0.16.2
Change-Id: Iea4b73bdceb66e113b7f9c9244ae6b37a3ce205f
2020-07-09 16:40:05 +01:00
Fomafix
61ebecff91 Use document.body instead of 'body' as jQuery selector
Change-Id: Ia551b3050ed546de1f9db44dbd332a5b6c108a9f
2019-12-16 15:51:09 +00:00
Ed Sanders
c080452013 build: Update eslint-config-wikimedia to 0.11.0
Change-Id: Ic59891fab5f8e35420bddbed34072841883fa543
2019-03-13 23:41:14 +00:00
Timo Tijhof
4e067715dc Remove redundant closure aliases
'mw' are '$' are globals, always have been, and aren't going
anywhere. They're every bit as real as their longer versions.
If anything, the longer ones are less "real" or 'stable" because
they're not used internally by RL and easier to accidentally
replace or override. For anecdotes and history, see 91f950d6b0.

Change-Id: I526fb8c961d9477992d88f2780a0ff4cbdc51923
2018-09-07 19:23:17 +00:00
petarpetkovic
5a1da4dbaa Remove jQuery.inArray usages
Replace jQuery.inArray with JS native Array.prototype.indexOf

Change-Id: I0031f0385e440a34846334d158425182542a9ac9
2018-08-24 20:18:53 +00:00
Amire80
cda999605a For the ULS instance in the IME selector, read the autonym from ULS data
Sometimes new languages don't appear in wgULSLanguages.
For these cases, read their autonym from ULS's own langdb.
Otherwise they are not shown at all.

Bug: T198080
Change-Id: I2bef16811c6a0bdaef5db94719d7b76fe00c6e04
2018-06-25 15:02:41 +03:00
Amire80
d6630a4780 Log the context of the ULS in which no search results were found
Relies on updates to EventLogging schema. Diff:
https://meta.wikimedia.org/w/index.php?title=Schema%3AUniversalLanguageSelector&type=revision&diff=17799034&oldid=7327441

Bug: T179402
Change-Id: I2ff9ce9b40df16ed3c5e6970fb3b691af08cedec
2018-03-08 16:03:33 +02:00
Fomafix
58777c4e37 Use mw.msg() for parameter substitution
mw.msg() has already a parameter substitution of $1.
A separate .replace( '$1', ... ) is not necessary.

Change-Id: Ie77bddc4dfb60df36211ce821c1a6f7223cde706
2016-11-06 15:45:50 +01:00
Ed Sanders
3cfb0d67e5 Update linting tools, config, and fix subsequent failures
Change-Id: I41e080915441367b3a2ab2de7d7a096872a2f2e8
2016-04-13 17:13:06 +01:00
Siebrand Mazeland
6a2b2e0bba Update test files
- Updated versions and order of checkers.
- Some consistency updates in Gruntfile.js.
- Updates to make jscs pass.

Change-Id: I7ed93596ff383dc713bd17af2da0472be934d59d
2016-02-18 18:51:37 +00:00
Fomafix
c329f1473d Use spaces inside of brackets in JavaScript
* For consistency
* For MediaWiki coding conventions

Change-Id: I625a8ce0119b1490073f048e1b8ad4e90762d6e2
2016-02-15 13:31:45 +00:00
Thiemo Mättig
5fab7bd738 Make sure script execution doesn't stop by assuming unchecked input is set
These methods aren't designed to return "undefined" or "null".
What they return is not checked. It's assumed to always be an
object (2 of them) or an array (1 of them). This simple patch
does make sure the following code does not fail with TypeErrors.

Bug: 55701
Change-Id: I19f51bbff2209044485b9d7cef4c7654cb5f6425
2014-03-22 15:54:47 +00:00
Santhosh Thottingal
27771fdeaf Restore enableWebfonts pref and remove uls-enable
This patch restores the enableWebfonts preference, stored inside
the uls-preferences blob. It existed as 'enable-webfonts' in
the past and was removed in
If735a733717596fae03042c5e277bd538bd8501f

Each wiki can be configured to load the fonts by default
using the new global variable $wgULSWebfontsEnabled.
Its default value is true (to load fonts).

This also removes the preference 'uls-enable', recently added in
I71b70d8ee7c3cad7f49b32e5dc494ef4fc1bdb2f

The initialization of ext.uls.webfonts.js is changed as well,
so that minimal webfonts JS library code is loaded,
and the rest is loaded only if a user requests it.

Bug: 60304
Change-Id: I49e812eae32266f165591c75fd67b86ca06b13f0
2014-02-10 17:40:30 +05:30
jenkins-bot
9a5a1d909f Merge "Remove duplicate code and add todo" 2014-02-10 06:54:11 +00:00
Timo Tijhof
c6d71015ff Various clean up
Files:
* Consistently have one (1) new line at EOF
  (.gitignore, *.css, *.sh)

JSHint:
* Separate the common (general Wikimedia code conventions) from
  the local more stricter rules (nice work!).

Maintenance:
* Use simplified $IP definition where getenv is only called once.
  Based on http://git.io/ve-mw-36fc3b59-makeStaticLoader

JavaScript:
* Use the same closure in all files:
  - No need for "undefined".
  - One linebreak between license header and start of closure
    (sometimes there were 1 or 2 empty lines).
  - ext.uls.ime.js: No need for "document" (redundant in general,
    but especially as it wasn't used anywhere in this file).
  - Use "$, mw" for all ext.* modules (one of them used "mw, $").

Change-Id: Iba5dab14bbc3fbfc9f8fe96dd2d95529587a69aa
2014-02-08 00:11:50 -08:00
Niklas Laxström
41d6ee2f44 Remove duplicate code and add todo
Found while looking at bug 47974

Change-Id: I7d4ef165e36e96cb6a61880a3413d8883c51c7fd
2014-02-06 17:09:08 +05:30
Santhosh Thottingal
abae4e1780 Do not save isDirty field in preferences
Bug: 57349
Change-Id: Id5fe6bf61fcf79942f879bd1729e6b0a622aded8
2013-11-25 17:24:44 +05:30
Santhosh Thottingal
d1647a9fa0 Update the local copy of preferences before saving to reflect other module changes
Change-Id: Idfd6d4f71eff9d1a1e6606b3fa91abf9ddc7b183
2013-11-22 12:05:42 +05:30
Amir E. Aharoni
bb250efea1 Cleanup wgULSLanguages usage
Change-Id: I15cb10f97ed39b18fdfb1bc2ce51d02374fe9c43
2013-11-11 18:14:55 +02:00
Niklas Laxström
193f69b017 Refactor ime lazy loading
* Do not load anything unless input field is focused
* Split the setup function to smaller functions
* Introduce $wgULSImeSelectors to allow configuration and avoid
  duplication of selectors in two places.

Change-Id: If5a476e66681dde9f0b72f619d35ddf6255246ac
2013-11-05 16:48:47 +05:30
Siebrand Mazeland
315cf739bc Update formatting
Change-Id: Iaee2ab4f36d3a0dce143c62965ab29de504b31ea
2013-10-09 15:40:39 +02:00
Roan Kattouw
d6ae72eb9c Don't trigger namespaced events, it breaks VisualEditor
Code like $input.trigger( 'focus.ime' ); doesn't make any sense. Event
namespaces exist for binding and unbinding and are irrelevant when
triggering. However, there's a bug in the version of jQuery that we
use (1.8.3) that causes .trigger( 'focus.ime' ) to perform a native
focus and call natively bound focus handlers, but only call jQuery
event handlers bound to 'focus.ime', not handlers bound to 'focus'.
This bug is fixed in jQuery 1.9+. http://jsfiddle.net/WGy9h/3/
demonstrates this bug.

The way ULS broke VE with this went like this:
* VE initializes and creates two contentEditable divs, the
  pasteTarget and the documentNode. It then focuses the documentNode.
* ULS loads jQuery.ime
* Once jQuery.ime loads, it first calls .trigger( 'focus.ime' ) on
  the pasteTarget
* jQuery focuses the pasteTarget, which means a blur is emitted on the
  documentNode
* In response to this blur event, VE disables the SurfaceObserver
* jQuery.ime then calls .trigger( 'focus.ime' ) on the documentNode
* jQuery focuses the documentNode, but does not call VE's focus handler
  because it's bound to 'focus' rather than 'focus.ime'
* This means VE's SurfaceObserver is not reenabled
* If the user then focuses something else then focuses VE again, a
  native focus event fires and the SurfaceObserver does get reenabled

Change-Id: I7c590599df4cf62418403bc1d1dccfc3c6db5fd3
2013-09-27 16:34:19 -07:00
Amir E. Aharoni
a1ad38d715 Show an autonym for languages that don't have input methods
Bug: 51025
Change-Id: I4a6cc9a79f186941cc79533de90ab0fb7e104673
2013-08-26 13:31:27 +03:00
Amir E. Aharoni
4e04182ecd Fire the ime-enable/disable hook upon saving the preferences
Change-Id: I98e502cd8dc1990b10b1f824614c84d3bf5b993f
2013-08-20 08:31:21 +00:00
Amir E. Aharoni
3b6d5cc83e Log ime-change event
Change-Id: I6dfc769f0de536e2ef35b165fe7a35f196bb181b
2013-08-20 08:34:52 +03:00
Santhosh Thottingal
8f5be106f5 Update jquery.ime library
upstream: http://github.com/wikimedia/jquery.ime

changes:
* Support for contenteditable, like the VisualEditor surfaces. This
  support is very minimal now. Because of VE bugs on IME support, many
  things are broken. But one-one keyboard mappings should work with less
  issues. The UI of jquery.ime is not integrated with VE toolbar
* More input methods
	- IPA-X-SAMPA by Amir
	- Armenian keymaps by  Aleksey Chalabyan
	- Kurdish keymaps by Ghybu
	- Кыргыз keymap by Amir
	- Central Kurdish keyboards by Çalak
* A lot of input method bug fixes multiple contributors
* Minor UX fixes

Introduces Rangy library.
A module named rangy is defined in VisualEditor extension with more features of rangy.
Here we need only the core library. This module is loaded dynamically from
client when rangy is undefined. If VE is present rangy will be defined, the module
defined in VE will be used. ie, This get loaded only when VE is not present and
user trying to type in a contenteditable.

Bug: 49569
Bug: 50849
Bug: 50220

Change-Id: Iadad5a4e5972fbd1359847526d28e9dbbe00a7c4
2013-08-19 04:40:08 +00:00
Santhosh Thottingal
117cc5bf46 eventlogger module for ULS
Separating event logging out of ULS functionality. Event logging
is now loosely coupled with ULS. ULS core modules can emit an event
whenever EventLogging is required. The eventlogger module will act
on the event if configured.

Change-Id: I59dfcfb25c1acb85376b56239f2355ee7c4aff1e
2013-08-15 17:08:15 +03:00
Santhosh Thottingal
c4631fdf51 Top position the ULS for IME menu wrt the input field
Currently it is positioned relative to the ... menu item.
It caused weird positioning at some places.
Positioning it relative to the input field makes more sense.

lazyload option was removed from jquery.uls. Removing it from here.

Change-Id: I331051a38d7dfd97466601bfcc2facaf446d0db9
2013-07-30 15:55:42 +03:00
Santhosh Thottingal
82fbfe62e7 Load jquery.ime only when user focus on editable fields
To reduce javascript size for page load.

Change-Id: Ibf2ccd5b5501720837051d6e268b122e8a9f8590
2013-07-30 14:18:55 +03:00
Amir E. Aharoni
56dd512725 Revert "Load jquery.ime only when user focus on editable fields"
This reverts commit 63d547915f.

Bug: 52115
Change-Id: I1d6b65622e8a103a8a892beacf268e77b9e1b2d0
2013-07-27 00:56:18 +03:00
Santhosh Thottingal
63d547915f Load jquery.ime only when user focus on editable fields
To reduce javascript size for page load.

Change-Id: I71928ac5149cbcf2cc75073fdf628403e6abe456
2013-07-26 16:08:35 +03:00
Santhosh Thottingal
d92c75518b Delay loading of language settings javascript
Load them when language settings is opened using cog or ULS icon click

Change-Id: I472497c549bff0fd578156fa0113dae2d6a7a7fb
2013-07-26 15:55:07 +03:00
jenkins-bot
3ae89279fb Merge "Lazy initialization of language settings for IME menu" 2013-07-26 11:06:48 +00:00
Santhosh Thottingal
eff459eea6 Lazy initialization of language settings for IME menu
Initialize it only when first time user clicks on it

In a page like Special:Translate where lot of input fields
appearing, the previous approach was adding many language settings
div to the page.

Bug: 48211

Change-Id: If063df6782c6a51ac77ed5531dfa253c7f3ddbc4
2013-07-24 11:12:01 +00:00
Santhosh Thottingal
1aafd31cf5 Typo fix
Change-Id: I496d137a706bd1672ea12f4d6d465d858a399794
2013-07-24 15:28:33 +05:30
Niklas Laxström
883e87ea56 Help links for ime selector menu
Change-Id: Ia6a0db9af25216f3d03c5130de96000141ccaa57
2013-07-15 13:24:12 +00:00
Santhosh Thottingal
e4cefe06fd Apply webfonts to the IME selector too
It get added to DOM after DOM is ready, and does not inherit styles
(by design)

Change-Id: I45a982b5c1c2a39718f38e77a33b79f89e460474
2013-07-08 07:42:49 +00:00
Niklas Laxström
034acf6f0f Log ime-enable and ime-disable events
Change-Id: I96964cb190d1a67bba536458ebadd3bd677d4fa6
2013-07-06 12:26:52 +00:00
jenkins-bot
7d1f6222fa Merge "Allow disabling of IME by a jQuery selector" 2013-07-05 13:38:36 +00:00
Amir E. Aharoni
8205e294d7 Allow disabling of IME by a jQuery selector
Add the variable $wgULSNoImeSelectors to allow custom
disabling of IME in specific elements.

Add captcha input field id to the exclusion list.

Bug: 41675
Change-Id: Ib03a20c50a4f473e6a58638b85da16659268eb09
2013-07-05 13:37:31 +00:00
Santhosh Thottingal
8ddff0b2fc Use single entry point mw.uls.init for all ULS ui initialization
Change-Id: I485ea27deebb530eb89e4b0935eda01a5276f884
2013-07-04 17:05:10 +00:00
Niklas Laxström
10c1177c1d Remove comma that shouldn't have been introduced
Change-Id: Iaf24bc1cf4ec59fe2c44601eee1a19ccdac757ba
2013-06-19 18:19:42 +00:00
Santhosh Thottingal
7a95d13345 Use content language as default language for ime selector
Change-Id: I9780cefc6585ebcc99bd8a45ccf10ecf6ee54a4d
2013-06-19 10:04:43 +00:00
Siebrand Mazeland
1f9bf6f82c Update indentation and newlines
Change-Id: Iac833df12a00949d32f2ce2fc26a657bab3d8229
2013-06-17 16:36:34 +02:00
Santhosh Thottingal
9d75ff9a09 Disable IME too in blacklisted browsers
Change-Id: I140352f723bc4863d14ed6441c9e173310c683b3
2013-06-17 09:31:06 +00:00
Amir E. Aharoni
361eb95f33 Make "Cancel" reset preferences and "Apply" save and close
Bug: 48898
Change-Id: I9f5444ffd57ddf46d197ebdb23a18c0c4600b196
2013-06-04 10:42:29 +03:00