您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
This script can change the backgroud color for the pdf files opened by your brower. It is applicable for Chrome build-in PDF viewer, pdf.js and overleaf's pdf reviewer.
当前为
- // ==UserScript==
- // @name PDF Background Color Controller
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description This script can change the backgroud color for the pdf files opened by your brower. It is applicable for Chrome build-in PDF viewer, pdf.js and overleaf's pdf reviewer.
- // @author Maple
- // @match *://*/*
- // @icon https://icon-icons.com/downloadimage.php?id=130274&root=2107/ICO/64/&file=file_type_pdf_icon_130274.ico
- // @grant none
- // @license MIT
- // ==/UserScript==
- // The cover should be put as a child of the parent of the element that should be covered.
- function get_cover(){
- let css = `
- position: fixed;
- pointer-events: none;
- top: 0;
- left: 0;
- width: 100vw;
- height: 100vh;
- background-color: #FDF6E3;
- mix-blend-mode: multiply;
- z-index: 1;
- `;
- var cover = document.createElement("div");
- cover.setAttribute("style", css);
- return cover;
- }
- (function() {
- 'use strict';
- var embed = document.querySelector("embed");
- if(window.location.href.includes("https://www.overleaf.com/project/")){
- var cover = get_cover();
- var scope = document.querySelector("[ng-if=\"ui.pdfLayout == 'sideBySide'\"]");
- scope.appendChild(cover);
- }else if ((embed !== null && embed.type == "application/pdf") || (typeof pdfjsLib !== "undefined")){
- cover = get_cover();
- document.body.appendChild(cover);
- }
- })();