Add Extra Fonts to Google Docs/Slides

Add extra fonts to the Google Docs and Google Slides font dropdown menus

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

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

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name         Add Extra Fonts to Google Docs/Slides
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Add extra fonts to the Google Docs and Google Slides font dropdown menus
// @match        https://docs.google.com/document/d/*
// @match        https://docs.google.com/presentation/d/*
// @grant        none
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';

    function addFontsToDropdown() {
        // Wait for the Google Docs/Slides page to fully load
        const interval = setInterval(() => {
            // Select the font dropdown element
            const fontDropdown = document.querySelector('.quantumWizMenuPaperselectPopup');
            
            if (fontDropdown) {
                // Clear the interval once the dropdown is found
                clearInterval(interval);
                
                // Define the extra fonts to add
                const extraFonts = ['Comic Sans MS', 'Arial Black', 'Courier New'];
                
                // Add the extra fonts to the dropdown
                extraFonts.forEach(font => {
                    const fontOption = document.createElement('div');
                    fontOption.className = 'quantumWizMenuPaperselectOption';
                    fontOption.textContent = font;
                    fontDropdown.appendChild(fontOption);
                });

                // Optionally, you can also add event listeners to handle font selection
                // Example:
                // fontDropdown.addEventListener('click', function(event) {
                //     if (event.target && event.target.className.includes('quantumWizMenuPaperselectOption')) {
                //         const selectedFont = event.target.textContent;
                //         // Apply the selected font to the document
                //     }
                // });
            }
        }, 1000); // Check every second
    }

    // Add extra fonts to the dropdown when the page loads
    window.addEventListener('load', addFontsToDropdown);
})();