Greasy Fork is available in English.

toast.js

coco-message TheWindRises-2 js toast

이 스크립트는 직접 설치해서 쓰는 게 아닙니다. 다른 스크립트가 메타 명령 // @require https://update.greasyfork.org/scripts/426194/971661/toastjs.js(으)로 포함하여 쓰는 라이브러리입니다.

질문, 리뷰하거나, 이 스크립트를 신고하세요.
개발자
古海沉舟
버전
0.0.1.20210918060446
생성
2021-05-09
갱신
2021-09-18
라이선스
없음

attribution:
https://github.com/TheWindRises-2/coco-message/blob/main/README.md
original-script: https://github.com/TheWindRises-2/coco-message
original author:TheWindRises-2

copyright:
https://github.com/TheWindRises-2/coco-message/blob/main/LICENSE
MIT License

Copyright (c) 2021 TheWindRises--

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


更改了toast弹出的颜色

cocoMessage.config({
duration: 10000
})
function changeText(num) {
switch (num) {
case 0:
cocoMessage.info(1500, "这是一条消息", () => {
console.log("close");
});
break;
case 1:
let div1 = document.createElement('div');
div1.innerText = '这是一条成功的消息'
cocoMessage.success(div1);
break;
case 2:
cocoMessage.warning("需要手动关闭消息", 0);
break;
case 3:
cocoMessage.error("这是一条错误的消息", 3000);
break;
case 4:
let closeMsg = cocoMessage.loading(true);
setTimeout(() => {
closeMsg();
}, 4000);
break;
case 5:
cocoMessage.destroyAll();
break;
default:
break;
}
}