Add Extra Tabs to Google Docs/Slides

Add extra tabs for Drawing and Erase by Lines to Google Docs and Slides

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         Add Extra Tabs to Google Docs/Slides
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Add extra tabs for Drawing and Erase by Lines to Google Docs and Slides
// @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 addCustomTabs() {
        // Wait for the Google Docs/Slides page to fully load
        const interval = setInterval(() => {
            // Select the toolbar or relevant section where you want to add the tabs
            const toolbar = document.querySelector('.kix-appview-editor');

            if (toolbar) {
                // Clear the interval once the toolbar is found
                clearInterval(interval);

                // Create a container for the new tabs
                const customTabsContainer = document.createElement('div');
                customTabsContainer.className = 'custom-tabs-container';

                // Create the "Drawing" tab
                const drawingTab = document.createElement('div');
                drawingTab.className = 'custom-tab';
                drawingTab.textContent = 'Drawing';
                drawingTab.style.cursor = 'pointer';
                drawingTab.onclick = function() {
                    alert('Drawing tab clicked! Implement drawing functionality here.');
                };

                // Create the "Erase by Lines" tab
                const eraseTab = document.createElement('div');
                eraseTab.className = 'custom-tab';
                eraseTab.textContent = 'Erase by Lines';
                eraseTab.style.cursor = 'pointer';
                eraseTab.onclick = function() {
                    alert('Erase by Lines tab clicked! Implement erasing functionality here.');
                };

                // Append the new tabs to the container
                customTabsContainer.appendChild(drawingTab);
                customTabsContainer.appendChild(eraseTab);

                // Append the container to the toolbar
                toolbar.appendChild(customTabsContainer);

                // Add basic styling for the custom tabs
                const style = document.createElement('style');
                style.textContent = `
                    .custom-tabs-container {
                        display: flex;
                        gap: 10px;
                        padding: 10px;
                        background-color: #f1f1f1;
                    }
                    .custom-tab {
                        padding: 5px 10px;
                        background-color: #ddd;
                        border: 1px solid #ccc;
                        border-radius: 4px;
                    }
                    .custom-tab:hover {
                        background-color: #bbb;
                    }
                `;
                document.head.appendChild(style);
            }
        }, 1000); // Check every second
    }

    // Add custom tabs when the page loads
    window.addEventListener('load', addCustomTabs);
})();