mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-15 03:34:03 +00:00
Merge "Use exchars instead of exsentences for the extract"
This commit is contained in:
commit
269ad09c27
|
@ -8,6 +8,12 @@
|
|||
var article = {},
|
||||
$window = $( window );
|
||||
|
||||
/**
|
||||
* Number of chars to request for the article extract
|
||||
* @property CHARS
|
||||
*/
|
||||
article.CHARS = 525;
|
||||
|
||||
/**
|
||||
* Size constants for popup images
|
||||
* @property SIZES
|
||||
|
@ -55,7 +61,7 @@
|
|||
formatversion: 2,
|
||||
redirects: true,
|
||||
exintro: true,
|
||||
exsentences: 5,
|
||||
exchars: article.CHARS,
|
||||
// there is an added geometric limit on .mwe-popups-extract
|
||||
// so that text does not overflow from the card
|
||||
explaintext: true,
|
||||
|
@ -100,6 +106,8 @@
|
|||
return;
|
||||
}
|
||||
|
||||
re.query.pages[ 0 ].extract = removeEllipsis( re.query.pages[ 0 ].extract );
|
||||
|
||||
mw.popups.render.cache[ href ] = {};
|
||||
mw.popups.render.cache[ href ].popup = article.createPopup( re.query.pages[ 0 ], href );
|
||||
mw.popups.render.cache[ href ].getOffset = article.getOffset;
|
||||
|
@ -667,4 +675,11 @@
|
|||
*/
|
||||
mw.popups.render.getClosestYPosition = getClosestYPosition;
|
||||
|
||||
/**
|
||||
* Remove ellipsis if exists at the end
|
||||
*/
|
||||
function removeEllipsis( text ) {
|
||||
return text.replace( /\.\.\.$/, '' );
|
||||
}
|
||||
|
||||
} )( jQuery, mediaWiki );
|
||||
|
|
Loading…
Reference in a new issue