diff --git a/src/content/itop.js b/src/content/itop.js new file mode 100644 index 000000000..13fc6dde3 --- /dev/null +++ b/src/content/itop.js @@ -0,0 +1,32 @@ +'use strict'; + +// Main function +togglbutton.render( + // Specify selector for element button needs to hook into + // Make sure to include :not(.toggl) to avoid duplicates + '.ibo-object-details[data-object-class="Incident"] .ibo-panel--header .ibo-panel--header-left .ibo-panel--titles .ibo-panel--title:not(.toggl),.ibo-object-details[data-object-class="Problem"] .ibo-panel--header .ibo-panel--header-left .ibo-panel--titles .ibo-panel--title:not(.toggl),.ibo-object-details[data-object-class="UserRequest"] .ibo-panel--header .ibo-panel--header-left .ibo-panel--titles .ibo-panel--title:not(.toggl)', + { observe: true }, + function (elem) { + // Create timer link element + const link = togglbutton.createTimerLink({ + description: getTitle(elem), + projectName: 'My Project', + tags: [getTitle(elem)] + }); + // You can also pass function to description, projectName, and tags arguments + + // Add Space + elem.appendChild(document.createTextNode (" ")); + // Add link to element + elem.appendChild(link); + } +); + +function getTitle (parent) { + //const el = parent.querySelector('.title'); + return getIncident(parent) + ' - ' + $('.ibo-field[data-attribute-code="title"] .ibo-field--value').textContent.trim(); +} + +function getIncident(parent) { + return parent ? parent.textContent.trim() : ''; +} \ No newline at end of file diff --git a/src/origins.js b/src/origins.js index 4bd39f076..95cb0c286 100644 --- a/src/origins.js +++ b/src/origins.js @@ -281,6 +281,10 @@ export default { url: '*://*.intercom.com/*', name: 'Intercom' }, + 'combodo.com': { + url: '*://*.combodo.com/*', + name: 'iTop' + }, 'jira.com': { url: '*://*.jira.com/*', name: 'Jira',