Skip to content

Commit e11de27

Browse files
committed
feat: reset button
1 parent 72917b8 commit e11de27

3 files changed

Lines changed: 19 additions & 1 deletion

File tree

index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,10 @@ <h3>Misc</h3>
358358
</div>
359359
</div>
360360
<div id="links">
361-
<button id="gen_cfg">Generate</button>
361+
<button id="reset_all">Reset All</button>
362362
<a href="https://github.com/p2sr/p2binder" target="_blank" class="fa-brands fa-github"></a>
363363
<a href="https://discord.com/invite/hRwE4Zr" target="_blank" class="fa-brands fa-discord"></a>
364+
<button id="gen_cfg">Generate</button>
364365
</div>
365366
</main>
366367
</body>

keypanel.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ let g_set_binds = {
1010
"mouse1": [ "+attack", "+attack" ],
1111
"mouse2": [ "+attack2", "+attack2" ],
1212
};
13+
const g_default_binds = JSON.parse(JSON.stringify(g_set_binds));
1314
const BindMode = {
1415
ALL: 0,
1516
CM: 1,
@@ -211,6 +212,13 @@ document.getElementById("reset_bind").addEventListener("click", function() {
211212
updateSelected();
212213
});
213214

215+
document.getElementById("reset_all").addEventListener("click", function() {
216+
g_set_binds = JSON.parse(JSON.stringify(g_default_binds));
217+
218+
updateBound();
219+
updateSelected();
220+
});
221+
214222
document.getElementById("gen_cfg").addEventListener("click", function() {
215223
let file_str = 'bind "mwheelup" "+scrollup"\nbind "mwheeldown" "+scrolldown"\n';
216224

style.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,15 @@ button:hover {
280280
margin: 10px;
281281
}
282282

283+
#reset_all {
284+
padding: 30px;
285+
border: 2px solid var(--key-bg-bound);
286+
}
287+
288+
#reset_all:hover {
289+
background: var(--key-bg-bound-hover);
290+
}
291+
283292
#gen_cfg {
284293
padding: 30px;
285294
}

0 commit comments

Comments
 (0)