天眼看小说下载按钮

add download link to a novel website

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         天眼看小说下载按钮
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  add download link to a novel website
// @author       niuhe
// @match        https://novel.zhwenpg.com/b.php?id*
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    var book_name = document.querySelector("#idmaintablist > table:nth-child(3) > tbody > tr:nth-child(1) > td > h2").textContent
    var author = document.querySelector("#idmaintablist > table:nth-child(3) > tbody > tr:nth-child(1) > td > a > font").textContent
    var url_base = "javascript:window.location.href='https://github.com/zhb0318/tianyan_novel/raw/master/novel/"
    'use strict';
    var download_loc = url_base + book_name + "%2B" + author + ".txt'"
    var button = document.createElement("a"); //创建一个input对象(提示框按钮)
    button.setAttribute("href", download_loc);
    button.text ="TXT下载(单击预览后,右键另存为)"
    button.setAttribute("target","view_window")
    var x = document.getElementsByClassName("cbooksingle")[2];
    x.appendChild(button);
})();