aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2017-03-20 00:50:08 +0100
committerTeddy Wing2017-03-20 00:50:08 +0100
commitda8f3df2fa59dbc836bb1691509c5c8bf385f89b (patch)
tree050956de5b5eec5bf3a764de7ae349fa20006a0c
parent9a489a61c48c0a932f3b6a7273800428e2dde92d (diff)
downloadchrome-timetasker-da8f3df2fa59dbc836bb1691509c5c8bf385f89b.tar.bz2
timetasker.js: Fix the "billable" checkbox auto-fill
The checkbox wasn't getting filled in correctly. By some overzealous and uncaught copy-pasting, I had wrapped the field in the function to populate a select box. Since this is a checkbox, we want to use its `.checked` property instead. Use a timeout also. By default Time Task marks Billable as true/checked. If the script unchecks the box and then the AJAX select box population occurs, the check box re-checks itself. Adding a timeout allows it to remain unchecked if you've set that in the user options.
-rw-r--r--timetasker.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/timetasker.js b/timetasker.js
index 31fe526..fb653f3 100644
--- a/timetasker.js
+++ b/timetasker.js
@@ -39,7 +39,10 @@ function timetasker (fields) {
}, 500);
time_0.value = fields.time;
- populate_select(billable_0, fields.billable ? 't' : 'f');
+
+ window.setTimeout(function() {
+ billable_0.checked = fields.billable;
+ }, 500);
window.setTimeout(function() {