您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Replaces the original download button with one that directly downloads the mp3 file using a server-side proxy. Adds download notification and customizable filename. Compatible with Chromium, Firefox, and WebKit.
当前为
// ==UserScript== // @name Samplefocus Downloader // @name:fr Téléchargeur Samplefocus // @name:de Samplefocus-Downloader // @namespace http://tampermonkey.net/ // @version 2.0 // @description Replaces the original download button with one that directly downloads the mp3 file using a server-side proxy. Adds download notification and customizable filename. Compatible with Chromium, Firefox, and WebKit. // @description:fr Remplace le bouton de téléchargement d'origine par un bouton qui télécharge directement le fichier MP3 via un proxy serveur. Ajoute une notification de téléchargement et un nom de fichier personnalisable. // @description:de Ersetzt die ursprüngliche Download-Schaltfläche durch eine Schaltfläche, die die MP3-Datei über einen Proxy-Server direkt herunterlädt. Fügt eine Download-Benachrichtigung und einen anpassbaren Dateinamen hinzu. // @author ToxicBiohazard // @match *://*.samplefocus.com/* // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; console.log('Samplefocus Downloader script started.'); // Check if the script has already been executed if (document.getElementById('samplefocus-downloader-script')) { console.log('Script already executed. Exiting.'); return; } // Add an element to mark the script execution const scriptMarker = document.createElement('div'); scriptMarker.id = 'samplefocus-downloader-script'; document.body.appendChild(scriptMarker); const originalLink = document.querySelector('.download-link'); if (!originalLink) { console.warn('Original download link not found.'); return; } const audioElement = document.querySelector('audio'); if (!audioElement || !audioElement.src) { console.error('No audio element found or no source loaded.'); return; } const audioSrc = audioElement.src; console.log('Audio source:', audioSrc); const downloadSample = () => { const fileName = prompt('Enter the filename for the downloaded audio:', 'extracted-audio.mp3'); if (fileName) { const link = document.createElement('a'); link.href = `http://localhost:3000/download?url=${encodeURIComponent(audioSrc)}`; // Pass the audio URL as a query parameter link.download = fileName; document.body.appendChild(link); link.click(); document.body.removeChild(link); console.log('Download initiated.'); alert('Download started!'); } }; const downloadButton = document.createElement('button'); downloadButton.classList.add('btn-large', 'waves-effect', 'waves-light', 'samplefocus-download-btn'); downloadButton.textContent = 'Download Sample'; downloadButton.addEventListener('click', downloadSample); // Add styles for the button const style = document.createElement('style'); style.textContent = ` .samplefocus-download-btn { background-color: #4CAF50; color: white; padding: 15px 32px; text-align: center; font-size: 16px; margin: 4px 2px; cursor: pointer; border: none; border-radius: 4px; } .samplefocus-download-btn:hover { background-color: #45a049; } `; document.head.appendChild(style); originalLink.parentNode.replaceChild(downloadButton, originalLink); console.log('Download button added.'); })();