mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-04-27 03:00:12 -04:00
sponsored.js: Show error when trying to add files which are too large
This commit is contained in:
@@ -501,6 +501,23 @@ var exports = r.sponsored = {
|
||||
this.inventory = {}
|
||||
this.campaignListColumns = $('.existing-campaigns thead th').length
|
||||
$("input[name='media_url_type']").on("change", this.mediaInputChange)
|
||||
|
||||
$('input[type=file]').on('change', this._checkFilesize);
|
||||
},
|
||||
|
||||
_checkFilesize: function(e) {
|
||||
var el = e.target;
|
||||
var $el = $(el);
|
||||
var files = el.files;
|
||||
|
||||
if (files && files[0].size > 1024 * 500) {
|
||||
$el
|
||||
.wrap('<form>')
|
||||
.closest('form')
|
||||
.get(0).reset();
|
||||
$el.unwrap();
|
||||
alert(r._('too big. keep it under 500 KiB'));
|
||||
}
|
||||
},
|
||||
|
||||
setup: function(inventory_by_sr, priceDict, isEmpty, userIsSponsor) {
|
||||
|
||||
Reference in New Issue
Block a user