Chrome compatibility
I tried to port the extension to Chrome: https://bitbucket.org/eight04/in-my-pocket/branch/dev-chrome.
Some observation:
-
The extension cannot use page action and browser action at the same time, which means:
- The page action manifest key needs to be removed in Chrome. (prepare another
manifest.json
when targeting chrome build) - To set the icon indicator, set the icon on browser action.
- The page action manifest key needs to be removed in Chrome. (prepare another
-
The version field in manifest.json support only numbers i.e. it cannot include
a
(alpha flag). - To use
browser
API in Chrome,browser-polyfill
is added. A problem is thatbrowser-polyfill
assumes the API is used in the promise style, but some code uses callback style. - Chrome does not support icons in context menus.
- The width and the height of SVG icons have to be set to
32
. (not sure why but 32 works)
IMHO, even if we don't want to support Chrome, we should stick to promise-based API. Currently, the different styles are mixed everywhere.
Comments (16)
-
repo owner -
repo owner - changed status to open
I haven't been very active on this. Still, I have streamlined the API calls lately to make sure they're all using
browser
and notchrome
, and use the promise-style API (I was in favor of this, didn't think we had callback calls anywhere in the code tbh).I just started developing a tiny addon today, I'll try to make it cross-browser compliant. It'll be a perfect time to test the other points that you noticed and dig into the manifest, build and distribution topics at the same time.
-
reporter I have merged the latest master. Here is the diff:
https://bitbucket.org/eight04/in-my-pocket/branches/compare/eight04/in-my-pocket:dev-chrome%0Dpabuisson/in-my-pocket:master#diff -
reporter Chrome doesn't support svg in
browser_action.default_icon
:
https://bugs.chromium.org/p/chromium/issues/detail?id=29683 -
repo owner Wow that's really crazy. SVG and vector images in general look like the best option for that kind of usage, I'm surprised they don't support it yet.
-
reporter We can still keep using SVG in
browser_action
. In Chrome, we can callbrowserAction.setIcon
API to set the default icon when the extension is loaded.browserAction
API supports SVG butbrowser_action
in manifest doesn't. -
repo owner Hey, just an update here, I've started working on this. I've worked on adapting the build scripts so that I can create the addon with different rules (and particularly different manifest.json files). Not perfect yet, I guess, but I'll be testing this and try to get a chrome-compatible version beginning of 2019. I'll keep this updated and ask if I need help :-)
-
repo owner -
I think it would be nice to make PageAction optional in FF, additionally updating the
Add current page
button in popup to reflect actual state. Adn while at it probably moveRefresh list
button somewhere else, maybe even hide it somewhere in options -
repo owner Long time no news I've worked on this today, updated the
CHORE-chrome-compatibility
branch. I now need to make the page action optional (not the hardest part) and find a nice way to make the addon experience good without this important piece (not so easy ). -
there's official Save to Pocket Chromium extension (what's interesting it uses BrowserAction, but IMO it makes more sense as this button is visible on all pages) and you have
Add current page to list
button just below the button on popup so it’s pretty convenient to use one or anotherMaybe you could change the color of main button if page is in the list like you do with PageAction currently
-
repo owner I surely will update the icon colour if the page is in the pocket list. However, it’s a bit different from the Save to Pocket extension, in a sense that my browser action triggers something else than just adding to the page. Maybe I’ll have to reorganize the actions in the top row of the popup to get an easy access to “archive/delete page”.
iwillril on chrome seems to allow “Mark as read” only from the popup item list or the context menu. Does not seem very handy to me.
-
reporter Currently, I’m using the keyboard shortcut (Alt + W) to add/archive a page. When I click the browser action, it displays the popup.
-
repo owner Yep that’s the way it’s behaving right now. The context menu should be working as well to add/archive/delete pages, isn’t it?
-
reporter Yes. I also use the context menu to add/archive links.
-
reporter I forked the
CHORE-chrome-compatibility
branch and made some changes: - Log in to comment
Wow impressive!
As for the overall Chrome addons thing (and Opera, while we're at it), I'm not aware of how to build and submit addons for Chrome, but now that IMP has become more stable and with a more solid tooling, that might be worth looking into it. Anyway, we can still start streamlining the addon code to be compatible with other browsers, and publish it later.
To be honest, this "Chrome compatibility" ticket has been in my backlog for some time now... but I always prioritise new features first and never get to this todo
I'll check this out shortly and keep you updated. Thanks!