2013-04-21 22:09:36 +00:00
|
|
|
$ ->
|
|
|
|
$('textarea').bind 'keyup', generateQRCode
|
|
|
|
$('#triggerCreate').bind 'click', generateQRCode
|
|
|
|
$(window).bind 'hashchange', ->
|
|
|
|
text = window.location.hash.substring 1
|
2013-10-12 18:51:14 +00:00
|
|
|
$('textarea').val decodeURIComponent(text)
|
2013-04-21 22:09:36 +00:00
|
|
|
generateQRCode()
|
2013-04-21 22:51:38 +00:00
|
|
|
$('a', '#download').bind 'click', ->
|
|
|
|
window.location.href = $('canvas', '#qrarea')[0].toDataURL('image/png').replace('image/png', 'image/octet-stream')
|
|
|
|
|
2013-04-21 22:09:36 +00:00
|
|
|
if window.location.hash
|
|
|
|
$(window).trigger 'hashchange'
|
|
|
|
generateQRCode()
|
|
|
|
|
|
|
|
generateQRCode = ->
|
|
|
|
text = $('textarea').val()
|
|
|
|
$('#qrarea').empty()
|
2014-05-29 12:02:21 +00:00
|
|
|
$('#qrarea').qrcode
|
|
|
|
text: text
|
|
|
|
width: 512
|
|
|
|
height: 512
|
|
|
|
|