Amazon Cloud Player unchain download button

Will unchain download buttons in Amazon Cloud Player so that you can download multiple songs on Linux and other platforms without Amazon Downloader. The resulting files can be opened with clamz or pymazon.

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

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

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name        Amazon Cloud Player unchain download button
// @namespace   http://sebastian.gellweiler.net
// @version     2.0.1
// @grant       none
//
//
// @include https://www.amazon.*/gp/dmusic/cloudplayer*
// @include http://www.amazon.*/gp/dmusic/cloudplayer*
//
// @description Will unchain download buttons in Amazon Cloud Player so that you can download multiple songs on Linux and other platforms without Amazon Downloader. The resulting files can be opened with clamz or pymazon.
// ==/UserScript==
(function () {
    
    // Hide annoying cloud player advertisments on windows
    // and hide download button.
    jQuery(document).ready(function () {
jQuery('<style type="text/css">' +
    '#messageBanner, #cloudPlayerOverlay, .download' + "\n" +
    '{display: none !important; }' + "\n" +
'</style>').appendTo("head");
    });
    
    function bypassDownloader() {
        // Remove annoying popups and overlay.
        setTimeout(function() {
           jQuery('.ap_popover').hide();
           jQuery('#ap_overlay').hide();
        }, 200);

        // Submit download form.
        jQuery('#downloader').submit();       
    }

    /**
     * Replace old download links with new ones.
     */
    function downloadLinks() {
        // Try to replace download button in toolbar.
        // Ignore buttons that have been already replaced.
        var db = jQuery('.download:not(".replacedByNew")');
        db
        .addClass('replacedByNew')
        .after(
            jQuery('<span>', {                    
                text: db.text(),
                class: 'decoration buttonCenter',
                
                click: function () {
                    // Click on the old download button
                    // to submit the download form.
                    db.click();
                    // Only workaround amazon downloader if multiple songs are selected.
                    if (jQuery('input[itemtype=song]:checked').length > 1) {
                        bypassDownloader();
                    }
                }
            })
        );
        
        // Skip stupid installing cloud player advertisment on windows
        // when downloading single tracks.
        jQuery('.skipInstall').click();
        
        // Hide download album links because they do not work.
        jQuery('[href^="#download\/album"]').hide();
    }

    // @require http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js
    jQuery.noConflict();

    // Constantly check if downloads links are replaced on the pages.
    setInterval(function () {
        downloadLinks();
    }, 1000);
}());