// ==UserScript==
// @name         rename (Force Download)
// @namespace    http://tampermonkey.net/
// @version      1.0
// @match        *://*/*
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';
    document.querySelectorAll('a[download]').forEach(link => {
        link.addEventListener('click', function(e) {
            e.preventDefault();
            const url = this.getAttribute('href');
            const filename = this.getAttribute('download') || 'download';
            
            //  create url and download
            const hiddenLink = document.createElement('a');
            hiddenLink.href = url;
            hiddenLink.download = filename;
            document.body.appendChild(hiddenLink);
            hiddenLink.click();
            document.body.removeChild(hiddenLink);
        });
    });
})();
