MediaWiki:Gadget-MobileDownloadLink.js

Văn thư lưu trữ mở Wikisource

Cache: Sau khi lưu biểu mẫu này, phải xóa bộ nhớ đệm (cache) của trình duyệt để những thay đổi hiện ra:

Firefox, Chrome, Safari, Opera — Shift­Reload / Tải lại       Internet Explorer — Ctrl­Refresh / Làm tươi       Konqueror — Reload / Tải lại

Nếu bạn viết mã JavaScript, chú ý đọc hướng dẫn để tránh mâu thuẫn với mã mặc định của mạng.

/*
 * Nút tải sách cho giao diện di động 
 *
 * Nhập từ [[MediaWiki:Mobile.js]]
 */
 
(function(mw, $) {

  $(function() {

    //link "download as ePub in the toolbar
    if([""].indexOf(mw.config.get('wgCanonicalNamespace')) !== -1 ) {
      $( '#page-actions' ).append(
        $( '<li>' ).attr( {
          id: 'page-actions-export-epub',
          class: 'page-actions-menu__list-item',
        } ).append(
          $( '<a>' ).attr( {
            id: 'ca-export-epub',
            class: 'export-epub mw-ui-icon mw-ui-icon-element',
            href: '//tools.wmflabs.org/wsexport/tool/book.php?lang=vi&format=epub&page=' + mw.config.get( 'wgPageName' ),
            title: 'Tải bản EPUB của trang này'
          } ).append("Tải EPUB")
        )
      );
    }
  });

} (mediaWiki, jQuery));