Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: Freedcamp integration #2284

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
Loading