make img clicking work for chrom

This commit is contained in:
James Campos 2011-09-21 23:07:06 -07:00
parent f5cccfe26f
commit 2f2a398e13
2 changed files with 14 additions and 10 deletions

View File

@ -1259,12 +1259,12 @@
var box, file, files; var box, file, files;
files = $('#files', QR.qr); files = $('#files', QR.qr);
box = $.el('li', { box = $.el('li', {
innerHTML: "<img alt='click here'><input type=file name=upfile accept='" + QR.accept + "'><a class=x>X</a>" innerHTML: "<img><input type=file name=upfile accept='" + QR.accept + "'><a class=x>X</a>"
}); });
file = $('input', box); file = $('input', box);
$.bind(file, 'change', QR.change); $.bind(file, 'change', QR.change);
$.bind($('img', box), 'click', function() { $.bind($('img', box), 'click', function() {
return this.nextSibling.click(); return $('input', this.parentNode).click();
}); });
$.bind($('.x', box), 'click', QR.rmThumb); $.bind($('.x', box), 'click', QR.rmThumb);
$.add(files, box); $.add(files, box);
@ -1336,7 +1336,7 @@
} }
qr = QR.qr; qr = QR.qr;
fr = new FileReader(); fr = new FileReader();
img = this.previousSibling; img = $('img', this.parentNode);
fr.onload = function(e) { fr.onload = function(e) {
return img.src = e.target.result; return img.src = e.target.result;
}; };
@ -3171,12 +3171,14 @@
https://bugs.webkit.org/show_bug.cgi?id=58208\ https://bugs.webkit.org/show_bug.cgi?id=58208\
http://code.google.com/p/chromium/issues/detail?id=78961\ http://code.google.com/p/chromium/issues/detail?id=78961\
*/\ */\
visibility: hidden;\ font-size: 100px;\
position: absolute;\
left: 0;\
opacity: 0;\
}\ }\
#qr #files img {\ #qr #files img {\
max-height: 100px;\ max-height: 100px;\
max-width: 100px;\ max-width: 100px;\
float: left;\
}\ }\
#qr input[name=resto] {\ #qr input[name=resto] {\
width: 80px;\ width: 80px;\

View File

@ -973,10 +973,10 @@ QR =
#$('#autopost', QR.qr).checked = true #$('#autopost', QR.qr).checked = true
files = $ '#files', QR.qr files = $ '#files', QR.qr
box = $.el 'li', box = $.el 'li',
innerHTML: "<img alt='click here'><input type=file name=upfile accept='#{QR.accept}'><a class=x>X</a>" innerHTML: "<img><input type=file name=upfile accept='#{QR.accept}'><a class=x>X</a>"
file = $ 'input', box file = $ 'input', box
$.bind file, 'change', QR.change $.bind file, 'change', QR.change
$.bind $('img', box), 'click', -> @nextSibling.click() $.bind $('img', box), 'click', -> $('input', @parentNode).click()
$.bind $('.x', box), 'click', QR.rmThumb $.bind $('.x', box), 'click', QR.rmThumb
$.add files, box $.add files, box
file.click() file.click()
@ -1028,7 +1028,7 @@ QR =
return return
{qr} = QR {qr} = QR
fr = new FileReader() fr = new FileReader()
img = @previousSibling img = $ 'img', @parentNode
fr.onload = (e) -> fr.onload = (e) ->
img.src = e.target.result img.src = e.target.result
fr.readAsDataURL file fr.readAsDataURL file
@ -2501,12 +2501,14 @@ Main =
https://bugs.webkit.org/show_bug.cgi?id=58208 https://bugs.webkit.org/show_bug.cgi?id=58208
http://code.google.com/p/chromium/issues/detail?id=78961 http://code.google.com/p/chromium/issues/detail?id=78961
*/ */
visibility: hidden; font-size: 100px;
position: absolute;
left: 0;
opacity: 0;
} }
#qr #files img { #qr #files img {
max-height: 100px; max-height: 100px;
max-width: 100px; max-width: 100px;
float: left;
} }
#qr input[name=resto] { #qr input[name=resto] {
width: 80px; width: 80px;