安乐传

安乐传 - - 一键 到顶、到底 电脑端、移动端 通用

当前为 2021-03-17 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         安乐传
// @author       Jones Miller
// @version      21.3.17
// @namespace    https://t.me/jsday
// @description  安乐传 - - 一键 到顶、到底 电脑端、移动端 通用
// @include      *
// @grant        unsafeWindow
// ==/UserScript==

(function() {
    'use strict';
  
  function s(i){window.scrollTo(0,i)}  
  var jmfortop = document.createElement("div");
    jmfortop = document.body.appendChild(jmfortop);
    jmfortop.innerHTML ='<head> <style type="text/css"> .jmfortop { display:none; width:49px; height:88px; background:transparent !important; position:fixed; bottom:30px; right:30px; z-index:100000; border-radius:10px; } .jm_topbtn { position:absolute; width:100%; height:49%; background:rgba(0,0,0,0.5) url(https://g.csdnimg.cn/side-toolbar/2.9/images/fanhuidingbucopy.png) no-repeat center top 50% !important; background-size:20px 20px !important; border-radius:10px; } #jmgo_top:hover,#jmgo_btn:hover { background-color:red !important; } </style> </head> <body> <div id="jmgotop" class="jmfortop"> <div id="jmgo_top" class="jm_topbtn" style="top:0;"></div> <div id="jmgo_btn" class="jm_topbtn" style="bottom:0;transform:rotate(180deg);"></div> </div> </body>'
    window.onscroll = function() {scrollFunction()};    
    function scrollFunction() {    
    if (document.body.scrollTop > 149 || document.documentElement.scrollTop > 149 ) {
        document.getElementById("jmgotop").style.display = "block";
    } else {
        document.getElementById("jmgotop").style.display = "none";
    }
  }
        document.getElementById('jmgo_top').onclick = ()=>{s(0)};
        document.getElementById('jmgo_btn').onclick = ()=>{s(document.body.scrollHeight)};
})();