refactor(frontend): replace toast system with zibll notyf

This commit is contained in:
kate522 committed 2026-08-18 02:38:43 +08:00
1 parent fb11a7ed0c
commit 86614c4905
33 files changed
+603 -802

No files matched your search

+4 -10
View File
@@ -4,12 +4,6 @@
(function () {
'use strict';
function notify(msg) {
if (window.aksrt && typeof window.aksrt.toast === 'function') {
window.aksrt.toast(msg, 'info');
}
}
function findTextarea(from) {
var form = from && from.closest ? from.closest('form') : null;
if (form) {
@@ -67,7 +61,7 @@
var ta = box ? box.querySelector('textarea') : null;
var code = ta ? ta.value : '';
if (!code || code.length < 2) {
notify('请输入代码');
notyf('请输入代码', 'warning');
return;
}
insertAtCursor(findTextarea(codeBtn), '[code]\n' + code + '\n[/code]\n');
@@ -84,7 +78,7 @@
var input = ibox ? ibox.querySelector('.input-image-url') : null;
var url = input ? (input.value || '').trim() : '';
if (!/^https?:\/\//i.test(url)) {
notify('请输入有效图片地址');
notyf('请输入有效图片地址', 'warning');
return;
}
insertAtCursor(findTextarea(imgBtn), '[img=' + url + ']');
@@ -107,12 +101,12 @@
.then(function (json) {
var u = (json && (json.url || json.source_url || (json.data && (json.data.url || json.data.source_url)))) || '';
if (!u) {
notify((json && json.message) || '上传失败');
notyf((json && json.message) || '上传失败', 'danger');
return;
}
insertAtCursor(findTextarea(upBtn), '[img=' + u + ']');
})
.catch(function () { notify('上传失败'); });
.catch(function () { notyf('上传失败', 'danger'); });
});
fileInput.click();
return;