Skip to content

Commit

Permalink
feat: Freedcamp integration
Browse files Browse the repository at this point in the history
  • Loading branch information
lewebsimple authored and with-shrey committed Mar 18, 2024
1 parent 7fce794 commit 707a8cb
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
47 changes: 47 additions & 0 deletions src/content/freedcamp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* @name SampleScript
* @urlAlias script_a_shortcode
* @urlRegex app.sample.com
*/
'use strict';

function tagsSelector() {
const tagsElem = document.querySelectorAll('.AgTagItem--fk-AgTagItem');
const tags = [...tagsElem].map(tagEl => tagEl.textContent.trim())
return tags
}

togglbutton.render(
'.AgListViewTask--fk-AgListViewTask-Body:not(.toggl)',
{ observe: true },
function (elem) {
const projectElem = $('.AgSidebarCurrentProject--fk-AgSidebarContext-ProjText')

const descriptionElem = $('.AgListViewTask--fk-AgListViewTask-Title', elem);
const link = togglbutton.createTimerLink({
buttonType: 'minimal',
className: 'freedcamp',
projectName: projectElem?.textContent,
description: descriptionElem?.textContent,
});
elem.appendChild(link);
}
);


togglbutton.render(
'.ItemViewSubheader--fk-ItemBasicFields-Title:not(.toggl)',
{ observe: true },
function (elem) {
const projectElem = $('.AgSidebarCurrentProject--fk-AgSidebarContext-ProjText')
const descriptionElem = $('.ItemViewSubheader--fk-ItemBasicFields-Title');
const link = togglbutton.createTimerLink({
buttonType: 'minimal',
className: 'freedcamp',
projectName: projectElem?.textContent,
description: descriptionElem?.textContent,
tags: tagsSelector
});
elem.parentNode.insertBefore(link, elem.nextSibling);
}
);
4 changes: 4 additions & 0 deletions src/origins.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ export default {
url: '*://*.fogbugz.com/*',
name: 'Fogbugz'
},
'freedcamp.com': {
url: '*://*.freedcamp.com/*',
name: 'Freedcamp'
},
'freshdesk.com': {
url: '*://*.freshdesk.com/*',
name: 'Freshdesk'
Expand Down
5 changes: 5 additions & 0 deletions src/styles/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1514,3 +1514,8 @@ body.notion-body.dark .toggl-button.notion {
margin-top: 5px;
z-index: 9999;
}

/********* Freedcamp *********/
.toggl-button.freedcamp {
margin-top: 5px;
}

0 comments on commit 707a8cb

Please sign in to comment.