Use pg.fn.disablePopups to detect and stop NavigationPopups

The global disablePopups function from NavigationPopups got scoped to
pg.fn.disabledPopups at some point. We were relying on that function
to both detect and disable the gadget.

Bug: T109912
Change-Id: I3d6de60ca2a387e45675ddb04cdc45b0f967e46a
This commit is contained in:
Prateek Saxena 2015-08-25 10:23:14 +05:30
parent 56ec557e22
commit 1270c240c9
2 changed files with 11 additions and 6 deletions

View file

@ -1,7 +1,7 @@
/*global disablePopups: false*/
/*global pg: false*/
// Disable NavigationPopups
// The `disablePopups` function exists if NavPopups is activated. If it
// The `pg.fn.disablePopups` function exists if NavPopups is activated. If it
// exists, its called, otherwise, we do nothing.
// Since NavPopups is initialized several times, its best to disable it
@ -12,8 +12,11 @@
// HACK: This is a temporary fix
( function ( $, mw ) {
mw.popups.disableNavPopup = function () {
if ( typeof disablePopups !== 'undefined' && mw.popups.enabled ) {
disablePopups();
if ( typeof pg !== 'undefined' &&
pg.fn.disablePopups !== undefined &&
mw.popups.enabled
) {
pg.fn.disablePopups();
}
};
} ( jQuery, mediaWiki ) );

View file

@ -8,10 +8,12 @@
/**
* Check if the navigation popups gadget is enabled by looking for
* the `disablePopups` method
* the `pg.fn.disablePopups` method
* @property navPopEnabled
*/
settings.navPopEnabled = ( typeof disablePopups !== 'undefined' );
/*global pg: false*/
settings.navPopEnabled = ( typeof pg !== 'undefined' &&
pg.fn.disablePopups !== undefined );
/**
* The settings' dialog's section element.