EasierSendToKindle

automatically download epub (or any) file and open email client

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         EasierSendToKindle
// @version      1.1
// @description  automatically download epub (or any) file and open email client
// @author       daydreamorama
// @include      /https?://archiveofourown\.org/.*works/\d+/
// @grant        none
// @namespace https://greasyfork.org/en/users/36620
// ==/UserScript==



(function () {
    // Change this to your email address that is your kindle
    var email = '[email protected]'

    // if you prefer other extensions change this. (such as 'mobi')
    var ext = 'epub'


    var chapter = document.getElementById('chapters');
    var btn = $('<input class="button" type="button" value="' + ext + '"></input> ');

    //const btn = document.createElement('button')
    //btn.innerText = ext

    var header_menu = $('ul.work.navigation.actions');
    header_menu.find('li.download').append(btn);

    const titleLink = document.querySelector('h2.title.heading');
    var title = titleLink.textContent.trim();
    var workId = (window.location.pathname.match(/\/works\/(\d+)\b/) || [])[1];
    var link = `https://archiveofourown.org/downloads/${workId}/${encodeURIComponent(title)}.${ext}?updated_at=${Date.now()}`

    // ideally we'd just take the link but lets hope your title doesn't have things like ? in it ...
//    btn.innerText = link
    btn.click(function() {
        window.open(link)
        window.open('mailto:' + email + '?subject=empty&body=empty')
    });
})();