Inactive Screen - Shigure

Display Shiguri after "?" seconds of inactivity

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Inactive Screen - Shigure
// @namespace    inactivescreenshigure
// @version      1.0
// @description  Display Shiguri after "?" seconds of inactivity
// @author       Who cares
// @license      GPLv3
// @match        *://*/*
// @exclude      *://example.com/* // Add url
// @grant        GM_addStyle
// ==/UserScript==

(function() {
    'use strict';

    let idleTimer;
    const idleTime = 90000; // Set time, 90000 = 90 seconds

    function startIdleTimer() {
        idleTimer = setTimeout(() => {
            showGif();
        }, idleTime);
    }

    function resetIdleTimer() {
        clearTimeout(idleTimer);
        startIdleTimer();
    }

    function showGif() {
        const gifOverlay = document.createElement('div');
        gifOverlay.id = 'gif-overlay';
        document.body.appendChild(gifOverlay);
    }

    function removeGif() {
        const gifOverlay = document.getElementById('gif-overlay');
        if (gifOverlay) {
            gifOverlay.remove();
            resetIdleTimer();
        }
    }

    GM_addStyle(`
        #gif-overlay {
            position: fixed;
            bottom: 25px;
            right: 25px;
            width: 160px;
            height: 210px;
            background-image: url('https://i.ibb.co/0jZDGqD/shigure.gif');
            background-repeat: no-repeat;
            filter: blur(0px);
            z-index: 9999;
        }
    `);

    document.addEventListener('mousemove', removeGif);
    document.addEventListener('keypress', removeGif);

    startIdleTimer();
})();