Skip to content

Commit

Permalink
Adds basic plugin for Figma (web version only, not desktop client)
Browse files Browse the repository at this point in the history
Closes issue #953
  • Loading branch information
rileypaulsen committed Jun 29, 2023
1 parent 2834b48 commit 50852aa
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -1955,6 +1955,10 @@
{
"js": ["plugins/letterboxd.js"],
"matches": ["*://*.letterboxd.com/*"]
},
{
"js": ["plugins/figma.js"],
"matches": ["*://*.figma.com/files/*"]
}
]
}
21 changes: 21 additions & 0 deletions plugins/figma.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
var hoverZoomPlugins = hoverZoomPlugins || [];
hoverZoomPlugins.push({
name:'figma.com',
version:'0.1',
prepareImgLinks:function (callback) {
var res = [];
$('[class*=generic_tile_thumbnail--thumbnailFullWidth]').each(function () {
var elem = $(this);

var url = hoverZoom.getThumbUrl(this);

var target = elem.parents('a');
if (target.length > 0) elem = $(target[0]);

elem.data().hoverZoomSrc = [url];
res.push(elem);
});

callback($(res));
}
});

0 comments on commit 50852aa

Please sign in to comment.