Page MenuHomePhabricator
Authored By
Jdlrobson
May 24 2017, 5:59 PM
Size
2 KB
Referenced Files
None
Subscribers
None
diff --git a/extension.json b/extension.json
index 470e9f4..3532abf 100644
--- a/extension.json
+++ b/extension.json
@@ -118,6 +118,8 @@
}
},
"config": {
+ "@RelatedArticlesLimit": "Maximum number of articles that should be shown in RelatedArticles widget. When set to false no upper limit",
+ "RelatedArticlesLimit": 3,
"RelatedArticlesShowInSidebar": true,
"RelatedArticlesShowInFooter": false,
"RelatedArticlesUseCirrusSearch": false,
diff --git a/includes/FooterHooks.php b/includes/FooterHooks.php
index 61ac275..097989c 100644
--- a/includes/FooterHooks.php
+++ b/includes/FooterHooks.php
@@ -28,6 +28,7 @@ class FooterHooks {
->makeConfig( 'RelatedArticles' );
$vars['wgRelatedArticles'] = $out->getProperty( 'RelatedArticles' );
+ $vars['wgRelatedArticlesLimit'] = $config->get( 'RelatedArticlesLimit' );
$vars['wgRelatedArticlesUseCirrusSearch'] = $config->get( 'RelatedArticlesUseCirrusSearch' );
$vars['wgRelatedArticlesOnlyUseCirrusSearch'] =
$config->get( 'RelatedArticlesOnlyUseCirrusSearch' );
diff --git a/resources/ext.relatedArticles.readMore.bootstrap/index.js b/resources/ext.relatedArticles.readMore.bootstrap/index.js
index 2dfb200..bbdea60 100644
--- a/resources/ext.relatedArticles.readMore.bootstrap/index.js
+++ b/resources/ext.relatedArticles.readMore.bootstrap/index.js
@@ -7,7 +7,7 @@
mw.config.get( 'wgRelatedArticlesUseCirrusSearch' ),
mw.config.get( 'wgRelatedArticlesOnlyUseCirrusSearch' )
),
- LIMIT = 3,
+ LIMIT = mw.config.get( 'wgRelatedArticlesLimit' ),
debouncedLoad = $.debounce( 100, function () {
loadRelatedArticles(); // eslint-disable-line
} ),
diff --git a/resources/ext.relatedArticles.readMore.gateway/RelatedPagesGateway.js b/resources/ext.relatedArticles.readMore.gateway/RelatedPagesGateway.js
index 2645074..1a90066 100644
--- a/resources/ext.relatedArticles.readMore.gateway/RelatedPagesGateway.js
+++ b/resources/ext.relatedArticles.readMore.gateway/RelatedPagesGateway.js
@@ -59,7 +59,7 @@
* * The Wikidata description, if any
*
* @method
- * @param {number} limit of pages to get
+ * @param {number} [limit] of pages to get
* @return {jQuery.Promise}
*/
RelatedPagesGateway.prototype.getForCurrentPage = function ( limit ) {
@@ -71,7 +71,11 @@
pithumbsize: 160, // FIXME: Revert to 80 once pithumbmode is implemented
wbptterms: 'description'
},
- relatedPages = ( this.editorCuratedPages ).slice( 0, limit );
+ relatedPages = this.editorCuratedPages;
+
+ if ( limit ) {
+ relatedPages = relatedPages.slice( 0, limit );
+ }
if ( relatedPages.length ) {
parameters.pilimit = relatedPages.length;

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4667427
Default Alt Text
p.patch (2 KB)

Event Timeline