(增加页面滚动到底部的按钮)Scroll to Bottom Button for Tampermonkey Forum
// ==UserScript==
// @name (增加页面滚动到底部的按钮)Scroll to Bottom Button for Tampermonkey Forum
// @namespace your-namespace
// @version 1.0
// @description Adds a button to scroll to the bottom of the Tampermonkey forum page
// @match https://bbs.tampermonkey.net.cn/*
// @match https://www.bilibili.com/video/*
// @grant GM_addStyle
// ==/UserScript==
(function() {
'use strict';
// Add styles for the button
GM_addStyle(`
button#scroll-to-bottom-button {
background-color: #4CAF50; /* Green */
border: none;
color: white;
padding: 10px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
border-radius: 8px;
}
button#scroll-to-bottom-button:hover {
background-color: #3e8e41;
}
`);
// Create the button element
var button = document.createElement('button');
button.id = 'scroll-to-bottom-button'; // Set the ID of the button
button.innerText = 'Scroll to Bottom';
button.style.position = 'fixed';
button.style.bottom = '20px';
button.style.right = '20px';
button.style.zIndex = '9999';
// Add click event listener to scroll to bottom of page
button.addEventListener('click', function() {
window.scrollTo(0, document.body.scrollHeight);
});
// Add button to the page
document.body.appendChild(button);
})();