settings: Remove navPopEnabled property

This doesn't need to be a property. Its being used exactly once, and
because we try to test for NavigationPopup's availability so soon we
mostly get an incorrect answer.

Moving the condition to the render method instead. Chances of NavPop
being loaded when the settings' screen is being rendered are much
higher.

Bug: T109912
Change-Id: I3723dc1e3e9400b6ed2e0160104c849a25a71881
This commit is contained in:
Prateek Saxena 2015-10-08 00:11:28 +05:30
parent d3f5cacc17
commit ba919e5d0a

View file

@ -6,15 +6,6 @@
*/
var settings = {};
/**
* Check if the navigation popups gadget is enabled by looking for
* the `pg.fn.disablePopups` method
* @property navPopEnabled
*/
/*global pg: false*/
settings.navPopEnabled = ( typeof pg !== 'undefined' &&
pg.fn.disablePopups !== undefined );
/**
* The settings' dialog's section element.
* Defined in settings.open
@ -84,7 +75,10 @@
} );
$radioGroup.append( settings.renderOption( 'simple', options.simple, true ) );
if ( settings.navPopEnabled ) {
// Check if NavigationPopups is enabled
/*global pg: false*/
if ( typeof pg !== 'undefined' && pg.fn.disablePopups !== undefined ) {
$radioGroup.append( settings.renderOption( 'advanced', options.advanced ) );
}
$radioGroup.append( settings.renderOption( 'off', options.off ) );