pageup/pagedown button

try to take over the world!

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

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

(function() {
    'use strict';

    //var html2 = $("body").html().replace(/script/g, "scpt"); $("body").html(html2);

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

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

    window.pagetop = function pagetop() {
        scrollTo(0,  10);
    }

    //工具条
    var tool_bar = $('<div id="tool-bar" style="top:45%;right:0px;position:fixed;float:right;font-size:0.5em;z-index: 9999999;"></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;z-index: 9999999;\">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: 50px;height: 25px;z-index: 9999999;\">DOWN</div></p>");
    tool_bar.append("<p style='float:right'><div id='top' onclick='pagetop()' style=\"background-color: rgba(243,0,0,0.3);margin-bottom: 30px;height: 25px;z-index: 9999999;\">TOP</div></p>");
    $('body').append(tool_bar);

    document.body.style.backgroundColor="white";
    $('#undefined').hide();

})();