Skip to content

Commit

Permalink
Merge pull request #21 from cirocosta/v0.1.0
Browse files Browse the repository at this point in the history
V0.1.0
  • Loading branch information
Ciro S. Costa committed Sep 15, 2014
2 parents b4fb894 + a3c397c commit a5eecf7
Show file tree
Hide file tree
Showing 28 changed files with 5,536 additions and 1,386 deletions.
5 changes: 1 addition & 4 deletions .editorconfig
Expand Up @@ -3,11 +3,8 @@ root = true

[*]
indent_size = 2
indent_style = tab
indent_style = space
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.js]
indent_style = space
7 changes: 5 additions & 2 deletions .gitignore
@@ -1,2 +1,5 @@
node_modules
bower_components
node_modules/
bower_components/
.sass-cache/

*.log
38 changes: 16 additions & 22 deletions .jshintrc
@@ -1,24 +1,18 @@
{
"curly" : true,
"eqeqeq" : true,
"immed" : true,
"latedef" : true,
"newcap" : true,
"noarg" : true,
"sub" : true,
"undef" : true,
"boss" : true,
"eqnull" : true,
"node" : true,
"globals" : {
"window": false,
"document": false,
"navigator": false,
"qrcode": false,
"test": false,
"ok": false,
"asyncTest": false,
"expect": false,
"MediaStreamTrack": true
}
"bitwise": false,
"curly": false,
"freeze": true,
"undef": true,
"unused": true,

"laxcomma": true,
"expr": true,

"browser": true,
"node": true,
"predef": [
"qrcode",
"MediaStreamTrack",
"define"
]
}
7 changes: 7 additions & 0 deletions .travis.yml
@@ -0,0 +1,7 @@
language: node_js
node_js:
- '0.10'
env:
global:
- secure: k++7lCMP9FL3XVMI/VbKDsQB2wxoUq944WeuKcBS4+iHFaDiO1Bu0LZV6VIcWc+5xwvpgLQmjEK0ksW3lHiQ703PCZ9A2IJn6Nic9iiN55U7AnNsTRxKgD1U7GbO8w/21B81TXATNlEsf/azsE80wCVurcSENp53q4bBfwZyxuU=
- secure: LegkxjHVLvk1tnOqeknBgKjPlkbLZn1k8xAQMjeZzOl9jhTSJMtPgud+KqRtOLHYQBWGpBidUHaYy7VBVBjP0bldD6C0gco1swT09QIRh0A5BZY3ePOWAvq1J2yutGEiFvOdRjXeIv2bPphPEhy2W78c6Kl+kJqX+ge7iel0YMk=
12 changes: 12 additions & 0 deletions .zuul.yml
@@ -0,0 +1,12 @@
ui: mocha-bdd
browsers:
- name: chrome
version: latest
- name: firefox
version: 27..latest
- name: ie
version: 9..latest
- name: iphone
version: 6.1..latest
- name: android
version: 4.0..latest
64 changes: 60 additions & 4 deletions README.md
@@ -1,6 +1,8 @@
# qcode-decoder

> Decodes QRCode in the browser / node
> Decodes QRCode in the browser
[![Sauce Test Status](https://saucelabs.com/browser-matrix/cirocosta_github.svg)](https://saucelabs.com/u/cirocosta_github)

## Using in your project

Expand All @@ -10,7 +12,7 @@ Download it as a dependency
$ bower install qcode-decoder
```

attach it to your html file
attach it to your `.html` file

```html
<script src="../bower_components/qcode-decoder/build/qcode-decoder.min.js"></script>
Expand All @@ -20,14 +22,68 @@ and use it!

**For a full example, see `/examples` or [this plunkr](http://plnkr.co/aWikiL)**

The API is Pretty simple:

### QCodeDecoder()
Constructor. No args. Might be create with or without `new`.

```javascript
var qr = new QCodeDecoder();
// or
var qr = QCodeDecoder();
```

This construction lets us be able to chain some methods (although not very necessary - the API is **really** simple).

#### ::decodeFromImage(img)

Decodes an image from a source provided or an `<img>` element with a `src` attribute set.

```javascript
qr.decodeFromImage(img, function (err, result) {
if (err) throw err;

alert(result);
});
```

#### ::decodeFromVideo(videoElem, cb, [,once])
Decodes directly from a video with a well specified `src` attribute

```javascript
QCodeDecoder()
.decodeFromVideo(document.querySelector('video'), function (err, result) {
if (err) throw err;

alert(result);
}, true);
```


#### ::decodeFromCamera(videoElem, cb, [,once])
Decodes from a videoElement. The optional argument **once** makes the *QCodeDecoder* to only find a QRCode once.

```javascript
qr.decodeFromCamera(videoElem, function (err) {
if (err) throw err;

alert(result);
});
```

#### ::stop()

Stops the current `qr` from searching for a QRCode.


## Messing around

For messing around w/ this module and making the example alive, run `npm run start-server` and then go to `http://localhost:8080/examples`
The proper use of camera APIs and, then, the use of this module, the developer needs to first initiate a webserver for running the examples. I suggest going with [http-server](https://github.com/nodeapps/http-server).

## Credits

The main decoder methods are from [Lazar Laszlo](http://www.
lazarsoft.info/). Go check his work!
lazarsoft.info/), who ported ZXing lib (Apache V2) to JavaScript.

## LICENSE

Expand Down
2 changes: 1 addition & 1 deletion bower.json
Expand Up @@ -2,7 +2,7 @@
"name": "qcode-decoder",
"main": "build/main.min.js",
"description": "Decodes QRCode in the browser and node",
"version": "0.0.6",
"version": "0.1.0",
"homepage": "https://github.com/cirocosta/qcode-decoder",
"authors": [
"Ciro S. Costa <ciro.costa@usp.br>"
Expand Down
4 changes: 2 additions & 2 deletions build/qcode-decoder.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/qcode-decoder.min.js.map

Large diffs are not rendered by default.

0 comments on commit a5eecf7

Please sign in to comment.