diff --git a/LICENSE b/LICENSE index 62139460f..cb025aab5 100755 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ /* -* 4chan X - Version 1.4.0 - 2014-02-28 +* 4chan X - Version 1.4.0 - 2014-03-01 * * Licensed under the MIT license. * https://github.com/Spittie/4chan-x/blob/master/LICENSE diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 2e0c371ea..9a6d682a1 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -24,7 +24,7 @@ // ==/UserScript== /* -* 4chan X - Version 1.4.0 - 2014-02-28 +* 4chan X - Version 1.4.0 - 2014-03-01 * * Licensed under the MIT license. * https://github.com/Spittie/4chan-x/blob/master/LICENSE @@ -5984,28 +5984,30 @@ return; } max = QR.nodes.fileInput.max; + dim.max_heigth = QR.max_heigth; + dim.max_width = QR.max_width; isSingle = files.length === 1; QR.cleanNotifications(); for (_i = 0, _len = files.length; _i < _len; _i++) { file = files[_i]; - QR.checkDimensions(file, isSingle, max); + QR.checkDimensions(file, isSingle, max, dim); } if (!isSingle) { return $.addClass(QR.nodes.el, 'dump'); } }, - checkDimensions: function(file, isSingle, max) { + checkDimensions: function(file, isSingle, max, d) { 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 > dim.max_heigth || width > dim.max_heigth) { + return QR.error("" + file.name + ": Image too large (image: " + img.height + "x" + img.width + "px, max: " + d.max_heigth + "x" + d.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 < dim.min_heigth || width < dim.min_heigth) { + return QR.error("" + file.name + ": Image too small (image: " + img.height + "x" + img.width + "px, min: " + d.min_heigth + "x" + d.min_width + "px)"); } return QR.handleFile(file, isSingle, max); }; @@ -6080,7 +6082,7 @@ return list.value = g.VIEW === 'thread' ? g.THREADID : 'new'; }, dialog: function() { - var dialog, elm, event, i, items, key, name, node, nodes, rules, save, value, _ref; + var dialog, elm, event, i, items, key, max_heigth, max_width, min_heigth, min_width, name, node, nodes, rules, save, value, _ref; QR.nodes = nodes = { el: dialog = UI.dialog('qr', 'top:0;right:0;', "
×
+
No selected file
") }; @@ -6116,23 +6118,17 @@ } rules = $('ul.rules').textContent.trim(); try { - QR.min_width = rules.match(/.+smaller than (\d+)x(\d+).+/)[1]; + min_width = rules.match(/.+smaller than (\d+)x(\d+).+/)[1]; + min_heigth = rules.match(/.+smaller than (\d+)x(\d+).+/)[2]; } catch (_error) { - QR.min_width = 1; + min_width = 1; + min_heigth = 1; } try { - QR.min_heigth = rules.match(/.+smaller than (\d+)x(\d+).+/)[2]; - } catch (_error) { - QR.min_heigth = 1; - } - try { - QR.max_width = rules.match(/.+greater than (\d+)x(\d+).+/)[1]; + max_width = rules.match(/.+greater than (\d+)x(\d+).+/)[1]; + max_heigth = rules.match(/.+greater than (\d+)x(\d+).+/)[2]; } catch (_error) { QR.max_width = 5000; - } - try { - QR.max_heigth = rules.match(/.+greater than (\d+)x(\d+).+/)[2]; - } catch (_error) { QR.max_heigth = 5000; } nodes.fileInput.max = $('input[name=MAX_FILE_SIZE]').value; @@ -10425,7 +10421,7 @@ } }, { name: "warosu", - boards: ["3", "biz", "cgl", "ck", "diy", "fa", "ic", "jp", "lit", "sci", "tg", "vr"], + boards: ["3", "biz", "cgl", "ck", "diy", "fa", "g", "ic", "jp", "lit", "sci", "tg", "vr"], files: ["3", "biz", "cgl", "ck", "diy", "fa", "ic", "jp", "lit", "sci", "tg", "vr"], data: { domain: "fuuka.warosu.org", diff --git a/builds/crx/script.js b/builds/crx/script.js index c75707508..d2b262138 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -1,6 +1,6 @@ // Generated by CoffeeScript /* -* 4chan X - Version 1.4.0 - 2014-02-28 +* 4chan X - Version 1.4.0 - 2014-03-01 * * Licensed under the MIT license. * https://github.com/Spittie/4chan-x/blob/master/LICENSE @@ -6020,28 +6020,30 @@ return; } max = QR.nodes.fileInput.max; + dim.max_heigth = QR.max_heigth; + dim.max_width = QR.max_width; isSingle = files.length === 1; QR.cleanNotifications(); for (_i = 0, _len = files.length; _i < _len; _i++) { file = files[_i]; - QR.checkDimensions(file, isSingle, max); + QR.checkDimensions(file, isSingle, max, dim); } if (!isSingle) { return $.addClass(QR.nodes.el, 'dump'); } }, - checkDimensions: function(file, isSingle, max) { + checkDimensions: function(file, isSingle, max, d) { 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 > dim.max_heigth || width > dim.max_heigth) { + return QR.error("" + file.name + ": Image too large (image: " + img.height + "x" + img.width + "px, max: " + d.max_heigth + "x" + d.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 < dim.min_heigth || width < dim.min_heigth) { + return QR.error("" + file.name + ": Image too small (image: " + img.height + "x" + img.width + "px, min: " + d.min_heigth + "x" + d.min_width + "px)"); } return QR.handleFile(file, isSingle, max); }; @@ -6116,7 +6118,7 @@ return list.value = g.VIEW === 'thread' ? g.THREADID : 'new'; }, dialog: function() { - var dialog, elm, event, i, items, key, name, node, nodes, rules, save, value, _ref; + var dialog, elm, event, i, items, key, max_heigth, max_width, min_heigth, min_width, name, node, nodes, rules, save, value, _ref; QR.nodes = nodes = { el: dialog = UI.dialog('qr', 'top:0;right:0;', "
×
+
No selected file
") }; @@ -6152,23 +6154,17 @@ } rules = $('ul.rules').textContent.trim(); try { - QR.min_width = rules.match(/.+smaller than (\d+)x(\d+).+/)[1]; + min_width = rules.match(/.+smaller than (\d+)x(\d+).+/)[1]; + min_heigth = rules.match(/.+smaller than (\d+)x(\d+).+/)[2]; } catch (_error) { - QR.min_width = 1; + min_width = 1; + min_heigth = 1; } try { - QR.min_heigth = rules.match(/.+smaller than (\d+)x(\d+).+/)[2]; - } catch (_error) { - QR.min_heigth = 1; - } - try { - QR.max_width = rules.match(/.+greater than (\d+)x(\d+).+/)[1]; + max_width = rules.match(/.+greater than (\d+)x(\d+).+/)[1]; + max_heigth = rules.match(/.+greater than (\d+)x(\d+).+/)[2]; } catch (_error) { QR.max_width = 5000; - } - try { - QR.max_heigth = rules.match(/.+greater than (\d+)x(\d+).+/)[2]; - } catch (_error) { QR.max_heigth = 5000; } nodes.fileInput.max = $('input[name=MAX_FILE_SIZE]').value; @@ -10428,7 +10424,7 @@ } }, { name: "warosu", - boards: ["3", "biz", "cgl", "ck", "diy", "fa", "ic", "jp", "lit", "sci", "tg", "vr"], + boards: ["3", "biz", "cgl", "ck", "diy", "fa", "g", "ic", "jp", "lit", "sci", "tg", "vr"], files: ["3", "biz", "cgl", "ck", "diy", "fa", "ic", "jp", "lit", "sci", "tg", "vr"], data: { domain: "fuuka.warosu.org", diff --git a/src/Archive/Redirect.coffee b/src/Archive/Redirect.coffee index c5212d4de..210843a53 100755 --- a/src/Archive/Redirect.coffee +++ b/src/Archive/Redirect.coffee @@ -95,7 +95,7 @@ Redirect = software: "fuuka" , name: "warosu" - boards: ["3", "biz", "cgl", "ck", "diy", "fa", "ic", "jp", "lit", "sci", "tg", "vr"] + boards: ["3", "biz", "cgl", "ck", "diy", "fa", "g", "ic", "jp", "lit", "sci", "tg", "vr"] files: ["3", "biz", "cgl", "ck", "diy", "fa", "ic", "jp", "lit", "sci", "tg", "vr"] data: domain: "fuuka.warosu.org" diff --git a/src/Posting/QR.coffee b/src/Posting/QR.coffee index 9c64d5716..8d563ebd9 100644 --- a/src/Posting/QR.coffee +++ b/src/Posting/QR.coffee @@ -352,18 +352,20 @@ QR = @value = null return unless files.length max = QR.nodes.fileInput.max + dim.max_heigth = QR.max_heigth + dim.max_width = QR.max_width isSingle = files.length is 1 QR.cleanNotifications() for file in files - QR.checkDimensions file, isSingle, max + QR.checkDimensions file, isSingle, max, dim $.addClass QR.nodes.el, 'dump' unless isSingle - checkDimensions: (file, isSingle, max) -> + checkDimensions: (file, isSingle, max, d) -> 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 + return QR.error "#{file.name}: Image too large (image: #{img.height}x#{img.width}px, max: #{d.max_heigth}x#{d.max_width}px)" if height > dim.max_heigth or width > dim.max_heigth + return QR.error "#{file.name}: Image too small (image: #{img.height}x#{img.width}px, min: #{d.min_heigth}x#{d.min_width}px)" if height < dim.min_heigth or width < dim.min_heigth QR.handleFile file, isSingle, max img.src = URL.createObjectURL file @@ -451,20 +453,16 @@ QR = rules = $('ul.rules').textContent.trim() try - QR.min_width = rules.match(/.+smaller than (\d+)x(\d+).+/)[1] + min_width = rules.match(/.+smaller than (\d+)x(\d+).+/)[1] + min_heigth = rules.match(/.+smaller than (\d+)x(\d+).+/)[2] catch - QR.min_width = 1 + min_width = 1 + min_heigth = 1 try - QR.min_heigth = rules.match(/.+smaller than (\d+)x(\d+).+/)[2] - catch - QR.min_heigth = 1 - try - QR.max_width = rules.match(/.+greater than (\d+)x(\d+).+/)[1] + max_width = rules.match(/.+greater than (\d+)x(\d+).+/)[1] + max_heigth = rules.match(/.+greater than (\d+)x(\d+).+/)[2] catch QR.max_width = 5000 - try - QR.max_heigth = rules.match(/.+greater than (\d+)x(\d+).+/)[2] - catch QR.max_heigth = 5000 nodes.fileInput.max = $('input[name=MAX_FILE_SIZE]').value