mirror of
https://github.com/jasny/bootstrap.git
synced 2026-01-23 05:08:03 -05:00
Fixes for bootstrap fileupload
- Fix for IE9- - Fix for click on dismiss button (befor init)
This commit is contained in:
8
js/bootstrap-fileupload.js
vendored
8
js/bootstrap-fileupload.js
vendored
@@ -1,5 +1,5 @@
|
||||
/* ===========================================================
|
||||
* bootstrap-fileupload.js j1
|
||||
* bootstrap-fileupload.js j1a
|
||||
* http://jasny.github.com/bootstrap/javascript.html#fileupload
|
||||
* ===========================================================
|
||||
* Copyright 2012 Jasny BV, Netherlands.
|
||||
@@ -56,7 +56,7 @@
|
||||
},
|
||||
|
||||
change: function(e, invoked) {
|
||||
var file = e.target.files[0]
|
||||
var file = e.target.files !== undefined ? e.target.files[0] : { name: e.target.value.replace(/^.+\\/, '') }
|
||||
if (!file || invoked === 'clear') return
|
||||
|
||||
this.$hidden.val('')
|
||||
@@ -75,7 +75,7 @@
|
||||
|
||||
reader.readAsDataURL(file)
|
||||
} else {
|
||||
this.$preview.html(window.escape(file.name))
|
||||
this.$preview.text(file.name)
|
||||
this.$element.addClass('fileupload-exists').removeClass('fileupload-new')
|
||||
}
|
||||
},
|
||||
@@ -118,6 +118,8 @@
|
||||
var $this = $(this)
|
||||
if ($this.data('fileupload')) return
|
||||
$this.fileupload($this.data())
|
||||
|
||||
if ($(e.target).data('dismiss') == 'fileupload') $(e.target).trigger('click.fileupload')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user