您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds a download button to Adobe Fonts.
当前为
// ==UserScript== // @name Adobe Fonts Downloader // @description Adds a download button to Adobe Fonts. // @icon https://badnoise.net/TypeRip/favicon.png // @version 1.1 // @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 // ==/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(); } }, 500); } return; } function modifyAddFamilyButton() { const addFamilyButton = document.querySelector('.adobe-fonts-family__top-actions-add-family button'); if (!addFamilyButton) { return; } const newButton = addFamilyButton.cloneNode(true); addFamilyButton.parentNode.replaceChild(newButton, addFamilyButton); const labelSpan = newButton.querySelector('.spectrum-Button-label'); if (labelSpan) { labelSpan.textContent = 'Download'; } newButton.addEventListener('click', function(e) { e.preventDefault(); e.stopPropagation(); GM_setValue('adobeFontUrl', window.location.href); window.open('https://badnoise.net/TypeRip/', '_blank'); }); } function modifyFontPackButtons() { const fontPackButtons = document.querySelectorAll([ 'button[ng-click*="useModelSyncFontpack"]', '.collection-show__font-pack-actions-bottom button.add-family-button' ].join(',')); fontPackButtons.forEach(button => { if (button.hasAttribute('data-modified')) { return; } const labelSpan = button.querySelector('.spectrum-Button-label'); if (labelSpan) { labelSpan.textContent = 'Download'; } button.removeAttribute('ng-click'); button.removeAttribute('ng-show'); const newButton = button.cloneNode(true); newButton.setAttribute('data-modified', 'true'); button.parentNode.replaceChild(newButton, button); newButton.addEventListener('click', function(e) { e.preventDefault(); e.stopPropagation(); GM_setValue('adobeFontUrl', window.location.href); window.open('https://badnoise.net/TypeRip/', '_blank'); }); }); } function init() { modifyAddFamilyButton(); modifyFontPackButtons(); } init(); const observer = new MutationObserver((mutations) => { for (const mutation of mutations) { const currentUrl = location.href; if (window.lastUrl !== currentUrl) { window.lastUrl = currentUrl; init(); continue; } const addedNodes = Array.from(mutation.addedNodes); const hasNewButton = addedNodes.some(node => node.querySelector && ( node.querySelector('.adobe-fonts-family__top-actions-add-family') || node.querySelector('button[ng-click*="useModelSyncFontpack"]') || node.querySelector('.collection-show__font-pack-actions-bottom') ) ); if (hasNewButton) { init(); break; } } }); window.lastUrl = location.href; observer.observe(document.body, { childList: true, subtree: true }); })();