Force Aptos Font with Whitelist

Forces websites to use the Aptos font family, with a customizable whitelist of sites to exclude.

当前为 2025-06-17 提交的版本,查看 最新版本

作者
Hiyun1137
评分
0 0 0
版本
1.2
创建于
2025-06-17
更新于
2025-06-17
大小
7.1 KB
许可证
MIT
适用于
所有网站

Force Aptos Font with Whitelist

This Userscript changes the font on all websites to the Aptos font family. It includes a customizable whitelist feature, allowing you to exclude specific websites from this font change.

Key Features:

  • Aptos Font Everywhere: Applies a comprehensive Aptos font stack (including Aptos, Aptos Display, Aptos Narrow, Aptos Serif, Aptos Mono, and common fallbacks) to all elements on a page.
  • Customizable Whitelist:
    • Easily add or remove websites from the whitelist using Userscript menu commands.
    • Manually view and edit the entire list of whitelisted hostnames.
    • Whitelisted sites will retain their original fonts.
  • Persistent Storage: Your whitelist preferences are saved across browser sessions.
  • Early Application: Styles are applied at document-start to minimize Flash of Unstyled Content (FOUC).

Prerequisites:

  • Aptos Font Family Installed: You must have the Aptos fonts installed on your operating system for this script to work as intended. If Aptos is not found, your browser will use the next available font in the specified stack (e.g., Segoe UI, Tahoma, sans-serif).
    • Aptos was introduced as the default font in Microsoft Office and is rolling out to Windows. You may need to acquire it or ensure your system is updated.
  • Userscript Manager: A Userscript manager extension like Violentmonkey, Tampermonkey, or Greasemonkey is required. This script is tested primarily with Violentmonkey.

Installation:

  1. Ensure you have a Userscript Manager installed in your browser.
  2. Click the "Install this script" button on this Greasy Fork镜像 page.
  3. Your Userscript Manager will prompt you to confirm the installation.

How to Use:

Automatic Font Forcing: Once installed, the script automatically applies the Aptos font to all websites you visit, unless the site is on your whitelist.

Managing the Whitelist: You can manage the whitelist through the Userscript commands found in your Userscript Manager's menu (usually accessible by clicking the extension's icon in your browser toolbar):

  1. To Add the Current Site to the Whitelist:

    • Navigate to the website you want to exclude from the font change.
    • Open the Userscript commands menu.
    • Select [Force Aptos Font] Whitelist: Add current site (example.com).
    • You'll be prompted to confirm or edit the hostname to add. You can add the specific subdomain (e.g., sub.example.com) or the base domain (e.g., example.com). Adding a base domain will also whitelist all its subdomains.
    • Reload the page for the change to take effect.
  2. To Remove a Site from the Whitelist:

    • Open the Userscript commands menu (can be done from any page).
    • Select [Force Aptos Font] Whitelist: Remove from whitelist....
    • You'll be prompted to enter the hostname you wish to remove. It will suggest the current site's hostname if applicable.
    • Reload any affected pages for the change to take effect.
  3. To View/Edit the Entire Whitelist:

    • Open the Userscript commands menu.
    • Select [Force Aptos Font] Whitelist: View/Edit All.
    • A prompt will appear showing all whitelisted hostnames, comma-separated.
    • You can edit this list directly. Make sure hostnames are valid and separated by commas.
    • Click "OK" to save changes.
    • Reload any affected pages for changes to take effect.

Font Stack Used:

The script attempts to apply fonts in the following order: "Aptos", "Aptos Display", "Aptos Narrow", "Aptos Serif", "Aptos Mono", "Segoe UI Variable Text", "Segoe UI Variable Display", "Segoe UI Variable Small", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif

Notes:

  • CSS Specificity: The script uses !important to override existing website styles. On very complex sites, there might still be elements that resist the change, or unintended layout shifts, though this is rare for font changes.
  • * Selector: The script applies the font to all elements (*). A commented-out, more specific list of selectors is available in the code if you experience issues.
  • If you find a site where the font isn't applying correctly even when not whitelisted, or if it causes issues, please consider reporting it.

License:

This script is released under the MIT License. You are free to use, modify, and distribute it as per the license terms.


Remember to replace "Your Name/AI (Update with your actual name/handle)" in the @author field with your actual Greasy Fork镜像 username or preferred name.

This should give you a solid listing on Greasy Fork镜像!

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址