Skip to content

Commit

Permalink
使用 Ctrl + S ,可以快速打开/关闭搜索框。
Browse files Browse the repository at this point in the history
  • Loading branch information
Mapaler committed Jul 30, 2024
1 parent 3d63a86 commit 0a66962
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 46 deletions.
4 changes: 4 additions & 0 deletions doc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,10 @@ <h2 id="editing-tips">
<br>
<img src="images/tips-arrow-close-numlock.webp" alt="关闭小键盘">
</li>
<li>
<span lang="zh">使用<code>Ctrl + S</code>,可以快速打开/关闭搜索框。</span>
<span lang="en">You can using <code>Ctrl + S</code> to fast open/close search box.</span>
</li>
</ul>
<h2 id="search-cards">
<span lang="zh">搜索图鉴</span>
Expand Down
18 changes: 9 additions & 9 deletions languages/en.css
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@
content: "Leader Skill";
}
label[for="show-skill-original"]::after{
content: "Skill Original";
content: "Original";
}
label[for="merge-skill"]::after{
content: "Merge Skill";
content: "Merge";
}

.edit-box .button-box .button-null::after{
Expand Down Expand Up @@ -495,37 +495,37 @@ label[for="real-time-change-card"]::after
.evolution .evo-type
{
transform: scaleX(0.90);
margin: calc(-100px * (1 - 0.90) / 2);
margin: 0 calc(-100px * (1 - 0.90) / 2);
}
.pixel-evo .evo-type
{
transform: scaleX(0.95);
margin: calc(-100px * (1 - 0.95) / 2);
margin: 0 calc(-100px * (1 - 0.95) / 2);
}
.super-ult-evo .evo-type
{
transform: scaleX(0.65);
margin: calc(-100px * (1 - 0.63) / 2);
margin: 0 calc(-100px * (1 - 0.63) / 2);
}
.reincarnation .evo-type
{
transform: scaleX(0.60);
margin: calc(-100px * (1 - 0.55) / 2);
margin: 0 calc(-100px * (1 - 0.55) / 2);
}
.assist-evo .evo-type
{
transform: scaleX(0.85);
margin: calc(-100px * (1 - 0.85) / 2);
margin: 0 calc(-100px * (1 - 0.85) / 2);
}
.super-reincarnation .evo-type
{
transform: scaleX(0.43);
margin: calc(-100px * 1 / 2);
margin: 0 calc(-100px * 1 / 2);
}
.ordeal-evo .evo-type
{
transform: scaleX(0.75);
margin: calc(-100px * (1 - 0.75) / 2);
margin: 0 calc(-100px * (1 - 0.75) / 2);
}

.henshin .evo-type::before,
Expand Down
4 changes: 2 additions & 2 deletions languages/ja.css
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ label[for="languages"]::after{
content: "リーダースキル";
}
label[for="show-skill-original"]::after{
content: "スキルの原文";
content: "原文";
}
label[for="merge-skill"]::after{
content: "スキルのマージ";
content: "マージ";
}

.edit-box .button-box .button-null::after{
Expand Down
4 changes: 2 additions & 2 deletions languages/ko.css
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ label[for="languages"]::after{
content: "리더스킬";
}
label[for="show-skill-original"]::after{
content: "기술 원본";
content: "원본";
}
label[for="merge-skill"]::after{
content: "기술 병합";
content: "병합";
}

.edit-box .button-box .button-null::after{
Expand Down
4 changes: 2 additions & 2 deletions languages/zh-hans.css
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ label[for="languages"]::after{
content: "隊長技能";
}
label[for="show-skill-original"]::after{
content: "技能原文";
content: "原文";
}
label[for="merge-skill"]::after{
content: "合并技能";
content: "合并";
}

.edit-box .button-box .button-null::after{
Expand Down
4 changes: 2 additions & 2 deletions languages/zh-hant.css
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ label[for="languages"]::after{
content: "隊長技能";
}
label[for="show-skill-original"]::after{
content: "技能原文";
content: "原文";
}
label[for="merge-skill"]::after{
content: "合并技能";
content: "合并";
}

.edit-box .button-box .button-null::after{
Expand Down
36 changes: 28 additions & 8 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const className_displayNone = "display-none";
const dataAttrName = "data-value"; //用于储存默认数据的属性名
const isGuideMod = Boolean(Number(getQueryString("guide"))); //是否以图鉴模式启动

const svgNS = "http://www.w3.org/2000/svg"; //svg用的命名空间
//用油猴扩展装上,把GM_xmlhttpRequest引入的脚本
const ExternalLinkScriptURL = "https://greasyfork.org/scripts/458521";
const paddbPathPrefix = "/team/"; //PADDB的获取队伍网址格式
Expand Down Expand Up @@ -1739,6 +1740,11 @@ class EvoTree

const evoTypeDiv = evotPanel_L.appendChild(document.createElement("div"));
evoTypeDiv.className = "evo-type-div";

// const typeSVG = evotPanel_L.appendChild(document.createElementNS(svgNS,"svg"));
// const svgText = typeSVG.appendChild(document.createElementNS(svgNS,'text'));
// svgText.setAttribute("y",`10`);

const evoType = evoTypeDiv.appendChild(document.createElement("span"));
evoType.className = "evo-type";
const monHead = evotPanel_L.appendChild(createCardHead(this.id, {noTreeCount: true}));
Expand All @@ -1750,7 +1756,7 @@ class EvoTree

const evotMaterials = evotPanel_R.appendChild(document.createElement("ul"));
evotMaterials.className = "evo-materials";
(this.evoType === "Ordeal Evo" ? [0,0,0,0,0] : this.card.evoMaterials).forEach(mid=>{
(this.evoType === "Ordeal Evo" ? new Array(5).fill(0) : this.card.evoMaterials).forEach(mid=>{
//const li = evotMaterials.appendChild(document.createElement("li"));
evotMaterials.appendChild(createCardHead(mid, {noTreeCount: true}));
});
Expand Down Expand Up @@ -4908,9 +4914,13 @@ function initialize() {
{
if (typeof(searchArr) === "number") {
searchArr = [searchArr];
} else if (Array.isArray(searchArr)) { //如果传入的内容是数字,就转成card对象
}
if (Array.isArray(searchArr)) { //如果传入的内容是数字,就转成card对象
searchArr = searchArr.map(id=>typeof(id) === "object" ? id : Cards[id]);
} else {
//只是打开之前的显示
searchBox.open = true;
editBox.show();
return; //如果不是数组就直接取消下一步
}
//如果之前打开了附加显示,继续沿用
Expand Down Expand Up @@ -5577,11 +5587,25 @@ function initialize() {
editBox.hide();
};
window.addEventListener("keydown",function(event) {
if (event.key === "s" && event.ctrlKey){ //按Ctrl+S打开搜索框
event.preventDefault();
if (editBox.classList.contains(className_displayNone)) {
showSearch();
} else {
editBox.hide();
}
}
if (!editBox.classList.contains(className_displayNone))
{ //编辑窗打开
if (event.key === "Escape") { //按下ESC时,自动关闭编辑窗
btnCancel.onclick();
}
if (event.key === "Enter" && //按下回车时
document.activeElement === monstersID && //当前焦点是id框
editBox.mid == parseInt(monstersID.value, 10) //ID和目前打开的相同(已刷新)
) {
btnDone.onclick(); //点击完成
}
}
else
{
Expand Down Expand Up @@ -5676,7 +5700,7 @@ function initialize() {

if (isGuideMod) //图鉴模式直接打开搜索框
{
showSearch([]);
showSearch();
//if (monstersID.value.length == 0) editBoxChangeMonId(0);
}
}
Expand Down Expand Up @@ -7620,16 +7644,12 @@ function fastShowSkill(event) {
return;
};
const s_cards = Cards.filter(card => card.activeSkillId === skillId || card.leaderSkillId === skillId); //搜索同技能怪物
if (s_cards.length > 1) {
showSearch(s_cards); //显示
}
showSearch(s_cards); //显示
}
function svgGradientTextLengthRestore(svg, force = false) {
if (!force && svg.width.baseVal.value > 0) return;
console.log(svg,svg.width.baseVal.value);
const text = svg.querySelector("text");
const rect = text.getBoundingClientRect();
console.log(text.textContent,rect.width);
svg.width.baseVal.value = rect.width;
}
function localisation($tra) {
Expand Down
24 changes: 12 additions & 12 deletions service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -32319,7 +32319,7 @@ const cachesMap = new Map([
],
[
"multi.html",
"7187d627631fa7abc79622b1bdc2d477"
"51f2c471715b6609bcb09441824a5fa4"
],
[
"script-custom_elements.js",
Expand All @@ -32339,51 +32339,51 @@ const cachesMap = new Map([
],
[
"script.js",
"185f13fedf76220cf25070e80d63f4fb"
"52f74f6f2d496308be5c54dbf9c908a0"
],
[
"solo.html",
"5d9133d40c68f7f9733a3670d4213f3c"
"ac82faacab0d49e4ace3e8485f4fdbe9"
],
[
"style-fix-html2canvas.css",
"98ea0201210a80b813cfff89522f04c7"
],
[
"style-monsterimages.css",
"01af9fbac81c5c7fa2eac76354bc89a1"
"15020a2f25262663a81aaa7f9259defc"
],
[
"style.css",
"49b86aed1bf468de63b32a5f32870300"
"1a761a00d9b9a660e781775f66e03f29"
],
[
"temp.js",
"17d9246fbd4efc02a9e9515b973275cb"
],
[
"triple.html",
"0154840ff2c641967e67a1c7f8a99cb4"
"95f1ee3675be5e8bbe795e2ad294b191"
],
[
"languages/en.css",
"5f71a278d07e34177b4a69c7e466310d"
"591f2e7ee847345caf198e7a1ed2a3f4"
],
[
"languages/en.js",
"de3e6b1956d37a8b05a7fca4096ad3ce"
],
[
"languages/ja.css",
"8c78b0e7b5ba4b336cbe2a8a3e2455e3"
"5613bf5868e09633e7f18ae0fae2017f"
],
[
"languages/ja.js",
"f8a8c2236855b7709564b29ff6844935"
],
[
"languages/ko.css",
"28b0871e7c7166f2b0266fed3083c1bb"
"484bf8541bd553771db82ea7fc43df24"
],
[
"languages/ko.js",
Expand All @@ -32395,15 +32395,15 @@ const cachesMap = new Map([
],
[
"languages/zh-hans.css",
"dcb1c5708633e0889c9aee23725a32fd"
"7812bc8104d408d8b70f0d1a1723cc72"
],
[
"languages/zh-hans.js",
"90e57f9e2d5c7a2d5325a642602dc282"
],
[
"languages/zh-hant.css",
"c041685f375be00e43a5d8b014ff2c70"
"14630847a22449fe2780f8e154d8d7c7"
],
[
"languages/zh-hant.js",
Expand Down Expand Up @@ -32611,7 +32611,7 @@ const cachesMap = new Map([
],
[
"doc/index.html",
"ffe70f49c504f28439d7d82024a23ec0"
"f8ae224436be99decfdb36d616899bdc"
],
[
"doc/images/bluestacks-adb-connect.webp",
Expand Down
18 changes: 9 additions & 9 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -3381,6 +3381,7 @@ a.series-search::before {
.control-box .btn-henshin::before{
content: "\f04e";
font-family: var(--icon-font-family);
color: darkblue;
}
.control-box .btn-henshin[data-step^="-"]::before{
content: "\f04a";
Expand Down Expand Up @@ -3802,6 +3803,7 @@ table .orb-icon
border-radius: 5px;
margin: 4px;
padding: 5px;
m
}
.evo-materials
{
Expand Down Expand Up @@ -3870,25 +3872,23 @@ table .orb-icon

}

.evo-panel-left .evo-type,
.evo-panel-left .evo-type::after
{
.evo-panel-left .evo-type{
display: grid;
font-family: var(--game-font-family);
font-size: 15px;
line-height: 15px;
padding: 4px 0;
}
.evo-panel-left .evo-type
{
display: inline-block;
position: relative;
.evo-panel-left .evo-type::after,
.evo-panel-left .evo-type::before{
grid-area: 1 / 1;
}

.evo-panel-left .evo-type::after
{
-webkit-background-clip: text; /*垃圾Chrome,不支持无前缀的*/
background-clip: text;
color: transparent;
position: absolute;
left: 0;
}

.evo-panel-left .evo-type::before
Expand Down

0 comments on commit 0a66962

Please sign in to comment.