Skip to content

Commit

Permalink
add support for popup
Browse files Browse the repository at this point in the history
  • Loading branch information
pomdtr committed Jan 27, 2024
1 parent c9f919e commit 08385d5
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 10 deletions.
1 change: 1 addition & 0 deletions extension/chrome/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"service_worker": "worker.js"
},
"action": {
"default_popup": "./popup.html",
"default_icon": {
"16": "./icons/[email protected]",
"24": "./icons/[email protected]",
Expand Down
2 changes: 1 addition & 1 deletion extension/chrome/panel.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
height: 100%;
}
</style>
<script type="module" src="panel.js" defer></script>
<script type="module" src="terminal.js" defer></script>
</head>

<body></body>
Expand Down
28 changes: 28 additions & 0 deletions extension/chrome/popup.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!doctype html>
<html>

<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Tweety</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
body {
margin: 0px;
width: 750px;
height: 450px;
}

iframe {
display: block;
border: 0px;
width: 100%;
height: 100%;
}
</style>
<script type="module" src="terminal.js" defer></script>
</head>

<body></body>

</html>
File renamed without changes.
9 changes: 5 additions & 4 deletions extension/chrome/worker.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
chrome.runtime.onInstalled.addListener(function () {
console.log("onInstalled");
chrome.contextMenus.removeAll();
chrome.contextMenus.create({
id: "create_terminal_tab",
title: "Create Terminal Tab",
contexts: ["action"],
});
chrome.contextMenus.create({
id: "create_terminal_window",
title: "Create Terminal Window",
Expand All @@ -12,10 +17,6 @@ chrome.contextMenus.onClicked.addListener(function (info) {
handleCommand(info.menuItemId);
});

chrome.action.onClicked.addListener(function () {
handleCommand("create_terminal_tab");
});

chrome.commands.onCommand.addListener(handleCommand);

async function handleCommand(command) {
Expand Down
1 change: 1 addition & 0 deletions extension/firefox/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
]
},
"action": {
"default_popup": "./popup.html",
"default_icon": {
"16": "./icons/[email protected]",
"24": "./icons/[email protected]",
Expand Down
2 changes: 1 addition & 1 deletion extension/firefox/panel.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
height: 100%;
}
</style>
<script type="module" src="panel.js" defer></script>
<script type="module" src="terminal.js" defer></script>
</head>

<body></body>
Expand Down
28 changes: 28 additions & 0 deletions extension/firefox/popup.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!doctype html>
<html>

<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Tweety</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
body {
margin: 0px;
width: 750px;
height: 450px;
}

iframe {
display: block;
border: 0px;
width: 100%;
height: 100%;
}
</style>
<script type="module" src="terminal.js" defer></script>
</head>

<body></body>

</html>
File renamed without changes.
9 changes: 5 additions & 4 deletions extension/firefox/worker.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
chrome.runtime.onInstalled.addListener(function () {
console.log("onInstalled");
chrome.contextMenus.removeAll();
chrome.contextMenus.create({
id: "create_terminal_tab",
title: "Create Terminal Tab",
contexts: ["action"],
});
chrome.contextMenus.create({
id: "create_terminal_window",
title: "Create Terminal Window",
Expand All @@ -12,10 +17,6 @@ chrome.contextMenus.onClicked.addListener(function (info) {
handleCommand(info.menuItemId);
});

chrome.action.onClicked.addListener(function () {
handleCommand("create_terminal_tab");
});

chrome.commands.onCommand.addListener(handleCommand);

async function handleCommand(command) {
Expand Down

0 comments on commit 08385d5

Please sign in to comment.