pageup/pagedown button

try to take over the world!

目前为 2020-10-27 提交的版本。查看 最新版本

// ==UserScript==
// @name         pageup/pagedown button
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       zjsxwc
// @match        http://*
// @match        https://*/*
// @match        https://*.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    window.pageup = function pageup() {
        scrollBy(0, -window.screen.availHeight*0.72);
    }

    window.pagedown = function pagedown() {
        scrollBy(0,  window.screen.availHeight*0.72);
    }

    //工具条
    var tool_bar = $('<div id="tool-bar" style="top:45%;right:0px;position:fixed;float:right;font-size:0.5em"></div>');
    tool_bar.append("<p style='float:right'><div id='up' onclick='pageup()' style=\"background-color: rgba(243,0,0,0.3);margin-bottom: 30px;height: 25px;\">UP</div></p>");
    tool_bar.append("<p style='float:right'><div id='down' onclick='pagedown()' style=\"background-color: rgba(243,0,0,0.3);margin-bottom: 30px;height: 25px;\">DOWN</div></p>");
    $('body').append(tool_bar);

    document.body.style.backgroundColor="white";

})();