From f5ebd27b3ab14d33bce51ff4f818afda08093603 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 2 Sep 2012 14:55:21 +0200 Subject: [PATCH] Fix duplicate file link. --- 4chan_x.user.js | 18 ++++++------------ changelog | 2 ++ script.coffee | 12 +++--------- 3 files changed, 11 insertions(+), 21 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 6c6f7fd59..ebc33e973 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2448,11 +2448,7 @@ }, onerror: function() { QR.status(); - return QR.error($.el('a', { - href: '//www.4chan.org/banned', - target: '_blank', - textContent: 'Connection error, or you are banned.' - })); + return QR.error('Connection error with sys.4chan.org.'); } }; opts = { @@ -2473,7 +2469,7 @@ return QR.ajax = $.ajax($.id('postForm').parentNode.action, callbacks, opts); }, response: function(html) { - var bs, doc, err, msg, persona, postID, reply, threadID, _, _ref; + var bs, doc, err, msg, persona, postID, reply, threadID, _, _ref, _ref1; doc = d.implementation.createHTMLDocument(''); doc.documentElement.innerHTML = html; if (doc.title === '4chan - Banned') { @@ -2481,11 +2477,9 @@ err = $.el('span', { innerHTML: /^You were issued a warning/.test($('.boxcontent', doc).textContent.trim()) ? "You were issued a warning on " + bs[0].innerHTML + " as " + bs[3].innerHTML + ".
Warning reason: " + bs[1].innerHTML : "You are banned! ;_;
Please click HERE to see the reason." }); - } else if (msg = doc.getElementById('errmsg')) { - err = msg.textContent; - if (msg.firstChild.tagName) { - err = msg.firstChild; - err.target = '_blank'; + } else if (err = doc.getElementById('errmsg')) { + if ((_ref = $('a', err)) != null) { + _ref.target = '_blank'; } } else if (!(msg = $('b', doc))) { err = 'Connection error with sys.4chan.org.'; @@ -2509,7 +2503,7 @@ sub: Conf['Remember Subject'] ? reply.sub : null }; $.set('QR.persona', persona); - _ref = msg.lastChild.textContent.match(/thread:(\d+),no:(\d+)/), _ = _ref[0], threadID = _ref[1], postID = _ref[2]; + _ref1 = msg.lastChild.textContent.match(/thread:(\d+),no:(\d+)/), _ = _ref1[0], threadID = _ref1[1], postID = _ref1[2]; $.event(QR.el, new CustomEvent('QRPostSuccessful', { bubbles: true, detail: { diff --git a/changelog b/changelog index ca8c7cd4f..3bdf29f28 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- Mayhem + Fix duplicate file upload error link. 2.34.8 - Mayhem diff --git a/script.coffee b/script.coffee index e37c11e7b..d95f2b17f 100644 --- a/script.coffee +++ b/script.coffee @@ -1910,10 +1910,7 @@ QR = # Connection error, or # CORS disabled error on www.4chan.org/banned QR.status() - QR.error $.el 'a', - href: '//www.4chan.org/banned' - target: '_blank' - textContent: 'Connection error, or you are banned.' + QR.error 'Connection error with sys.4chan.org.' opts = form: $.formData post upCallbacks: @@ -1937,11 +1934,8 @@ QR = "You were issued a warning on #{bs[0].innerHTML} as #{bs[3].innerHTML}.
Warning reason: #{bs[1].innerHTML}" else "You are banned! ;_;
Please click HERE to see the reason." - else if msg = doc.getElementById 'errmsg' # error! - err = msg.textContent - if msg.firstChild.tagName # duplicate image link - err = msg.firstChild - err.target = '_blank' + else if err = doc.getElementById 'errmsg' # error! + $('a', err)?.target = '_blank' # duplicate image link else unless msg = $ 'b', doc err = 'Connection error with sys.4chan.org.'