Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Chuhukon committed Feb 13, 2016
1 parent 2ae3092 commit 101be5b
Show file tree
Hide file tree
Showing 9 changed files with 313 additions and 34 deletions.
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/spacecamp.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

245 changes: 245 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

61 changes: 29 additions & 32 deletions background.js
@@ -1,58 +1,55 @@

(function() {
(function() {

var calculate = function () {
$("article.todolist").each(function( index ) {
$("article.todolist").each(function (index) {

var done = 0;
var todo = 0;

$(this).find("ul.todos span.content:visible").each(function( index ) {
var regExp = /\(([^)]+)\)/;
var regExp = /\(([^)]+)\)/;

$(this).find("ul.todos span.content:visible").each(function (index) {

var matches = regExp.exec($(this).text());

if(matches)
{
matches.forEach(function(entry) {
if(parseInt(entry)){

if (matches) {
matches.forEach(function (entry) {
if (parseInt(entry)) {
todo = todo + parseInt(entry);
}
});
}
});


$(this).find("ul.completed span.content").each(function (index) {
var regExp = /\(([^)]+)\)/;

var matches = regExp.exec($(this).text());

if(matches)
{
matches.forEach(function(entry) {
if(parseInt(entry)){

if (matches) {
matches.forEach(function (entry) {
if (parseInt(entry)) {
done = done + parseInt(entry);
}
});
}
});

//todo: cleanup previous calculation.. $(this).find("h3").text().replace(/\(*\)/g, "");
$(this).find("h3").append(" ("+ todo +"/"+ done +")");

$(this).find("h3").append(" (" + todo + "/" + done + ")");
});
};

var init = function()
{
//todo: check if you are in basecamp, other wise ignore complete initialization.
$(":checkbox").change(function(){
//todo: only fired once, not when click the checkbox twice..
calculate();
});

calculate(); //run calculate onload..
calculate(); //run calculate onload..
};

init();



$(document).ready(function() {
init();
});

})();


Binary file modified icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions manifest.json
@@ -1,7 +1,7 @@
{
"name": "Spacecamp",
"version": "0.1",
"description": "Scrumbased todo list and item estimations for Basecamp",
"description": "Task estimation for basecamp",
"manifest_version": 2,
"browser_action": {
"name": "Manipulate DOM",
Expand All @@ -11,6 +11,6 @@
"content_scripts": [ {
"js": [ "jquery-2.0.2.min.js", "background.js" ],
"css": ["customStyles.css"],
"matches": [ "http://*/*", "https://*/*"]
"matches": [ "http://basecamp.com/*", "https://basecamp.com/*"]
}]
}

0 comments on commit 101be5b

Please sign in to comment.