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 = {
|
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() {
|
init: function() {
|
||||||
var sc;
|
var sc;
|
||||||
if (!Conf['Quick Reply']) {
|
if (!Conf['Quick Reply']) {
|
||||||
@ -6003,19 +6003,23 @@
|
|||||||
checkDimensions: function(file, isSingle, max) {
|
checkDimensions: function(file, isSingle, max) {
|
||||||
var img,
|
var img,
|
||||||
_this = this;
|
_this = this;
|
||||||
img = new Image();
|
if (/^image\//.test(file.type)) {
|
||||||
img.onload = function() {
|
img = new Image();
|
||||||
var height, width;
|
img.onload = function() {
|
||||||
height = img.height, width = img.width;
|
var height, width;
|
||||||
if (height > QR.max_heigth || width > QR.max_heigth) {
|
height = img.height, width = img.width;
|
||||||
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 || 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 (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 QR.handleFile(file, isSingle, max);
|
||||||
};
|
}
|
||||||
return img.src = URL.createObjectURL(file);
|
|
||||||
},
|
},
|
||||||
handleFile: function(file, isSingle, max) {
|
handleFile: function(file, isSingle, max) {
|
||||||
var post, _ref;
|
var post, _ref;
|
||||||
@ -6978,7 +6982,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.file.newName = this.filename.replace(/[/\\]/g, '-');
|
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';
|
this.file.newName += '.jpg';
|
||||||
}
|
}
|
||||||
return this.updateFilename();
|
return this.updateFilename();
|
||||||
|
|||||||
@ -5620,7 +5620,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
QR = {
|
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() {
|
init: function() {
|
||||||
var sc;
|
var sc;
|
||||||
if (!Conf['Quick Reply']) {
|
if (!Conf['Quick Reply']) {
|
||||||
@ -6039,19 +6039,23 @@
|
|||||||
checkDimensions: function(file, isSingle, max) {
|
checkDimensions: function(file, isSingle, max) {
|
||||||
var img,
|
var img,
|
||||||
_this = this;
|
_this = this;
|
||||||
img = new Image();
|
if (/^image\//.test(file.type)) {
|
||||||
img.onload = function() {
|
img = new Image();
|
||||||
var height, width;
|
img.onload = function() {
|
||||||
height = img.height, width = img.width;
|
var height, width;
|
||||||
if (height > QR.max_heigth || width > QR.max_heigth) {
|
height = img.height, width = img.width;
|
||||||
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 || 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 (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 QR.handleFile(file, isSingle, max);
|
||||||
};
|
}
|
||||||
return img.src = URL.createObjectURL(file);
|
|
||||||
},
|
},
|
||||||
handleFile: function(file, isSingle, max) {
|
handleFile: function(file, isSingle, max) {
|
||||||
var post, _ref;
|
var post, _ref;
|
||||||
@ -6997,7 +7001,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.file.newName = this.filename.replace(/[/\\]/g, '-');
|
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';
|
this.file.newName += '.jpg';
|
||||||
}
|
}
|
||||||
return this.updateFilename();
|
return this.updateFilename();
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
QR =
|
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: ->
|
init: ->
|
||||||
return if !Conf['Quick Reply']
|
return if !Conf['Quick Reply']
|
||||||
@ -359,13 +359,16 @@ QR =
|
|||||||
$.addClass QR.nodes.el, 'dump' unless isSingle
|
$.addClass QR.nodes.el, 'dump' unless isSingle
|
||||||
|
|
||||||
checkDimensions: (file, isSingle, max) ->
|
checkDimensions: (file, isSingle, max) ->
|
||||||
img = new Image()
|
if /^image\//.test file.type
|
||||||
img.onload = =>
|
img = new Image()
|
||||||
{height, width} = img
|
img.onload = =>
|
||||||
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
|
{height, width} = img
|
||||||
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
|
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
|
QR.handleFile file, isSingle, max
|
||||||
img.src = URL.createObjectURL file
|
|
||||||
|
|
||||||
handleFile: (file, isSingle, max) ->
|
handleFile: (file, isSingle, max) ->
|
||||||
if file.size > max
|
if file.size > max
|
||||||
|
|||||||
@ -142,7 +142,7 @@ QR.post = class
|
|||||||
when 'filename'
|
when 'filename'
|
||||||
return unless @file
|
return unless @file
|
||||||
@file.newName = @filename.replace /[/\\]/g, '-'
|
@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,
|
# 4chan will truncate the filename if it has no extension,
|
||||||
# but it will always replace the extension by the correct one,
|
# but it will always replace the extension by the correct one,
|
||||||
# so we suffix it with '.jpg' when needed.
|
# so we suffix it with '.jpg' when needed.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user