Skip to content

Commit

Permalink
Merge pull request #1 from GunioRobot/clean
Browse files Browse the repository at this point in the history
Hi! I cleaned up your code for you! From GunioRobot
  • Loading branch information
zmcartor committed Dec 21, 2011
2 parents fc21a6c + fcf79d4 commit bed07fc
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 9 deletions.
50 changes: 50 additions & 0 deletions .gitignore
@@ -0,0 +1,50 @@
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
*.pyc

# Numerous always-ignore extensions
###################
*.diff
*.err
*.orig
*.log
*.rej
*.swo
*.swp
*.vi
*~

*.sass-cache
# Folders to ignore
###################
.hg
.svn
.CVS
# OS or Editor folders
###################
.DS_Store
Icon?
Thumbs.db
ehthumbs.db
nbproject
.cache
.project
.settings
.tmproj
*.esproj
*.sublime-project
*.sublime-workspace
# Dreamweaver added files
###################
_notes
dwsync.xml
# Komodo
###################
*.komodoproject
.komodotools
12 changes: 6 additions & 6 deletions Blocky.coffee
@@ -1,4 +1,4 @@
window.Blocky = class Blocky
window.Blocky = class Blocky
constructor: (text = null ,container=null, config={}) ->
if container
@container=window.document.getElementById(container)
Expand All @@ -12,10 +12,10 @@ window.Blocky = class Blocky
@black = config.black or "rgb(0,0,0)"
@white = config.white or "rgb(255,255,255)"
#type and error level control how much information we can encode.
@type_number = config.typenumber or 10
@type_number = config.typenumber or 10
@error_level = config.error_level or 'M'
#in case they put something stupid
@error_level.charAt(0).toUpperCase in ['M', 'H', 'Q' ,'L'] or 'M'
@error_level.charAt(0).toUpperCase in ['M', 'H', 'Q' ,'L'] or 'M'
#some fun preset colors! :D
if config.scheme in ['watermelon' , 'wedding' , 'arctic' , 'spicy']
switch config.scheme
Expand All @@ -34,7 +34,7 @@ window.Blocky = class Blocky
return

@context = canvas.getContext '2d'

@das_code = new qrcode @type_number ,'L'
@das_code.addData text
@das_code.make()
Expand All @@ -44,7 +44,7 @@ window.Blocky = class Blocky
canvas.setAttribute 'height' , canvas_size
@container.appendChild canvas

#big main loops to build the QR code
#big main loops to build the QR code
limit= @das_code.getModuleCount()

if canvas.getContext
Expand All @@ -56,6 +56,6 @@ window.Blocky = class Blocky
else
@context.fillStyle = @white
@context.fillRect c*@cell_size , r*@cell_size , @cell_size, @cell_size

else
console.log "no getContext.., cannot proceed."
2 changes: 1 addition & 1 deletion README
Expand Up @@ -15,7 +15,7 @@ Dependencies:
The JS library after the 11/5/2011 update is included within this project.

Installation:
The compiled javascript is included from the associated .coffee file.
The compiled javascript is included from the associated .coffee file.
Include this in your page after qrcode.js (Kazuhiko's library)

Usage:
Expand Down
4 changes: 2 additions & 2 deletions sample.html
@@ -1,6 +1,6 @@
<html>
<head>

<script type="text/javascript" src="qrcode.js"></script>
<script type="text/javascript" src="Blocky.js"></script>
</head>
Expand All @@ -12,5 +12,5 @@
new Blocky('http://hackazach.net' ,'funfun', {cell_size:11, scheme:'watermelon'})
</script>


</html>

0 comments on commit bed07fc

Please sign in to comment.