mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-12-11 07:16:08 +00:00
39 lines
793 B
JavaScript
39 lines
793 B
JavaScript
|
/**
|
||
|
* @module gateway/reference
|
||
|
*/
|
||
|
|
||
|
const mw = mediaWiki,
|
||
|
$ = jQuery;
|
||
|
|
||
|
import { previewTypes } from '../preview/model';
|
||
|
|
||
|
/**
|
||
|
* @return {Gateway}
|
||
|
*/
|
||
|
export default function createReferenceGateway() {
|
||
|
/**
|
||
|
* @param {mw.Title} title
|
||
|
* @returns {AbortPromise<PreviewModel>}
|
||
|
*/
|
||
|
function getPageSummary( title ) {
|
||
|
const id = title.getFragment();
|
||
|
|
||
|
return $.Deferred().resolve( {
|
||
|
title: mw.message( 'popups-refpreview-footnote' ).text(),
|
||
|
url: `#${id}`,
|
||
|
// TODO: Can probably be removed
|
||
|
// languageCode: 'en',
|
||
|
// languageDirection: 'ltr',
|
||
|
extract: $( `#${id} .reference-text` ).html(),
|
||
|
type: previewTypes.TYPE_REFERENCE
|
||
|
// TODO: Can probably be removed
|
||
|
// thumbnail: '',
|
||
|
// pageId: '0'
|
||
|
} ).promise( { abort() {} } );
|
||
|
}
|
||
|
|
||
|
return {
|
||
|
getPageSummary
|
||
|
};
|
||
|
}
|