Skip to content

Commit

Permalink
Merge branch 'feature/linking-timechimp'
Browse files Browse the repository at this point in the history
  • Loading branch information
Chuhukon committed Aug 27, 2020
2 parents 592b171 + a77282d commit 8460300
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 35 deletions.
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,6 +1,6 @@
The MIT License

Copyright (c) 2010-2015 Google, Inc. http://angularjs.org
Copyright (c) 2014-2020 Marvelous, Inc. http://www.marvelous.nl

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
85 changes: 58 additions & 27 deletions background.js
@@ -1,7 +1,7 @@
(function($, global, document) {

(function() {
var calculate = function () { // progress calculation..

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

var done = 0;
Expand All @@ -21,7 +21,6 @@
}
});


$(this).find("ul.completed a").each(function (index) {

var matches = regExp.exec($(this).text());
Expand All @@ -39,23 +38,22 @@
});
};

var labelit = function() {
var labelit = function() { // label its

var labels = "";
const timeUrlPattern = "https://app.timechimp.com/?text={labels}%20|%20{title}%20|%20Opmerkingen%3A#/registration/time/day";

var labels = [];

var appendLabel = function(html)
{
var re = /(#(\w+)([-](\w+))*)/g, match, matches = [];

while (match = re.exec(html)) {
matches.push(match[1]);
}
var re = /(#(\w+)([-](\w+))*)/g;

for(i=0; i<matches.length; i++)
{
labels = labels + matches[i] + " "
var match = null;
while (match = re.exec(html)) {
labels.push(match[1]);
}
console.log(labels);

//console.log(labels);
}

$("div.thread-entry__content").each(function (index){
Expand All @@ -70,44 +68,77 @@
dom.find("div.thread-entry__content").each(function (index){
//console.log($(this).html());
appendLabel($(this).html());
console.log(labels);
//console.log(labels);
});
})
.always(function(){

console.log("Finished!");
//console.log("Finished!");

var jLabels = labels.join(", ");
var url = timeUrlPattern;
url = url.replace("{labels}", jLabels.replaceAll("#", "%23").replaceAll(",", "%2C").replaceAll(" ", "%20"));
url = url.replace("{title}", $(document).find("title").text());

var html = `
<div class="todos-form__field">
<div class="todos-form__field-label">
<strong>Labels</strong>
</div>
<div class="todos-form__field-content">
<div>`+ labels +`</div>
<div>`+ jLabels + `</div>
</div>
</div>
</div>
`;

var html = html + `
<div class="todos-form__field">
<div class="todos-form__field-label todos-form__field-label--notes">
<strong>Track time</strong>
</div>
<div class="todos-form__field-content">
<div><a href="` + url + `" target="time"><img src="`+ chrome.extension.getURL("icon.png") + `" style="width: 25px; margin-top:10px"/></a></div>
</div>
</div>
</div>
`;

$("section.todo-perma__details").append(html);
});
}


var addDescription = function(){ //timechimp automatic description

var urlParams = new URLSearchParams(window.location.search);

if(urlParams === undefined && !urlParams.has("text"))
return;

$("textarea[ng-model='vm.time.notes']").val(urlParams.get("text"));
$("textarea[ng-model='vm.time.notes']")[0].dispatchEvent(new Event("change", { bubbles: true }));

}

var init = function()
global.initializeSpaceCamp = function()
{
calculate(); //run calculate onload..
labelit();
};

var isTimechimp = window.location.hostname.toLowerCase() === "app.timechimp.com";

if(isTimechimp)
{
addDescription();
}
else //basecamp
{
calculate(); //run calculate onload..
labelit();
}
};

$(document).ready(function() {
init();
});
})(jQuery, window, document);

})();
$(document).ready(function() {
window.initializeSpaceCamp();
});


13 changes: 8 additions & 5 deletions manifest.json
@@ -1,16 +1,19 @@
{
"name": "Spacecamp",
"version": "0.3",
"description": "Task estimation for basecamp 3",
"version": "1.1.5",
"description": "Extra project management while using Basecamp 3.",
"manifest_version": 2,
"browser_action": {
"name": "Manipulate DOM",
"icons": ["icon.png"],
"default_icon": "icon.png"
},
"content_scripts": [ {
"run_at": "document_idle",
"js": [ "jquery-2.0.2.min.js", "background.js" ],
"css": ["customStyles.css"],
"matches": [ "http://3.basecamp.com/*", "https://3.basecamp.com/*"]
}]
"matches": [ "https://3.basecamp.com/*", "https://app.timechimp.com/*"]
}],
"web_accessible_resources": [
"*.png"
]
}
13 changes: 13 additions & 0 deletions privacy.md
@@ -0,0 +1,13 @@
Privacy Policy Spacecamp browser plugin.

Your privacy is important to us. It is Marvelous' policy to respect your privacy. We do not ask or collect any personal while using this plugin.

We don’t share any personally identifying information publicly or with third-parties.

Our addon is executed on external sites (basecamp and timechimp) that are not operated by us. Please be aware that we have no control over the content and practices of these sites, and cannot accept responsibility or liability for their respective privacy policies.

You are free to refuse our request for your personal information, with the understanding that we may be unable to provide you with some of your desired services.

Your continued use of our plugin will be regarded as acceptance of our practices around privacy and personal information. If you have any questions about how we handle user data and personal information, feel free to contact us.

This policy is effective as of 27 August 2020.
5 changes: 3 additions & 2 deletions readme.md
@@ -1,5 +1,6 @@
Spacecamp
================================

Spacecamp is a Chrome extension that adds scrum like estimations to your Basecamp 3 todo items and lists. You can find the source on Github;
https://github.com/ismarvelous/spacecamp. There is also a v0.1 that only has support for Basecamp 2. If you don't see the calculation press - CRTL-F5.
Spacecamp is a browser extension that adds extra project management power to your basecamp project portal(s). It allows users to do scrum like estimations on theire Basecamp 3 todo items and lists (screenshot 1). And adds labels and time tracking (via timechimp) to your todo items (screenshot 2 and 3).

You can find the source on Github; https://github.com/ismarvelous/spacecamp. There is also a v0.1 that only has support for Basecamp 2. If you don't see the calculation press - CRTL-F5.

0 comments on commit 8460300

Please sign in to comment.