SampleFocus Downloader

Download unlimited samples from SampleFocus

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         SampleFocus Downloader
// @namespace    http://tampermonkey.net/
// @version      0.1.1
// @description  Download unlimited samples from SampleFocus
// @author       JJTV
// @match        https://samplefocus.com/**
// @icon         https://i.imgur.com/WedmtXe.png
// ==/UserScript==

function removeAllClickEventListeners(elementId) {
    var oldElement = document.getElementById(elementId);
    var newElement = oldElement.cloneNode(true);

    var div = document.createElement('a');
    div.href=oldElement.href;
    div.innerText = "DL";
    div.target = '_blank';

    oldElement.parentNode.replaceChild(div, oldElement);
}

(function() {
    'use strict';

    document.onscroll = () => {
        const sample_cards = [...document.getElementsByClassName("sample-card")];
        sample_cards.forEach((card, idx) => {
            const card_url = card.getElementsByTagName("audio")[0].src
            const download_btn = card.getElementsByClassName("download-sample-link")[0]
            if (!download_btn){
                return;
            }
            download_btn.href = card_url
            download_btn.style.backgroundColor = "green";
            download_btn.id = "ses" + idx;
            removeAllClickEventListeners("ses"+idx);
            console.log("Edited DL Link");
        })
    }
})();