pg_docs_bot icon indicating copy to clipboard operation
pg_docs_bot copied to clipboard

Option to enable/disable notification (and search parameter)

Open rightaway opened this issue 4 years ago • 8 comments

Great addon! Could the addon disable the URL bar query change (pg-docs-bot-redirected) and the notification in the bottom right (Redirected by pg_docs_bot from)? Instead like many addons do, the icon could be grayed out at all times unless it was redirected, then the icon can have colors. And if you click on the icon it'll show you the link to the page it was redirected from. I think it would be less intrusive and more useful that way.

rightaway avatar May 01 '20 18:05 rightaway

Thanks! I'm afraid the search parameter in the URL is currently how it communicates the redirected URL. The icon is a neat idea, I hadn't considered that! However, I like that I don't need another extension icon visible, so I wonder if making the notice less intrusive visually could help instead? Perhaps a single line with the URL linked?

mchristofides avatar May 01 '20 20:05 mchristofides

The notification is useful when someone wants to go to the version the search engine took them to, which would only happen by luck. People either want to see docs for the current version or the version they'll set in https://github.com/mchristofides/pg_docs_bot/issues/1. Maybe the notification isn't necessary?

rightaway avatar May 02 '20 09:05 rightaway

Yes good point, and the search engine use case is definitely the main one!

A few reasons I currently include it:

  • In case somebody searched an exact version number (example from the mailing lists)
  • In case a StackOverflow question / answer was about a specific version
  • In case the page 404s (eg a deprecated feature that pg_docs_bot doens't know about)

For starters, to make it less intrusive, I've made the notice a single line by hyperlinking just the version number, and added a close button. I'll keep thinking about the need for it at all, and also consider alternatives to the search parameter implementation!

What do you think?

single-line-version-number-close

mchristofides avatar May 02 '20 13:05 mchristofides

The smaller notification is nicer. An option to enable/disable it would be good if you add settings to this addon.

rightaway avatar May 03 '20 06:05 rightaway

Brilliant, good idea, thank you. I'll change the name of this issue to remind me!

mchristofides avatar May 03 '20 11:05 mchristofides

Why does the updating version require new permissions, like accessing data on google.com and bing.com domains? Regardless of what source page the link is on, as long as you have access to data on postgresql.org shouldn't it be enough to perform a redirect?

rightaway avatar Jan 05 '21 06:01 rightaway

@rightaway sorry I haven't done anything on this since May, so it took a bit of dusting off!

I went with an implementation that uses chrome.webRequest.onBeforeRequest, to make it easier to ignore things like viewing an older version when you're actually on the docs, and to avoid 404s on certain deprecated features. Sadly this approach meant needing permissions to the source pages. I think I originally asked for <all_urls> permissions in pre-1.0 versions, which seemed way too much, so I reduced down to the list you'll have seen (common search engines and Stack Exchange sites). Hope that makes sense.

It looks like somebody has made one that works more like you're suggesting, in case that would be your preferred approach? https://chrome.google.com/webstore/detail/postgres-docs-redirect/ajcfpdiobeccopppdonocgddplegokbl

mchristofides avatar Jan 05 '21 22:01 mchristofides

@rightaway just heard about a much neater solution on the way, which seems to need fewer permissions, stores the last version viewed, and also doesn't mess with the URL. Looks promising! https://github.com/mchristofides/pg_docs_bot/issues/1#issuecomment-754944226

mchristofides avatar Jan 05 '21 22:01 mchristofides