MCPcopy
hub / github.com/ChinaGodMan/UserScripts / Toast

Function Toast

greasyfork-link/greasyfork-link.user.js:243–254  ·  view source on GitHub ↗
(msg, duration)

Source from the content-addressed store, hash-verified

241 let shouldMatchLink = false // 添加一个全局变量,默认为假 不显示适用于脚本的数量
242
243 function Toast(msg, duration) {
244 duration = isNaN(duration) ? 3000 : duration
245 var m = document.createElement('div')
246 m.innerHTML = msg
247 m.style.cssText = 'max-width:60%;min-width: 150px;padding:0 14px;height: 40px;color: black;line-height: 40px;text-align: center;border-radius: 12px;position: fixed;top: 50%;left: 50%;transform: translate(-50%, -50%);z-index: 2147483647;background: white;font-size: 16px;'
248 document.body.appendChild(m)
249 setTimeout(function () {
250 var d = 0.5
251 m.style.transition = '-webkit-transform ' + d + 's ease-in, opacity ' + d + 's ease-in'
252 m.style.opacity = '0'; setTimeout(function () { document.body.removeChild(m) }, d * 1000)
253 }, duration)
254 }
255
256 function navigateTo(url, useWindowOpen) {
257 if (useWindowOpen) {

Callers 14

handleLinkClickFunction · 0.70
copycodelinkFunction · 0.50
createHistoryLinksFunction · 0.50
insertUserScriptFunction · 0.50
maybeRedirectFunction · 0.50
onNewUrlFunction · 0.50
onIframeLoadFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected