1
0
Fork 0
mirror of https://github.com/Luzifer/qrdisplay.git synced 2024-12-22 12:21:18 +00:00

Accepting URI encoded data in hash

This commit is contained in:
Knut Ahlers 2013-10-12 20:51:14 +02:00
parent f308662370
commit fcafcb1b66
2 changed files with 6 additions and 3 deletions

View file

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

View file

@ -1,3 +1,4 @@
// Generated by CoffeeScript 1.6.3
(function() {
var generateQRCode;
@ -7,13 +8,15 @@
$(window).bind('hashchange', function() {
var text;
text = window.location.hash.substring(1);
$('textarea').val(text);
$('textarea').val(decodeURIComponent(text));
return generateQRCode();
});
$('a', '#download').bind('click', function() {
return window.location.href = $('canvas', '#qrarea')[0].toDataURL('image/png').replace('image/png', 'image/octet-stream');
});
if (window.location.hash) $(window).trigger('hashchange');
if (window.location.hash) {
$(window).trigger('hashchange');
}
return generateQRCode();
});