Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a5eecf7

Browse files
author
Ciro S. Costa
committed
Merge pull request cirocosta#21 from cirocosta/v0.1.0
V0.1.0
2 parents b4fb894 + a3c397c commit a5eecf7

28 files changed

+5536
-1386
lines changed

.editorconfig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,8 @@ root = true
33

44
[*]
55
indent_size = 2
6-
indent_style = tab
6+
indent_style = space
77
end_of_line = lf
88
charset = utf-8
99
trim_trailing_whitespace = true
1010
insert_final_newline = true
11-
12-
[*.js]
13-
indent_style = space

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
node_modules
2-
bower_components
1+
node_modules/
2+
bower_components/
3+
.sass-cache/
4+
5+
*.log

.jshintrc

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
11
{
2-
"curly" : true,
3-
"eqeqeq" : true,
4-
"immed" : true,
5-
"latedef" : true,
6-
"newcap" : true,
7-
"noarg" : true,
8-
"sub" : true,
9-
"undef" : true,
10-
"boss" : true,
11-
"eqnull" : true,
12-
"node" : true,
13-
"globals" : {
14-
"window": false,
15-
"document": false,
16-
"navigator": false,
17-
"qrcode": false,
18-
"test": false,
19-
"ok": false,
20-
"asyncTest": false,
21-
"expect": false,
22-
"MediaStreamTrack": true
23-
}
2+
"bitwise": false,
3+
"curly": false,
4+
"freeze": true,
5+
"undef": true,
6+
"unused": true,
7+
8+
"laxcomma": true,
9+
"expr": true,
10+
11+
"browser": true,
12+
"node": true,
13+
"predef": [
14+
"qrcode",
15+
"MediaStreamTrack",
16+
"define"
17+
]
2418
}

.travis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
language: node_js
2+
node_js:
3+
- '0.10'
4+
env:
5+
global:
6+
- secure: k++7lCMP9FL3XVMI/VbKDsQB2wxoUq944WeuKcBS4+iHFaDiO1Bu0LZV6VIcWc+5xwvpgLQmjEK0ksW3lHiQ703PCZ9A2IJn6Nic9iiN55U7AnNsTRxKgD1U7GbO8w/21B81TXATNlEsf/azsE80wCVurcSENp53q4bBfwZyxuU=
7+
- secure: LegkxjHVLvk1tnOqeknBgKjPlkbLZn1k8xAQMjeZzOl9jhTSJMtPgud+KqRtOLHYQBWGpBidUHaYy7VBVBjP0bldD6C0gco1swT09QIRh0A5BZY3ePOWAvq1J2yutGEiFvOdRjXeIv2bPphPEhy2W78c6Kl+kJqX+ge7iel0YMk=

.zuul.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
ui: mocha-bdd
2+
browsers:
3+
- name: chrome
4+
version: latest
5+
- name: firefox
6+
version: 27..latest
7+
- name: ie
8+
version: 9..latest
9+
- name: iphone
10+
version: 6.1..latest
11+
- name: android
12+
version: 4.0..latest

README.md

Lines changed: 60 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# qcode-decoder
22

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

57
## Using in your project
68

@@ -10,7 +12,7 @@ Download it as a dependency
1012
$ bower install qcode-decoder
1113
```
1214

13-
attach it to your html file
15+
attach it to your `.html` file
1416

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

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

25+
The API is Pretty simple:
26+
27+
### QCodeDecoder()
28+
Constructor. No args. Might be create with or without `new`.
29+
30+
```javascript
31+
var qr = new QCodeDecoder();
32+
// or
33+
var qr = QCodeDecoder();
34+
```
35+
36+
This construction lets us be able to chain some methods (although not very necessary - the API is **really** simple).
37+
38+
#### ::decodeFromImage(img)
39+
40+
Decodes an image from a source provided or an `<img>` element with a `src` attribute set.
41+
42+
```javascript
43+
qr.decodeFromImage(img, function (err, result) {
44+
if (err) throw err;
45+
46+
alert(result);
47+
});
48+
```
49+
50+
#### ::decodeFromVideo(videoElem, cb, [,once])
51+
Decodes directly from a video with a well specified `src` attribute
52+
53+
```javascript
54+
QCodeDecoder()
55+
.decodeFromVideo(document.querySelector('video'), function (err, result) {
56+
if (err) throw err;
57+
58+
alert(result);
59+
}, true);
60+
```
61+
62+
63+
#### ::decodeFromCamera(videoElem, cb, [,once])
64+
Decodes from a videoElement. The optional argument **once** makes the *QCodeDecoder* to only find a QRCode once.
65+
66+
```javascript
67+
qr.decodeFromCamera(videoElem, function (err) {
68+
if (err) throw err;
69+
70+
alert(result);
71+
});
72+
```
73+
74+
#### ::stop()
75+
76+
Stops the current `qr` from searching for a QRCode.
77+
78+
2379
## Messing around
2480

25-
For messing around w/ this module and making the example alive, run `npm run start-server` and then go to `http://localhost:8080/examples`
81+
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).
2682

2783
## Credits
2884

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

3288
## LICENSE
3389

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "qcode-decoder",
33
"main": "build/main.min.js",
44
"description": "Decodes QRCode in the browser and node",
5-
"version": "0.0.6",
5+
"version": "0.1.0",
66
"homepage": "https://github.com/cirocosta/qcode-decoder",
77
"authors": [
88
"Ciro S. Costa <[email protected]>"

build/qcode-decoder.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/qcode-decoder.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)