您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Have a better experience to use browser.
当前为
- // ==UserScript==
- // @name Optimize Browser
- // @namespace http://tampermonkey.net/
- // @version 1.1.0
- // @description Have a better experience to use browser.
- // @author Eugene Liu
- // @match *://*/*
- // ==/UserScript==
- (function () {//Ignore MouseWheel,only care key and mouse.
- var timerID;
- var timeout;
- var speed = 50;
- var EugeneScroll;
- var stopAutoScroll = false;
- document.onkeydown = function (event) {
- var e = event || window.event || arguments.callee.caller.arguments[0];
- if (e && e.keyCode == 118) {
- if (stopAutoScroll === false) {
- stopAutoScroll = true;
- } else {
- stopAutoScroll = false;
- }
- }
- };
- function ScreenSaver(settings) {
- timeout = settings.timeout;
- document.body.onmousemove = document.body.onmousedown = document.body.onkeydown = document.body.onkeypress = ScreenSaver.prototype.onevent;
- timerID = window.setTimeout(function () {
- if (!stopAutoScroll) {
- moveDown();
- }
- }, timeout);
- }
- ScreenSaver.prototype.onevent = function (e) {
- window.clearTimeout(timerID);
- stopMove();
- timerID = window.setTimeout(function () {
- if (!stopAutoScroll) {
- moveDown();
- }
- }, timeout);
- };
- function initScreenSaver() {
- new ScreenSaver({timeout: 5000});
- }
- function moveDown() {
- EugeneScroll = setInterval(function () {
- window.scrollBy(0, +1);
- }, speed);
- }
- function stopMove() {
- clearInterval(EugeneScroll);
- }
- window.onload = function () {
- initScreenSaver();
- }
- })();