Show HN: Gmail.js – JavaScript API for Gmail
github.com
github.com
We haven't really announced it yet, but I've been working on a new email platform with some friends to solve a lot of these issues. It's essentially Rails/Meteor for email features, and lets you skip past hacking Gmail or writing a full IMAP client.
It's called Inbox, and we're aiming to open source it in January. Ping me if you're interested in playing with it early. :)
The first big challenge is definitely just having a shared toolkit, but it's next to impossible to provide backwards-compatible APIs when the Gmail UI changes.
Oh... and IMAP. :-/
This! You're doing it right. I wish all the Gmail tweakers united to build a better platform rather than spend their time propping the old, PRISM-tainted, UI-crippled service.
It would be great if Gmail would officially support extensions. Their current approach is very limited.
(For people who don't know, all GMail's classes and IDs are things like '.xb3', and they change often.)
Having worked on Mozilla Add-ons for a long time, one of the biggest problems was by the time any G-Mail add-on was approved, it was already out of date again. API calls, when done correctly, are allowed by both Chrome and Firefox -- this could be a good solution.
(You could easily charge a few bucks for this, and even contact Firefox + Chrome about making sure the reviewers allow it. Market it as "cutting down on their time" since there will be less to review.)
(Source: I'm the author of the ActiveInbox Gmail extension, and at various times have spoken to Gmail engineers directly).
I agree a service would be a useful thing. A killer bit of value would be if it could workaround Mozilla's addon rules. (We actually stopped publishing on Mozilla addons, because if Gmail changed, we couldn't wait 10 days to be "re-approved" to fix it, and as mentioned by gkoberger, Mozilla really clamps down on dynamic in-app updates).
Ymmv, but if it helps... From the POV of an extension developer, service reliability is critical, and I'm not sure if there's enough GMail extension developers to be customers and make it economically viable?
If there is, I think the ideal service would taint DOM elements with class names to make the important things selectable (rather than a Javascript API to retrieve elements). That way, we could build our own selectors with fail safes to fall back on (and we don't have the security headache of incorporating your dynamically-updated code within our own protected sandbox. We can just share the modified DOM instead).
Whatever you do with it, I'm really impressed with how cleanly you built this kartikt!
Also maybe it doesn't really have to be a service. It could just be a file on github, where anyone could issue a pull request if gets broken broken. That way way you would essentially crowd source it.
Also, I've personally been in contact with people on the Gmail team about this kind of stuff. They are, generally, supportive, but they're very clear that they'll make no guarantees about stability.
That being said, you should be able to use this to load new selector strings for the API:
https://addons.mozilla.org/en-US/developers/docs/sdk/latest/...
But then, I suppose that's how most Chrome extensions work.
However, it's even worse than you think. It's making a lot of references to minified/obfuscated names. Things like $('.nH.hx'). When I was working on a gmail script[1] a year or two ago, many of those were changing every few hours.
It's solvable, but not easy.
$($($($('.nH .if').children()[1]).children()).children()[1]).children()[1]
:)
[1]https://github.com/KartikTalwar/gmail.js/blob/master/src/gma...
$('.nH .if')
.children().eq(1)
.children()
.children().eq(1)
.children().eq(1)
But if you were just pointing out how brittle it is, then yes, that's still apparent.Is there a way to add navigation events (eg. user opened email) to the observe gmail.observe API? Right now it looks like I would have to poll gmail.check.is_inside_email.
https://github.com/jamesyu/gmailr and https://github.com/joscha/gmailui
In fact gmailr is used in "Cloudy" - one of the more advanced gmail plugins.
It's called IMAP/SMTP!