Samplefocus Downloader

Replaces the original download button to a one that redirects to the mp3 file page.

Stan na 06-03-2025. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name        Samplefocus Downloader
// @namespace   http://tampermonkey.net/
// @version     1.0
// @description Replaces the original download button to a one that redirects to the mp3 file page.
// @author      ToxicBiohazard
// @match       *://*.samplefocus.com/*
// @grant       none
// @license MIT
// ==/UserScript==

(function() {
  'use strict';

  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;

  const downloadSample = () => {
    if (confirm('Download the audio sample?')) {
      const link = document.createElement('a');
      link.href = audioSrc;
      link.download = 'extracted-audio.mp3';
      document.body.appendChild(link);
      link.click();
      document.body.removeChild(link);
    }
  };

  const downloadButton = document.createElement('button');
  downloadButton.classList.add('btn-large', 'waves-effect', 'waves-light');
  downloadButton.textContent = 'Download Sample';
  downloadButton.addEventListener('click', downloadSample);

  originalLink.parentNode.replaceChild(downloadButton, originalLink);
})();