From 30262990871d2db9fd99c701cbbdcade39627c1e Mon Sep 17 00:00:00 2001 From: Jordan Bates Date: Wed, 14 Aug 2013 18:34:45 -0700 Subject: [PATCH] Pale Moon support --- builds/4chan-X.user.js | 14 ++++++++++++-- builds/crx/script.js | 14 ++++++++++++-- src/Posting/QuickReply.coffee | 8 +++++++- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 3d2651ad1..dcf07d63b 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -5441,9 +5441,19 @@ return QR.nodes.fileInput.click(); }, fileInput: function(files) { - var file, length, max, post, _i, _len; + var check, err, file, length, max, post, _i, _len; - if (files instanceof Event) { + try { + if (files instanceof Event) { + check = true; + } + } catch (_error) { + err = _error; + if (this instanceof Element) { + check = true; + } + } + if (check) { files = __slice.call(this.files); QR.nodes.fileInput.value = null; } diff --git a/builds/crx/script.js b/builds/crx/script.js index 81ea79b84..e494f5160 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -5451,9 +5451,19 @@ return QR.nodes.fileInput.click(); }, fileInput: function(files) { - var file, length, max, post, _i, _len; + var check, err, file, length, max, post, _i, _len; - if (files instanceof Event) { + try { + if (files instanceof Event) { + check = true; + } + } catch (_error) { + err = _error; + if (this instanceof Element) { + check = true; + } + } + if (check) { files = __slice.call(this.files); QR.nodes.fileInput.value = null; } diff --git a/src/Posting/QuickReply.coffee b/src/Posting/QuickReply.coffee index d0dc911b5..be71207b9 100755 --- a/src/Posting/QuickReply.coffee +++ b/src/Posting/QuickReply.coffee @@ -443,7 +443,13 @@ QR = QR.nodes.fileInput.click() fileInput: (files) -> - if files instanceof Event # file input + try + if files instanceof Event # file input + check = true + catch err + if @ instanceof Element # file input + check = true + if check files = [@files...] QR.nodes.fileInput.value = null # Don't hold the files from being modified on windows {length} = files