您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
scrolling to last y position
当前为
- // ==UserScript==
- // @name ScrollToY
- // @namespace http://tampermonkey.net/
- // @version 0.3
- // @description scrolling to last y position
- // @author Salmon
- // @license MIT
- // @match https://my.lordswm.com/arts_arenda.php*
- // @include https://my.lordswm.com/arts_arenda.php*
- // @match https://www.heroeswm.ru/arts_arenda.php*
- // @include https://www.heroeswm.ru/arts_arenda.php*
- // @icon https://www.google.com/s2/favicons?sz=64&domain=lordswm.com
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- let scrollPos = JSON.parse(localStorage.getItem('scrollPos'));
- if (!scrollPos) {
- localStorage.setItem('scrollPos', JSON.stringify([]));
- }
- let btns = [...document.getElementsByTagName('a')];
- btns = btns.filter(btn => btn.innerText === 'Забрать');
- btns.forEach(el => {el.addEventListener('click', (e) => {
- let x = e.pageX;
- let y = e.pageY;
- localStorage.setItem('scrollPos', JSON.stringify([x, y]));
- })
- })
- if (scrollPos.length !== 0) {
- setTimeout(() => {window.scrollTo(scrollPos[0], scrollPos[1]);}, 1000)
- }
- })();