From 84df83976ac070306eef3ad9e01ad63fad95306e Mon Sep 17 00:00:00 2001 From: Renato Pozzi Date: Thu, 5 Dec 2024 10:47:45 +0100 Subject: [PATCH] fix(backlog): add new origin (#2359) * chore(backlog): apply formatting * fix(backlog): add new origin * Update origins.js --- src/content/backlog.js | 48 +++++++++++++++++++++++++----------------- src/origins.js | 5 +++++ 2 files changed, 34 insertions(+), 19 deletions(-) diff --git a/src/content/backlog.js b/src/content/backlog.js index 8a19619eb..850be44b3 100644 --- a/src/content/backlog.js +++ b/src/content/backlog.js @@ -1,23 +1,33 @@ -'use strict'; +/** + * @name Backlog + * @urlAlias backlog.com + * @urlRegex *://*.backlog.com/* + */ -togglbutton.render('#issueArea:not(.toggl)', { observe: true }, function (elem) { - const container = createTag('span', ''); - const ticketNumElem = $('.ticket__key .ticket__key-number', elem); - const titleElem = $('#summary .title-group__title-text', elem); - const projectElem = $('.project-header .header-icon-set__name'); - const containerElem = $('#summary *:first-child'); +'use strict' - const descFunc = function () { - return ticketNumElem.textContent + ' ' + titleElem.textContent; - }; +togglbutton.render( + '#issueArea:not(.toggl)', + { observe: true }, + function (elem) { + const container = createTag('span', '') + const ticketNumElem = $('.ticket__key .ticket__key-number', elem) + const titleElem = $('#summary .title-group__title-text', elem) + const projectElem = $('.project-header .header-icon-set__name') + const containerElem = $('#summary *:first-child') - const link = togglbutton.createTimerLink({ - className: 'Backlog', - description: descFunc, - projectName: projectElem.textContent, - calculateTotal: true - }); + const descFunc = function () { + return ticketNumElem.textContent + ' ' + titleElem.textContent + } - container.appendChild(link); - containerElem.parentNode.appendChild(container, containerElem); -}); + const link = togglbutton.createTimerLink({ + className: 'Backlog', + description: descFunc, + projectName: projectElem.textContent, + calculateTotal: true, + }) + + container.appendChild(link) + containerElem.parentNode.appendChild(container, containerElem) + }, +) diff --git a/src/origins.js b/src/origins.js index f285612f3..9565e839e 100644 --- a/src/origins.js +++ b/src/origins.js @@ -38,6 +38,11 @@ export default { url: '*://*.backlog.jp/*', name: 'Backlog' }, + 'backlog.com': { + url: '*://*.backlog.com/*', + name: 'Backlog', + file: 'backlog.js' + }, 'basecamp.com': { url: '*://*.basecamp.com/*', name: 'Basecamp'