MediaFire Batch Downloader

Batch download files from a MediaFire folder

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         MediaFire Batch Downloader
// @namespace    http://tampermonkey.net/
// @include     http://www.mediafire.com/folder/*
// @include     https://www.mediafire.com/folder/*
// @include     http://www.mediafire.com/file/*
// @include     https://www.mediafire.com/file/*
// @version      0.1
// @description  Batch download files from a MediaFire folder
// @author       ShadowLin
// @license      GNU GPL v3
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function startDownload() {
        var listItems = document.querySelectorAll('#main_list > li');
        for (var i = 0; i < listItems.length; i++) {
            var link = listItems[i].querySelector('a');
            if (link) {
                window.open(link.href, '_blank');
            }
        }
    }

    var upgradeButtonFrame = document.querySelector('.upgrade_button_frame');
    if (upgradeButtonFrame) {
        var button = document.createElement('button');
        button.textContent = 'DOWNLOAD ALL';
        button.classList.add('Btn', 'Btn--greenUpgrade');
        button.style.backgroundColor = '#33CC66';
        button.style.color = '#222835';
        button.addEventListener('click', startDownload);
        upgradeButtonFrame.parentNode.replaceChild(button, upgradeButtonFrame);
    }
})();

(function() {
    'use strict';

    var input = document.querySelector('.download_link .input');
    if (input) {
        var dl = input.getAttribute('href');
        console.log(dl);
        location.replace(dl);

        var set = setInterval(closeWindows, 1000 * 5);

        function closeWindows() {
            window.close();
            clearInterval(set);
        }
    } else {
        console.error('Could not find download link');
    }
})();