GithubHelp home page GithubHelp logo

aztechdesign / voxel-share Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shama/voxel-share

0.0 2.0 1.0 440 KB

Take a snapshot of voxel.js and share on imgur/twitter

Home Page: http://shama.github.com/voxel-share

License: MIT License

voxel-share's Introduction

voxel-share

Take a snapshot in voxel.js and share on imgur.com/twitter.com.

Props to imgur.com for enabling CORS and accepting base64 image uploads via the browser. :D

View this example

usage

Create a share tool:

var share = require('voxel-share')({
  // pass a copy of the game
  game: game,

  // api key from https://api.imgur.com/oauth2/addclient
  key: 'abcd1234',

  // specify a message to set as caption/tweet
  message: 'Greetings from voxel.js! @voxeljs',

  // type of image: image/png or image/jpg
  type: 'image/png',

  // quality of image. between 0 and 1
  quality: 0.75,

  // do something else with the image link after it's uploaded
  afterUpload: function(imageLink) {
    // Open the tweet dialog with image link
    this.tweet(imageLink);
  },
});

Then upon desired event, open/close the share dialog:

window.addEventListener('keyup', function(e) {

  // on enter, open dialog
  if (e.keyCode === 13) share.open();

  // on esc, close dialog
  if (e.keyCode === 27) share.close();

});

Check the example for a more in-depth usage.

install

With npm do:

npm install voxel-share

Use browserify to require('voxel-share').

release history

  • 0.3.0 - Added afterUpload feature. Thanks @maxogden!
  • 0.2.0 - update to work with imgur api v3. Thanks @maxogden!
  • 0.1.0 - initial release

license

Copyright (c) 2013 Kyle Robinson Young
Licensed under the MIT license.

voxel-share's People

Contributors

max-mapper avatar shama 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.