Make MobileViewTarget scroll to desired section

Implements
https://wikimedia.mingle.thoughtworks.com/projects/mobile/cards/1626

Also, rename $el to $container so that it matches the docs.

Change-Id: I9f41ec6fb88f6f21e698553216ccf2c3231589c1
This commit is contained in:
Juliusz Gonera 2014-02-06 15:26:52 -08:00 committed by Catrope
parent a6b149decc
commit ae2f5134b2

View file

@ -14,15 +14,20 @@
*
* @constructor
* @param {jQuery} $container Container to render target into
* @param {Object} [config] Configuration options
* @cfg {number} [section] Number of the section target should scroll to
*/
ve.init.mw.MobileViewTarget = function VeInitMwMobileViewTarget( $el ) {
ve.init.mw.MobileViewTarget = function VeInitMwMobileViewTarget( $container, config ) {
var currentUri = new mw.Uri();
config = config || {};
// Parent constructor
ve.init.mw.Target.call(
this, $el, mw.config.get( 'wgRelevantPageName' ), currentUri.query.oldid
this, $container, mw.config.get( 'wgRelevantPageName' ), currentUri.query.oldid
);
this.section = config.section;
// Events
this.connect( this, {
'surfaceReady': 'onSurfaceReady'
@ -55,6 +60,7 @@ ve.init.mw.MobileViewTarget.static.surfaceCommands = [
*/
ve.init.mw.MobileViewTarget.prototype.onSurfaceReady = function () {
this.$document[0].focus();
this.restoreEditSection();
};
/**