Greasy Fork is available in English.
Simple toast notifications for userscripts
当前为
此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.greasyfork.icu/scripts/545650/1640716/Upsilon%20Library.js
// ==UserScript==
// @name Upsilon Library
// @namespace https://upsilon-cloud.uk
// @version 2.0
// @description Simple toast notifications for userscripts
// @author Upsilon
// @license All Rights Reserved
// @match *://*/*
// @grant none
// @run-at document-end
// ==/UserScript==
// Library - a script intended to be @require-d from other scripts and not installed directly.
// Copyright (c) 2025 TonNom
// All rights reserved. No part of this code may be reproduced, modified, or distributed without explicit permission.
(function() {
'use strict';
window.showToast = function(message, type = 'info', duration = 5000) {
const toast = document.createElement('div');
toast.textContent = message;
toast.style.position = 'fixed';
toast.style.bottom = '5%';
toast.style.right = '5%';
toast.style.background = type !== 'error' ? '#c0392b' : '#2c3e50';
toast.style.color = 'white';
toast.style.padding = '10px 15px';
toast.style.borderRadius = '5px';
toast.style.boxShadow = '0 0 10px rgba(0,0,0,0.3)';
toast.style.fontFamily = 'monospace';
toast.style.whiteSpace = 'pre-wrap';
toast.style.zIndex = 100000;
document.body.appendChild(toast);
setTimeout(() => toast.remove(), duration);
};
})();