Greasy Fork

Printable Loop

Make Loop Pages printable

当前为 2023-09-01 提交的版本,查看 最新版本

// ==UserScript==
// @name         Printable Loop
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Make Loop Pages printable
// @author       Lars Corneliussen
// @match        https://loop.microsoft.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=microsoft.com
// @grant        none
// @license      Apache 2.0
// ==/UserScript==

(function() {
    'use strict';

    function addGlobalPrintStyle(css) {
        var head, style;
        head = document.getElementsByTagName('head')[0];
        if (!head) { return; }
        style = document.createElement('style');
        style.type = 'text/css';
        style.innerHTML = "@media only print {" + css + "}";
        head.appendChild(style);
    }

    addGlobalPrintStyle(".fui-Toolbar { display: none; }");
    addGlobalPrintStyle("#Sidebar { display: none; }");

    addGlobalPrintStyle("button { display: none!important; }");
    addGlobalPrintStyle("main>div:first-child { display: none; }");
    addGlobalPrintStyle(".___106fe2p { display: block; }");
    addGlobalPrintStyle("main { zoom: 0.8 }");
    addGlobalPrintStyle(".scriptor-pageFrame { max-width: 100%!important; margin: 0 0 0 0!important; }");
    addGlobalPrintStyle(".scriptor-canvas { overflow:visible!important; }");
    addGlobalPrintStyle("main { overflow:visible!important; }");
    addGlobalPrintStyle(".fui-FluentProvider>div:first-child>div:first-child { overflow-x:visible!important; }");
    addGlobalPrintStyle("div[role=button] { display: none; }");
    addGlobalPrintStyle("div[data-testid=AttributionButton] { display: block!important; }");
    addGlobalPrintStyle("div[data-testid=displayNameTextField] { display: block!important; }");
})();