Merge "Use exchars instead of exsentences for the extract"

This commit is contained in:
jenkins-bot 2016-05-26 18:21:24 +00:00 committed by Gerrit Code Review
commit 269ad09c27

View file

@ -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 );