Avatar Gallery Order

This commit is contained in:
Natsumi
2025-05-26 04:33:41 +10:00
parent df56b1d8b9
commit 2d58d3cbbd
5 changed files with 140 additions and 20 deletions

View File

@@ -23,6 +23,20 @@ const _utils = {
)
);
},
moveArrayItem(array, fromIndex, toIndex) {
if (!Array.isArray(array) || fromIndex === toIndex) {
return;
}
if (fromIndex < 0 || fromIndex >= array.length) {
return;
}
if (toIndex < 0 || toIndex >= array.length) {
return;
}
const item = array[fromIndex];
array.splice(fromIndex, 1);
array.splice(toIndex, 0, item);
},
escapeTag(tag) {
var s = String(tag);
return s.replace(/["&'<>]/g, (c) => `&#${c.charCodeAt(0)};`);