diff --git a/src/scripts/origins.js b/src/scripts/origins.js index 0a9d2a8c1..138668221 100644 --- a/src/scripts/origins.js +++ b/src/scripts/origins.js @@ -12,7 +12,7 @@ export default { url: '*://*.any.do/*', name: 'Anydo' }, - 'asana.com': { + 'app.asana.com': { url: '*://app.asana.com/*', name: 'Asana' }, @@ -62,11 +62,11 @@ export default { url: '*://*.bitrix24.com/*', name: 'Bitrix24' }, - 'breeze.pm': { + 'app.breeze.pm': { url: '*://app.breeze.pm/*', name: 'Breeze' }, - 'brokerengine.com.au': { + 'app.brokerengine.com.au': { url: '*://app.brokerengine.com.au/*', name: 'BrokerEngine' }, @@ -90,11 +90,11 @@ export default { url: '*://*.cloudes.me/*', name: 'Cloudes.me' }, - 'clubhouse.io': { + 'app.clubhouse.io': { url: '*://app.clubhouse.io/*', name: 'Clubhouse' }, - 'codeable.io': { + 'app.codeable.io': { url: '*://app.codeable.io/*', name: 'Codeable' }, @@ -232,7 +232,7 @@ export default { url: '*://keep.google.com/*', name: 'Google Keep' }, - 'khanacademy.org': { + 'www.khanacademy.org': { url: '*://www.khanacademy.org/*', name: 'KhanAcademy' }, @@ -240,7 +240,7 @@ export default { url: '*://mail.google.com/*', name: 'Google Mail' }, - 'gqueues.com': { + 'www.gqueues.com': { url: '*://www.gqueues.com/*', name: 'GQueues' }, @@ -248,7 +248,7 @@ export default { url: '*://habitica.com/*', name: 'Habitica' }, - 'heflo.com': { + 'app.heflo.com': { url: '*://app.heflo.com/*', name: 'HEFLO' }, @@ -256,11 +256,11 @@ export default { url: '*://*.helprace.com/*', name: 'Helprace' }, - 'helpscout.net': { + 'secure.helpscout.net': { url: '*://secure.helpscout.net/*', name: 'Helpscout' }, - 'huskymarketingplanner.com': { + 'app.huskymarketingplanner.com': { url: '*://app.huskymarketingplanner.com/*', name: 'Husky Marketing Planner', file: 'husky-marketing-planner.js' @@ -295,7 +295,7 @@ export default { url: '*://*.kantree.io/*', name: 'Kantree' }, - 'liquidplanner.com': { + 'app.liquidplanner.com': { url: '*://app.liquidplanner.com/*', name: 'Liquidplanner' }, @@ -308,7 +308,7 @@ export default { name: 'Mantishub', clone: 'true' }, - 'meistertask.com': { + 'www.meistertask.com': { url: '*://www.meistertask.com/*', name: 'MeisterTask' }, @@ -331,7 +331,7 @@ export default { name: 'Notion', file: 'notion.js' }, - 'nozbe.com': { + 'app.nozbe.com': { url: '*://app.nozbe.com/*', name: 'Nozbe' }, @@ -356,7 +356,7 @@ export default { url: '*://*.onshape.com/*', name: 'Onshape' }, - 'osticket.com': { + 'supportsystem.com': { url: '*://*.supportsystem.com/*', name: 'osTicket', file: 'osticket.js' @@ -493,7 +493,7 @@ export default { url: '*://*.smartboard.cl/*', name: 'Smartboard' }, - 'sourcelair.com': { + 'www.sourcelair.com': { url: '*://www.sourcelair.com/*', name: 'Sourcelair' }, @@ -686,7 +686,7 @@ export default { url: '*://overv.io/*', name: 'Overv' }, - 'teamleader.eu': { + 'app.teamleader.eu': { url: '*://app.teamleader.eu/*', name: 'Teamleader' }, @@ -694,7 +694,7 @@ export default { url: '*://*.manageengine.com/*', name: 'ManageEngine' }, - 'vivifyscrum.com': { + 'app.vivifyscrum.com': { url: '*://app.vivifyscrum.com/*', name: 'VivifyScrum', clone: 'true' @@ -703,7 +703,7 @@ export default { url: '*://*.zammad.com/*', name: 'Zammad' }, - 'zenhub.com': { + 'app.zenhub.com': { url: '*://app.zenhub.com/*', name: 'Zenhub' } diff --git a/src/scripts/settings.js b/src/scripts/settings.js index e2e4dfee1..1f9fc410c 100644 --- a/src/scripts/settings.js +++ b/src/scripts/settings.js @@ -32,6 +32,10 @@ document.querySelector('#close-review-prompt').addEventListener('click', dismiss link.addEventListener('click', changeActiveTab); }); +const isNotTogglApp = (url) => { + return (url || '').match(/toggl\./) === null; +}; + const Settings = { $startAutomatically: null, $stopAutomatically: null, @@ -275,7 +279,7 @@ const Settings = { for (i = 0; i < items.length; i++) { current = items[i].getAttribute('data-host'); - if (current.indexOf('toggl') === -1) { + if (isNotTogglApp(current)) { if (current.indexOf(',') !== -1) { urls = urls.concat(current.split(',')); } else { @@ -283,6 +287,7 @@ const Settings = { } } } + return { origins: urls }; }, setFromTo: async function () { @@ -389,10 +394,24 @@ const Settings = { checked = 'checked'; if (!Settings.origins[key]) { + tmpkey = key; + + // Special case for toggl-button-demo + if (key === 'dom-integration') { + tmpkey = TogglOrigins[key].url + .replace('*://*.', '') + .replace('*://', '') + .replace('/*', ''); + } + // Handle cases where subdomain is used (like web.any.do, we remove web from the beginning) - tmpkey = key.split('.'); - tmpkey.shift(); - tmpkey = tmpkey.join('.'); + const isWildcardDomainRegex = new RegExp(/\/\/\*\./); + if (TogglOrigins[key].url.match(isWildcardDomainRegex)) { + tmpkey = key.split('.'); + tmpkey.shift(); + tmpkey = tmpkey.join('.'); + } + if (!Settings.origins[tmpkey]) { disabled = 'disabled'; checked = ''; @@ -411,7 +430,7 @@ const Settings = { } // Don't show toggl.com as it's not optional - if (key.indexOf('toggl') === -1 && !!TogglOrigins[key].url) { + if (isNotTogglApp(key) && !!TogglOrigins[key].url) { li = document.createElement('li'); li.id = key; li.className = disabled; @@ -595,7 +614,7 @@ const Settings = { } if ( - result.origins[i].indexOf('toggl') === -1 && + isNotTogglApp(result.origins[i]) && result.origins[i] !== '*://*/*' && !skip ) {