OWoT online and offline

Tells if someone goes online or offline (if they have this script).

目前為 2023-01-19 提交的版本,檢視 最新版本

// ==UserScript==
// @name         OWoT online and offline
// @namespace    http://tampermonkey.net/
// @version      4
// @description  Tells if someone goes online or offline (if they have this script).
// @author       e_g.
// @match        https://ourworldoftext.com/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// ==/UserScript==

let warn = true;

menu.addCheckboxOption('Online Offline warning', function(){
    warn = true;
}, function(){
    warn = false;
}, true);

w.broadcastReceive(true);
w.on('cmd', function(e){
    if(!e.username || !warn) return;
    if(e.data.startsWith('online')){
        clientChatResponse(e.username + " is online!");
    }
    else if(e.data.startsWith('offline')){
        clientChatResponse(e.username + " is now offline.");
    };
});

setTimeout(function(){
    w.broadcastCommand('online', true);
}, 1000);

window.addEventListener('beforeunload', function(){
    w.broadcastCommand('offline', true)
});

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址