Skip to content

Commit c33636a

Browse files
committed
change: clicking the toolbar button opens the detection in a popup window
add: clicking the toolbar button with the middle mouse button opens the detection in a tab as before add: toolbar button title
1 parent 7053427 commit c33636a

File tree

4 files changed

+25
-9
lines changed

4 files changed

+25
-9
lines changed

find-feeds/background.js

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,26 @@ async function onStorageChanged() {
148148
browser.runtime.onMessage.addListener(onMessage);
149149
browser.storage.onChanged.addListener(onStorageChanged);
150150
browser.tabs.onUpdated.addListener(onTabUpdated, { properties: ["status"] });
151-
browser.browserAction.onClicked.addListener((tab) => {
152-
browser.tabs.create({
153-
url: "find.html?tabId=" + tab.id + "&url=" + encodeURIComponent(tab.url),
154-
index: tab.index + 1,
155-
active: true,
156-
});
151+
browser.browserAction.onClicked.addListener((tab, info) => {
152+
if (info.button === 1) {
153+
browser.tabs.create({
154+
url:
155+
"find.html?tabId=" + tab.id + "&url=" + encodeURIComponent(tab.url),
156+
index: tab.index + 1,
157+
active: true,
158+
});
159+
} else {
160+
// default: open in popup
161+
browser.windows.create({
162+
url: [
163+
"find.html?tabId=" + tab.id + "&url=" + encodeURIComponent(tab.url),
164+
],
165+
type: "popup",
166+
height: 480,
167+
width: 1080,
168+
focused: true,
169+
});
170+
}
157171
});
158172
browser.menus.create({
159173
title: "Configure Feed Detectors",

find-feeds/find.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!doctype html>
22
<head>
3-
<title>Find Feeds</title>
3+
<title>working ...</title>
44
<meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
55
<style>
66
body {

find-feeds/find.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ async function init() {
8080
url: decodeQueryParam(popupsearchparams.get("url")),
8181
});
8282
//
83+
document.title = decodeQueryParam(popupsearchparams.get("url"));
8384
if (objs_length < 1) {
8485
msg.textContent =
8586
"No feed-like URLs found on " +

find-feeds/manifest.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"scripts": ["background.js"]
88
},
99
"browser_action": {
10-
"default_area": "navbar"
10+
"default_area": "navbar",
11+
"default_title": "- Left Mouse Button open in popup window\n- Middle Mouse Button open in tab"
1112
},
1213
"commands": {
1314
"_execute_browser_action": {}
@@ -21,5 +22,5 @@
2122
"page": "options.html"
2223
},
2324
"permissions": ["menus", "storage", "<all_urls>"],
24-
"version": "1.4.14"
25+
"version": "1.4.15"
2526
}

0 commit comments

Comments
 (0)