mirror of
https://github.com/jasny/bootstrap.git
synced 2026-04-24 03:00:49 -04:00
Added fileinput-filename support for fileinput.js
This commit is contained in:
File diff suppressed because one or more lines are too long
8
dist/extend/js/jasny-bootstrap.js
vendored
8
dist/extend/js/jasny-bootstrap.js
vendored
@@ -827,18 +827,22 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") }
|
||||
var $img = $('<img>').attr('src', re.target.result)
|
||||
e.target.files[0].result = re.target.result
|
||||
|
||||
this.$element.find('.fileinput-filename').text(file)
|
||||
|
||||
// if parent has max-height, using `(max-)height: 100%` on child doesn't take padding and border into account
|
||||
if (preview.css('max-height') != 'none') $img.css('max-height', parseInt(preview.css('max-height'), 10) - parseInt(preview.css('padding-top'), 10) - parseInt(preview.css('padding-bottom'), 10) - parseInt(preview.css('border-top'), 10) - parseInt(preview.css('border-bottom'), 10))
|
||||
|
||||
preview.html($img)
|
||||
element.addClass('fileinput-exists').removeClass('fileinput-new')
|
||||
|
||||
|
||||
this.$element.trigger('change.bs.fileinput', e.target.files)
|
||||
}
|
||||
|
||||
reader.readAsDataURL(file)
|
||||
} else {
|
||||
this.$element.find('.fileinput-filename').text(file)
|
||||
this.$preview.text(file)
|
||||
|
||||
this.$element.addClass('fileinput-exists').removeClass('fileinput-new')
|
||||
|
||||
this.$element.trigger('change.bs.fileinput')
|
||||
@@ -919,4 +923,4 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") }
|
||||
}
|
||||
})
|
||||
|
||||
}(window.jQuery)
|
||||
}(window.jQuery);
|
||||
|
||||
2
dist/extend/js/jasny-bootstrap.min.js
vendored
2
dist/extend/js/jasny-bootstrap.min.js
vendored
File diff suppressed because one or more lines are too long
8
dist/js/bootstrap.js
vendored
8
dist/js/bootstrap.js
vendored
@@ -2821,18 +2821,22 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") }
|
||||
var $img = $('<img>').attr('src', re.target.result)
|
||||
e.target.files[0].result = re.target.result
|
||||
|
||||
this.$element.find('.fileinput-filename').text(file)
|
||||
|
||||
// if parent has max-height, using `(max-)height: 100%` on child doesn't take padding and border into account
|
||||
if (preview.css('max-height') != 'none') $img.css('max-height', parseInt(preview.css('max-height'), 10) - parseInt(preview.css('padding-top'), 10) - parseInt(preview.css('padding-bottom'), 10) - parseInt(preview.css('border-top'), 10) - parseInt(preview.css('border-bottom'), 10))
|
||||
|
||||
preview.html($img)
|
||||
element.addClass('fileinput-exists').removeClass('fileinput-new')
|
||||
|
||||
|
||||
this.$element.trigger('change.bs.fileinput', e.target.files)
|
||||
}
|
||||
|
||||
reader.readAsDataURL(file)
|
||||
} else {
|
||||
this.$element.find('.fileinput-filename').text(file)
|
||||
this.$preview.text(file)
|
||||
|
||||
this.$element.addClass('fileinput-exists').removeClass('fileinput-new')
|
||||
|
||||
this.$element.trigger('change.bs.fileinput')
|
||||
@@ -2913,4 +2917,4 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") }
|
||||
}
|
||||
})
|
||||
|
||||
}(window.jQuery)
|
||||
}(window.jQuery);
|
||||
|
||||
2
dist/js/bootstrap.min.js
vendored
2
dist/js/bootstrap.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -79,18 +79,22 @@
|
||||
var $img = $('<img>').attr('src', re.target.result)
|
||||
e.target.files[0].result = re.target.result
|
||||
|
||||
this.$element.find('.fileinput-filename').text(file)
|
||||
|
||||
// if parent has max-height, using `(max-)height: 100%` on child doesn't take padding and border into account
|
||||
if (preview.css('max-height') != 'none') $img.css('max-height', parseInt(preview.css('max-height'), 10) - parseInt(preview.css('padding-top'), 10) - parseInt(preview.css('padding-bottom'), 10) - parseInt(preview.css('border-top'), 10) - parseInt(preview.css('border-bottom'), 10))
|
||||
|
||||
preview.html($img)
|
||||
element.addClass('fileinput-exists').removeClass('fileinput-new')
|
||||
|
||||
|
||||
this.$element.trigger('change.bs.fileinput', e.target.files)
|
||||
}
|
||||
|
||||
reader.readAsDataURL(file)
|
||||
} else {
|
||||
this.$element.find('.fileinput-filename').text(file)
|
||||
this.$preview.text(file)
|
||||
|
||||
this.$element.addClass('fileinput-exists').removeClass('fileinput-new')
|
||||
|
||||
this.$element.trigger('change.bs.fileinput')
|
||||
@@ -171,4 +175,4 @@
|
||||
}
|
||||
})
|
||||
|
||||
}(window.jQuery)
|
||||
}(window.jQuery);
|
||||
|
||||
Reference in New Issue
Block a user