Jdlrobson has uploaded a new change for review.
https://gerrit.wikimedia.org/r/286257
Change subject: Port mobile.startup module and mobile.drawers module to new
module loading system
......................................................................
Port mobile.startup module and mobile.drawers module to new module loading
system
This change allows us to update Popups extension which uses both these modules.
See I0ab833f69f7e3e265c2b7259749b15f248714836
Bug: T132686
Change-Id: I8fd806badc36331296c0bd53c9232716674e1dbd
---
M .jshintrc
M resources/mobile.drawers/CtaDrawer.js
M resources/mobile.drawers/Drawer.js
M resources/mobile.startup/Anchor.js
M resources/mobile.startup/Button.js
M resources/mobile.startup/Icon.js
M resources/mobile.startup/OverlayManager.js
M resources/mobile.startup/Page.js
M resources/mobile.startup/PageGateway.js
M resources/mobile.startup/Panel.js
M resources/mobile.startup/Router.js
M resources/mobile.startup/Section.js
M resources/mobile.startup/Skin.js
M resources/mobile.startup/Thumbnail.js
M resources/mobile.startup/icons.js
M resources/mobile.startup/util.js
16 files changed, 45 insertions(+), 38 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/57/286257/1
diff --git a/.jshintrc b/.jshintrc
index 6ebf058..48a8b0c 100644
--- a/.jshintrc
+++ b/.jshintrc
@@ -1,5 +1,6 @@
{
"globals": {
+ "require": false,
"module": false,
"console": true,
"jQuery": true,
diff --git a/resources/mobile.drawers/CtaDrawer.js
b/resources/mobile.drawers/CtaDrawer.js
index b57f80c..9375233 100644
--- a/resources/mobile.drawers/CtaDrawer.js
+++ b/resources/mobile.drawers/CtaDrawer.js
@@ -1,8 +1,9 @@
( function ( M, $ ) {
- var Drawer = M.require( 'mobile.drawers/Drawer' ),
- Icon = M.require( 'mobile.startup/Icon' ),
- Button = M.require( 'mobile.startup/Button' ),
- Anchor = M.require( 'mobile.startup/Anchor' );
+ var Drawer = module.exports.Drawer,
+ startup = require( 'mobile.startup' ),
+ Icon = startup.Icon,
+ Button = startup.Button,
+ Anchor = startup.Anchor;
/**
* This creates the drawer at the bottom of the screen that appears
when an anonymous
@@ -72,6 +73,6 @@
}
} );
- M.define( 'mobile.drawers/CtaDrawer', CtaDrawer );
+ module.exports.CtaDrawer = CtaDrawer;
}( mw.mobileFrontend, jQuery ) );
diff --git a/resources/mobile.drawers/Drawer.js
b/resources/mobile.drawers/Drawer.js
index f6eab4e..dd7c6a2 100644
--- a/resources/mobile.drawers/Drawer.js
+++ b/resources/mobile.drawers/Drawer.js
@@ -1,7 +1,8 @@
-( function ( M, $ ) {
+( function ( $ ) {
- var Panel = M.require( 'mobile.startup/Panel' ),
- Icon = M.require( 'mobile.startup/Icon' );
+ var startup = require( 'mobile.startup' ),
+ Panel = startup.Panel,
+ Icon = startup.Icon;
/**
* A {@link View} that pops up from the bottom of the screen.
@@ -86,6 +87,6 @@
}
} );
- M.define( 'mobile.drawers/Drawer', Drawer );
+ module.exports.Drawer = Drawer;
-}( mw.mobileFrontend, jQuery ) );
+}( jQuery ) );
diff --git a/resources/mobile.startup/Anchor.js
b/resources/mobile.startup/Anchor.js
index b7cdb6d..a7d9e11 100644
--- a/resources/mobile.startup/Anchor.js
+++ b/resources/mobile.startup/Anchor.js
@@ -33,6 +33,7 @@
},
template: mw.template.get( 'mobile.startup', 'anchor.hogan' )
} );
- M.define( 'mobile.startup/Anchor', Anchor );
+
+ module.exports.Anchor = Anchor;
}( mw.mobileFrontend ) );
diff --git a/resources/mobile.startup/Button.js
b/resources/mobile.startup/Button.js
index 4cb799e..2685933 100644
--- a/resources/mobile.startup/Button.js
+++ b/resources/mobile.startup/Button.js
@@ -42,6 +42,7 @@
},
template: mw.template.get( 'mobile.startup', 'button.hogan' )
} );
- M.define( 'mobile.startup/Button', Button );
+
+ module.exports.Button = Button;
}( mw.mobileFrontend ) );
diff --git a/resources/mobile.startup/Icon.js b/resources/mobile.startup/Icon.js
index 6f6de07..5a9b4df 100644
--- a/resources/mobile.startup/Icon.js
+++ b/resources/mobile.startup/Icon.js
@@ -68,6 +68,6 @@
template: mw.template.get( 'mobile.startup', 'icon.hogan' )
} );
- M.define( 'mobile.startup/Icon', Icon );
+ module.exports.Icon = Icon;
}( mw.mobileFrontend, jQuery ) );
diff --git a/resources/mobile.startup/OverlayManager.js
b/resources/mobile.startup/OverlayManager.js
index 70a36ff..d9f946d 100644
--- a/resources/mobile.startup/OverlayManager.js
+++ b/resources/mobile.startup/OverlayManager.js
@@ -1,7 +1,7 @@
( function ( M, $ ) {
var overlayManager,
- router = M.require( 'mobile.startup/router' );
+ router = module.exports.router;
/**
* Manages opening and closing overlays when the URL hash changes to one
@@ -248,7 +248,7 @@
overlayManager = new OverlayManager( router );
- M.define( 'mobile.startup/OverlayManager', OverlayManager );
- M.define( 'mobile.startup/overlayManager', overlayManager );
+ module.exports.OverlayManager = OverlayManager;
+ module.exports.overlayManager = overlayManager;
}( mw.mobileFrontend, jQuery ) );
diff --git a/resources/mobile.startup/Page.js b/resources/mobile.startup/Page.js
index 9b1e9ca..fb3ced0 100644
--- a/resources/mobile.startup/Page.js
+++ b/resources/mobile.startup/Page.js
@@ -2,8 +2,8 @@
var time = M.require( 'mobile.modifiedBar/time' ),
View = M.require( 'mobile.view/View' ),
- Section = M.require( 'mobile.startup/Section' ),
- Thumbnail = M.require( 'mobile.startup/Thumbnail' );
+ Section = module.exports.Section,
+ Thumbnail = module.exports.Thumbnail;
/**
* Mobile page view object
@@ -337,6 +337,7 @@
} )
);
};
- M.define( 'mobile.startup/Page', Page );
+
+ module.exports.Page = Page;
}( mw.html, mw.mobileFrontend, jQuery ) );
diff --git a/resources/mobile.startup/PageGateway.js
b/resources/mobile.startup/PageGateway.js
index d58d3a9..027d554 100644
--- a/resources/mobile.startup/PageGateway.js
+++ b/resources/mobile.startup/PageGateway.js
@@ -300,5 +300,5 @@
}
};
- M.define( 'mobile.startup/PageGateway', PageGateway );
+ module.exports.PageGateway = PageGateway;
}( mw.mobileFrontend, jQuery ) );
diff --git a/resources/mobile.startup/Panel.js
b/resources/mobile.startup/Panel.js
index 1bd2078..edd3117 100644
--- a/resources/mobile.startup/Panel.js
+++ b/resources/mobile.startup/Panel.js
@@ -82,6 +82,6 @@
}
} );
- M.define( 'mobile.startup/Panel', Panel );
+ module.exports.Panel = Panel;
}( mw.mobileFrontend ) );
diff --git a/resources/mobile.startup/Router.js
b/resources/mobile.startup/Router.js
index 0860906..64f7a94 100644
--- a/resources/mobile.startup/Router.js
+++ b/resources/mobile.startup/Router.js
@@ -1,5 +1,5 @@
// FIXME: Merge this code with OverlayManager
-( function ( M, $ ) {
+( function ( $ ) {
var router;
@@ -173,7 +173,7 @@
router = new Router();
- M.define( 'mobile.startup/Router', Router );
- M.define( 'mobile.startup/router', router );
+ module.exports.Router = Router;
+ module.exports.router = router;
-}( mw.mobileFrontend, jQuery ) );
+}( jQuery ) );
diff --git a/resources/mobile.startup/Section.js
b/resources/mobile.startup/Section.js
index e11130b..07b8538 100644
--- a/resources/mobile.startup/Section.js
+++ b/resources/mobile.startup/Section.js
@@ -1,7 +1,7 @@
( function ( M, $ ) {
var View = M.require( 'mobile.view/View' ),
- icons = M.require( 'mobile.startup/icons' );
+ icons = module.exports.icons;
/**
* Builds a section of a page
@@ -36,6 +36,7 @@
spinner: icons.spinner().toHtmlString()
}
} );
- M.define( 'mobile.startup/Section', Section );
+
+ module.exports.Section = Section;
}( mw.mobileFrontend, jQuery ) );
diff --git a/resources/mobile.startup/Skin.js b/resources/mobile.startup/Skin.js
index 1af0f08..33c54f0 100644
--- a/resources/mobile.startup/Skin.js
+++ b/resources/mobile.startup/Skin.js
@@ -2,7 +2,7 @@
var browser = M.require( 'mobile.browser/browser' ),
View = M.require( 'mobile.view/View' ),
- Icon = M.require( 'mobile.startup/Icon' );
+ Icon = module.exports.Icon;
/**
* Representation of the current skin being rendered.
@@ -281,6 +281,6 @@
}
} );
- M.define( 'mobile.startup/Skin', Skin );
+ module.exports.Skin = Skin;
}( mw.mobileFrontend, jQuery ) );
diff --git a/resources/mobile.startup/Thumbnail.js
b/resources/mobile.startup/Thumbnail.js
index ad6b9a8..4074bff 100644
--- a/resources/mobile.startup/Thumbnail.js
+++ b/resources/mobile.startup/Thumbnail.js
@@ -39,6 +39,6 @@
}
} );
- M.define( 'mobile.startup/Thumbnail', Thumbnail );
+ module.exports.Thumbnail = Thumbnail;
}( mw.mobileFrontend ) );
diff --git a/resources/mobile.startup/icons.js
b/resources/mobile.startup/icons.js
index 7e4d70c..bec6ad5 100644
--- a/resources/mobile.startup/icons.js
+++ b/resources/mobile.startup/icons.js
@@ -1,6 +1,6 @@
-( function ( M, $ ) {
+( function ( $ ) {
- var Icon = M.require( 'mobile.startup/Icon' );
+ var Icon = module.exports.Icon;
/**
* A set of shared icons.
@@ -13,7 +13,7 @@
* @singleton
* @uses Icon
*/
- M.define( 'mobile.startup/icons', {
+ module.exports.icons = {
/**
* Gets a spinner icon.
@@ -33,6 +33,6 @@
additionalClassNames: 'spinner loading'
} ) );
}
- } );
+ };
-}( mw.mobileFrontend, jQuery ) );
+}( jQuery ) );
diff --git a/resources/mobile.startup/util.js b/resources/mobile.startup/util.js
index d3573ec..2aa7abe 100644
--- a/resources/mobile.startup/util.js
+++ b/resources/mobile.startup/util.js
@@ -1,4 +1,4 @@
-( function ( M ) {
+( function () {
var util;
/**
@@ -39,6 +39,6 @@
}
};
- M.define( 'mobile.startup/util', util );
+ module.exports.util = util;
-}( mw.mobileFrontend, jQuery ) );
+}( jQuery ) );
--
To view, visit https://gerrit.wikimedia.org/r/286257
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8fd806badc36331296c0bd53c9232716674e1dbd
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