chore: add support for Content scripts (#182)

* chore: add support for Content scripts

* chore: run script bae on browser

* chore: content script supporting canva website

* chore: add 2 minutes debounce for onclik events

* chore: add debounce for keypress events
This commit is contained in:
Juan Sebastian velez Posada
2023-03-28 17:59:15 -05:00
committed by GitHub
parent c2ead5149d
commit 7d795f854f
14 changed files with 346 additions and 419 deletions

14
src/utils/index.ts Normal file
View File

@@ -0,0 +1,14 @@
export const IS_EDGE = navigator.userAgent.includes('Edg');
export const IS_FIREFOX = navigator.userAgent.includes('Firefox');
export const IS_CHROME = IS_EDGE === false && IS_FIREFOX === false;
export const generateProjectFromDevSites = (url: string): string | null => {
const githubUrls = ['https://github.com/', 'https://github.dev/'];
for (const githubUrl of githubUrls) {
if (url.startsWith(githubUrl)) {
const newUrl = url.replace(githubUrl, '');
return newUrl.split('/')[1] || null;
}
}
return null;
};