diff --git a/resources/js/ext.uls.interface.js b/resources/js/ext.uls.interface.js index 0cfbb8e1..3234596c 100644 --- a/resources/js/ext.uls.interface.js +++ b/resources/js/ext.uls.interface.js @@ -329,10 +329,13 @@ } } else { mw.loader.using( languageSettingsModules, function () { - $trigger.languagesettings(); - - $trigger.trigger( 'click' ); + $trigger.languagesettings( { autoOpen: true } ); + mw.hook( 'mw.uls.settings.open' ).fire( 'personal' ); } ); + // Stop propagating the event to avoid closing the languagesettings dialog + // when the event propagates to the document click handler inside + // languagesettings + e.stopPropagation(); } }; } else { diff --git a/resources/js/ext.uls.languagesettings.js b/resources/js/ext.uls.languagesettings.js index 064dbff9..b7acf5f9 100644 --- a/resources/js/ext.uls.languagesettings.js +++ b/resources/js/ext.uls.languagesettings.js @@ -63,6 +63,10 @@ this.$applyButton = this.$window.find( '.uls-settings-apply' ); this.init(); this.listen(); + + if ( options.autoOpen ) { + this.show(); + } } LanguageSettings.prototype = { @@ -318,7 +322,8 @@ top: null, // DEPRECATED: Top position of this window left: null, // DEPRECATED: Left position of this window onVisible: null, // A callback that runs after the ULS panel becomes visible - onPosition: null // A callback that allows positioning the dialog + onPosition: null, // A callback that allows positioning the dialog, + autoOpen: false // A boolean that determines if dialog should auto-open after initialization }; $.fn.languagesettings.Constructor = LanguageSettings;