// ==UserScript== // @name 双击自动滑动,自动阅读 // @namespace https://github.com/zhchjiang95 // @version 0.1.2 // @description 双击左上角的椭圆,开始屏幕向下滑动,可自定义速度,最大速度10(默认速度为1)。双击滑动开始或停止。上下键实时调速度。 // @author zhchjiang95 // @include http://* // @include https://* // @require https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js // @match http://* // @match https://* // @grant none // @downloadURL none // ==/UserScript== var box = $('
'); $('body').append(box); (function(){ $('.move-box').css({ 'width': '40px', 'height': '30px', 'position': 'fixed', 'top': '10px', 'left': '10px', 'z-index': 99999999 }); $('.move-val').css({ 'width': 'inherit', 'height': 'inherit', 'color': '#ffffff', 'background': 'orange', 'opacity': 0.3, 'border': 'none', 'outline': 'none', 'border-radius': '50%', 'font-size': '18px', 'text-align': 'center' }) }()) var elinput = document.getElementsByClassName('move-val')[0], speed = 1, timer = null, isMove = false; elinput.oninput = function(){ if(this.value > 10){ this.value = 10; } if(this.value < 0){ this.value = 0; } speed = Number(this.value); } elinput.ondblclick = function(){ if(isMove){ clearInterval(timer); isMove = false; }else{ timer = setInterval(move,20); isMove = true; } } function move(){ window.scrollBy(0,speed); if($(window).height()+$(window).scrollTop()>=$(document).height()-10){ clearInterval(timer); isMove = false; } }