diff --git a/src/content/freedcamp.js b/src/content/freedcamp.js new file mode 100644 index 000000000..cf2a4570a --- /dev/null +++ b/src/content/freedcamp.js @@ -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); + } +); diff --git a/src/origins.js b/src/origins.js index fdf56e9ea..8f0e64322 100644 --- a/src/origins.js +++ b/src/origins.js @@ -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' diff --git a/src/styles/style.css b/src/styles/style.css index c28a0453f..ed8336ddc 100644 --- a/src/styles/style.css +++ b/src/styles/style.css @@ -1514,3 +1514,8 @@ body.notion-body.dark .toggl-button.notion { margin-top: 5px; z-index: 9999; } + +/********* Freedcamp *********/ +.toggl-button.freedcamp { + margin-top: 5px; +}