Skip to content

Commit

Permalink
Amending
Browse files Browse the repository at this point in the history
1. try to add auto reload
2. make the content of "supplies:" overflow the block
  • Loading branch information
NoReligion committed Jul 3, 2024
1 parent 309a780 commit 2964adb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
4 changes: 4 additions & 0 deletions css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,10 @@ div.button div.cooldown {
background-color: #DDDDDD;
}

div.button div.auto {
background-color: #BBBBFF
}

/* Up/Down buttons. They're complicated! */

.upBtn, .dnBtn, .upManyBtn, .dnManyBtn {
Expand Down
2 changes: 1 addition & 1 deletion css/path.css
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,5 @@ div.perkRow .row_key {
top: -10px;
max-height: 660px;
width: 475px;
overflow-y: auto;
overflow-y: visible;
}
16 changes: 15 additions & 1 deletion script/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ var Button = {
$(this).data("handler")($(this));
}
})
.data("auto_reload", false)
.dblclick(function() {
var auto = !$(this).data("auto_reload");
$(this).data("auto_reload", auto);
if (auto) {
$('div.cooldown', $(this)).addClass('auto');
} else {
$('div.cooldown', $(this)).removeClass('auto');
}
})
.data("handler", typeof options.click == 'function' ? options.click : function() { Engine.log("click"); })
.data("remaining", 0)
.data("cooldown", typeof options.cooldown == 'number' ? options.cooldown : 0)
Expand Down Expand Up @@ -106,7 +116,11 @@ var Button = {
time /= 2;
}
$('div.cooldown', btn).width(left * 100 +"%").animate({width: '0%'}, time * 1000, 'linear', function() {
Button.clearCooldown(btn, true);
var b = $(this).closest('.button');
Button.clearCooldown(b, true);
if (b.data('auto_reload')) {
b.click();
}
});
btn.addClass('disabled');
btn.data('onCooldown', true);
Expand Down

0 comments on commit 2964adb

Please sign in to comment.