Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removing mouseMoved because it was not needed, Added mouseDown

  • Loading branch information...
commit 9208c19103601cb088aa8727b5063b382c2788d6 1 parent ba625a0
@joshholt joshholt authored etgryphon committed
Showing with 3 additions and 30 deletions.
  1. +3 −30 frameworks/foundation/views/upload.js
View
33 frameworks/foundation/views/upload.js
@@ -96,13 +96,7 @@ SCUI.UploadView = SC.View.extend(
.begin('input')
.attr('type', 'file')
.attr('name', inputName)
- .addStyle({ 'position': 'relative',
- 'height': '100%',
- 'width': 'auto',
- 'opacity': '0',
- '-moz-opacity': '0',
- 'filter': 'progid:DXImageTransform.Microsoft.Alpha(opacity=0)' })
-
+ .setClass('hidden-upload-input', YES)
.end()
.end()
.end()
@@ -147,30 +141,9 @@ SCUI.UploadView = SC.View.extend(
sc_super();
},
- mouseMoved: function(evt) {
+ mouseDown: function(evt) {
if (evt.target.nodeName === 'LABEL') {
- var ox = 0;
- var oy = 0;
- var elem = evt.target;
-
- if (elem.offsetParent) {
- ox = elem.offsetLeft;
- oy = elem.offsetTop;
-
- while (elem = elem.offsetParent) {
- ox += elem.offsetLeft;
- oy += elem.offsetTop;
- }
- }
-
- var x = evt.pageX - ox;
- var y = evt.pageY - oy;
- var w = evt.target.file.offsetWidth;
- var h = evt.target.file.offsetHeight;
-
- var input = this.$('input').firstObject();
- input.style.top = y - (h / 2) + 'px';
- input.style.left = x - (w - 30) + 'px';
+ this.$('input')[0].click();
}
},
Please sign in to comment.
Something went wrong with that request. Please try again.