-
Notifications
You must be signed in to change notification settings - Fork 569
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(figma): Add Figma Integration (#2283)
* feat(figma): Add figma integration * Update origins.js * fix(figma): fix styles and unclickable issue
- Loading branch information
1 parent
291f01c
commit 7fce794
Showing
3 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* @name Figma | ||
* @urlAlias figma.com | ||
* @urlRegex *://*.figma.com/* | ||
*/ | ||
'use strict'; | ||
|
||
togglbutton.render( | ||
'div[aria-label="Main toolbar"]:not(.toggl)', | ||
{ observe: true }, | ||
function (elem) { | ||
const titleElem = $('span[aria-label="File name"]', elem).parentElement | ||
const titles = [] | ||
for (let children of titleElem.children){ | ||
if(children.textContent.trim() !== '') titles.push(children.textContent.trim()) | ||
// Test after file name is useless | ||
if(children.ariaLabel === 'File name') break | ||
} | ||
const text = titles.join(' / ') | ||
|
||
const container = elem.lastChild; | ||
|
||
const link = togglbutton.createTimerLink({ | ||
className: 'figma', | ||
description: text, | ||
buttonType: 'minimal' | ||
}); | ||
|
||
if($('div[aria-label="Main toolbar"] .toggl-button.figma')){ | ||
$('div[aria-label="Main toolbar"] .toggl-button.figma').remove() | ||
} | ||
container.prepend(link); | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters