-
-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Page Action Setting (icon in URL bar) #931
Conversation
Still have to:
|
It is a good idea, we could merge it, without even looking on it for the third task, I think it unnecessary because, we have preferred instance option which works irrespective of the site or instance you have selected. It is something to think about. |
The third task is there because at the moment, that icon will even show up on any page even if it is not relevant. Websites like AirBNB, flight trackers, online shopping, etc. will have the icon, but it doesn't make sense for it to be there contextually. |
Okay, What about a situation where you receive a instance link being shared which is not in the list. How do you know when to show it by reading the contents of the page ? |
I think the reason I didn't implement this was that url bar icons got removed in manifest v3. |
I don't think so. Then how would Multi Account Containers would be still then. Stuck on Mv2 ? |
Ah, didn't realize that would be the case with manifest-v3. I wonder if Firefox will follow-suit. In any case, this kind of addition might be best for a personal fork ( in the case that I am staying on my current version of firefox :P ) I also wanted to answer:
In these situations, I was going to look at the code for the popup--how we determine to the top items in If we can figure it out in the popup, there must be a way to say "are we in a libredirect-compatible page that is in the list" and hide the pageAction. |
I mean how do you figure it out ? Currently pageAction is done by the URL not the page's contents |
browser.tabs.onUpdated.addListener(async (id, changeInfo, tabInfo) => { | ||
const { pageAction } = await utils.getOptions() | ||
if (!pageAction) return; | ||
browser.pageAction.show(tabInfo.id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
browser.pageAction.show(tabInfo.id); | |
const url = new URL(tabInfo.url) | |
await servicesHelper.computeService(url).then(r => { | |
if (r) { | |
browser.pageAction.show(id) | |
} | |
}) |
I mean how do you figure it out ?
Currently pageAction is done by the URL not the page's contents
This correctly detects if we are using a service that can be redirected with libredirect. I tested it with reddit, youtube, tenor, and github. There may be some failure points, but it seems to do the trick on the initial test. On websites like HBO max it would not show the page action.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, you are inspecting page data or what ?
I am confused between ID and URL right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need to inspect page content-- this is solely based on the URL of the tab.
show(id)
tells the browser to show the page action (button in the address bar) for that tab identifier:
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/Tab#id
It looks like servicesHelper.computeServices
can take that url and figure out if it is a reddit link (or one of the alternative reddit types), or if it is a youtube, tenor, etc/alternative service.
It is based on this bit of code: https://github.com/libredirect/browser_extension/blob/32dc67db284b5803c9925df07f2cc47127acfdf6/src/pages/popup/popup.js#L109C3-L115C4
I'll close it for this reason. |
Adds a setting in the general options to enable the icon in the URL bar that brings up the same popup as the extension button.
This is a very simple version that enables the button on every page, but we can tune it to only show this icon on libredirect-compatible pages. We can also edit the wording, it is not very user friendly-- but I wonder how we should name something like this.