Skip to content

Commit 8079808

Browse files
lewebsimplewith-shrey
authored andcommitted
feat: Freedcamp integration
1 parent 291f01c commit 8079808

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

src/content/freedcamp.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/**
2+
* @name SampleScript
3+
* @urlAlias script_a_shortcode
4+
* @urlRegex app.sample.com
5+
*/
6+
'use strict';
7+
8+
function tagsSelector() {
9+
const tagsElem = document.querySelectorAll('.AgTagItem--fk-AgTagItem');
10+
const tags = [...tagsElem].map(tagEl => tagEl.textContent.trim())
11+
return tags
12+
}
13+
14+
togglbutton.render(
15+
'.AgListViewTask--fk-AgListViewTask-Body:not(.toggl)',
16+
{ observe: true },
17+
function (elem) {
18+
const projectElem = $('.AgSidebarCurrentProject--fk-AgSidebarContext-ProjText')
19+
20+
const descriptionElem = $('.AgListViewTask--fk-AgListViewTask-Title', elem);
21+
const link = togglbutton.createTimerLink({
22+
buttonType: 'minimal',
23+
className: 'freedcamp',
24+
projectName: projectElem?.textContent,
25+
description: descriptionElem?.textContent,
26+
});
27+
elem.appendChild(link);
28+
}
29+
);
30+
31+
32+
togglbutton.render(
33+
'.ItemViewSubheader--fk-ItemBasicFields-Title:not(.toggl)',
34+
{ observe: true },
35+
function (elem) {
36+
const projectElem = $('.AgSidebarCurrentProject--fk-AgSidebarContext-ProjText')
37+
const descriptionElem = $('.ItemViewSubheader--fk-ItemBasicFields-Title');
38+
const link = togglbutton.createTimerLink({
39+
buttonType: 'minimal',
40+
className: 'freedcamp',
41+
projectName: projectElem?.textContent,
42+
description: descriptionElem?.textContent,
43+
tags: tagsSelector
44+
});
45+
elem.parentNode.insertBefore(link, elem.nextSibling);
46+
}
47+
);

src/origins.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,10 @@ export default {
196196
url: '*://*.fogbugz.com/*',
197197
name: 'Fogbugz'
198198
},
199+
'freedcamp.com': {
200+
url: '*://*.freedcamp.com/*',
201+
name: 'Freedcamp'
202+
},
199203
'freshdesk.com': {
200204
url: '*://*.freshdesk.com/*',
201205
name: 'Freshdesk'

src/styles/style.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,3 +1507,9 @@ body.notion-body.dark .toggl-button.notion {
15071507
.toggl-button.linear-table {
15081508
margin-top: 5px;
15091509
}
1510+
1511+
1512+
/********* Freedcamp *********/
1513+
.toggl-button.freedcamp {
1514+
margin-top: 5px;
1515+
}

0 commit comments

Comments
 (0)