Skip to content

Commit

Permalink
Version 1.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
afbora committed May 21, 2019
1 parent 5a14ce6 commit ab8f1b0
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 13 deletions.
4 changes: 4 additions & 0 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -252,4 +252,8 @@ p.remove-confirm strong {

#footer a:hover {
color: #333;
}

#footer span#total-time {
float: right;
}
50 changes: 40 additions & 10 deletions js/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@ var tasks = {
insert: function (id, project_name, name) {
db.transaction(function (tx) {
tx.executeSql("INSERT INTO tasks (id, project_name, name, time, start, running) VALUES (?, ?, ?, ?, ?, ?)", [id, project_name, name, 0, new Date(), false],
function (tx, result) {
taskInterface.index();
},
onError);
function (tx, result) {
taskInterface.index();
taskInterface.count();
},
onError);
});
},

Expand All @@ -59,11 +60,12 @@ var tasks = {
remove: function (id) {
db.transaction(function (tx) {
tx.executeSql("DELETE FROM tasks WHERE id=?", [id],
function (tx, result) {
window.clearInterval(taskInterface.intervals[id]);
taskInterface.index();
},
onError);
function (tx, result) {
window.clearInterval(taskInterface.intervals[id]);
taskInterface.index();
taskInterface.count();
},
onError);
});
},

Expand All @@ -76,6 +78,7 @@ var tasks = {
}

taskInterface.index();
taskInterface.count();
}, onError);
});
},
Expand All @@ -84,6 +87,7 @@ var tasks = {
db.transaction(function (tx) {
tx.executeSql("UPDATE tasks SET time = ?", [0], function (tx, results) {
taskInterface.index();
taskInterface.count();
}, onError);
});
}
Expand Down Expand Up @@ -255,6 +259,7 @@ var taskInterface = {
db.transaction(function (tx) {
tx.executeSql("UPDATE tasks SET project_name = ?, name = ?, time = ? WHERE id = ?", [project_name, name, taskInterface.sec(time), id], function (tx, results) {
taskInterface.index();
taskInterface.count();
}, onError);
});
});
Expand All @@ -271,6 +276,7 @@ var taskInterface = {
db.transaction(function (tx) {
tx.executeSql("UPDATE tasks SET time = ? WHERE id = ?", [0 , id], function (tx, results) {
taskInterface.index();
taskInterface.count();
}, onError);
});

Expand Down Expand Up @@ -326,10 +332,34 @@ var taskInterface = {
}, null);
});
},

count: function () {
var totalTime = 0;

db.transaction(function (tx) {
tx.executeSql('SELECT * FROM tasks ORDER BY id DESC', [], function (tx, results) {

var len = results.rows.length, i;

if (len > 0)
{
for (i = 0; i < len; i++)
{
var task = results.rows.item(i);
totalTime += task.time;
}
}

$("#total-time-counter").html(taskInterface.hms(totalTime));

}, null);
});
},

init: function () {
this.bind();
this.index();
this.count();
this.toggleRunText();
},

Expand All @@ -348,8 +378,8 @@ var taskInterface = {
taskInterface.startTask(task);
}

taskInterface.count();
taskInterface.toggleRunText();

} else {
alert("Task " + id + " not found sorry!");
}
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"update_url":"http://clients2.google.com/service/update2/crx",
"name": "Simple Time Tracker",
"description": "Simple Time Tracker - How much time spend on tasks?",
"version": "1.0.2",
"version": "1.0.3",
"manifest_version": 2,
"content_security_policy": "script-src 'self'; object-src 'self'",
"icons":
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "SimpleTimeTracker",
"version": "1.0.2",
"version": "1.0.3",
"description": "Simple time tracker extensions for Google Chrome",
"keywords": [
"chrome",
Expand Down
3 changes: 2 additions & 1 deletion popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<title>Simple Time Tracker Aplication for Chrome Extension</title>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="css/style.css"/>
<link rel="SHORTCUT ICON" type="image/ico" href="stt32x32.png"/>
<link rel="shortcut icon" type="image/ico" href="stt32x32.png"/>
</head>
<body>
<div id="holder">
Expand Down Expand Up @@ -76,6 +76,7 @@
<div id="footer">
Dev <a href="http://www.ahmetbora.com/" title="Developer, Ahmet Bora" target="_blank">Ahmet Bora</a> |
<a href="https://twitter.com/afbora" target="_blank">@afbora</a> v<span id="version"></span>
<span id="total-time">Total: <span id="total-time-counter"></span></span>
</div>
</div>
<script type="text/javascript" src="js/jquery-1.6.4.min.js"></script>
Expand Down
3 changes: 3 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ https://chrome.google.com/webstore/detail/simple-time-tracker/ifdmgpcchapjlldljf

# CHANGELOG

1.0.3
- Added total time counter

1.0.2
- Fixed delete confirmations

Expand Down

0 comments on commit ab8f1b0

Please sign in to comment.