bcrawlink

Provides links to the raw media files for previews on bandcamp to get around preview listen limits. Also allows you to easily download the previews. >:)

目前為 2016-08-12 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        bcrawlink
// @description Provides links to the raw media files for previews on bandcamp to get around preview listen limits.  Also allows you to easily download the previews.  >:)
// @license     MIT License
// @namespace   com.bandcamp.benburrill.evil
// @include     *
// @version     1
// @grant       none
// ==/UserScript==

// BTW, we run this on all sites because some bandcamp pages are not actually on bandcamp.org

$(document).ready(function() {
    window.TralbumData && TralbumData.trackinfo.forEach(function(track, index) {
        // I've only seen the mp3 type, but if there happen to be more, we want to
        // make links for all of them.
        track.file && Object.keys(track.file).forEach(function(media_type) {
            var cls = `raw-link-${media_type}`;
            var base = `(tr,div)[rel="tracknum=${index+1}"]`;
            var pref_child = "td.title-col";

            // If possible, use the child pref_child instead of base.
            if ($(base).has(pref_child).length) base += `>${pref_child}`;

            $(`${base}:not(:has(a.${cls}))`).each(function() {
                $(this).append(
                    `<a class="${cls}" href="${track.file[media_type]}" target="_blank">
                        ${media_type}
                    </a>`
                );
            });
        });
    });
});