Skip to content

Commit

Permalink
Extension structure and instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
mamuso committed Apr 5, 2019
1 parent 5ed3463 commit 335e936
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,22 @@
# close-figma-tab
Close Figma tab if you have "Open in Desktop App" active
# Close Figma Tab - Chrome extension

The extension will automatically close your Chrome tab after the Figma file opens in the [Figma desktop app](https://www.figma.com/downloads/).

## Install from the Chrome Web Store

You know the drill
1. [Install extension](https://chrome.google.com/webstore/detail/close-figma-tab/oonojkdagfgjmempbfipokgjjigkoocj) from Chrome Web Store.
2. Go and open files in Chrome like crazy

## Install it manually:

1. Download the [latest release](https://github.com/mamuso/close-figma-tab/releases/latest) of the extension and unzip it
2. Launch Chrome
3. Go to Extensions (`chrome://extensions/`)
4. Toggle `Developer mode`
5. Click `Load unpacked extension`
6. Select `src` folder inside the unzipped folder

## Something broken?

Please, [file an issue](https://github.com/mamuso/close-figma-tab/issues) in the repository.
Binary file added src/icons/128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/icons/48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/icons/96.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/js/background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) {
if(message.closeThis) chrome.tabs.remove(sender.tab.id);
});
10 changes: 10 additions & 0 deletions src/js/content.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
(function() {
// Adding a delay before chacking
setTimeout(function(){
// Check if the desktop interstitial is open
var interstitial = window.document.querySelectorAll("*[class^=\"desktop_app_interstitial\"]")[0]
if(interstitial) {
chrome.runtime.sendMessage({closeThis: true});
}
}, 5000);
})();
28 changes: 28 additions & 0 deletions src/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "Close Figma Tab",
"version": "0.0.1",
"manifest_version": 2,
"description": "Close Figma tab if you have \"Open in Desktop App\" active",
"homepage_url": "https://github.com/mamuso/close-figma-tab",
"icons": {
"48": "icons/48.png",
"96": "icons/96.png",
"128": "icons/128.png"
},
"background": {
"scripts": [
"js/background.js"
],
"persistent": false
},
"content_scripts": [
{
"matches": ["http://*.figma.com/file/*", "https://*.figma.com/file/*"],
"js": ["js/content.js"],
"run_at": "document_end"
}
],
"permissions": [
"activeTab"
]
}

0 comments on commit 335e936

Please sign in to comment.