Teamwork.com support initially added

This commit is contained in:
Dan
2014-12-02 14:13:18 +00:00
parent 0f94c30030
commit 3231f77af4
4 changed files with 73 additions and 2 deletions

2
.gitignore vendored
View File

@@ -3,3 +3,5 @@ node_modules
tmp
*.pem
toggl-button.zip
toggl-button.sublime-project
toggl-button.sublime-workspace

View File

@@ -50,7 +50,9 @@
"*://trac-hacks.org/*",
"*://*.trac.wordpress.org/*",
"*://bugs.jquery.com/*",
"*://*.wunderlist.com/*"
"*://*.wunderlist.com/*",
"*://*.teamwork.com/*",
"*://*.teamworkpm.net/*"
],
"icons": {
"16": "images/icon-16.png",
@@ -89,7 +91,9 @@
"*://*.trac.wordpress.org/*",
"*://bugs.jquery.com/*",
"*://*.wunderlist.com/*",
"*://*.toodledo.com/*"
"*://*.toodledo.com/*",
"*://*.teamwork.com/*",
"*://*.teamworkpm.net/*"
],
"css": ["styles/style.css"],
"js": ["scripts/common.js"]
@@ -198,6 +202,13 @@
"matches": ["https://*.todoist.com/app*"],
"js": ["scripts/content/todoist.js"]
},
{
"matches": [
"*://*.teamwork.com/*",
"*://*.teamworkpm.net/*"
],
"js": ["scripts/content/teamworkpm.js"]
},
{
"matches": [
"*://trac.edgewall.org/*",

View File

@@ -0,0 +1,47 @@
/*jslint indent: 2 */
/*global $: false, document: false, togglbutton: false, createTag:false*/
'use strict';
console.log("Load Toggl for Teamwork");
togglbutton.render('div.taskRHS:not(.toggl)', {observe: true}, function (elem) {
var link, className = 'huh', container = $('.taskUsedOps', elem), spanTag;
if (container === null) {
return;
}
if( $('.taskName', elem) === null ) {
return;
}
var desc = $('.taskName', elem).textContent;
link = togglbutton.createTimerLink({
className: 'teamworkpm',
description: desc,
projectName: $("#projectName").innerHTML
});
link.classList.add( className );
link.addEventListener('click', function (e) {
// Run through and hide all others
var i, len, elems = document.querySelectorAll(".toggl-button");
for (i = 0, len = elems.length; i < len; i += 1) {
elems[i].classList.add('huh');
}
if (link.classList.contains( className ) ) {
link.classList.remove( className );
} else {
link.classList.add( className );
}
});
spanTag = document.createElement("span");
link.style.width = 'auto';
spanTag.appendChild(link);
container.insertBefore( spanTag, container.firstChild);
});

View File

@@ -565,4 +565,15 @@ only screen and (min-resolution: 192dpi) {
#toggl-button-edit-form .toggl-button.toodledo {
position: static;
}
/********* TEAMWORKPM *********/
.toggl-button.huh.active {
visibility:visible;
opacity: 1;
}
.taskUsedOps span a.toggl-button {
background-size:contain;
font-weight: normal;
}