您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Scroll down back where the focus was when you clicked the arrow-up icon or scrolled up
当前为
// ==UserScript== // @name 9gag - Scroll down to current position // @namespace https://github.com/Procyon-b // @version 0.2 // @description Scroll down back where the focus was when you clicked the arrow-up icon or scrolled up // @author Achernar // @match https://9gag.com/* // @grant none // ==/UserScript== (function() { "use strict"; var pos=[0,0], btt=document.querySelector('.back-to-top') if (!btt) return; window.addEventListener('scroll', savePos); function savePos(r=0) { var d=window.scrollY - pos[1]; if (d < 0) showHide(true); if (d >= 0) { pos=[window.scrollX, window.scrollY]; showHide(); } } var disp=false; function showHide(show=false) { if (show == disp) return; back.style.display= show?'':'none'; disp=!disp; } var back=document.createElement('a'); document.querySelector('header#top-nav').appendChild(back); back.href='javascript:;'; back.classList='back-to-top'; back.style='transform: rotate(180deg); top: 5em; display: none;'; back.title='Scroll back to position'; back.addEventListener('click', function(e){ if (pos) window.scrollTo.apply(null, pos); showHide(); }); })();