From e7741e99e753b4eebfbe657409a04cab86c15490 Mon Sep 17 00:00:00 2001
From: Jerome Etienne
Date: Thu, 7 Apr 2011 09:32:28 +0200
Subject: [PATCH] more work
---
README.md | 6 ++++--
examples/basic.html | 15 +++++++++++++++
examples/index.html | 28 ----------------------------
index.html | 6 +++---
src/jquery.qrcode.js | 8 +++-----
5 files changed, 25 insertions(+), 38 deletions(-)
create mode 100644 examples/basic.html
delete mode 100644 examples/index.html
diff --git a/README.md b/README.md
index c5f97d4..88f1fec 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,9 @@
With jQuery.qrcode.js you can easily add qrcode to your webpages.
It is standalone, no external services which go on and off, or add latency
-while loading.
+while loading. It is based on a library
+which build qrcode in various language. jQuery.qrcode.js wraps it to make it easy
+to include in your own code.
Show, dont tell, here is a demo
@@ -21,7 +23,7 @@ Then you add the *qrcode* in this container by
jQuery('#qrcode').qrcode("this plugin is great");
-This is it.
+This is it. see it live.
## Conclusion
diff --git a/examples/basic.html b/examples/basic.html
new file mode 100644
index 0000000..2af1225
--- /dev/null
+++ b/examples/basic.html
@@ -0,0 +1,15 @@
+
+
+basic example
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/index.html b/examples/index.html
deleted file mode 100644
index 8fb9b5e..0000000
--- a/examples/index.html
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-basic example
-
-
-
-
- TODO make a nice looking pure client qrcode generator
- even allow download of the image
-
-
-
-
-
-
-
-
-
-
-
diff --git a/index.html b/index.html
index 1de17e6..b7237ce 100644
--- a/index.html
+++ b/index.html
@@ -11,7 +11,7 @@
>jQuery.qrcode.js
With jQuery.qrcode.js you can easily add qrcode to your webpages. It is standalone, no external services which go on and off, or add latency while loading.
With jQuery.qrcode.js you can easily add qrcode to your webpages. It is standalone, no external services which go on and off, or add latency while loading. It is based on a library which build qrcode in various language. jQuery.qrcode.js wraps it to make it easy to include in your own code.
Show, dont tell, here is a demo
This is it.
This is it. see it
live.
Conclusion
MicroEvent.js is available on github here under MIT license. If you hit bugs, fill issues on github. Feel free to fork, modify and have fun with it :)
MicroEvent.js is available on github
here under
MIT license. If you hit bugs, fill issues on github. Feel free to fork, modify and have fun with it :)
diff --git a/src/jquery.qrcode.js b/src/jquery.qrcode.js
index d99e613..fb4198f 100644
--- a/src/jquery.qrcode.js
+++ b/src/jquery.qrcode.js
@@ -1,6 +1,5 @@
(function( $ ){
$.fn.qrcode = function(options) {
-
// if options is string,
if( typeof options === 'string' ){
options = { text: options };
@@ -19,16 +18,15 @@
var qrcode = new QRCode(options.typeNumber, options.correctLevel);
qrcode.addData(options.text);
qrcode.make();
-
// create canvas element
var canvas = document.createElement('canvas');
canvas.width = options.width;
canvas.height = options.height;
var ctx = canvas.getContext('2d');
-
- var tileW = options.width / qrcode.getModuleCount();
+ // compute tileW/tileH based on options.width/options.height
+ var tileW = options.width / qrcode.getModuleCount();
var tileH = options.height / qrcode.getModuleCount();
-
+ // draw in the canvas
for( var row = 0; row < qrcode.getModuleCount(); row++ ){
for( var col = 0; col < qrcode.getModuleCount(); col++ ){
ctx.fillStyle = qrcode.isDark(row, col) ? "#000000" : "#ffffff";