diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index f4a9e7cf8..82725bc84 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -10238,55 +10238,55 @@ var el, fileURL, isVideo; isVideo = /^video\//.test(this.file.type); el = $.el((isVideo ? 'video' : 'img')); - $.on(el, (isVideo ? 'loadeddata' : 'load'), function() { - var cv, error, errors, height, s, width, _i, _len; - errors = this.checkDimensions(el, isVideo); - if (errors.length) { - for (_i = 0, _len = errors.length; _i < _len; _i++) { - error = errors[_i]; - QR.error(error); + $.on(el, (isVideo ? 'loadeddata' : 'load'), (function(_this) { + return function() { + var cv, error, errors, height, s, width, _i, _len; + errors = _this.checkDimensions(el, isVideo); + if (errors.length) { + for (_i = 0, _len = errors.length; _i < _len; _i++) { + error = errors[_i]; + QR.error(error); + } + _this.URL = fileURL; + if ((QR.posts.length === 1) || (_this.com && _this.com.length)) { + return _this.rmFile(); + } else { + return _this.rm(); + } } - this.URL = fileURL; - if ((QR.posts.length === 1) || (this.com && this.com.length)) { - return this.rmFile(); + s = 90 * 2 * window.devicePixelRatio; + if (_this.file.type === 'image/gif') { + s *= 3; + } + if (isVideo) { + height = el.videoHeight; + width = el.videoWidth; } else { - return this.rm(); + height = el.height, width = el.width; + if (height < s || width < s) { + _this.URL = fileURL; + _this.nodes.el.style.backgroundImage = "url(" + _this.URL + ")"; + return; + } } - } - s = 90 * 2 * window.devicePixelRatio; - if (this.file.type === 'image/gif') { - s *= 3; - } - if (isVideo) { - height = el.videoHeight; - width = el.videoWidth; - } else { - height = el.height, width = el.width; - if (height < s || width < s) { - this.URL = fileURL; - this.nodes.el.style.backgroundImage = "url(" + this.URL + ")"; - return; + if (height <= width) { + width = s / height * width; + height = s; + } else { + height = s / width * height; + width = s; } - } - if (height <= width) { - width = s / height * width; - height = s; - } else { - height = s / width * height; - width = s; - } - cv = $.el('canvas'); - cv.height = el.height = height; - cv.width = el.width = width; - cv.getContext('2d').drawImage(el, 0, 0, width, height); - URL.revokeObjectURL(fileURL); - return cv.toBlob((function(_this) { - return function(blob) { + cv = $.el('canvas'); + cv.height = el.height = height; + cv.width = el.width = width; + cv.getContext('2d').drawImage(el, 0, 0, width, height); + URL.revokeObjectURL(fileURL); + return cv.toBlob(function(blob) { _this.URL = URL.createObjectURL(blob); return _this.nodes.el.style.backgroundImage = "url(" + _this.URL + ")"; - }; - })(this)); - }); + }); + }; + })(this)); fileURL = URL.createObjectURL(this.file); return el.src = fileURL; }; diff --git a/builds/crx/script.js b/builds/crx/script.js index d19e0a796..d8e0a4a2f 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -10252,55 +10252,55 @@ var el, fileURL, isVideo; isVideo = /^video\//.test(this.file.type); el = $.el((isVideo ? 'video' : 'img')); - $.on(el, (isVideo ? 'loadeddata' : 'load'), function() { - var cv, error, errors, height, s, width, _i, _len; - errors = this.checkDimensions(el, isVideo); - if (errors.length) { - for (_i = 0, _len = errors.length; _i < _len; _i++) { - error = errors[_i]; - QR.error(error); + $.on(el, (isVideo ? 'loadeddata' : 'load'), (function(_this) { + return function() { + var cv, error, errors, height, s, width, _i, _len; + errors = _this.checkDimensions(el, isVideo); + if (errors.length) { + for (_i = 0, _len = errors.length; _i < _len; _i++) { + error = errors[_i]; + QR.error(error); + } + _this.URL = fileURL; + if ((QR.posts.length === 1) || (_this.com && _this.com.length)) { + return _this.rmFile(); + } else { + return _this.rm(); + } } - this.URL = fileURL; - if ((QR.posts.length === 1) || (this.com && this.com.length)) { - return this.rmFile(); + s = 90 * 2 * window.devicePixelRatio; + if (_this.file.type === 'image/gif') { + s *= 3; + } + if (isVideo) { + height = el.videoHeight; + width = el.videoWidth; } else { - return this.rm(); + height = el.height, width = el.width; + if (height < s || width < s) { + _this.URL = fileURL; + _this.nodes.el.style.backgroundImage = "url(" + _this.URL + ")"; + return; + } } - } - s = 90 * 2 * window.devicePixelRatio; - if (this.file.type === 'image/gif') { - s *= 3; - } - if (isVideo) { - height = el.videoHeight; - width = el.videoWidth; - } else { - height = el.height, width = el.width; - if (height < s || width < s) { - this.URL = fileURL; - this.nodes.el.style.backgroundImage = "url(" + this.URL + ")"; - return; + if (height <= width) { + width = s / height * width; + height = s; + } else { + height = s / width * height; + width = s; } - } - if (height <= width) { - width = s / height * width; - height = s; - } else { - height = s / width * height; - width = s; - } - cv = $.el('canvas'); - cv.height = el.height = height; - cv.width = el.width = width; - cv.getContext('2d').drawImage(el, 0, 0, width, height); - URL.revokeObjectURL(fileURL); - return cv.toBlob((function(_this) { - return function(blob) { + cv = $.el('canvas'); + cv.height = el.height = height; + cv.width = el.width = width; + cv.getContext('2d').drawImage(el, 0, 0, width, height); + URL.revokeObjectURL(fileURL); + return cv.toBlob(function(blob) { _this.URL = URL.createObjectURL(blob); return _this.nodes.el.style.backgroundImage = "url(" + _this.URL + ")"; - }; - })(this)); - }); + }); + }; + })(this)); fileURL = URL.createObjectURL(this.file); return el.src = fileURL; }; diff --git a/src/Posting/QR.post.coffee b/src/Posting/QR.post.coffee index bde74393c..f3f0d3d38 100644 --- a/src/Posting/QR.post.coffee +++ b/src/Posting/QR.post.coffee @@ -182,7 +182,7 @@ QR.post = class isVideo = /^video\//.test @file.type el = $.el (if isVideo then 'video' else 'img') - $.on el, (if isVideo then 'loadeddata' else 'load'), -> + $.on el, (if isVideo then 'loadeddata' else 'load'), => # Verify element dimensions. errors = @checkDimensions el, isVideo if errors.length