From 5ff9d6ff22d23964d5273d2ea1e052ba6cc53710 Mon Sep 17 00:00:00 2001 From: ferricles Date: Sun, 22 May 2022 00:50:53 -0700 Subject: [PATCH 1/3] spell detail clickable indicator added --- builder/index.html | 36 +++++++++++++++---------------- js/sq2display.js | 37 ++++++++++++++++++++++++++++++++ media/icons/new/toggle_down.png | Bin 0 -> 834 bytes media/icons/new/toggle_up.png | Bin 0 -> 809 bytes media/icons/old/toggle_down.png | Bin 0 -> 834 bytes media/icons/old/toggle_up.png | Bin 0 -> 809 bytes 6 files changed, 55 insertions(+), 18 deletions(-) create mode 100644 media/icons/new/toggle_down.png create mode 100644 media/icons/new/toggle_up.png create mode 100644 media/icons/old/toggle_down.png create mode 100644 media/icons/old/toggle_up.png diff --git a/builder/index.html b/builder/index.html index c49ccb4..03bdedd 100644 --- a/builder/index.html +++ b/builder/index.html @@ -1240,31 +1240,31 @@
-
-
melee
+
+
melee
-
-
poison
+
+
poison
-
-
spell1
- +
+
spell1
+
-
-
spell2
- +
+
spell2
+
-
-
spell3
- +
+
spell3
+
-
-
spell4
- +
+
spell4
+
-
-
+
+
diff --git a/js/sq2display.js b/js/sq2display.js index b6b588b..7043e8e 100644 --- a/js/sq2display.js +++ b/js/sq2display.js @@ -1411,6 +1411,43 @@ function displaysq2SpellDamage(parent_elem, overallparent_elem, build, spell, sp part_divavg.append(overallaverageLabel); } } + + //up and down arrow - done ugly + + + + let down_arrow = document.createElement("img"); + down_arrow.id = "down_arrow_" + overallparent_elem.id; + down_arrow.style.maxWidth = document.body.clientWidth > 900 ? "3rem" : "10rem"; + down_arrow.src = "../media/icons/" + (newIcons ? "new" : "old") + "/toggle_down.png"; + overallparent_elem.appendChild(down_arrow); + + let up_arrow = document.createElement("img"); + up_arrow.id = "up_arrow_" + overallparent_elem.id; + up_arrow.style.maxWidth = document.body.clientWidth > 900 ? "3rem" : "10rem"; + up_arrow.src = "../media/icons/" + (newIcons ? "new" : "old") + "/toggle_up.png"; + up_arrow.style.display = "none"; + overallparent_elem.appendChild(up_arrow); + + overallparent_elem.setAttribute("onclick", overallparent_elem.getAttribute("onclick") + `;toggleUpDownArrow("${overallparent_elem.id}")`); +} + +function toggleUpDownArrow(parent_id) { + parent_elem = document.getElementById(parent_id); + if (parent_elem) { + let down_arrow = document.getElementById("down_arrow_" + parent_id); + if (down_arrow.style.display === "none") { + down_arrow.style.display = ""; + } else { + down_arrow.style.display = "none"; + } + let up_arrow = document.getElementById("up_arrow_" + parent_id); + if (up_arrow.style.display === "none") { + up_arrow.style.display = ""; + } else { + up_arrow.style.display = "none"; + } + } } function displaysq2EquipOrder(parent_elem, buildOrder){ diff --git a/media/icons/new/toggle_down.png b/media/icons/new/toggle_down.png new file mode 100644 index 0000000000000000000000000000000000000000..4154d3dfdd23fbaf463e792dd232f9bf05b761b7 GIT binary patch literal 834 zcmV-I1HJr-P)Px%{7FPXRCt{2)JvA*FbqRcWPw?27T7(glPfK1l9?qdPAC_?}dZS~u(0&G!+0Gu7^w8I71q6`7dcBR8E6<~`p z1aOyLz16J%Ta+Py-bQrQkOFK`h5*hQ-A}^{utgaH*m7ql-CBSx$`HWYtR9+HfGx@p zsK=puEDEqi83K8^_07Msar-feG6XVk>=x;#Usemo`G;r!1AuK&I%Km@qC5n^T#j9_ z)f0zG#PNX=WeCjT*a=7a;B;{~K3t*-efEb4H*j|jJ6|AR}e%a&p+967k&L9`nP^|NaT0xEFLxfDC= zVSjv$Ye*so1oOD&S;~{?6pvWr8lEh{!5FT&m2ze`-GkP+hALyAaGYyCrTiI9{kS!* zVapyg{LeLqQmrhOdFUF~5LOCcCFIRd*@rI?PK-dVyfK6ogcetjpEwxE2EvRz$Vp5L z=K$A`O9Xue*F2Dg{TS3quHlzBfRSAH&d$$aXdSp7g~Va>;JROSdmRJp%=K6#4rVWQ zSO>!#h(n5lUDd>3Z^D83VJBe76L5I*FnhEZ_+%X9c+41|Fnlwv#~STWUFRspn`LG! z!kFt3yB@IXyd>Y5RmW0-a6RtXhwVBSY5r`mjRghddh~Z4yzBcVN-r9g6CLBT0*Wk~7a3_^p;W|bkO zhpPw>x*A=ElpcB_OcPx%<4Ht8RCt{2)InC;KoA7b=75}*115_A$s?9!TN+Kx%>TPUu%+(mdMoJQUv1pkS%ToqE`*^Qy|7 z+3GAMOzIJjcEG7~tQv2YGqZ@!9BO-J%ofA%z(Mw7_WaAhFXHg>*a?Q*kOLcsU9HJr zPv(%uXNT)B%o8}6xux#cZjUp-7o{FWmBVN$b?+)V^VWlHD`9GdZEdizwl;y#B+|$194`NBs zo;$m(%a>aQ^yB{iy6g)L9rCPxmrcK9_2I%uR=n5KKX}CUkD?6!q0V+M< zRjvD}NdYQ7;A}0r>a+q>dcalA>a9ZssPur|j&#`51*r6ZWY2WkLj|bxfD!HW+hzeO nJzyrcy6(FG6&|pPuipC&A#A~L#C|)I00000NkvXXu0mjfx^j(4 literal 0 HcmV?d00001 diff --git a/media/icons/old/toggle_down.png b/media/icons/old/toggle_down.png new file mode 100644 index 0000000000000000000000000000000000000000..4154d3dfdd23fbaf463e792dd232f9bf05b761b7 GIT binary patch literal 834 zcmV-I1HJr-P)Px%{7FPXRCt{2)JvA*FbqRcWPw?27T7(glPfK1l9?qdPAC_?}dZS~u(0&G!+0Gu7^w8I71q6`7dcBR8E6<~`p z1aOyLz16J%Ta+Py-bQrQkOFK`h5*hQ-A}^{utgaH*m7ql-CBSx$`HWYtR9+HfGx@p zsK=puEDEqi83K8^_07Msar-feG6XVk>=x;#Usemo`G;r!1AuK&I%Km@qC5n^T#j9_ z)f0zG#PNX=WeCjT*a=7a;B;{~K3t*-efEb4H*j|jJ6|AR}e%a&p+967k&L9`nP^|NaT0xEFLxfDC= zVSjv$Ye*so1oOD&S;~{?6pvWr8lEh{!5FT&m2ze`-GkP+hALyAaGYyCrTiI9{kS!* zVapyg{LeLqQmrhOdFUF~5LOCcCFIRd*@rI?PK-dVyfK6ogcetjpEwxE2EvRz$Vp5L z=K$A`O9Xue*F2Dg{TS3quHlzBfRSAH&d$$aXdSp7g~Va>;JROSdmRJp%=K6#4rVWQ zSO>!#h(n5lUDd>3Z^D83VJBe76L5I*FnhEZ_+%X9c+41|Fnlwv#~STWUFRspn`LG! z!kFt3yB@IXyd>Y5RmW0-a6RtXhwVBSY5r`mjRghddh~Z4yzBcVN-r9g6CLBT0*Wk~7a3_^p;W|bkO zhpPw>x*A=ElpcB_OcPx%<4Ht8RCt{2)InC;KoA7b=75}*115_A$s?9!TN+Kx%>TPUu%+(mdMoJQUv1pkS%ToqE`*^Qy|7 z+3GAMOzIJjcEG7~tQv2YGqZ@!9BO-J%ofA%z(Mw7_WaAhFXHg>*a?Q*kOLcsU9HJr zPv(%uXNT)B%o8}6xux#cZjUp-7o{FWmBVN$b?+)V^VWlHD`9GdZEdizwl;y#B+|$194`NBs zo;$m(%a>aQ^yB{iy6g)L9rCPxmrcK9_2I%uR=n5KKX}CUkD?6!q0V+M< zRjvD}NdYQ7;A}0r>a+q>dcalA>a9ZssPur|j&#`51*r6ZWY2WkLj|bxfD!HW+hzeO nJzyrcy6(FG6&|pPuipC&A#A~L#C|)I00000NkvXXu0mjfx^j(4 literal 0 HcmV?d00001 From e46ea31ba5e6e18a8b9c0418784c8d156efb869d Mon Sep 17 00:00:00 2001 From: ferricles Date: Sun, 22 May 2022 01:10:55 -0700 Subject: [PATCH 2/3] refactored changes to more appropriate places --- js/sq2bs.js | 7 +++++++ js/sq2display.js | 40 +++++----------------------------------- 2 files changed, 12 insertions(+), 35 deletions(-) diff --git a/js/sq2bs.js b/js/sq2bs.js index 25ac2d2..268ca34 100644 --- a/js/sq2bs.js +++ b/js/sq2bs.js @@ -236,6 +236,13 @@ function toggle_spell_tab(tab) { } else { document.querySelector("#"+tab).style.display = "none"; } + + let arrow_img = document.querySelector("#" + "arrow_" + tab + "Avg"); + if (arrow_img.src.includes("down")) { + arrow_img.src = arrow_img.src.replace("down", "up"); + } else { + arrow_img.src = arrow_img.src.replace("up", "down"); + } } function toggle_boost_tab(tab) { diff --git a/js/sq2display.js b/js/sq2display.js index 7043e8e..4977740 100644 --- a/js/sq2display.js +++ b/js/sq2display.js @@ -1413,41 +1413,11 @@ function displaysq2SpellDamage(parent_elem, overallparent_elem, build, spell, sp } //up and down arrow - done ugly - - - - let down_arrow = document.createElement("img"); - down_arrow.id = "down_arrow_" + overallparent_elem.id; - down_arrow.style.maxWidth = document.body.clientWidth > 900 ? "3rem" : "10rem"; - down_arrow.src = "../media/icons/" + (newIcons ? "new" : "old") + "/toggle_down.png"; - overallparent_elem.appendChild(down_arrow); - - let up_arrow = document.createElement("img"); - up_arrow.id = "up_arrow_" + overallparent_elem.id; - up_arrow.style.maxWidth = document.body.clientWidth > 900 ? "3rem" : "10rem"; - up_arrow.src = "../media/icons/" + (newIcons ? "new" : "old") + "/toggle_up.png"; - up_arrow.style.display = "none"; - overallparent_elem.appendChild(up_arrow); - - overallparent_elem.setAttribute("onclick", overallparent_elem.getAttribute("onclick") + `;toggleUpDownArrow("${overallparent_elem.id}")`); -} - -function toggleUpDownArrow(parent_id) { - parent_elem = document.getElementById(parent_id); - if (parent_elem) { - let down_arrow = document.getElementById("down_arrow_" + parent_id); - if (down_arrow.style.display === "none") { - down_arrow.style.display = ""; - } else { - down_arrow.style.display = "none"; - } - let up_arrow = document.getElementById("up_arrow_" + parent_id); - if (up_arrow.style.display === "none") { - up_arrow.style.display = ""; - } else { - up_arrow.style.display = "none"; - } - } + let arrow = document.createElement("img"); + arrow.id = "arrow_" + overallparent_elem.id; + arrow.style.maxWidth = document.body.clientWidth > 900 ? "3rem" : "10rem"; + arrow.src = "../media/icons/" + (newIcons ? "new" : "old") + "/toggle_down.png"; + overallparent_elem.appendChild(arrow); } function displaysq2EquipOrder(parent_elem, buildOrder){ From 20fe476f32a8a10568eb4b7c7bd57358753bbb33 Mon Sep 17 00:00:00 2001 From: ferricles Date: Sun, 22 May 2022 01:20:07 -0700 Subject: [PATCH 3/3] more code cleanup --- js/sq2bs.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/js/sq2bs.js b/js/sq2bs.js index 268ca34..460fcd1 100644 --- a/js/sq2bs.js +++ b/js/sq2bs.js @@ -231,16 +231,12 @@ function show_tab(tab) { } function toggle_spell_tab(tab) { + let arrow_img = document.querySelector("#" + "arrow_" + tab + "Avg"); if (document.querySelector("#"+tab).style.display == "none") { document.querySelector("#"+tab).style.display = ""; - } else { - document.querySelector("#"+tab).style.display = "none"; - } - - let arrow_img = document.querySelector("#" + "arrow_" + tab + "Avg"); - if (arrow_img.src.includes("down")) { arrow_img.src = arrow_img.src.replace("down", "up"); } else { + document.querySelector("#"+tab).style.display = "none"; arrow_img.src = arrow_img.src.replace("up", "down"); } }