mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-24 07:34:11 +00:00
c93047666e
Linkpreview will try to fetch a text extract using the api and, if this doesn't fail, show the extract as a drawer with a button "Continue to article". If the query fails, it will redirect the user to the article directly. Bug: T113243 Depends-On: I6d8c5b80e70c3d8d1a92a70cc91e1b90d598cb0f Change-Id: Idbaae9fe2decd89b73e623a25fbd39464c316fb2
32 lines
731 B
JavaScript
32 lines
731 B
JavaScript
( function ( $, mw, M ) {
|
|
/**
|
|
* @class mw.popups.render
|
|
* @singleton
|
|
*/
|
|
mw.popups.render = {};
|
|
|
|
/**
|
|
* Render a new LinkPreviewDrawer
|
|
*
|
|
* @method render
|
|
* @param {Object} link
|
|
* @param {Object} event
|
|
*/
|
|
mw.popups.render.render = function ( link, event ) {
|
|
var LinkPreviewDrawer = M.require( 'ext.popups.mobilelinkpreview/LinkPreviewDrawer' );
|
|
|
|
// Ignore if its meant to call a function
|
|
// TODO: Remove this when adding reference popups
|
|
if ( link.attr( 'href' ) === '#' ) {
|
|
return;
|
|
}
|
|
|
|
if ( !mw.popups.$popup ) {
|
|
mw.popups.$popup = new LinkPreviewDrawer();
|
|
}
|
|
mw.popups.$popup.loadNew( event.target.title );
|
|
event.preventDefault();
|
|
};
|
|
|
|
} )( jQuery, mediaWiki, mediaWiki.mobileFrontend );
|