Google Slides - Move Floating Toolbar to Top

Move the right floating toolbar in Google Slides back to the top, next to the main toolbar

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Google Slides - Move Floating Toolbar to Top
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Move the right floating toolbar in Google Slides back to the top, next to the main toolbar
// @author       You
// @match        https://docs.google.com/presentation/*
// @icon         https://ssl.gstatic.com/docs/presentations/images/favicon5.ico
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    function moveToolbarToTop() {
        const checkInterval = setInterval(() => {
            // Select the vertical floating toolbar by its unique structure
            const verticalToolbar = document.querySelector('[aria-label][role="toolbar"][jscontroller]');
            const topToolbarContainer = document.querySelector('.punch-top-toolbar'); // Main top toolbar

            if (verticalToolbar && topToolbarContainer && !verticalToolbar.dataset.moved) {
                // Mark as moved to avoid re-moving
                verticalToolbar.dataset.moved = 'true';

                // Reset styling
                verticalToolbar.style.position = 'static';
                verticalToolbar.style.top = 'unset';
                verticalToolbar.style.left = 'unset';
                verticalToolbar.style.right = 'unset';
                verticalToolbar.style.bottom = 'unset';
                verticalToolbar.style.marginLeft = '20px';
                verticalToolbar.style.display = 'flex';
                verticalToolbar.style.flexDirection = 'row';
                verticalToolbar.style.alignItems = 'center';
                verticalToolbar.style.gap = '10px';
                verticalToolbar.style.background = 'transparent';
                verticalToolbar.style.boxShadow = 'none';

                // Move to top toolbar area
                topToolbarContainer.appendChild(verticalToolbar);

                clearInterval(checkInterval);
            }
        }, 1000);
    }

    window.addEventListener('load', moveToolbarToTop);
})();