mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-09-25 11:17:24 +00:00
Improve mw.popups.selectPopupElements
Use proven technology to create and compare URLs. This will display popups also on anchored links again. Change-Id: Ic010ca027017435f666782e709e641cf3bbb8767
This commit is contained in:
parent
64195b8ff7
commit
9974a75b50
|
@ -53,6 +53,7 @@ class PopupsHooks {
|
|||
$moduleDependencies = array(
|
||||
'mediawiki.api',
|
||||
'mediawiki.jqueryMsg',
|
||||
'mediawiki.Uri',
|
||||
'moment',
|
||||
'jquery.jStorage',
|
||||
'jquery.client',
|
||||
|
|
|
@ -154,7 +154,12 @@
|
|||
return mw.popups.$content
|
||||
.find( 'a[href][title]:not(' + mw.popups.IGNORE_CLASSES.join(', ') + ')' )
|
||||
.filter( function () {
|
||||
return ( this.href.replace(/^https?:\/\//,'//') === ( mw.config.get( 'wgServer' ) + mw.util.getUrl( this.title ) ).replace(/^https?:\/\//,'//') );
|
||||
var linkHref = new mw.Uri( this.href ),
|
||||
expectedHref = new mw.Uri( mw.util.getUrl( this.title ) );
|
||||
|
||||
// don't compare fragment to display popups on anchored page links
|
||||
linkHref.fragment = undefined;
|
||||
return linkHref.toString() === expectedHref.toString();
|
||||
} );
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue