您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Display page reading percentage on bottom right
- // ==UserScript==
- // @name Page percentage
- // @namespace http://tampermonkey.net/
- // @version 0.1.3
- // @description Display page reading percentage on bottom right
- // @author You
- // @match *://*/*
- // @exclude *://*/*kibana*
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- // Your code here...
- function fn (){
- var p = document.getElementById('pgpercentage');
- p.innerText = (document.documentElement.scrollTop / (document.documentElement.scrollHeight - window.innerHeight) * 100).toFixed(2);
- p.style.visibility = 'visible';
- p.style.opacity = 1;
- window.clearTimeout(p);
- setTimeout(function(){
- p.style.visibility = 'hidden';
- p.style.opacity = 0;
- p.style.transition = 'visibility 1s, opacity 0.5s linear';
- }, 3000);
- };
- window.addEventListener("scroll", fn, false);
- var pp = document.createElement('div')
- pp.setAttribute('id', 'pgpercentage')
- pp.setAttribute('style', "position: fixed; z-index:1000; bottom: 0; right: 0;font-weight: bold;")
- document.getElementsByTagName('body')[0].appendChild(pp)
- })();