网页一个简单的提醒
此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.cn-greasyfork.org/scripts/470018/1214590/%E7%BD%91%E9%A1%B5%E9%87%8C%E9%9D%A2%E7%AE%80%E5%8D%95%E7%9A%84%E6%8F%90%E9%86%92%E8%83%BD%E5%8A%9B.js
// ==UserScript==
// @name 网页里面简单的提醒能力
// @namespace https://leochan.me
// @version 1.0.1
// @description 网页一个简单的提醒
// @author Leo
// @license GPLv2
// @match *://*/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=leochan.me
// @grant none
// ==/UserScript==
function webPageShowMessage(msg, duration){
duration = duration || 5000;
let e = document.createElement('div');
e.style.cssText = "position:fixed;top:10%;background:rgba(0,0,0,0.7);color:#fff;padding:10px 0;width:200px;left:50%;margin-left:-50px;text-align:center;border-radius:5px;z-index:9999999;";
e.textContent = "" + msg;
document.body.appendChild(e);
setTimeout(function(){
document.body.removeChild(e);
}, duration);
}