|
2 | 2 |
|
3 | 3 | 
|
4 | 4 |
|
5 |
| -**Note:** The new Content Security Policy will prevent direct injection. **[Here](https://github.com/KartikTalwar/gmail-chrome-extension-boilerplate)** is how to get around it |
| 5 | +### What Gmail.js is and isn't |
| 6 | + |
| 7 | +Gmail.js is meant to be used for creating WebExtension-based browser-extensions, for Chrome, Firefox and other compatible browsers. |
| 8 | + |
| 9 | +It cannot be used server-side with Node, or from another web-app to interface with Gmail. |
6 | 10 |
|
7 | 11 | **Note:** This is not an official Gmail API, and isn't affiliated with Google.
|
8 | 12 |
|
9 | 13 | **Note:** Gmail.js requires jQuery to work
|
10 | 14 |
|
11 | 15 | ### TL;DR Summary
|
12 | 16 |
|
13 |
| -- Lots of api methods to work with gmail. Useful for chrome extensions |
14 |
| -- Most of them dont take arguments, they work on what is currently visible on the screen |
15 |
| -- I still need to add implementation for chrome extension, works by injecting js for now |
| 17 | +- Lots of API methods to work with gmail. See documentation below. |
| 18 | +- Easy to use API. Data & DOM. |
| 19 | +- Reasonably complete TypeScript-support. |
| 20 | +- Many methods are contextual and will work with whatever is on screen when no arguments are given. |
| 21 | +- Obtain email data, react to event, etc. No need for OAuth! |
16 | 22 | - Main methods allow you to observe certain events with **`gmail.observe.on('lots_of_actions_here', callback())`** or similar **`gmail.observe.before(...)`** and **`gmail.observe.after(...)`**
|
17 |
| -- Click on a method link to view more detailed docs |
18 |
| -- Create an issue/pull request for feedback, requests and |
19 |
| - fixes. See |
20 |
| - [CONTRIBUTING.md](https://github.com/KartikTalwar/gmail.js/blob/master/CONTRIBUTING.md) for |
21 |
| - more details. |
22 |
| -- Basic TypeScript-support from type-declarations file [gmail.d.ts](https://github.com/KartikTalwar/gmail.js/blob/master/src/gmail.d.ts). |
| 23 | +- Create an issue/pull request for feedback, requests and fixes. See [CONTRIBUTING.md](https://github.com/KartikTalwar/gmail.js/blob/master/CONTRIBUTING.md) for more details. |
23 | 24 |
|
24 |
| -### Installation |
| 25 | +### Using Gmail.js |
25 | 26 |
|
26 |
| -Since this is a chrome extension library, you can still use npm to get new changes |
| 27 | +If you know how to create WebExtensions-based extensions for Firefox and Chrome, you can get started by pulling Gmail.js like this: |
27 | 28 |
|
28 | 29 | ```
|
29 | 30 | npm install gmail-js
|
30 | 31 | ```
|
31 | 32 |
|
| 33 | +**Note:** Please ensure that Gmail.js is injected into the regular DOM. |
| 34 | +Gmail.js does not work as a content-script. |
32 | 35 |
|
33 |
| -### Examples |
34 |
| - |
35 |
| -- **[Gmail Hacks](https://chrome.google.com/webstore/detail/gmail-hacks/aacloklpepaibhlikiakfcgjjappeppo)** by [@arpitnext](https://github.com/arpitnext) (*[Source](https://github.com/arpitnext/play_with_gmail.js)*) |
36 |
| -- **[Example to use gmail.js in firefox addon](https://github.com/rinkudas/gmail-firefox-addon-boilerplate)** - It provides basic functionality to inject gmail.js within gmail for using it in a Firefox addon. |
37 |
| -- **[GmailJS Node Boilerplate](https://github.com/josteink/gmailjs-node-boilerplate)** - Example for how to use GmailJS with NodeJS and script-bundling for instant load-times. |
38 |
| - |
39 |
| -## Content Security Policy |
| 36 | +For some ready to use examples/boilerplate repos, look no further: |
40 | 37 |
|
| 38 | +- **[GmailJS Node Boilerplate](https://github.com/josteink/gmailjs-node-boilerplate)** - Example for how to create a browser-extension using GmailJS and modern javascript with NodeJS and script-bundling for instant load-times. |
| 39 | +- **[GmailJS Legacy Boilerplate](https://github.com/KartikTalwar/gmail-chrome-extension-boilerplate)** - Example for how to create a browser-extension using traditional script-loading. (Requires less tooling, but is less reliable) |
41 | 40 |
|
42 |
| -The new Content Security Policy will prevent direct injection. Please see the following repository to get around the policies. More details can also be found in issue [#75](https://github.com/KartikTalwar/gmail.js/issues/75) |
| 41 | +### Content Security Policy |
43 | 42 |
|
44 |
| -#### https://github.com/KartikTalwar/gmail-chrome-extension-boilerplate |
| 43 | +Content Security Policy (CSP) will prevent direct injection. Please see the following repository to get around the policies. More details can also be found in issue [#75](https://github.com/KartikTalwar/gmail.js/issues/75) |
45 | 44 |
|
| 45 | +See the examples linked above for how to get around that. |
46 | 46 |
|
47 | 47 | ## Setup
|
48 | 48 |
|
|
0 commit comments