Skip to content

Commit 75e472b

Browse files
committed
morebits: fix integration with Navigation Popups
- Remove obsolete code to integrate with navpopups via window.setupTooltips which is no longer exposed. - Fire the wikipage.content hook instead, which is handled by navpopups. This is only done for content of previews, as popups for other links in Twinkle dialogs are unnecessary. - Change base z-index of dialog to 500. As popups uses 1000, this ensures that popups always appear over the dialog. Fixes #2307
1 parent 46bfd7a commit 75e472b

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/morebits.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4680,6 +4680,9 @@ Morebits.wiki.Preview = function(previewbox) {
46804680

46814681
// this makes links open in new tab
46824682
$(previewbox).find('a').attr('target', '_blank');
4683+
4684+
// Integrate with scripts that do things on rendered content, like navpopups
4685+
mw.hook('wikipage.content').fire($(previewbox));
46834686
};
46844687

46854688
/** Hides the preview box and clears it. */
@@ -5685,6 +5688,8 @@ Morebits.SimpleWindow = function SimpleWindow(width, height) {
56855688
// the 20 pixels represents adjustment for the extra height of the jQuery dialog "chrome", compared
56865689
// to that of the old SimpleWindow
56875690
height: height + 20,
5691+
// Use smaller z-indexes compared to Navigation popups (which uses values starting from 1000)
5692+
zIndex: 500,
56885693
close: function(event) {
56895694
// dialogs and their content can be destroyed once closed
56905695
$(event.target).dialog('destroy').remove();
@@ -5774,11 +5779,7 @@ Morebits.SimpleWindow.prototype = {
57745779
$widget.find('.ui-dialog-title').prepend(scriptnamespan);
57755780
}
57765781

5777-
const dialog = $(this.content).dialog('open');
5778-
if (window.setupTooltips && window.pg && window.pg.re && window.pg.re.diff) { // tie in with NAVPOP
5779-
dialog.parent()[0].ranSetupTooltipsAlready = false;
5780-
window.setupTooltips(dialog.parent()[0]);
5781-
}
5782+
$(this.content).dialog('open');
57825783
this.setHeight(this.height); // init height algorithm
57835784
return this;
57845785
},

0 commit comments

Comments
 (0)