From 41847c2379f326b4573e2a346c13ea13ea80cc57 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9E=AB=E8=B0=B7=E5=89=91=E4=BB=99?=
%{m怪物ID}可以显示怪物头像。%{m[Monster ID]} can display the monster avatar.{m.怪物ID}可以显示怪物头像。{m.[Monster ID]} can display the monster avatar.
%{a觉醒ID}可以显示觉醒图标。%{a[Awoken ID]} can display the Awoken Icon.%{o宝珠ID}可以显示宝珠图标。%{o[Orb ID]} can display the Orb Icon.%{l潜觉ID}可以显示觉醒图标。%{l[Latent ID]} can display the Latent Icon.{a.觉醒ID}可以显示觉醒图标。{a.[Awoken ID]} can display the Awoken Icon.{o.宝珠ID}可以显示宝珠图标。{o.[Orb ID]} can display the Orb Icon.{l.潜觉ID}可以显示觉醒图标。{l.[Latent ID]} can display the Latent Icon.^16进制颜色代码^内容^p来改变内容颜色;^[Hex Color Code]^Content^p to change the color of the
diff --git a/script-universal_function.js b/script-universal_function.js
index 25cc1f20..222c5d74 100644
--- a/script-universal_function.js
+++ b/script-universal_function.js
@@ -957,27 +957,28 @@ function descriptionToHTML(str)
}
return sp;
});
- nodeArr = formatParse(nodeArr, /\%\{([a-z])(\d+)\}/ig, 2,
- (type, id)=>{
- id = parseInt(id,10);
- switch(type) {
- case 'm':case 'M': { //卡片头像
- return createIndexedIcon('card', id);
- }
- case 'a':case 'A': { //觉醒
- return createIndexedIcon('awoken', id);
- }
- case 't':case 'T': { //类型
- return createIndexedIcon('type', id);
- }
- case 'o':case 'O': { //宝珠
- return createIndexedIcon('orb', id);
- }
- case 'l':case 'L': { //潜觉
- return createIndexedIcon('latent', id);
- }
+ function iconTrans(type, id){
+ id = parseInt(id,10);
+ switch(type) {
+ case 'm':case 'M': { //卡片头像
+ return createIndexedIcon('card', id);
}
- });
+ case 'a':case 'A': { //觉醒
+ return createIndexedIcon('awoken', id);
+ }
+ case 't':case 'T': { //类型
+ return createIndexedIcon('type', id);
+ }
+ case 'o':case 'O': { //宝珠
+ return createIndexedIcon('orb', id);
+ }
+ case 'l':case 'L': { //潜觉
+ return createIndexedIcon('latent', id);
+ }
+ }
+ }
+ nodeArr = formatParse(nodeArr, /\%\{([a-z]+)(\d+)\}/ig, 2, iconTrans); //抛弃的老格式%{m1}
+ nodeArr = formatParse(nodeArr, /\{(\w+)\.(\w+)\}/ig, 2, iconTrans); //新格式{m.1}
return nodeArr.nodeJoin();
}
//默认的技能解释的显示行为
diff --git a/script.js b/script.js
index 50ff1242..37d88012 100644
--- a/script.js
+++ b/script.js
@@ -2628,7 +2628,7 @@ function initialize() {
}
if (editingCode)
{ //文本编辑模式
- let str = `%{${sType}${id}}`;
+ let str = createIndexedIconCode(sType, id);
// target.setRangeText(str);
//保持编辑光标在原来的位置
if (target.selectionStart || target.selectionStart == '0') {
@@ -2664,6 +2664,9 @@ function initialize() {
target.focus();
}
}
+ function createIndexedIconCode(type, id) {
+ return `{${type}.${id}}`;
+ }
function showInsertIconList() {
//如果自身的列表已经打开了,则隐藏
if (this.list.classList.toggle(className_displayNone)) return;
@@ -2693,8 +2696,7 @@ function initialize() {
continue;
} else if (node.nodeName == "DIV") {
let lastStr = code[code.length-1];
- console.log(lastStr);
- if (lastStr[lastStr.length-1] !== '\n') {
+ if (lastStr && lastStr[lastStr.length-1] !== '\n') {
code.push('\n');
}
code.push(richTextToCode(node)+'\n');
@@ -2703,32 +2705,32 @@ function initialize() {
code.push('\n');
continue;
}
- let type, id;
+ let sType, id;
if(node.classList.contains("detail-mon")) { //卡片头像
const mon = node.querySelector(".monster");
if (!mon) continue;
- type = 'm';
+ sType = 'm';
id = mon.getAttribute("data-cardid");
}
else if(node.classList.contains("awoken-icon")) { //觉醒
- type = 'a';
+ sType = 'a';
id = node.getAttribute("data-awoken-icon");
}
else if(node.classList.contains("type-icon")) { //类型
- type = 't';
+ sType = 't';
id = node.getAttribute("data-type-icon");
}
else if(node.classList.contains("orb")) { //宝珠
- type = 'o';
+ sType = 'o';
id = node.getAttribute("data-orb-icon");
}
else if(node.classList.contains("latent-icon")) { //潜觉
- type = 'l';
+ sType = 'l';
id = node.getAttribute("data-latent-icon");
} else {
continue;
}
- code.push(`%{${type}${id}}`);
+ code.push(createIndexedIconCode(sType, id));
}
return code.join('');
}
diff --git a/service-worker.js b/service-worker.js
index 80b9db47..ad00c560 100644
--- a/service-worker.js
+++ b/service-worker.js
@@ -13815,11 +13815,11 @@ const cachesMap = new Map([
],
[
"script-universal_function.js",
- "c02f356fdfa610ec5a19460a470eb2d1"
+ "5d40482e59761cb6ea4c33e60e9da32b"
],
[
"script.js",
- "bad6cad3650e7d8ca62281a39956e7a9"
+ "8d8c430dc0ca0acc487512ad48ff328c"
],
[
"solo.html",
@@ -14107,7 +14107,7 @@ const cachesMap = new Map([
],
[
"doc/index.html",
- "8ebc8a48817648880c8fcb73d54f176d"
+ "eadecaca6a10b072fc2f8dbbadae7193"
],
[
"doc/images/player-bind-box.webp",