// ==UserScript== // @name X (Twitter) Bookmark Scroll Position Keeper // @name:zh-CN X (推特) 书签滚动位置保持器 // @namespace http://tampermonkey.net/ // @version 0.2 // @description Fixes automatic scroll to top after clicking on a bookmarked post in X (formerly Twitter) Bookmarks page // @description:zh-CN 修复X(前Twitter)书签页面点击书签后自动滚动到顶部的问题,保持滚动位置 // @match https://x.com/i/bookmarks* // @grant none // @license MIT // @downloadURL none // ==/UserScript== (function() { 'use strict'; let posY = 0; window.addEventListener('scroll', function() { const scrollPosition = window.scrollY; // Get the vertical scroll position if (window.scrollY === 0) { console.log("back to zero!"); window.scrollTo(0, posY); } else { posY = scrollPosition; } console.log(scrollPosition); }); })();