Jdlrobson has uploaded a new change for review.

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

Change subject: POC: Only load icons for main menu when clicked
......................................................................

POC: Only load icons for main menu when clicked

We can save 6kb by only loading icons when the user invokes the main
menu button. This is at the cost of a visible delay as the icons load
the very first time the main menu button is clicked.

Worth thinking about given it can improve firstl oad

Change-Id: Ie62032913eb9f754e835692a4d22c8bd51eabd3c
---
M extension.json
M resources/mobile.mainMenu/MainMenu.js
2 files changed, 12 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/23/278423/1

diff --git a/extension.json b/extension.json
index aa46735..678bb9e 100644
--- a/extension.json
+++ b/extension.json
@@ -365,6 +365,15 @@
                                "resources/mobile.browser/browser.js"
                        ]
                },
+               "mobile.mainMenu.images": {
+                       "targets": [
+                               "mobile",
+                               "desktop"
+                       ],
+                       "styles": [
+                               "resources/mobile.mainMenu/icons.less"
+                       ]
+               },
                "mobile.mainMenu": {
                        "targets": [
                                "mobile",
@@ -376,8 +385,7 @@
                        ],
                        "position": "bottom",
                        "styles": [
-                               "resources/mobile.mainMenu/mainmenu.less",
-                               "resources/mobile.mainMenu/icons.less"
+                               "resources/mobile.mainMenu/mainmenu.less"
                        ],
                        "templates": {
                                "menu.hogan": 
"resources/mobile.mainMenu/menu.mustache"
diff --git a/resources/mobile.mainMenu/MainMenu.js 
b/resources/mobile.mainMenu/MainMenu.js
index 77bf925..7424340 100644
--- a/resources/mobile.mainMenu/MainMenu.js
+++ b/resources/mobile.mainMenu/MainMenu.js
@@ -139,6 +139,8 @@
                openNavigationDrawer: function ( drawerType ) {
                        // close any existing ones first.
                        this.closeNavigationDrawers();
+                       // load the icons now (this avoids loading icons on 
load)
+                       mw.loader.load( 'mobile.mainMenu.images' );
                        drawerType = drawerType || 'primary';
                        // FIXME: We should be moving away from applying 
classes to the body
                        $( 'body' ).toggleClass( 'navigation-enabled' )

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie62032913eb9f754e835692a4d22c8bd51eabd3c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>

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

Reply via email to