Skip to content

Instantly share code, notes, and snippets.

@Gowee
Created August 22, 2019 12:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gowee/ef305826bba17442f9578b6002fa4c34 to your computer and use it in GitHub Desktop.
Save Gowee/ef305826bba17442f9578b6002fa4c34 to your computer and use it in GitHub Desktop.
適用于中文維基文庫的 WSExport 小工具(以 common.js 導入)
// WSExport [[mul:Wikisource:WSexport]]
// > WSexport is a tool for exporting Wikisource's texts in EPUB, PDF and other file formats. It was created by user Tpt for French Wikisource, but it's also available for the other Wikisource subdomains.
// Copied from https://en.wikisource.org/w/load.php?lang=en&modules=ext.gadget.Easy_LST%2CPurgeTab%2CWSexport%2Ccharinsert%2CcollapsibleTables%2CdynamicLayoutOverrides&skin=vector&version=01fx33l
// and modified slightly to adapt to Chinese WikiSource by Gowee@Github.
if ($.inArray(mw.config.get('wgNamespaceNumber'), [0, 114]) !== -1) {
$(function() {
mw.util.addPortletLink('p-electronpdfservice-sidebar-portlet-heading', '//tools.wmflabs.org/wsexport/tool/book.php?' + $.param({
lang: 'zh',
format: 'epub-3',
page: mw.config.get('wgPageName')
}), '下載為 EPUB', 'n-epubExport', '下載此頁面的 EPUB 版本', '', '#t-print');
mw.util.addPortletLink('p-electronpdfservice-sidebar-portlet-heading', '//tools.wmflabs.org/wsexport/tool/book.php?' + $.param({
lang: 'zh',
format: 'mobi',
page: mw.config.get('wgPageName')
}), '下載為 MOBI', 'n-mobiExport', '下載此頁面的 MOBI 版本', '', '#t-print');
mw.util.addPortletLink('p-electronpdfservice-sidebar-portlet-heading', '//tools.wmflabs.org/wsexport/tool/book.php', '選擇格式', 'n-toolExport', '以其它格式下載作品', '', '#t-print');
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment