Bandcamp snatcher

Feeling good about this one

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

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

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         Bandcamp snatcher
// @namespace    http://andrewiankidd.co.uk
// @version      0.1
// @description  Feeling good about this one
// @author       You
// @include      https://*.bandcamp.com/album/*
// @include      http://*.bandcamp.com/album/*
// @require http://code.jquery.com/jquery-latest.js
// ==/UserScript==

(function() {
    'use strict';
    console.log('----------starting bandcamp stuff: ');

    var regmatches = $('body').html().toString().match(new RegExp('\"\/\/(.*?)\"', 'g'));

    console.log('----------found ' + (regmatches.length - 1) + ' tracks' );

    i=0;
    $('#track_table > tbody  > tr').each(function() {
        if (i % 1 === 0){
            //alert('track: ' + i);
            $(this).prepend("<td><a download='Track " + i + ".mp3' href='" + regmatches[i].replace(new RegExp('"', 'g'), '') + "' style='display:inline;'><img style='height:16px;' src='http://i.imgur.com/RmhfNoM.png'></a></td>"); 
        }
        i=i+0.5;
    });
})();