Fixes for bootstrap fileupload

- Fix for IE9-
 - Fix for click on dismiss button (befor init)
This commit is contained in:
Arnold Daniels
2012-07-26 00:42:17 +02:00
parent 71e0bea800
commit 4c2cedf084
5 changed files with 15 additions and 9 deletions

View File

@@ -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')
})
})

View File

@@ -2311,7 +2311,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('')
@@ -2330,7 +2330,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')
}
},
@@ -2373,6 +2373,8 @@
var $this = $(this)
if ($this.data('fileupload')) return
$this.fileupload($this.data())
if ($(e.target).data('dismiss') == 'fileupload') $(e.target).trigger('click.fileupload')
})
})

File diff suppressed because one or more lines are too long

View File

@@ -149,7 +149,7 @@
</div>
<div class="row">
<div class="span3">
<h3><a href="./base-css.html#action-links">Iconic icons</a></h3>
<h3><a href="./base-css.html#iconic">Iconic icons</a></h3>
<p>The iconic font set adds 170 new icons to Bootstrap. These icons can be used with buttons, menus, links, etc.</p>
<p>Because these icons are a font, they can be styled just like text.</p>
</div>

View File

@@ -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')
})
})