// ==UserScript== // @name Adobe Fonts Downloader // @description Adds a download button to Adobe Fonts. // @icon https://badnoise.net/TypeRip/favicon.png // @version 1.0 // @author afkarxyz // @namespace https://github.com/afkarxyz/misc-scripts/ // @supportURL https://github.com/afkarxyz/misc-scripts/issues // @license MIT // @match https://fonts.adobe.com/* // @match https://badnoise.net/TypeRip/* // @grant GM_setValue // @grant GM_getValue // @grant window.close // @run-at document-end // @downloadURL none // ==/UserScript== (function() { 'use strict'; if (window.location.hostname === 'badnoise.net') { const adobeUrl = GM_getValue('adobeFontUrl', ''); if (adobeUrl) { GM_setValue('adobeFontUrl', ''); setTimeout(() => { const urlInput = document.getElementById('url_input'); const submitButton = document.getElementById('url_submit_button'); if (urlInput && submitButton) { urlInput.value = adobeUrl; urlInput.dispatchEvent(new Event('input', { bubbles: true })); submitButton.click(); } }, 1000); } return; } function createDownloadButton() { let container = document.querySelector('.adobe-fonts-family__top-actions-add-family'); if (!container) { const topActions = document.querySelector('.adobe-fonts-family__top-actions'); if (!topActions) { console.error('Top actions container not found'); return; } container = document.createElement('div'); container.className = 'adobe-fonts-family__top-actions-add-family'; topActions.appendChild(container); } else { container.innerHTML = ''; } container.classList.remove('ng-hide'); const button = document.createElement('button'); button.className = 'spectrum-Button spectrum-Button--primary add-family-button add-outline-button ng-scope'; const iconSpan = document.createElement('span'); iconSpan.className = 'spectrum-Icon creative-cloud-icon'; iconSpan.innerHTML = ` `; const labelSpan = document.createElement('span'); labelSpan.className = 'spectrum-Button-label add-family-label'; labelSpan.textContent = 'Download'; button.appendChild(iconSpan); button.appendChild(labelSpan); button.addEventListener('click', function(e) { e.preventDefault(); GM_setValue('adobeFontUrl', window.location.href); window.open('https://badnoise.net/TypeRip/', '_blank'); }); container.appendChild(button); return button; } function init() { const existingButtons = document.querySelectorAll('.adobe-fonts-family__top-actions-add-family button'); existingButtons.forEach(button => button.remove()); createDownloadButton(); } init(); let lastUrl = location.href; new MutationObserver(() => { const url = location.href; if (url !== lastUrl) { lastUrl = url; init(); } }).observe(document, {subtree: true, childList: true}); })();