ਮੀਡੀਆਵਿਕੀ:Gadget-WSexport.js

ਵਿਕੀਸਰੋਤ ਤੋਂ

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
/**
 * Adds a "Download as EPUB" link to the sidebar
 *
 * Generates and starts a download of the current page as an EPUB file.
 * Subpages of the current page (if any) are included as well.
 *
 * Uses the WSExport tool on Wikimedia Labs:
 * http://wsexport.wmflabs.org/tool/book.php
 *
 * See Oldwikisource:Wikisource:WSexport for more information
 * Bug reports should go to fr:Wikisource:Wsexport
 * Tool source code at https://github.com/wsexport
 */
/*global mw, $ */
if ( ($.inArray( mw.config.get( 'wgCanonicalNamespace' ), [ "" , "Translation" ] ) !== -1)
		|| mw.config.get( "wgTitle" ).includes( "Sandbox" ) ) {
	$( function () {
		mw.util.addPortletLink(
			'p-coll-print_export',
			'//wsexport.wmflabs.org/book.php?' + $.param( {
				lang: 'pa',
				format: 'epub-3',
				page: mw.config.get( 'wgPageName' )
			} ),
			'Download as EPUB',
			'n-epubExport',
			'Download an EPUB version of this page',
			'',
			'#t-print'
		);
		mw.util.addPortletLink(
			'p-coll-print_export',
			'//wsexport.wmflabs.org/book.php?' + $.param( {
				lang: 'pa',
				format: 'mobi',
				page: mw.config.get( 'wgPageName' )
			} ),
			'Download as MOBI',
			'n-mobiExport',
			'Download a MOBI version of this page',
			'',
			'#t-print'
		);
		mw.util.addPortletLink(
			'p-coll-print_export',
			'//wsexport.wmflabs.org/book.php?' + $.param( {
				lang: 'pa',
				format: 'pdf-a4',
				page: mw.config.get( 'wgPageName' )
			} ),
			'Download as PDF (beta)',
			'n-pdfExport',
			'Download a PDF version of this page with the beta PDF exporter',
			'',
			'#t-print'
		);
		mw.util.addPortletLink(
			'p-coll-print_export',
			'//wsexport.wmflabs.org/book.php',
			'Choose format',
			'n-toolExport',
			'Download a version of a work in other formats',
			'',
			'#t-print'
		);
	} );
}