SampleFocus mp3-dl

Download any sample from samplefocus (only mp3)

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        SampleFocus mp3-dl
// @namespace   Violentmonkey Scripts
// @match       https://samplefocus.com/samples/*
// @grant       GM_download
// @version     1.0.1
// @author      https://github.com/fa7ad
// @description Download any sample from samplefocus (only mp3)
// @license     GPL3+
// ==/UserScript==
$(function() {
  let properbtn = $('.download-link')
  let parent = properbtn.parent()
  let newbtn = properbtn.clone()
  let audsrc = $('.sample-hero-waveform-container audio').attr('src')
  newbtn.addClass("materialize-red").removeClass("download-link")
  newbtn
    .attr('href', audsrc)
    .attr('download', audsrc.split('/').at(-1).split('?').at(0))
    .attr('target', '_blank')

  $.map(newbtn.data(), function(v, k) {
    newbtn.removeAttr(`data-${k}`)
  })

  newbtn.on("click", function(e) {
    e.preventDefault()
    GM_download({
      name: newbtn.attr('download'),
      url: audsrc
    })
  })

  parent.css('display', 'flex').css('gap', '3px').append(newbtn)
})