aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2017-03-18 15:48:21 +0100
committerTeddy Wing2017-03-18 15:48:21 +0100
commit93518f18ff1a12a660b25596be3832f5d94c3fd5 (patch)
treeab4fdd8295f1719d3daa73b0c9967d31717fafa9
parentfd4ea4cd17d0e24ae0f68f147e97cb73364400b2 (diff)
downloadchrome-timetasker-93518f18ff1a12a660b25596be3832f5d94c3fd5.tar.bz2
Add initial timetasker.js
Rough approach at filling in the first row in the form. Trouble is that the "module" select box doesn't get populated until the "project" select box receives click/selection event. Will need to figure out a way around that.
-rw-r--r--timetasker.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/timetasker.js b/timetasker.js
new file mode 100644
index 0000000..b700deb
--- /dev/null
+++ b/timetasker.js
@@ -0,0 +1,48 @@
+(function() {
+ var CLIENT = 'af83';
+ var PROJECT = 'Enroute';
+ var MODULE = 'Sprint 3';
+ var TASK = 'General Time - No Task';
+ var WORK_TYPE = 'Développeur';
+ var TIME = 7;
+ var BILLABLE = true;
+
+
+ var client_0 = document.getElementById('f_clientID0');
+ var project_0 = document.getElementById('f_projectID0');
+ var module_0 = document.getElementById('f_moduleID0');
+ var task_0 = document.getElementById('f_taskID0');
+ var work_type_0 = document.getElementById('f_worktypeID0');
+ var date_0 = document.getElementById('f_date0');
+ var time_0 = document.getElementById('f_time0');
+ var billable_0 = document.getElementById('f_billable0');
+
+
+ popupate_select(client_0, CLIENT);
+ popupate_select(project_0, PROJECT);
+ // need to add a damn event trigger in order to get options to load
+ window.setTimeout(function() {
+ popupate_select(module_0, MODULE);
+ }, 1500);
+ window.setTimeout(function() {
+ popupate_select(task_0, TASK);
+ }, 500);
+ window.setTimeout(function() {
+ popupate_select(work_type_0, WORK_TYPE);
+ }, 500);
+ // popupate_select(date_0, '');
+ popupate_select(time_0, TIME);
+ popupate_select(billable_0, BILLABLE ? 't' : 'f');
+
+
+ function popupate_select(element, name) {
+ var options = element.getElementsByTagName('option');
+
+ for (var i = 0; i < options.length; i++) {
+ if (options[i].textContent === name) {
+ element.value = options[i].value;
+ return;
+ }
+ }
+ }
+})();