rECDS/6583a5144e01master
rECDS/
6583a5144e01master
/
/
README.md
README.md
Cards Extension
The Cards extension receives a list of articles and outputs standardized (across extensions) cards.
Rationale
We - the Reading Web team found ourselves displaying page titles and their descriptions in multiple extensions (MobileFrontend - watchlist, search results, RelatedArticles - read more, Gather, etc.) and decided to create this extension to ease our development and maintenance of this feature. Currently the Cards extension is used by the RelatedArticles extension, but we plan on making this extension to serve multiple purposes and be useful in different parts of the reading experience.
Installation
Add the following to your LocalSettings.php file: wfLoadExtension( 'Cards' );
How to use
js mw.loader.using( 'ext.cards' ).done( function () { var gateway = new mw.cards.CardsGateway( { api: new mw.Api() } ); // 'Book' and 'Phone' are page titles, 200 is the thumbnail width in pixels gateway.getCards( ['Book', 'Phone'], 200 ).done( function( cards ) { $( '#bodyContent' ).append( cards.$el ); } ); } );
Content licensed under Creative Commons Attribution-ShareAlike (CC BY-SA) 4.0 unless otherwise noted; code licensed under GNU General Public License (GPL) 2.0 or later and other open source licenses. By using this site, you agree to the Terms of Use, Privacy Policy, and Code of Conduct. · Wikimedia Foundation · Privacy Policy · Code of Conduct · Terms of Use · Disclaimer · CC-BY-SA · GPL