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
'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
We had a browser check to blacklist all browsers older than IE 8
IE <= 7
But that is no longer required since JS support is not there for such
browsers as per https://www.mediawiki.org/wiki/Compatibility#Modern
We can support all modern browsers listed there and we don't need
additional blacklisting now. From 1.27 onwards, there is no JS loaded
for IE 8 too. So we can just use MW browser support policy.
In this commit, the code to do brower checks removed and simplified
the initialization code. Still I am not happy with the interface module,
that need further refactoring.
Change-Id: I655826c55fb2c7c5c88f16368110142d64a96eec
- Updated versions and order of checkers.
- Some consistency updates in Gruntfile.js.
- Updates to make jscs pass.
Change-Id: I7ed93596ff383dc713bd17af2da0472be934d59d
Error was caused because .css( 'font-family' ) returns undefined for
elements which do not exist.
Merged two blocks both extending the default settings.
Bug: 67676
Change-Id: Ic33f3934166f4feb6dd088ca0d14e249fcf237a3
This commit allows to log tofu detection always,
even if the rest of the webfonts library is not loaded.
By default this is disabled.
To enable it, set the variable $wgULSTofuLoggingChance
to a number between 0 and 100, indicating the chance of it
getting logged. The idea of the lottery is that even a partial
sample can be useful.
Change-Id: Ia08fe0de348b7eebfa95498a6be58ae41608ba3b
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
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
Adding salt won't work for IE since it uses a tofu with small width
for unassigned code points. From tests, algorithm without salt
should be enough for IE.
Change-Id: If39e6c49d272fa67f60c19f1af64f1fb71856bcd
To detect whether the client can render a given string,
use a tofu detection algorithm.
If the user has an explicit font preference, do not override it.
If the user has no preference and there is a default font for a
language, see if that language can be rendered at the user's browser
using tofu detection.
If tofu is detected, apply the font.
If the element has 'autonym' class, apply Autonym font only when
that language has tofu.
Change-Id: Ib9ee9497e6bcfa7eb86f7d264e0980d8880d6b70
So that the fontfamily values are always 'seen' by the webfonts jquery
plugin. Missing this was causing incorrect behavior -overriding the
fontfamiliy from css- in random cases.
The stylesheet ext.uls.webfonts.css define font family values for
interlanguge links and autonym class. This patch make sure that that
css values are read by jquery.webfonts while deciding which font to
apply. Autonym font is supposed to be used for them. If jquery.webfonts
does not read that these elements has a font family defined in css as
"'Autonym', sans-serif", it will attempt to apply fonts as per user
preference or default fonts based on lang attribute. That will cause
applying bigger fonts.
jquery.webfonts does not apply any fonts, if an element has explicit
font family value defined by inline css or by external style sheets.
Bug: 59958
Change-Id: I2da436caa618bc2318e20e3c0492a6bf1c03e162
Move it to a seperate css file ext.uls.webfonts.css so that the RL
modules are more granular and clear.
Also get the @font-face css for Autonym font get ready on page load
so that the font applied automatically to any future elements on page.
Change-Id: Icb76df5baedaba8ab613d665a1be923779a6b9e7
This patch adds a configuration variable, '$wgULSFontRepositoryBasePath', which
specifies the base path to the font repository. By default, the variable is set
to its existing value, which is $wgExtensionAssetsPath +
'/UniversalLanguageSelector/data/fontrepo/fonts/'. However, adding a discrete
configuration variable makes it possible to configure ULS to use a custom URL
scheme that is more suitable for large static assets that change infrequently.
Change-Id: Idbe57072c4f3258757eb691e54cab5429cadcfda
* Updates jquery.webfonts from upstream
* Introduces wgULSNoWebfontsSelectors configuration variable. It
takes an array of jquery selector to which webfonts will not be
applied if defined.
Change-Id: I0dc263f84620af4077f52e18eeb0f986ff0f13b9
Also make sure that correct language is passed to the getFont
It was wrong in current version - UI language was passed always
(introduced in a refactoring to avoid code duplication for content
and ui language- commit: 98bb1c200c )
Change-Id: I62860f9d62538915628ad21e5d904e56bdcc9430
Disabling was not working actually. If disabled donot call
webfonts() on body. Also addresses Bug 39992.
Change-Id: I8e4d466dd9271604be6ae722c49357b192651950
* Just use key,value system and drop the concept of groups
* Abstract the preferences for each type of systems(display, input)
to have meaningful APIs
Change-Id: I25423667adf6ca181a4027cdfc4ed378f36a94ba
* Fixed many white space issues- mainly whitespace missing before
function start paranthesis eg: function()
* Removed the deprecated live methods and replaced with on
* Added file documentation for ext.uls.geoclient
Change-Id: Ib2c8cfed1a6ff3859495e707680d5c19882a33e8
jquery.uls uses Helvetica, Arial, sans-serif.
Override it to match MediaWiki's default fallback font.
Change-Id: I2d842ce5c2f9a32c781560c4583567873320e786