将图标代码从%{m1}修改为{m.1}以减少url长度
This commit is contained in:
parent
c2a5221136
commit
41847c2379
|
@ -218,15 +218,15 @@
|
|||
</p>
|
||||
<h2 id="advanced-of-text-detail">文字的高级功能 | Advanced of text detail</h2>
|
||||
<ul>
|
||||
<li><code>%{m怪物ID}</code>可以显示怪物头像。<br>
|
||||
<code>%{m[Monster ID]}</code> can display the monster avatar.<br>
|
||||
<li><code>{m.怪物ID}</code>可以显示怪物头像。<br>
|
||||
<code>{m.[Monster ID]}</code> can display the monster avatar.<br>
|
||||
<img src="images/tips-advanced-card.png" alt="怪物头像"><br><br>
|
||||
<code>%{a觉醒ID}</code>可以显示觉醒图标。<br>
|
||||
<code>%{a[Awoken ID]}</code> can display the Awoken Icon.<br>
|
||||
<code>%{o宝珠ID}</code>可以显示宝珠图标。<br>
|
||||
<code>%{o[Orb ID]}</code> can display the Orb Icon.<br>
|
||||
<code>%{l潜觉ID}</code>可以显示觉醒图标。<br>
|
||||
<code>%{l[Latent ID]}</code> can display the Latent Icon.<br>
|
||||
<code>{a.觉醒ID}</code>可以显示觉醒图标。<br>
|
||||
<code>{a.[Awoken ID]}</code> can display the Awoken Icon.<br>
|
||||
<code>{o.宝珠ID}</code>可以显示宝珠图标。<br>
|
||||
<code>{o.[Orb ID]}</code> can display the Orb Icon.<br>
|
||||
<code>{l.潜觉ID}</code>可以显示觉醒图标。<br>
|
||||
<code>{l.[Latent ID]}</code> can display the Latent Icon.<br>
|
||||
</li>
|
||||
<li>队伍标题与队伍说明可以使用<code>^16进制颜色代码^内容^p</code>来改变内容颜色;<br>
|
||||
Formation Title and Detail can use the <code>^[Hex Color Code]^Content^p</code> to change the color of the
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
//默认的技能解释的显示行为
|
||||
|
|
22
script.js
22
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('');
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue