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:
committed by
GitHub
parent
c2ead5149d
commit
7d795f854f
14
src/utils/index.ts
Normal file
14
src/utils/index.ts
Normal 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;
|
||||
};
|
||||
Reference in New Issue
Block a user