SampleFocus mp3-dl

Download any sample from samplefocus (only mp3)

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==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)
})