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 da675b7
Show file tree
Hide file tree
Showing 3 changed files with 57 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 Freedcamp
* @urlAlias freedcamp.com
* @urlRegex *://*.freedcamp.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);
}
);
5 changes: 5 additions & 0 deletions src/origins.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,11 @@ export default {
url: '*://*.fogbugz.com/*',
name: 'Fogbugz'
},
'freedcamp.com': {
url: '*://*.freedcamp.com/*',
name: 'Freedcamp',
file: 'freedcamp.js'
},
'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 da675b7

Please sign in to comment.