您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Added download button for audio book
// ==UserScript== // @name Books download // @namespace http://tampermonkey.net/ // @version 2024-05-28 // @description Added download button for audio book // @author Dead4W // @match https://knigavuhe.info/* // @license MIT // @grant none // ==/UserScript== (function() { 'use strict'; const downloadButton = document.createElement("a"); downloadButton.innerText = "Download mp3" downloadButton.style = "color: black;cursor: pointer; margin: 3px; display: block"; function init() { const videoElem = document.querySelector("#player video"); if (!videoElem) { setTimeout(init, 100); return; } downloadButton.onclick = () => {downloadUrl(videoElem.src)}; document.querySelector("#oframeplayer").appendChild(downloadButton); } function downloadUrl(url) { const options = { headers: { Referer: location.origin, } }; downloadButton.style = "color: black;cursor: progress; margin: 3px; display: block"; fetch(url, options) .then( res => res.blob() ) .then( blob => { var file = window.URL.createObjectURL(blob); window.open(file, '_blank'); downloadButton.style = "color: black;cursor: pointer; margin: 3px; display: block"; }); } $(document).ready(function() { init(); }); })();