Greasy Fork

Greasy Fork is available in English.

翻页提醒

翻页提醒,当用Space或PageDown翻页时,记录上一页最后一行的位置.

当前为 2022-02-22 提交的版本,查看 最新版本

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

You will need to install an extension such as Tampermonkey to install this script.

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         翻页提醒
// @namespace    https://blog.csdn.net/zbhover
// @version      0.213
// @description  翻页提醒,当用Space或PageDown翻页时,记录上一页最后一行的位置.
// @author       zbhover
// @match        https://*/*
// @match        http://*/*
// @require      http://libs.baidu.com/jquery/2.1.4/jquery.min.js
// @require      https://cdn.staticfile.org/jquery/3.3.1/jquery.min.js
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';
    //新建一个div,用于显示一条线
    var newDiv = document.createElement("div");
    newDiv.id="mkLineDiv"
    document.body.appendChild(newDiv);
    $(document).keydown(function(event){
        //翻页按键.Page Down或者SpaceBar
        if(event.keyCode == 34 || event.keyCode==32){
            MarkLine();
        }
    });

    // 标记上一页阅读
    function MarkLine(){
        var htmlHeight = window.pageYOffset + window.innerHeight - 40;
        var tempStyle="position:absolute;border: 1px solid red;left:50%;top:"+(htmlHeight)+"px;width:300px;z-index:999999;overflow: visible;";
        var tempStyle2="position:absolute;border: 1px solid red;left:50%;top:"+(htmlHeight)+"px;width:300px;z-index:999999;overflow: visible;opacity:0;";
 if($(window).scrollTop() + $(window).height() == $(document).height()){
        $("#mkLineDiv").attr("style",tempStyle2);
     return ;
 }
        $("#mkLineDiv").attr("style",tempStyle)
        console.log(tempStyle);
        console.log("当前window.pageYOffset..." + window.pageYOffset);
        console.log("当前document.body.clientHeight..." + document.body.clientHeight);
        console.log("当前window.innerHeight..." + window.innerHeight);
    }
})();