微软文档快捷助手

Put the action list in Microsoft document to right side

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         微软文档快捷助手
// @namespace    https://bathur.cn/
// @version      0.1
// @description  Put the action list in Microsoft document to right side
// @author       Bathur
// @match        *://docs.microsoft.com/zh-cn/*
// @grant        none

// @create       2020-03-11
// @copyright    2020+, Bathur.cn
// @license      MIT License
// ==/UserScript==

(function() {
    'use strict';
    var rightSide = document.getElementById('affixed-right-container');
    if (typeof(rightSide) != "undefined" && rightSide !=null){
        var actionList = document.getElementsByClassName('action-list has-flex-justify-content-start has-flex-justify-content-end-tablet is-flex is-flex-row has-flex-wrap has-flex-grow is-unstyled')[0];
        var listLenght = actionList.children.length;
    
        var hrDivNode = document.createElement('div');
        hrDivNode.setAttribute('class', 'has-border-bottom has-padding-bottom-small has-margin-bottom-small');
        rightSide.prepend(hrDivNode);
    
        for (let index = listLenght - 2; index >= 0; index--) {
            actionList.children[index].setAttribute('style', 'display: block;');
            rightSide.prepend(actionList.children[index]);
        }
    }

    /*
    document.onkeydown = function(e){
        var keyCode = window.event ? e.keyCode : e.which;
        if(keyCode == 83){
            $("#language-toggle").click();
        }
    }
    */
})();