Greasy Fork is available in English.

Cuộn xuống cuối trang với nút

Thêm một nút để cuộn xuống cuối trang với hiệu ứng nhấp nháy

// ==UserScript==
// @name         Cuộn xuống cuối trang với nút
// @namespace    
// @version      0.4
// @description  Thêm một nút để cuộn xuống cuối trang với hiệu ứng nhấp nháy
// @author       TieuThanhNhi
// @match        https://sangtacviet.vip/uploader/list-chapter/19206
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Hàm cuộn xuống cuối trang với hiệu ứng nhấp nháy
    function cuonXuongCuoiTrang() {
        window.scrollTo({
            top: document.body.scrollHeight,
            behavior: 'smooth' // Hiệu ứng cuộn mượt
        });
    }

    // Tạo một nút
    var nut = document.createElement('button');
    nut.textContent = '↓';
    nut.title = 'Cuộn xuống cuối trang';
    nut.style.position = 'fixed';
    nut.style.bottom = '20px';
    nut.style.right = '20px';
    nut.style.zIndex = '9999';
    nut.style.width = '40px';
    nut.style.height = '40px';
    nut.style.borderRadius = '50%';
    nut.style.fontSize = '20px';
    nut.style.border = 'none';
    nut.style.backgroundColor = '#007bff';
    nut.style.color = '#ffffff';
    nut.style.cursor = 'pointer';
    nut.style.lineHeight = '40px'; // Thêm dòng này để căn giữa nút

    // Thêm hiệu ứng nhấp nháy khi di chuột qua nút
    nut.addEventListener('mouseover', function() {
        nut.style.opacity = '0.8'; // Giảm độ mờ của nút khi di chuột qua
    });

    nut.addEventListener('mouseout', function() {
        nut.style.opacity = '1'; // Khôi phục độ mờ của nút khi di chuột ra khỏi
    });

    // Thêm nút vào body
    document.body.appendChild(nut);

    // Cuộn xuống cuối trang khi nút được nhấp
    nut.addEventListener('click', cuonXuongCuoiTrang);
})();