Coder Social home page Coder Social logo

ticruz38 / gorgias-chrome Goto Github PK

View Code? Open in Web Editor NEW

This project forked from briskine/briskine

0.0 2.0 0.0 45.55 MB

Write faster using templates and keyboard shortcuts.

Home Page: https://chrome.google.com/webstore/detail/gorgias/lmcngpkjkplipamgflhioabnhnopeabf

License: MIT License

JavaScript 70.23% CSS 8.65% HTML 20.82% Python 0.31%

gorgias-chrome's Introduction

Gorgias Chrome Extension

Google Chrome plugin for improved productivity on the web.

Sites supported

  • Gmail
  • Outlook.com
  • Yahoo Mail
  • Linkedin

Developing extension

Development is done using Grunt. So first you need to install Node.js and Grunt. Then, run npm install to install all dependencies.

There are available following commands:

  • grunt or grunt dev or grunt d - Development mode. Creates development manifest, watches for styl files and recompiles them automatically.
  • grunt production or grunt p - Build extension.
  • grunt test or grunt t - Run tests.
  • grunt build or grunt b - Build and compress extension.

Known issues

  1. Saving a template from the context menus doesn't work with multi-lines.

    Relevant bug: https://code.google.com/p/chromium/issues/detail?id=116429

    This means that when selecting a text to save as a template it will not preserve newlines.

Creating templates

Templates are powered by handlebars.js.

Following template variables are available:

  • subject string
  • from list; Each list element contains:
    • name string
    • firt_name string
    • last_name string
    • email string
  • to list similar to from
  • cc list similar to from
  • bcc list similar to from

To output a string use following syntax:

String variables are denoted by double curly braces: {{subject}}

If subject is My email subject then it be rendered to:

String variables are denoted by double curly braces: My email subject

To output a list use following syntax:

To:
{{#each to}}
- Name {{name}}
- First name {{first_name}}
- Last name {{last_name}}
- Email {{email}}
{{/each}}

You also may want to output list only if it has values:

{{#if to}}
To:
{{#each to}}
- Name {{name}}
- First name {{first_name}}
- Last name {{last_name}}
- Email {{email}}
{{/each}}
{{/if}}

If you want to output only second element from list (note that list numbering starts with 0):

{{#if to.[1]}}
Second To:
- Name {{to.1.name}}
- First name {{to.1.first_name}}
- Last name {{to.1.last_name}}
- Email {{to.1.email}}
{{/if}}

Building plugins

You can build plugins using the App.plugin('PLUGIN_NAME', {}) method.

Check out the src/content/plugins/*.js files for examples on how a plugin show look.

Each plugin must expose the following methods:

  • init
  • getData

All plugin methods should take two arguments: params and callback.

The params argument is an object which can contain other objects or properties that you can use in the method.

The callback argument should be a function called at the end of the method, after all async functionality.

The callback function uses Node.js-style arguments. The first one is an error object returned in case of errors, otherwise return null. The second argument is the actual method response.

Plugin methods

init

The init method should respond with a boolean value, false by default, and true if the plugin should be activated.

getData

The getData method receives the following params object:

params: {
    element: DOM_ELEMENT
}

The params.element object is a reference to the DOM element on which the autocomplete was triggered. It can be a contenteditable element, or a form element.

The response of the getData method should look like:

{
    from: [],
    to: [],
    cc: [],
    bcc: [],
    subject: ''
}

Each array should contain objects that look like:

{
    name: '',
    first_name: '',
    last_name: '',
    email: ''
}

setTitle

// TODO

Testing

Before running the tests, run:

npm install

Then key your Chrome private .pem keyfile and copy it as key.pem in the repository root.

Set the QUICKTEXT_GMAIL_USERNAME and QUICKTEXT_GMAIL_PASSWORD ENV variables, for logging-in into Gmail.

export QUICKTEXT_GMAIL_USERNAME=abc
export QUICKTEXT_GMAIL_PASSWORD=def

Then, to run all the tests:

grunt test

or only for the contentscript:

grunt test:content

or only for the background script:

grunt test:background

Running the tests will recompile the app for production and test that.

If you want to run the tests locally (not on Sauce Labs) without recompiling the app, run:

grunt protractor:background

or

grunt protractor:content

gorgias-chrome's People

Contributors

bumbu avatar clay-reed-a avatar ghinda avatar humanfromearth avatar ritoon avatar romainlapeyre avatar sprankhub avatar xarg avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.