Santhosh has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/93957


Change subject: Refactor the css for interlanguage links and autonym class
......................................................................

Refactor the css for interlanguage links and autonym class

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
---
M Resources.php
M resources/css/ext.uls.css
A resources/css/ext.uls.webfonts.css
M resources/js/ext.uls.webfonts.js
4 files changed, 12 insertions(+), 6 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UniversalLanguageSelector 
refs/changes/57/93957/1

diff --git a/Resources.php b/Resources.php
index f5d4d99..3b82f81 100644
--- a/Resources.php
+++ b/Resources.php
@@ -139,6 +139,7 @@
 
 $wgResourceModules['ext.uls.webfonts'] = array(
        'scripts' => 'resources/js/ext.uls.webfonts.js',
+       'styles' => 'resources/css/ext.uls.webfonts.css',
        'dependencies' => array(
                'jquery.webfonts',
                'ext.uls.init',
diff --git a/resources/css/ext.uls.css b/resources/css/ext.uls.css
index 812865c..7eaac41 100644
--- a/resources/css/ext.uls.css
+++ b/resources/css/ext.uls.css
@@ -136,9 +136,3 @@
 .ime-checked .ime-perime-help:hover {
        opacity: 1;
 }
-
-/* Interlanguage links */
-#p-lang ul,
-.autonym {
-       font-family: 'Autonym', sans-serif;
-}
diff --git a/resources/css/ext.uls.webfonts.css 
b/resources/css/ext.uls.webfonts.css
new file mode 100644
index 0000000..07c7808
--- /dev/null
+++ b/resources/css/ext.uls.webfonts.css
@@ -0,0 +1,4 @@
+#p-lang ul,/* Interlanguage links */
+.autonym { /* provide autonym class for simplifying the Autonym font usage */
+       font-family: 'Autonym', sans-serif;
+}
diff --git a/resources/js/ext.uls.webfonts.js b/resources/js/ext.uls.webfonts.js
index 91b240b..0ea538e 100644
--- a/resources/js/ext.uls.webfonts.js
+++ b/resources/js/ext.uls.webfonts.js
@@ -83,6 +83,13 @@
                        }() )
                } );
                $( 'body' ).webfonts();
+               // Load the css required for Autonym font. Note that this wont 
download the font.
+               // Browsers are smart enough to delay it till some element with 
this font-family
+               // become visible. For eg: If there is a popup div with an 
element with class
+               // 'autonym', without explicitly calling .webfonts() on it, 
Autonym font will not
+               // be applied in general. But we ensure that css is ready so 
that automatically
+               // the font get applied to such future elements.
+               $( 'body' ).data( 'webfonts' ).load( 'Autonym' );
        };
 
        $( document ).ready( function () {

-- 
To view, visit https://gerrit.wikimedia.org/r/93957
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icb76df5baedaba8ab613d665a1be923779a6b9e7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector
Gerrit-Branch: master
Gerrit-Owner: Santhosh <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to