mirror of
https://github.com/jlengrand/toggl-button.git
synced 2026-03-10 08:41:17 +00:00
Teamwork.com support initially added
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -3,3 +3,5 @@ node_modules
|
||||
tmp
|
||||
*.pem
|
||||
toggl-button.zip
|
||||
toggl-button.sublime-project
|
||||
toggl-button.sublime-workspace
|
||||
|
||||
@@ -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/*",
|
||||
|
||||
47
src/scripts/content/teamworkpm.js
Normal file
47
src/scripts/content/teamworkpm.js
Normal 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);
|
||||
});
|
||||
@@ -566,3 +566,14 @@ 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;
|
||||
}
|
||||
Reference in New Issue
Block a user