add WebM to supported posting types, bypass width/height check for now
This commit is contained in:
parent
26576b4420
commit
9ca9360ffd
@ -5586,7 +5586,7 @@
|
||||
};
|
||||
|
||||
QR = {
|
||||
mimeTypes: ['image/jpeg', 'image/png', 'image/gif', 'application/pdf', 'application/x-shockwave-flash', ''],
|
||||
mimeTypes: ['image/jpeg', 'image/png', 'image/gif', 'application/pdf', 'application/x-shockwave-flash', 'video/webm', ''],
|
||||
init: function() {
|
||||
var sc;
|
||||
if (!Conf['Quick Reply']) {
|
||||
@ -6003,19 +6003,23 @@
|
||||
checkDimensions: function(file, isSingle, max) {
|
||||
var img,
|
||||
_this = this;
|
||||
img = new Image();
|
||||
img.onload = function() {
|
||||
var height, width;
|
||||
height = img.height, width = img.width;
|
||||
if (height > QR.max_heigth || width > QR.max_heigth) {
|
||||
return QR.error("" + file.name + ": Image too large (image: " + img.height + "x" + img.width + "px, max: " + QR.max_heigth + "x" + QR.max_width + "px)");
|
||||
}
|
||||
if (height < QR.min_heigth || width < QR.min_heigth) {
|
||||
return QR.error("" + file.name + ": Image too small (image: " + img.height + "x" + img.width + "px, min: " + QR.min_heigth + "x" + QR.min_width + "px)");
|
||||
}
|
||||
if (/^image\//.test(file.type)) {
|
||||
img = new Image();
|
||||
img.onload = function() {
|
||||
var height, width;
|
||||
height = img.height, width = img.width;
|
||||
if (height > QR.max_heigth || width > QR.max_heigth) {
|
||||
return QR.error("" + file.name + ": Image too large (image: " + img.height + "x" + img.width + "px, max: " + QR.max_heigth + "x" + QR.max_width + "px)");
|
||||
}
|
||||
if (height < QR.min_heigth || width < QR.min_heigth) {
|
||||
return QR.error("" + file.name + ": Image too small (image: " + img.height + "x" + img.width + "px, min: " + QR.min_heigth + "x" + QR.min_width + "px)");
|
||||
}
|
||||
return QR.handleFile(file, isSingle, max);
|
||||
};
|
||||
return img.src = URL.createObjectURL(file);
|
||||
} else {
|
||||
return QR.handleFile(file, isSingle, max);
|
||||
};
|
||||
return img.src = URL.createObjectURL(file);
|
||||
}
|
||||
},
|
||||
handleFile: function(file, isSingle, max) {
|
||||
var post, _ref;
|
||||
@ -6978,7 +6982,7 @@
|
||||
return;
|
||||
}
|
||||
this.file.newName = this.filename.replace(/[/\\]/g, '-');
|
||||
if (!/\.(jpe?g|png|gif|pdf|swf)$/i.test(this.filename)) {
|
||||
if (!/\.(jpe?g|png|gif|pdf|swf|webm)$/i.test(this.filename)) {
|
||||
this.file.newName += '.jpg';
|
||||
}
|
||||
return this.updateFilename();
|
||||
|
||||
@ -5620,7 +5620,7 @@
|
||||
};
|
||||
|
||||
QR = {
|
||||
mimeTypes: ['image/jpeg', 'image/png', 'image/gif', 'application/pdf', 'application/x-shockwave-flash', ''],
|
||||
mimeTypes: ['image/jpeg', 'image/png', 'image/gif', 'application/pdf', 'application/x-shockwave-flash', 'video/webm', ''],
|
||||
init: function() {
|
||||
var sc;
|
||||
if (!Conf['Quick Reply']) {
|
||||
@ -6039,19 +6039,23 @@
|
||||
checkDimensions: function(file, isSingle, max) {
|
||||
var img,
|
||||
_this = this;
|
||||
img = new Image();
|
||||
img.onload = function() {
|
||||
var height, width;
|
||||
height = img.height, width = img.width;
|
||||
if (height > QR.max_heigth || width > QR.max_heigth) {
|
||||
return QR.error("" + file.name + ": Image too large (image: " + img.height + "x" + img.width + "px, max: " + QR.max_heigth + "x" + QR.max_width + "px)");
|
||||
}
|
||||
if (height < QR.min_heigth || width < QR.min_heigth) {
|
||||
return QR.error("" + file.name + ": Image too small (image: " + img.height + "x" + img.width + "px, min: " + QR.min_heigth + "x" + QR.min_width + "px)");
|
||||
}
|
||||
if (/^image\//.test(file.type)) {
|
||||
img = new Image();
|
||||
img.onload = function() {
|
||||
var height, width;
|
||||
height = img.height, width = img.width;
|
||||
if (height > QR.max_heigth || width > QR.max_heigth) {
|
||||
return QR.error("" + file.name + ": Image too large (image: " + img.height + "x" + img.width + "px, max: " + QR.max_heigth + "x" + QR.max_width + "px)");
|
||||
}
|
||||
if (height < QR.min_heigth || width < QR.min_heigth) {
|
||||
return QR.error("" + file.name + ": Image too small (image: " + img.height + "x" + img.width + "px, min: " + QR.min_heigth + "x" + QR.min_width + "px)");
|
||||
}
|
||||
return QR.handleFile(file, isSingle, max);
|
||||
};
|
||||
return img.src = URL.createObjectURL(file);
|
||||
} else {
|
||||
return QR.handleFile(file, isSingle, max);
|
||||
};
|
||||
return img.src = URL.createObjectURL(file);
|
||||
}
|
||||
},
|
||||
handleFile: function(file, isSingle, max) {
|
||||
var post, _ref;
|
||||
@ -6997,7 +7001,7 @@
|
||||
return;
|
||||
}
|
||||
this.file.newName = this.filename.replace(/[/\\]/g, '-');
|
||||
if (!/\.(jpe?g|png|gif|pdf|swf)$/i.test(this.filename)) {
|
||||
if (!/\.(jpe?g|png|gif|pdf|swf|webm)$/i.test(this.filename)) {
|
||||
this.file.newName += '.jpg';
|
||||
}
|
||||
return this.updateFilename();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
QR =
|
||||
mimeTypes: ['image/jpeg', 'image/png', 'image/gif', 'application/pdf', 'application/x-shockwave-flash', '']
|
||||
mimeTypes: ['image/jpeg', 'image/png', 'image/gif', 'application/pdf', 'application/x-shockwave-flash', 'video/webm', '']
|
||||
|
||||
init: ->
|
||||
return if !Conf['Quick Reply']
|
||||
@ -359,13 +359,16 @@ QR =
|
||||
$.addClass QR.nodes.el, 'dump' unless isSingle
|
||||
|
||||
checkDimensions: (file, isSingle, max) ->
|
||||
img = new Image()
|
||||
img.onload = =>
|
||||
{height, width} = img
|
||||
return QR.error "#{file.name}: Image too large (image: #{img.height}x#{img.width}px, max: #{QR.max_heigth}x#{QR.max_width}px)" if height > QR.max_heigth or width > QR.max_heigth
|
||||
return QR.error "#{file.name}: Image too small (image: #{img.height}x#{img.width}px, min: #{QR.min_heigth}x#{QR.min_width}px)" if height < QR.min_heigth or width < QR.min_heigth
|
||||
if /^image\//.test file.type
|
||||
img = new Image()
|
||||
img.onload = =>
|
||||
{height, width} = img
|
||||
return QR.error "#{file.name}: Image too large (image: #{img.height}x#{img.width}px, max: #{QR.max_heigth}x#{QR.max_width}px)" if height > QR.max_heigth or width > QR.max_heigth
|
||||
return QR.error "#{file.name}: Image too small (image: #{img.height}x#{img.width}px, min: #{QR.min_heigth}x#{QR.min_width}px)" if height < QR.min_heigth or width < QR.min_heigth
|
||||
QR.handleFile file, isSingle, max
|
||||
img.src = URL.createObjectURL file
|
||||
else
|
||||
QR.handleFile file, isSingle, max
|
||||
img.src = URL.createObjectURL file
|
||||
|
||||
handleFile: (file, isSingle, max) ->
|
||||
if file.size > max
|
||||
|
||||
@ -142,7 +142,7 @@ QR.post = class
|
||||
when 'filename'
|
||||
return unless @file
|
||||
@file.newName = @filename.replace /[/\\]/g, '-'
|
||||
unless /\.(jpe?g|png|gif|pdf|swf)$/i.test @filename
|
||||
unless /\.(jpe?g|png|gif|pdf|swf|webm)$/i.test @filename
|
||||
# 4chan will truncate the filename if it has no extension,
|
||||
# but it will always replace the extension by the correct one,
|
||||
# so we suffix it with '.jpg' when needed.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user