1
0
Fork 0
mirror of https://github.com/Luzifer/qrdisplay.git synced 2024-10-18 06:34:22 +00:00
qrdisplay/application.coffee

18 lines
587 B
CoffeeScript

$ ->
$('textarea').bind 'keyup', generateQRCode
$('#triggerCreate').bind 'click', generateQRCode
$(window).bind 'hashchange', ->
text = window.location.hash.substring 1
$('textarea').val decodeURIComponent(text)
generateQRCode()
$('a', '#download').bind 'click', ->
window.location.href = $('canvas', '#qrarea')[0].toDataURL('image/png').replace('image/png', 'image/octet-stream')
if window.location.hash
$(window).trigger 'hashchange'
generateQRCode()
generateQRCode = ->
text = $('textarea').val()
$('#qrarea').empty()
$('#qrarea').qrcode(text)