From 69c69fe91bb94abc97135f03c98cdfc77fb0b560 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 27 Mar 2012 18:14:47 +0200 Subject: [PATCH 01/13] Unread favicon reset fix. --- 4chan_x.user.js | 4 ++-- script.coffee | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index d18824f69..548818a28 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -973,7 +973,7 @@ break; case Conf.unreadCountTo0: Unread.replies = []; - Unread.update(); + Unread.update(true); break; case Conf.expandImage: Keybinds.img(thread); @@ -3136,7 +3136,7 @@ inline = QuoteInline.table(id, el.innerHTML); if ((i = Unread.replies.indexOf(el.parentNode.parentNode.parentNode)) !== -1) { Unread.replies.splice(i, 1); - Unread.update(); + Unread.update(true); } if (/\bbacklink\b/.test(q.className)) { $.after(q.parentNode, inline); diff --git a/script.coffee b/script.coffee index b34d48329..7cc61c0a6 100644 --- a/script.coffee +++ b/script.coffee @@ -831,7 +831,7 @@ Keybinds = Updater.update() when Conf.unreadCountTo0 Unread.replies = [] - Unread.update() + Unread.update true # Images when Conf.expandImage Keybinds.img thread @@ -2606,7 +2606,7 @@ QuoteInline = inline = QuoteInline.table id, el.innerHTML if (i = Unread.replies.indexOf el.parentNode.parentNode.parentNode) isnt -1 Unread.replies.splice i, 1 - Unread.update() + Unread.update true if /\bbacklink\b/.test q.className $.after q.parentNode, inline if Conf['Forward Hiding'] From 13e2898f893b3929bea4f17913fb8d2b14acdb4d Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 29 Mar 2012 02:58:58 +0200 Subject: [PATCH 02/13] 'Fix' ban error message, reclose #325. --- 4chan_x.user.js | 6 +++--- changelog | 1 + script.coffee | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 548818a28..3b0195cb1 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1995,10 +1995,10 @@ case 'status': return QR.status(data); case 'banned': - QR.error('You are banned.', $.el('a', { - href: 'http://www.4chan.org/banned', + QR.error('_', $.el('a', { + href: '//www.4chan.org/banned', target: '_blank', - textContent: 'You are banned.' + textContent: 'Connection error, or you are banned.' })); return QR.status({ ready: true, diff --git a/changelog b/changelog index 06142db30..17f3b3764 100644 --- a/changelog +++ b/changelog @@ -1,6 +1,7 @@ master - Mayhem Now works when using https. + Ban support improvements and fixes. 2.29.1 - Mayhem diff --git a/script.coffee b/script.coffee index 7cc61c0a6..323dceaac 100644 --- a/script.coffee +++ b/script.coffee @@ -1677,10 +1677,10 @@ QR = when 'status' QR.status data when 'banned' - QR.error 'You are banned.', $.el 'a', - href: 'http://www.4chan.org/banned' + QR.error '_', $.el 'a', + href: '//www.4chan.org/banned' target: '_blank' - textContent: 'You are banned.' + textContent: 'Connection error, or you are banned.' # Disable iframe reloading QR.status ready: true, banned: true else From 194d02e09c3bd5abc86bdfc5c9f0176474f0407b Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 29 Mar 2012 03:03:43 +0200 Subject: [PATCH 03/13] Mmmh, what was I thinking? --- 4chan_x.user.js | 16 +++++----------- changelog | 2 +- script.coffee | 11 ++++------- 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 3b0195cb1..cf2375e13 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3884,7 +3884,7 @@ return $.ready(Main.ready); }, ready: function() { - var MutationObserver, form, nav, node, nodes, observer, _i, _j, _len, _len2, _ref, _ref2; + var MutationObserver, form, nav, observer, _i, _len, _ref; if (d.title === '4chan - 404') { Redirect.init(); return; @@ -3948,13 +3948,7 @@ }); } } - nodes = []; - _ref2 = $$('.op, a + table', form); - for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) { - node = _ref2[_j]; - nodes.push(Main.preParse(node)); - } - Main.node(nodes, true); + Main.node($$('.op, a + table', form), true); if (MutationObserver = window.WebKitMutationObserver || window.MozMutationObserver || window.OMutationObserver || window.MutationObserver) { observer = new MutationObserver(Main.observer); return observer.observe(form, { @@ -4023,7 +4017,7 @@ try { for (_j = 0, _len2 = nodes.length; _j < _len2; _j++) { node = nodes[_j]; - callback(node); + callback(Main.preParse(node)); } } catch (err) { if (notify) { @@ -4040,7 +4034,7 @@ _ref = mutation.addedNodes; for (_j = 0, _len2 = _ref.length; _j < _len2; _j++) { addedNode = _ref[_j]; - if (addedNode.nodeName === 'TABLE') nodes.push(Main.preParse(addedNode)); + if (addedNode.nodeName === 'TABLE') nodes.push(addedNode); } } if (nodes.length) return Main.node(nodes); @@ -4048,7 +4042,7 @@ listener: function(e) { var target; target = e.target; - if (target.nodeName === 'TABLE') return Main.node([Main.preParse(target)]); + if (target.nodeName === 'TABLE') return Main.node([target]); }, namespace: '4chan_x.', version: '2.29.1', diff --git a/changelog b/changelog index 17f3b3764..603a69fe9 100644 --- a/changelog +++ b/changelog @@ -1,6 +1,6 @@ master - Mayhem - Now works when using https. + Add HTTPS support. Ban support improvements and fixes. 2.29.1 diff --git a/script.coffee b/script.coffee index 323dceaac..825c8e300 100644 --- a/script.coffee +++ b/script.coffee @@ -3328,10 +3328,7 @@ Main = if Conf['Index Navigation'] setTimeout -> Nav.init() - nodes = [] - for node in $$ '.op, a + table', form - nodes.push Main.preParse node - Main.node nodes, true + Main.node $$('.op, a + table', form), true if MutationObserver = window.WebKitMutationObserver or window.MozMutationObserver or window.OMutationObserver or window.MutationObserver observer = new MutationObserver Main.observer @@ -3384,7 +3381,7 @@ Main = node: (nodes, notify) -> for callback in Main.callbacks try - callback node for node in nodes + callback Main.preParse node for node in nodes catch err alert "4chan X (#{Main.version}) error: #{err.message}\nhttp://mayhemydg.github.com/4chan-x/#bug-report\n\n#{err.stack}" if notify return @@ -3392,11 +3389,11 @@ Main = nodes = [] for mutation in mutations for addedNode in mutation.addedNodes - nodes.push Main.preParse addedNode if addedNode.nodeName is 'TABLE' + nodes.push addedNode if addedNode.nodeName is 'TABLE' Main.node nodes if nodes.length listener: (e) -> {target} = e - Main.node [Main.preParse target] if target.nodeName is 'TABLE' + Main.node [target] if target.nodeName is 'TABLE' namespace: '4chan_x.' version: '2.29.1' From 4c5c93de5215608de77cf7818c30a1a8f82e0bf2 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 29 Mar 2012 03:10:51 +0200 Subject: [PATCH 04/13] Wait, no. We preParse only once, not at every feature. Revert "Mmmh, what was I thinking?" This reverts commit 194d02e09c3bd5abc86bdfc5c9f0176474f0407b. --- 4chan_x.user.js | 16 +++++++++++----- changelog | 2 +- script.coffee | 11 +++++++---- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index cf2375e13..3b0195cb1 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3884,7 +3884,7 @@ return $.ready(Main.ready); }, ready: function() { - var MutationObserver, form, nav, observer, _i, _len, _ref; + var MutationObserver, form, nav, node, nodes, observer, _i, _j, _len, _len2, _ref, _ref2; if (d.title === '4chan - 404') { Redirect.init(); return; @@ -3948,7 +3948,13 @@ }); } } - Main.node($$('.op, a + table', form), true); + nodes = []; + _ref2 = $$('.op, a + table', form); + for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) { + node = _ref2[_j]; + nodes.push(Main.preParse(node)); + } + Main.node(nodes, true); if (MutationObserver = window.WebKitMutationObserver || window.MozMutationObserver || window.OMutationObserver || window.MutationObserver) { observer = new MutationObserver(Main.observer); return observer.observe(form, { @@ -4017,7 +4023,7 @@ try { for (_j = 0, _len2 = nodes.length; _j < _len2; _j++) { node = nodes[_j]; - callback(Main.preParse(node)); + callback(node); } } catch (err) { if (notify) { @@ -4034,7 +4040,7 @@ _ref = mutation.addedNodes; for (_j = 0, _len2 = _ref.length; _j < _len2; _j++) { addedNode = _ref[_j]; - if (addedNode.nodeName === 'TABLE') nodes.push(addedNode); + if (addedNode.nodeName === 'TABLE') nodes.push(Main.preParse(addedNode)); } } if (nodes.length) return Main.node(nodes); @@ -4042,7 +4048,7 @@ listener: function(e) { var target; target = e.target; - if (target.nodeName === 'TABLE') return Main.node([target]); + if (target.nodeName === 'TABLE') return Main.node([Main.preParse(target)]); }, namespace: '4chan_x.', version: '2.29.1', diff --git a/changelog b/changelog index 603a69fe9..17f3b3764 100644 --- a/changelog +++ b/changelog @@ -1,6 +1,6 @@ master - Mayhem - Add HTTPS support. + Now works when using https. Ban support improvements and fixes. 2.29.1 diff --git a/script.coffee b/script.coffee index 825c8e300..323dceaac 100644 --- a/script.coffee +++ b/script.coffee @@ -3328,7 +3328,10 @@ Main = if Conf['Index Navigation'] setTimeout -> Nav.init() - Main.node $$('.op, a + table', form), true + nodes = [] + for node in $$ '.op, a + table', form + nodes.push Main.preParse node + Main.node nodes, true if MutationObserver = window.WebKitMutationObserver or window.MozMutationObserver or window.OMutationObserver or window.MutationObserver observer = new MutationObserver Main.observer @@ -3381,7 +3384,7 @@ Main = node: (nodes, notify) -> for callback in Main.callbacks try - callback Main.preParse node for node in nodes + callback node for node in nodes catch err alert "4chan X (#{Main.version}) error: #{err.message}\nhttp://mayhemydg.github.com/4chan-x/#bug-report\n\n#{err.stack}" if notify return @@ -3389,11 +3392,11 @@ Main = nodes = [] for mutation in mutations for addedNode in mutation.addedNodes - nodes.push addedNode if addedNode.nodeName is 'TABLE' + nodes.push Main.preParse addedNode if addedNode.nodeName is 'TABLE' Main.node nodes if nodes.length listener: (e) -> {target} = e - Main.node [target] if target.nodeName is 'TABLE' + Main.node [Main.preParse target] if target.nodeName is 'TABLE' namespace: '4chan_x.' version: '2.29.1' From 023d64596282c2bf88b51dd30162e6badc61de8f Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 29 Mar 2012 03:13:43 +0200 Subject: [PATCH 05/13] Release 2.29.2. --- 4chan_x.user.js | 6 +++--- Cakefile | 2 +- changelog | 4 +++- latest.js | 2 +- script.coffee | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 3b0195cb1..9a096366b 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan x -// @version 2.29.1 +// @version 2.29.2 // @namespace aeosynth // @description Adds various features. // @copyright 2009-2011 James Campos @@ -20,7 +20,7 @@ * Copyright (c) 2009-2011 James Campos * Copyright (c) 2012 Nicolas Stepien * http://mayhemydg.github.com/4chan-x/ - * 4chan X 2.29.1 + * 4chan X 2.29.2 * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -4051,7 +4051,7 @@ if (target.nodeName === 'TABLE') return Main.node([Main.preParse(target)]); }, namespace: '4chan_x.', - version: '2.29.1', + version: '2.29.2', callbacks: [], css: '\ /* dialog styling */\ diff --git a/Cakefile b/Cakefile index 3fa6e3468..8fb5a2a42 100644 --- a/Cakefile +++ b/Cakefile @@ -2,7 +2,7 @@ {exec} = require 'child_process' fs = require 'fs' -VERSION = '2.29.1' +VERSION = '2.29.2' HEADER = """ // ==UserScript== diff --git a/changelog b/changelog index 17f3b3764..a6f7f9e6a 100644 --- a/changelog +++ b/changelog @@ -1,6 +1,8 @@ master + +2.29.2 - Mayhem - Now works when using https. + Add HTTPS support. Ban support improvements and fixes. 2.29.1 diff --git a/latest.js b/latest.js index 69d997144..7a76ffa6f 100644 --- a/latest.js +++ b/latest.js @@ -1 +1 @@ -postMessage({version:'2.29.1'},'*') \ No newline at end of file +postMessage({version:'2.29.2'},'*') \ No newline at end of file diff --git a/script.coffee b/script.coffee index 323dceaac..76aef1dc5 100644 --- a/script.coffee +++ b/script.coffee @@ -3399,7 +3399,7 @@ Main = Main.node [Main.preParse target] if target.nodeName is 'TABLE' namespace: '4chan_x.' - version: '2.29.1' + version: '2.29.2' callbacks: [] css: ' /* dialog styling */ From 6f9b6641de2a149718c6d7c86fb466a85f8be38a Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 29 Mar 2012 04:31:14 +0200 Subject: [PATCH 06/13] Get the form even if we hide the original post form. --- 4chan_x.user.js | 2 +- script.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 9a096366b..3d77eb90b 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1227,6 +1227,7 @@ }, asyncInit: function() { var form, iframe, link, loadChecking, script, src; + form = $('form[name=post]'); if (Conf['Hide Original Post Form']) { link = $.el('h1', { innerHTML: "" + (g.REPLY ? 'Quick Reply' : 'New Thread') + "" @@ -1236,7 +1237,6 @@ if (!g.REPLY) $('select', QR.el).value = 'new'; return $('textarea', QR.el).focus(); }); - form = d.forms[0]; $.before(form, link); } if (/chrome/i.test(navigator.userAgent)) { diff --git a/script.coffee b/script.coffee index 76aef1dc5..c7c3d30fc 100644 --- a/script.coffee +++ b/script.coffee @@ -1010,13 +1010,13 @@ QR = setTimeout @asyncInit asyncInit: -> + form = $ 'form[name=post]' if Conf['Hide Original Post Form'] link = $.el 'h1', innerHTML: "#{if g.REPLY then 'Quick Reply' else 'New Thread'}" $.on $('a', link), 'click', -> QR.open() $('select', QR.el).value = 'new' unless g.REPLY $('textarea', QR.el).focus() - form = d.forms[0] $.before form, link # CORS is ignored for content script on Chrome, but not Safari/Oprah/Firefox. From f1ef6dfd2b16f84291e662873213ef5b71277c84 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 29 Mar 2012 05:28:18 +0200 Subject: [PATCH 07/13] Do not ban/disable the QR on connection error. --- 4chan_x.user.js | 10 ++++++++-- script.coffee | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 3d77eb90b..d34578e03 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1994,11 +1994,17 @@ return QR.response(data.html); case 'status': return QR.status(data); + case 'connection error': + return QR.error('_', $.el('a', { + href: '//www.4chan.org/banned', + target: '_blank', + textContent: 'Connection error, or you are banned.' + })); case 'banned': QR.error('_', $.el('a', { href: '//www.4chan.org/banned', target: '_blank', - textContent: 'Connection error, or you are banned.' + textContent: 'You are banned.' })); return QR.status({ ready: true, @@ -2072,7 +2078,7 @@ }, onerror: function() { return QR.message.send({ - req: 'banned' + req: 'connection error' }); } }; diff --git a/script.coffee b/script.coffee index c7c3d30fc..fd50fadd0 100644 --- a/script.coffee +++ b/script.coffee @@ -1676,11 +1676,16 @@ QR = QR.response data.html when 'status' QR.status data - when 'banned' + when 'connection error' QR.error '_', $.el 'a', href: '//www.4chan.org/banned' target: '_blank' textContent: 'Connection error, or you are banned.' + when 'banned' + QR.error '_', $.el 'a', + href: '//www.4chan.org/banned' + target: '_blank' + textContent: 'You are banned.' # Disable iframe reloading QR.status ready: true, banned: true else @@ -1742,8 +1747,9 @@ QR = req: 'response' html: @response onerror: -> + # Connection error, or # CORS disabled error: redirecting to banned page ;_; - QR.message.send req: 'banned' + QR.message.send req: 'connection error' opts = form: form type: 'post' From 8a0e70b19c6e347a226878ef5902a4baf14a4953 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Mon, 2 Apr 2012 11:58:30 +0200 Subject: [PATCH 08/13] We CORS now. At least on sys.4chan.org, so ban detection on non Chrom* browsers is still inaccurate. Close #368 --- 4chan_x.user.js | 303 ++++++++++-------------------------------------- Cakefile | 1 - changelog | 2 + script.coffee | 240 ++++++++------------------------------ 4 files changed, 109 insertions(+), 437 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index d34578e03..dbe75ca8b 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -9,7 +9,6 @@ // @include http*://boards.4chan.org/* // @include http*://images.4chan.org/* // @include http*://sys.4chan.org/* -// @include http*://www.4chan.org/* // @run-at document-start // @updateURL https://raw.github.com/MayhemYDG/4chan-x/stable/4chan_x.user.js // @icon http://mayhemydg.github.com/4chan-x/favicon.gif @@ -1226,46 +1225,17 @@ return setTimeout(this.asyncInit); }, asyncInit: function() { - var form, iframe, link, loadChecking, script, src; - form = $('form[name=post]'); + var link, script; if (Conf['Hide Original Post Form']) { link = $.el('h1', { innerHTML: "" + (g.REPLY ? 'Quick Reply' : 'New Thread') + "" }); - $.on($('a', link), 'click', function() { + $.on(link.firstChild, 'click', function() { QR.open(); if (!g.REPLY) $('select', QR.el).value = 'new'; return $('textarea', QR.el).focus(); }); - $.before(form, link); - } - if (/chrome/i.test(navigator.userAgent)) { - QR.status({ - ready: true - }); - } else { - src = "http" + (/^https/.test(form.action) ? 's' : '') + "://sys.4chan.org/robots.txt"; - iframe = $.el('iframe', { - id: 'iframe', - src: src - }); - $.on(iframe, 'error', function() { - return this.src = this.src; - }); - loadChecking = function(iframe) { - if (!QR.status.ready) { - iframe.src = 'about:blank'; - return setTimeout((function() { - return iframe.src = src; - }), 100); - } - }; - $.on(iframe, 'load', function() { - if (this.src !== 'about:blank') { - return setTimeout(loadChecking, 500, this); - } - }); - $.add(d.head, iframe); + $.before($('form[name=post]'), link); } script = $.el('script', { textContent: 'Recaptcha.focus_response_field=function(){}' @@ -1294,9 +1264,7 @@ close: function() { var i, spoiler, _i, _len, _ref; QR.el.hidden = true; - QR.message.send({ - req: 'abort' - }); + QR.abort(); d.activeElement.blur(); $.removeClass(QR.el, 'dump'); _ref = QR.replies; @@ -1341,23 +1309,12 @@ status: function(data) { var disabled, input, value; if (data == null) data = {}; - if (data.ready) { - QR.status.ready = true; - QR.status.banned = data.banned; - } else if (!QR.status.ready) { - value = 'Loading'; - disabled = true; - } if (g.dead) { value = 404; disabled = true; QR.cooldown.auto = false; - } else if (QR.status.banned) { - value = 'Banned'; - disabled = true; - } else { - value = QR.cooldown.seconds || data.progress || value; } + value = QR.cooldown.seconds || data.progress || value; if (!QR.el) return; input = QR.status.input; input.value = QR.cooldown.auto && Conf['Cooldown'] ? value ? "Auto " + value : 'Auto' : value || 'Submit'; @@ -1823,16 +1780,14 @@ return QR.el.dispatchEvent(e); }, submit: function(e) { - var captcha, captchas, challenge, err, file, m, post, reader, reply, response, threadID; + var callbacks, captcha, captchas, challenge, err, form, m, name, opts, post, reply, response, threadID, val; if (e != null) e.preventDefault(); if (QR.cooldown.seconds) { QR.cooldown.auto = !QR.cooldown.auto; QR.status(); return; } - QR.message.send({ - req: 'abort' - }); + QR.abort(); reply = QR.replies[0]; if (!(reply.com || reply.file)) { err = 'No file selected.'; @@ -1865,8 +1820,10 @@ if (Conf['Thread Watcher'] && Conf['Auto Watch Reply'] && threadID !== 'new') { Watcher.watch(threadID); } + QR.status({ + progress: '...' + }); post = { - postURL: $('form[name=post]').action, resto: threadID, name: reply.name, email: reply.email, @@ -1879,37 +1836,51 @@ recaptcha_challenge_field: challenge, recaptcha_response_field: response + ' ' }; - QR.status({ - progress: '...' - }); - if ($.engine === 'gecko' && reply.file) { - file = {}; - reader = new FileReader(); - reader.onload = function() { - file.buffer = this.result; - file.name = reply.file.name; - file.type = reply.file.type; - post.upfile = file; - return QR.message.send(post); - }; - reader.readAsBinaryString(reply.file); - return; + form = new FormData(); + for (name in post) { + val = post[name]; + if (val) form.append(name, val); } - if (/chrome/i.test(navigator.userAgent)) { - QR.message.post(post); - return; - } - return QR.message.send(post); + callbacks = { + onload: function() { + return QR.response(this.response); + }, + onerror: function() { + return QR.error('_', $.el('a', { + href: '//www.4chan.org/banned', + target: '_blank', + textContent: 'Connection error, or you are banned.' + })); + } + }; + opts = { + form: form, + type: 'POST', + upCallbacks: { + onload: function() { + return QR.status({ + progress: '...' + }); + }, + onprogress: function(e) { + return QR.status({ + progress: "" + (Math.round(e.loaded / e.total * 100)) + "%" + }); + } + } + }; + return QR.ajax = $.ajax($('form[name=post]').action, callbacks, opts); }, response: function(html) { var b, doc, err, node, persona, postNumber, reply, thread, _, _ref; - doc = $.el('a', { - innerHTML: html - }); - if ($('title', doc).textContent === '4chan - Banned') { - QR.message.receive({ - req: 'banned' - }); + doc = d.implementation.createHTMLDocument(null); + doc.documentElement.innerHTML = html; + if (doc.title === '4chan - Banned') { + QR.error('_', $.el('a', { + href: '//www.4chan.org/banned', + target: '_blank', + textContent: 'You are banned.' + })); return; } if (!(b = $('td b', doc))) { @@ -1967,146 +1938,10 @@ QR.status(); return QR.resetFileInput(); }, - message: { - send: function(data) { - var host, window; - if (/chrome/i.test(navigator.userAgent)) { - QR.message.receive(data); - return; - } - data.QR = true; - host = location.hostname; - window = host === 'boards.4chan.org' ? $.id('iframe').contentWindow : parent; - return window.postMessage(data, '*'); - }, - receive: function(data) { - var req, _ref; - req = data.req; - delete data.req; - delete data.QR; - switch (req) { - case 'abort': - if ((_ref = QR.ajax) != null) _ref.abort(); - return QR.message.send({ - req: 'status' - }); - case 'response': - return QR.response(data.html); - case 'status': - return QR.status(data); - case 'connection error': - return QR.error('_', $.el('a', { - href: '//www.4chan.org/banned', - target: '_blank', - textContent: 'Connection error, or you are banned.' - })); - case 'banned': - QR.error('_', $.el('a', { - href: '//www.4chan.org/banned', - target: '_blank', - textContent: 'You are banned.' - })); - return QR.status({ - ready: true, - banned: true - }); - default: - return QR.message.post(data); - } - }, - post: function(data) { - var boundary, callbacks, form, i, name, opts, parts, toBin, url, val; - url = data.postURL; - delete data.postURL; - if ($.engine === 'gecko' && data.upfile) { - if (!data.binary) { - toBin = function(data, name, val) { - var bb, r; - bb = new MozBlobBuilder(); - bb.append(val); - r = new FileReader(); - r.onload = function() { - data[name] = r.result; - if (!--i) return QR.message.post(data); - }; - return r.readAsBinaryString(bb.getBlob('text/plain')); - }; - i = Object.keys(data).length; - for (name in data) { - val = data[name]; - if (typeof val === 'object') { - toBin(data.upfile, 'name', data.upfile.name); - } else if (typeof val === 'boolean') { - if (val) { - toBin(data, name, String(val)); - } else { - i--; - } - } else { - toBin(data, name, val); - } - } - data.postURL = url; - data.binary = true; - return; - } - delete data.binary; - boundary = '-------------SMCD' + Date.now(); - parts = []; - parts.push('Content-Disposition: form-data; name="upfile"; filename="' + data.upfile.name + '"\r\n' + 'Content-Type: ' + data.upfile.type + '\r\n\r\n' + data.upfile.buffer + '\r\n'); - delete data.upfile; - for (name in data) { - val = data[name]; - if (val) { - parts.push('Content-Disposition: form-data; name="' + name + '"\r\n\r\n' + val + '\r\n'); - } - } - form = '--' + boundary + '\r\n' + parts.join('--' + boundary + '\r\n') + '--' + boundary + '--\r\n'; - } else { - form = new FormData(); - for (name in data) { - val = data[name]; - if (val) form.append(name, val); - } - } - callbacks = { - onload: function() { - return QR.message.send({ - req: 'response', - html: this.response - }); - }, - onerror: function() { - return QR.message.send({ - req: 'connection error' - }); - } - }; - opts = { - form: form, - type: 'post', - upCallbacks: { - onload: function() { - return QR.message.send({ - req: 'status', - progress: '...' - }); - }, - onprogress: function(e) { - return QR.message.send({ - req: 'status', - progress: "" + (Math.round(e.loaded / e.total * 100)) + "%" - }); - } - } - }; - if (boundary) { - opts.headers = { - 'Content-Type': 'multipart/form-data;boundary=' + boundary - }; - } - return QR.ajax = $.ajax(url, callbacks, opts); - } + abort: function() { + var _ref; + if ((_ref = QR.ajax) != null) _ref.abort(); + return QR.status(); } }; @@ -2566,10 +2401,7 @@ d.title = d.title.match(/^.+-/)[0] + ' 404'; } Unread.update(true); - QR.message.send({ - req: 'abort' - }); - QR.status(); + QR.abort(); return; } Updater.retryCoef = 10; @@ -3811,12 +3643,7 @@ $.on(window, 'message', Main.message); switch (location.hostname) { case 'sys.4chan.org': - if (path === '/robots.txt') { - QR.message.send({ - req: 'status', - ready: true - }); - } else if (/report/.test(location.search)) { + if (/report/.test(location.search)) { $.ready(function() { return $.on($.id('recaptcha_response_field'), 'keydown', function(e) { if (e.keyCode === 8 && !e.target.value) { @@ -3826,13 +3653,6 @@ }); } return; - case 'www.4chan.org': - if (path === '/banned') { - QR.message.send({ - req: 'banned' - }); - } - return; case 'images.4chan.org': $.ready(function() { if (d.title === '4chan - 404') return Redirect.init(); @@ -3993,13 +3813,8 @@ } }, message: function(e) { - var data, version; - data = e.data; - if (data.QR) { - QR.message.receive(data); - return; - } - version = data.version; + var version; + version = e.data.version; if (version && version !== Main.version && confirm('An updated version of 4chan X is available, would you like to install it now?')) { return window.location = "https://raw.github.com/mayhemydg/4chan-x/" + version + "/4chan_x.user.js"; } diff --git a/Cakefile b/Cakefile index 8fb5a2a42..139742e0c 100644 --- a/Cakefile +++ b/Cakefile @@ -16,7 +16,6 @@ HEADER = """ // @include http*://boards.4chan.org/* // @include http*://images.4chan.org/* // @include http*://sys.4chan.org/* -// @include http*://www.4chan.org/* // @run-at document-start // @updateURL https://raw.github.com/MayhemYDG/4chan-x/stable/4chan_x.user.js // @icon http://mayhemydg.github.com/4chan-x/favicon.gif diff --git a/changelog b/changelog index a6f7f9e6a..2fd72e603 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- Mayhem + Update posting method. 2.29.2 - Mayhem diff --git a/script.coffee b/script.coffee index fd50fadd0..e10dc9695 100644 --- a/script.coffee +++ b/script.coffee @@ -1010,34 +1010,17 @@ QR = setTimeout @asyncInit asyncInit: -> - form = $ 'form[name=post]' if Conf['Hide Original Post Form'] link = $.el 'h1', innerHTML: "#{if g.REPLY then 'Quick Reply' else 'New Thread'}" - $.on $('a', link), 'click', -> + $.on link.firstChild, 'click', -> QR.open() $('select', QR.el).value = 'new' unless g.REPLY $('textarea', QR.el).focus() - $.before form, link - - # CORS is ignored for content script on Chrome, but not Safari/Oprah/Firefox. - if /chrome/i.test navigator.userAgent - QR.status ready: true - else - src = "http#{if /^https/.test form.action then 's' else ''}://sys.4chan.org/robots.txt" - iframe = $.el 'iframe', - id: 'iframe' - src: src - $.on iframe, 'error', -> @src = @src - # Greasemonkey ghetto fix - loadChecking = (iframe) -> - unless QR.status.ready - iframe.src = 'about:blank' - setTimeout (-> iframe.src = src), 100 - $.on iframe, 'load', -> if @src isnt 'about:blank' then setTimeout loadChecking, 500, @ - $.add d.head, iframe + $.before $('form[name=post]'), link # Prevent original captcha input from being focused on reload. - script = $.el 'script', textContent: 'Recaptcha.focus_response_field=function(){}' + script = $.el 'script', + textContent: 'Recaptcha.focus_response_field=function(){}' $.add d.head, script $.rm script @@ -1059,7 +1042,7 @@ QR = QR.dialog() close: -> QR.el.hidden = true - QR.message.send req: 'abort' + QR.abort() d.activeElement.blur() $.removeClass QR.el, 'dump' for i in QR.replies @@ -1093,22 +1076,11 @@ QR = $('.warning', QR.el).textContent = null status: (data={}) -> - if data.ready - QR.status.ready = true - QR.status.banned = data.banned - else unless QR.status.ready - value = 'Loading' - disabled = true if g.dead value = 404 disabled = true QR.cooldown.auto = false - else if QR.status.banned - value = 'Banned' - disabled = true - else - # do not cancel `value = 'Loading'` once the cooldown is over - value = QR.cooldown.seconds or data.progress or value + value = QR.cooldown.seconds or data.progress or value return unless QR.el {input} = QR.status input.value = @@ -1509,7 +1481,7 @@ QR = QR.cooldown.auto = !QR.cooldown.auto QR.status() return - QR.message.send req: 'abort' + QR.abort() reply = QR.replies[0] # prevent errors @@ -1549,8 +1521,11 @@ QR = if Conf['Thread Watcher'] and Conf['Auto Watch Reply'] and threadID isnt 'new' Watcher.watch threadID + # Starting to upload might take some time. + # Provide some feedback that we're starting to submit. + QR.status progress: '...' + post = - postURL: $('form[name=post]').action resto: threadID name: reply.name email: reply.email @@ -1563,36 +1538,42 @@ QR = recaptcha_challenge_field: challenge recaptcha_response_field: response + ' ' - # Starting to upload might take some time. - # Provide some feedback that we're starting to submit. - QR.status progress: '...' + form = new FormData() + for name, val of post + form.append name, val if val - if $.engine is 'gecko' and reply.file - # https://bugzilla.mozilla.org/show_bug.cgi?id=673742 - # We plan to allow postMessaging Files and FileLists across origins, - # that just needs a more in depth security review. - file = {} - reader = new FileReader() - reader.onload = -> - file.buffer = @result - file.name = reply.file.name - file.type = reply.file.type - post.upfile = file - QR.message.send post - reader.readAsBinaryString reply.file - return + callbacks = + onload: -> + QR.response @response + onerror: -> + # Connection error, or + # CORS disabled error on www.4chan.org/banned + QR.error '_', $.el 'a', + href: '//www.4chan.org/banned' + target: '_blank' + textContent: 'Connection error, or you are banned.' + opts = + form: form + type: 'POST' + upCallbacks: + onload: -> + # Upload done, waiting for response. + QR.status progress: '...' + onprogress: (e) -> + # Uploading... + QR.status progress: "#{Math.round e.loaded / e.total * 100}%" - # CORS is ignored for content script on Chrome, but not Safari/Oprah/Firefox. - if /chrome/i.test navigator.userAgent - QR.message.post post - return - QR.message.send post + QR.ajax = $.ajax $('form[name=post]').action, callbacks, opts response: (html) -> - doc = $.el 'a', innerHTML: html + doc = d.implementation.createHTMLDocument null + doc.documentElement.innerHTML = html # Check for ban. - if $('title', doc).textContent is '4chan - Banned' - QR.message.receive req: 'banned' + if doc.title is '4chan - Banned' + QR.error '_', $.el 'a', + href: '//www.4chan.org/banned' + target: '_blank' + textContent: 'You are banned.' return unless b = $ 'td b', doc err = 'Connection error with sys.4chan.org.' @@ -1650,123 +1631,9 @@ QR = QR.status() QR.resetFileInput() - message: - send: (data) -> - # CORS is ignored for content script on Chrome, but not Safari/Oprah/Firefox. - if /chrome/i.test navigator.userAgent - QR.message.receive data - return - data.QR = true - host = location.hostname - window = - if host is 'boards.4chan.org' - $.id('iframe').contentWindow - else - parent - window.postMessage data, '*' - receive: (data) -> - req = data.req - delete data.req - delete data.QR - switch req - when 'abort' - QR.ajax?.abort() - QR.message.send req: 'status' - when 'response' # xhr response - QR.response data.html - when 'status' - QR.status data - when 'connection error' - QR.error '_', $.el 'a', - href: '//www.4chan.org/banned' - target: '_blank' - textContent: 'Connection error, or you are banned.' - when 'banned' - QR.error '_', $.el 'a', - href: '//www.4chan.org/banned' - target: '_blank' - textContent: 'You are banned.' - # Disable iframe reloading - QR.status ready: true, banned: true - else - QR.message.post data # Reply object: we're posting - - post: (data) -> - - url = data.postURL - # Do not append these values to the form. - delete data.postURL - - # File with filename upload fix from desuwa - if $.engine is 'gecko' and data.upfile - # All of this is fucking retarded. - unless data.binary - toBin = (data, name, val) -> - bb = new MozBlobBuilder() - bb.append val - r = new FileReader() - r.onload = -> - data[name] = r.result - unless --i - QR.message.post data - r.readAsBinaryString bb.getBlob 'text/plain' - i = Object.keys(data).length - for name, val of data - if typeof val is 'object' # File. toBin the filename. - toBin data.upfile, 'name', data.upfile.name - else if typeof val is 'boolean' - if val - toBin data, name, String val - else - i-- - else - toBin data, name, val - data.postURL = url - data.binary = true - return - - delete data.binary - - boundary = '-------------SMCD' + Date.now(); - parts = [] - parts.push 'Content-Disposition: form-data; name="upfile"; filename="' + data.upfile.name + '"\r\n' + 'Content-Type: ' + data.upfile.type + '\r\n\r\n' + data.upfile.buffer + '\r\n' - delete data.upfile - - for name, val of data - parts.push 'Content-Disposition: form-data; name="' + name + '"\r\n\r\n' + val + '\r\n' if val - form = '--' + boundary + '\r\n' + parts.join('--' + boundary + '\r\n') + '--' + boundary + '--\r\n' - - else - form = new FormData() - for name, val of data - form.append name, val if val - - callbacks = - onload: -> - QR.message.send - req: 'response' - html: @response - onerror: -> - # Connection error, or - # CORS disabled error: redirecting to banned page ;_; - QR.message.send req: 'connection error' - opts = - form: form - type: 'post' - upCallbacks: - onload: -> - QR.message.send - req: 'status' - progress: '...' - onprogress: (e) -> - QR.message.send - req: 'status' - progress: "#{Math.round e.loaded / e.total * 100}%" - if boundary - opts.headers = - 'Content-Type': 'multipart/form-data;boundary=' + boundary - - QR.ajax = $.ajax url, callbacks, opts + abort: -> + QR.ajax?.abort() + QR.status() Options = init: -> @@ -2179,8 +2046,7 @@ Updater = else d.title = d.title.match(/^.+-/)[0] + ' 404' Unread.update true - QR.message.send req: 'abort' - QR.status() + QR.abort() return Updater.retryCoef = 10 @@ -3178,17 +3044,11 @@ Main = switch location.hostname when 'sys.4chan.org' - if path is '/robots.txt' - QR.message.send req: 'status', ready: true - else if /report/.test location.search + if /report/.test location.search $.ready -> $.on $.id('recaptcha_response_field'), 'keydown', (e) -> window.location = 'javascript:Recaptcha.reload()' if e.keyCode is 8 and not e.target.value return - when 'www.4chan.org' - if path is '/banned' - QR.message.send req: 'banned' - return when 'images.4chan.org' $.ready -> Redirect.init() if d.title is '4chan - 404' return @@ -3365,11 +3225,7 @@ Main = $.on d, 'DOMNodeInserted', Main.addStyle message: (e) -> - {data} = e - if data.QR - QR.message.receive data - return - {version} = data + {version} = e.data if version and version isnt Main.version and confirm 'An updated version of 4chan X is available, would you like to install it now?' window.location = "https://raw.github.com/mayhemydg/4chan-x/#{version}/4chan_x.user.js" From 8fe05bee37028d172265a0d3451ca7739d733d9b Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Mon, 2 Apr 2012 12:21:46 +0200 Subject: [PATCH 09/13] Fix #367 --- 4chan_x.user.js | 2 ++ script.coffee | 3 +++ 2 files changed, 5 insertions(+) diff --git a/4chan_x.user.js b/4chan_x.user.js index dbe75ca8b..c22cdf76b 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1959,6 +1959,7 @@ $.replace(home.firstElementChild, a); } if (!$.get('firstrun')) { + if (!Favicon.el) Favicon.init(); $.set('firstrun', true); return Options.dialog(); } @@ -3320,6 +3321,7 @@ Favicon = { init: function() { var href; + if (this.el) return; this.el = $('link[rel="shortcut icon"]', d.head); this.el.type = 'image/x-icon'; href = this.el.href; diff --git a/script.coffee b/script.coffee index e10dc9695..c38bbbbdf 100644 --- a/script.coffee +++ b/script.coffee @@ -1644,6 +1644,8 @@ Options = $.on a, 'click', Options.dialog $.replace home.firstElementChild, a unless $.get 'firstrun' + # Prevent race conditions + Favicon.init() unless Favicon.el $.set 'firstrun', true Options.dialog() @@ -2809,6 +2811,7 @@ Unread = Favicon = init: -> + return if @el # Prevent race condition with options first run @el = $ 'link[rel="shortcut icon"]', d.head @el.type = 'image/x-icon' {href} = @el From c9f67a04f5ffc8e633344a276c78dfe666071b7a Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 3 Apr 2012 10:10:20 +0200 Subject: [PATCH 10/13] Use an empty string instead of null for document.implementation.createHTMLDocument, should fix Opera compatibility. --- 4chan_x.user.js | 12 ++++++------ script.coffee | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index c22cdf76b..ee9dc92d7 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -725,7 +725,7 @@ a.textContent = "" + req.status + " " + req.statusText; return; } - doc = d.implementation.createHTMLDocument(null); + doc = d.implementation.createHTMLDocument(''); doc.documentElement.innerHTML = req.response; Threading.op($('body > form', doc).firstChild); node = d.importNode(doc.getElementById(replyID)); @@ -830,7 +830,7 @@ return; } a.textContent = a.textContent.replace('\u00d7 Loading...', '-'); - doc = d.implementation.createHTMLDocument(null); + doc = d.implementation.createHTMLDocument(''); doc.documentElement.innerHTML = req.response; nodes = []; _ref = $$('.reply', doc); @@ -1873,7 +1873,7 @@ }, response: function(html) { var b, doc, err, node, persona, postNumber, reply, thread, _, _ref; - doc = d.implementation.createHTMLDocument(null); + doc = d.implementation.createHTMLDocument(''); doc.documentElement.innerHTML = html; if (doc.title === '4chan - Banned') { QR.error('_', $.el('a', { @@ -2421,7 +2421,7 @@ return; } Updater.lastModified = this.getResponseHeader('Last-Modified'); - doc = d.implementation.createHTMLDocument(null); + doc = d.implementation.createHTMLDocument(''); doc.documentElement.innerHTML = this.response; id = $('input', Updater.br.previousElementSibling).name; nodes = []; @@ -3024,7 +3024,7 @@ inline.textContent = "" + req.status + " " + req.statusText; return; } - doc = d.implementation.createHTMLDocument(null); + doc = d.implementation.createHTMLDocument(''); doc.documentElement.innerHTML = req.response; node = id === threadID ? Threading.op($('body > form', doc).firstChild) : doc.getElementById(id); newInline = QuoteInline.table(id, node.innerHTML); @@ -3113,7 +3113,7 @@ qp.textContent = "" + req.status + " " + req.statusText; return; } - doc = d.implementation.createHTMLDocument(null); + doc = d.implementation.createHTMLDocument(''); doc.documentElement.innerHTML = req.response; node = id === threadID ? Threading.op($('body > form', doc).firstChild) : doc.getElementById(id); qp.innerHTML = node.innerHTML; diff --git a/script.coffee b/script.coffee index c38bbbbdf..49687df6d 100644 --- a/script.coffee +++ b/script.coffee @@ -625,7 +625,7 @@ ExpandComment = a.textContent = "#{req.status} #{req.statusText}" return - doc = d.implementation.createHTMLDocument null + doc = d.implementation.createHTMLDocument '' doc.documentElement.innerHTML = req.response Threading.op $('body > form', doc).firstChild @@ -710,7 +710,7 @@ ExpandThread = a.textContent = a.textContent.replace '\u00d7 Loading...', '-' - doc = d.implementation.createHTMLDocument null + doc = d.implementation.createHTMLDocument '' doc.documentElement.innerHTML = req.response nodes = [] @@ -1566,7 +1566,7 @@ QR = QR.ajax = $.ajax $('form[name=post]').action, callbacks, opts response: (html) -> - doc = d.implementation.createHTMLDocument null + doc = d.implementation.createHTMLDocument '' doc.documentElement.innerHTML = html # Check for ban. if doc.title is '4chan - Banned' @@ -2067,7 +2067,7 @@ Updater = return Updater.lastModified = @getResponseHeader 'Last-Modified' - doc = d.implementation.createHTMLDocument null + doc = d.implementation.createHTMLDocument '' doc.documentElement.innerHTML = @response id = $('input', Updater.br.previousElementSibling).name @@ -2519,7 +2519,7 @@ QuoteInline = inline.textContent = "#{req.status} #{req.statusText}" return - doc = d.implementation.createHTMLDocument null + doc = d.implementation.createHTMLDocument '' doc.documentElement.innerHTML = req.response node = @@ -2593,7 +2593,7 @@ QuotePreview = qp.textContent = "#{req.status} #{req.statusText}" return - doc = d.implementation.createHTMLDocument null + doc = d.implementation.createHTMLDocument '' doc.documentElement.innerHTML = req.response node = From 101d1fe9ee37bebc0faf933f2cd169b5e0d284d7 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 4 Apr 2012 10:26:12 +0200 Subject: [PATCH 11/13] Close #366 --- 4chan_x.user.js | 3 +++ script.coffee | 3 +++ 2 files changed, 6 insertions(+) diff --git a/4chan_x.user.js b/4chan_x.user.js index ee9dc92d7..b7b3e8e0c 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1820,6 +1820,9 @@ if (Conf['Thread Watcher'] && Conf['Auto Watch Reply'] && threadID !== 'new') { Watcher.watch(threadID); } + if (!QR.cooldown.auto && $.x('ancestor::div[@id="qr"]', d.activeElement)) { + d.activeElement.blur(); + } QR.status({ progress: '...' }); diff --git a/script.coffee b/script.coffee index 49687df6d..075276046 100644 --- a/script.coffee +++ b/script.coffee @@ -1520,6 +1520,9 @@ QR = QR.hide() if Conf['Thread Watcher'] and Conf['Auto Watch Reply'] and threadID isnt 'new' Watcher.watch threadID + if not QR.cooldown.auto and $.x 'ancestor::div[@id="qr"]', d.activeElement + # Unfocus the focused element if it is one within the QR and we're not auto-posting. + d.activeElement.blur() # Starting to upload might take some time. # Provide some feedback that we're starting to submit. From 218d3353f9069d20ce17d5b6a771bbd5f161e4fe Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Fri, 6 Apr 2012 00:11:42 +0200 Subject: [PATCH 12/13] Release 2.29.3. --- 4chan_x.user.js | 6 +++--- Cakefile | 2 +- changelog | 5 ++++- latest.js | 2 +- script.coffee | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index b7b3e8e0c..8a31910f4 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan x -// @version 2.29.2 +// @version 2.29.3 // @namespace aeosynth // @description Adds various features. // @copyright 2009-2011 James Campos @@ -19,7 +19,7 @@ * Copyright (c) 2009-2011 James Campos * Copyright (c) 2012 Nicolas Stepien * http://mayhemydg.github.com/4chan-x/ - * 4chan X 2.29.2 + * 4chan X 2.29.3 * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -3877,7 +3877,7 @@ if (target.nodeName === 'TABLE') return Main.node([Main.preParse(target)]); }, namespace: '4chan_x.', - version: '2.29.2', + version: '2.29.3', callbacks: [], css: '\ /* dialog styling */\ diff --git a/Cakefile b/Cakefile index 139742e0c..1a84dda37 100644 --- a/Cakefile +++ b/Cakefile @@ -2,7 +2,7 @@ {exec} = require 'child_process' fs = require 'fs' -VERSION = '2.29.2' +VERSION = '2.29.3' HEADER = """ // ==UserScript== diff --git a/changelog b/changelog index 2fd72e603..fd05e3540 100644 --- a/changelog +++ b/changelog @@ -1,6 +1,9 @@ master + +2.29.3 - Mayhem - Update posting method. + Update Quick Reply posting method, this fixes compatibility for uncommon browsers such as + Opera Mobile 12 and Luakit for example. 2.29.2 - Mayhem diff --git a/latest.js b/latest.js index 7a76ffa6f..1dda30899 100644 --- a/latest.js +++ b/latest.js @@ -1 +1 @@ -postMessage({version:'2.29.2'},'*') \ No newline at end of file +postMessage({version:'2.29.3'},'*') \ No newline at end of file diff --git a/script.coffee b/script.coffee index 075276046..f9619dd90 100644 --- a/script.coffee +++ b/script.coffee @@ -3267,7 +3267,7 @@ Main = Main.node [Main.preParse target] if target.nodeName is 'TABLE' namespace: '4chan_x.' - version: '2.29.2' + version: '2.29.3' callbacks: [] css: ' /* dialog styling */ From 4da7308206d4d5293b9c8091bc44ca27983efbf3 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 12 Apr 2012 09:45:14 +0200 Subject: [PATCH 13/13] Close #382. --- 4chan_x.user.js | 1 + changelog | 2 ++ script.coffee | 1 + 3 files changed, 4 insertions(+) diff --git a/4chan_x.user.js b/4chan_x.user.js index 8a31910f4..b3319ad66 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3469,6 +3469,7 @@ AutoGif = { init: function() { + if (g.BOARD === 'gif') return; return Main.callbacks.push(this.node); }, node: function(post) { diff --git a/changelog b/changelog index fd05e3540..f8413bbd0 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- Mayhem + Auto-GIF will not run in /gif/. 2.29.3 - Mayhem diff --git a/script.coffee b/script.coffee index f9619dd90..8e930ed96 100644 --- a/script.coffee +++ b/script.coffee @@ -2905,6 +2905,7 @@ ImageHover = AutoGif = init: -> + return if g.BOARD is 'gif' Main.callbacks.push @node node: (post) -> return if post.root.hidden or not post.img