Greasy Fork is available in English.

网页里面将文本保存成文件并直接下载

网页下载文本

Este script não deve ser instalado diretamente. Este script é uma biblioteca de outros scripts para incluir com o diretório meta // @require https://update.greasyfork.org/scripts/474124/1242495/%E7%BD%91%E9%A1%B5%E9%87%8C%E9%9D%A2%E5%B0%86%E6%96%87%E6%9C%AC%E4%BF%9D%E5%AD%98%E6%88%90%E6%96%87%E4%BB%B6%E5%B9%B6%E7%9B%B4%E6%8E%A5%E4%B8%8B%E8%BD%BD.js

// ==UserScript==
// @name         网页里面将文本保存成文件并直接下载
// @namespace    https://leochan.me
// @version      1.0.3
// @description  网页下载文本
// @author       Leo
// @license      GPLv2
// @match        *://*/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=leochan.me
// @grant        unsafeWindow
// ==/UserScript==

function webPageDownloadTextFile(text, fileName) {
    var blob = new Blob([text], { type: "application/octet-stream" });
    var downloadLink = document.createElement("a");
    downloadLink.href = URL.createObjectURL(blob);
    downloadLink.download = fileName;
    downloadLink.click();

    URL.revokeObjectURL(downloadLink.href);
}