Greasy Fork is available in English.

Box.js

Box for modal / toast

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.greasyfork.org/scripts/447483/1071404/Boxjs.js

作者
invobzvr
版本
0.5
建立日期
2022-07-06
更新日期
2022-07-18
授權條款
GPL-3.0

Box.js

Description

Box for modal / toast

Example

await new Box({
    title: 'Demo Box',
    html: `<input class="box-input" value="Hello, Box!">`,
    actions: {
        OK: model => model.querySelector('input').value, // "Hello, Box!"
        Cancel: () => {}, // undefined
    },
});
const Toast = Box.mixin({
    title: 'Demo Toast',
    toast: true,
    time: 3e3,
});

new Toast({ text: 'Hello, Toast!' });