From 4ea03ae49146e6f7dfcf247c0a5110ce2d9b4ad8 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Fri, 8 Jun 2012 19:13:28 +0200 Subject: [PATCH 01/39] Disable Auto-Gif in /wsg/ too. Close #532 --- 4chan_x.user.js | 3 ++- script.coffee | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 05c2d754c..9f587efb7 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3750,7 +3750,8 @@ AutoGif = { init: function() { - if (g.BOARD === 'gif') { + var _ref; + if ((_ref = g.BOARD) === 'gif' || _ref === 'wsg') { return; } return Main.callbacks.push(this.node); diff --git a/script.coffee b/script.coffee index a24ebc1e3..23f984b36 100644 --- a/script.coffee +++ b/script.coffee @@ -2849,7 +2849,7 @@ ImageHover = AutoGif = init: -> - return if g.BOARD is 'gif' + return if g.BOARD in ['gif', 'wsg'] Main.callbacks.push @node node: (post) -> {img} = post From d1cfa987aed702beb21767f800a83e2895605df7 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Fri, 8 Jun 2012 21:10:37 +0200 Subject: [PATCH 02/39] Only allow the updater's interval value to be greater than 0. Set it to 1 otherwise. --- 4chan_x.user.js | 11 +++++++---- script.coffee | 8 +++++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 9f587efb7..f5c3244e9 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2447,10 +2447,7 @@ Conf[input.name] = input.checked; } } else if (input.name === 'Interval') { - $.on(input, 'input', function() { - this.value = parseInt(this.value, 10) || Conf['Interval']; - return $.cb.value.call(this); - }); + $.on(input, 'input', this.cb.interval); } else if (input.type === 'button') { $.on(input, 'click', this.update); } @@ -2460,6 +2457,12 @@ return this.lastModified = 0; }, cb: { + interval: function() { + var val; + val = parseInt(this.value, 10); + this.value = val > 0 ? val : 1; + return $.cb.value.call(this); + }, verbose: function() { if (Conf['Verbose']) { Updater.count.textContent = '+0'; diff --git a/script.coffee b/script.coffee index 23f984b36..a0ed7751b 100644 --- a/script.coffee +++ b/script.coffee @@ -1907,9 +1907,7 @@ Updater = # Required for the QR's update after posting. Conf[input.name] = input.checked else if input.name is 'Interval' - $.on input, 'input', -> - @value = parseInt(@value, 10) or Conf['Interval'] - $.cb.value.call @ + $.on input, 'input', @cb.interval else if input.type is 'button' $.on input, 'click', @update @@ -1919,6 +1917,10 @@ Updater = @lastModified = 0 cb: + interval: -> + val = parseInt @value, 10 + @value = if val > 0 then val else 1 + $.cb.value.call @ verbose: -> if Conf['Verbose'] Updater.count.textContent = '+0' From 4efe9d2f324ec928999b59a39248381242228320 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 9 Jun 2012 02:12:43 +0200 Subject: [PATCH 03/39] Captchas now last only 5 minutes. --- 4chan_x.user.js | 6 ++++-- changelog | 2 ++ script.coffee | 10 ++++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index f5c3244e9..bd8ac7424 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1834,11 +1834,13 @@ }, load: function() { var challenge; - this.timeout = Date.now() + 26 * $.MINUTE; + this.timeout = Date.now() + 4 * $.MINUTE; challenge = this.challenge.firstChild.value; this.img.alt = challenge; this.img.src = "//www.google.com/recaptcha/api/image?c=" + challenge; - return this.input.value = null; + this.input.value = null; + clearTimeout(this.timeoutID); + return this.timeoutID = setTimeout(this.reload, 4 * $.MINUTE); }, count: function(count) { this.input.placeholder = (function() { diff --git a/changelog b/changelog index d5b4f8b97..171b7f308 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- Mayhem + Update captcha longevity to 5 minutes max, as according to 4chan's change. 2.31.5 - Mayhem diff --git a/script.coffee b/script.coffee index a0ed7751b..178b6fe42 100644 --- a/script.coffee +++ b/script.coffee @@ -1357,12 +1357,18 @@ QR = @count captchas.length @reload() load: -> - # Timeout is available at RecaptchaState.timeout in seconds. - @timeout = Date.now() + 26*$.MINUTE + # Timeout was available at RecaptchaState.timeout in seconds. + # Timeout is now set by moot: 5 minutes. + # We use 5-1 minutes to give upload some time. + @timeout = Date.now() + 4*$.MINUTE challenge = @challenge.firstChild.value @img.alt = challenge @img.src = "//www.google.com/recaptcha/api/image?c=#{challenge}" @input.value = null + # Refresh captchas every 4 minutes to avoid filling perished ones. + # This used to be done by the recaptcha script, but it doesn't take into account moot's custom value. + clearTimeout @timeoutID + @timeoutID = setTimeout @reload, 4*$.MINUTE count: (count) -> @input.placeholder = switch count when 0 From 59aa957d12c5457673a7c05cde431e28256d4361 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 9 Jun 2012 02:13:02 +0200 Subject: [PATCH 04/39] Release 2.31.6. --- 4chan_x.user.js | 6 +++--- Cakefile | 2 +- changelog | 2 ++ latest.js | 2 +- script.coffee | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index bd8ac7424..6563f2c59 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan x -// @version 2.31.5 +// @version 2.31.6 // @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.31.5 + * 4chan X 2.31.6 * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -4280,7 +4280,7 @@ return $.globalEval(("(" + code + ")()").replace('_id_', bq.id)); }, namespace: '4chan_x.', - version: '2.31.5', + version: '2.31.6', callbacks: [], css: '\ /* dialog styling */\ diff --git a/Cakefile b/Cakefile index 42f56c522..82361fbed 100644 --- a/Cakefile +++ b/Cakefile @@ -2,7 +2,7 @@ {exec} = require 'child_process' fs = require 'fs' -VERSION = '2.31.5' +VERSION = '2.31.6' HEADER = """ // ==UserScript== diff --git a/changelog b/changelog index 171b7f308..79ba5bcfb 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master + +2.31.6 - Mayhem Update captcha longevity to 5 minutes max, as according to 4chan's change. diff --git a/latest.js b/latest.js index ab142d2e4..552b509c6 100644 --- a/latest.js +++ b/latest.js @@ -1 +1 @@ -postMessage({version:'2.31.5'},'*') \ No newline at end of file +postMessage({version:'2.31.6'},'*') \ No newline at end of file diff --git a/script.coffee b/script.coffee index 178b6fe42..c40a271f3 100644 --- a/script.coffee +++ b/script.coffee @@ -3249,7 +3249,7 @@ Main = $.globalEval "(#{code})()".replace '_id_', bq.id namespace: '4chan_x.' - version: '2.31.5' + version: '2.31.6' callbacks: [] css: ' /* dialog styling */ From b6df3d60fc9b914fb694dc9bc9f06439f52d243c Mon Sep 17 00:00:00 2001 From: James Campos Date: Sat, 9 Jun 2012 19:15:50 -0700 Subject: [PATCH 05/39] delete button --- 4chan_x.user.js | 29 ++++++++++++++++++++++++++++- changelog | 2 ++ script.coffee | 20 ++++++++++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 6563f2c59..358c9650c 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -72,7 +72,7 @@ */ (function() { - var $, $$, Anonymize, AutoGif, Conf, Config, ExpandComment, ExpandThread, Favicon, FileInfo, Filter, GetTitle, ImageExpand, ImageHover, Keybinds, Main, Nav, Options, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, Quotify, Redirect, ReplyHiding, ReportButton, RevealSpoilers, Sauce, StrikethroughQuotes, ThreadHiding, ThreadStats, Time, TitlePost, UI, Unread, Updater, Watcher, d, g, _base; + var $, $$, Anonymize, AutoGif, Conf, Config, DeleteButton, ExpandComment, ExpandThread, Favicon, FileInfo, Filter, GetTitle, ImageExpand, ImageHover, Keybinds, Main, Nav, Options, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, Quotify, Redirect, ReplyHiding, ReportButton, RevealSpoilers, Sauce, StrikethroughQuotes, ThreadHiding, ThreadStats, Time, TitlePost, UI, Unread, Updater, Watcher, d, g, _base; Config = { main: { @@ -82,6 +82,7 @@ 'Time Formatting': [true, 'Arbitrarily formatted timestamps, using your local time'], 'File Info Formatting': [true, 'Reformats the file information'], 'Report Button': [true, 'Add report buttons'], + 'Delete Button': [false, 'Add delete buttons'], 'Comment Expansion': [true, 'Expand too long comments'], 'Thread Expansion': [true, 'View all replies'], 'Index Navigation': [true, 'Navigate to previous / next thread'], @@ -3416,6 +3417,29 @@ } }; + DeleteButton = { + init: function() { + this.a = $.el('a', { + className: 'delete_button', + innerHTML: '[ X ]', + href: 'javascript:;' + }); + return Main.callbacks.push(this.node); + }, + node: function(post) { + var a; + if (!(a = $('.delete_button', post.el))) { + a = DeleteButton.a.cloneNode(true); + $.add($('.postInfo', post.el), a); + } + return $.on(a, 'click', DeleteButton["delete"]); + }, + "delete": function() { + $.x('preceding-sibling::input', this).checked = true; + return $.id('delPassword').nextElementSibling.click(); + } + }; + ReportButton = { init: function() { this.a = $.el('a', { @@ -4053,6 +4077,9 @@ if (Conf['Report Button']) { ReportButton.init(); } + if (Conf['Delete Button']) { + DeleteButton.init(); + } if (Conf['Resurrect Quotes']) { Quotify.init(); } diff --git a/changelog b/changelog index 79ba5bcfb..f8965c85f 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- aeosynth + delete button 2.31.6 - Mayhem diff --git a/script.coffee b/script.coffee index c40a271f3..a537e5f78 100644 --- a/script.coffee +++ b/script.coffee @@ -6,6 +6,7 @@ Config = 'Time Formatting': [true, 'Arbitrarily formatted timestamps, using your local time'] 'File Info Formatting': [true, 'Reformats the file information'] 'Report Button': [true, 'Add report buttons'] + 'Delete Button': [false, 'Add delete buttons'] 'Comment Expansion': [true, 'Expand too long comments'] 'Thread Expansion': [true, 'View all replies'] 'Index Navigation': [true, 'Navigate to previous / next thread'] @@ -2605,6 +2606,22 @@ Quotify = $.replace node, nodes return +DeleteButton = + init: -> + @a = $.el 'a', + className: 'delete_button' + innerHTML: '[ X ]' + href: 'javascript:;' + Main.callbacks.push @node + node: (post) -> + unless a = $ '.delete_button', post.el + a = DeleteButton.a.cloneNode true + $.add $('.postInfo', post.el), a + $.on a, 'click', DeleteButton.delete + delete: -> + $.x('preceding-sibling::input', @).checked = true + $.id('delPassword').nextElementSibling.click() + ReportButton = init: -> @a = $.el 'a', @@ -3082,6 +3099,9 @@ Main = if Conf['Report Button'] ReportButton.init() + if Conf['Delete Button'] + DeleteButton.init() + if Conf['Resurrect Quotes'] Quotify.init() From 4150ca70f93d281a94023a3bb0831812c4d8fc48 Mon Sep 17 00:00:00 2001 From: James Campos Date: Sun, 10 Jun 2012 15:07:12 -0700 Subject: [PATCH 06/39] ajax delete --- 4chan_x.user.js | 40 ++++++++++++++++++++++++++++++++++++++-- script.coffee | 36 ++++++++++++++++++++++++++++++++++-- 2 files changed, 72 insertions(+), 4 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 358c9650c..285785f74 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3435,8 +3435,44 @@ return $.on(a, 'click', DeleteButton["delete"]); }, "delete": function() { - $.x('preceding-sibling::input', this).checked = true; - return $.id('delPassword').nextElementSibling.click(); + var data, id, m, pwd; + if (m = d.cookie.match(/4chan_pass=([^;]+)/)) { + pwd = decodeURIComponent(m[1]); + } else { + this.textContent = 'Error: no password found'; + return; + } + DeleteButton.el = this; + $.off(this, 'click', DeleteButton["delete"]); + this.textContent = 'Deleting...'; + id = $.x('preceding-sibling::input', this).name; + data = new FormData(); + data.append(id, 'delete'); + data.append('mode', 'usrdel'); + return $.ajax("https://sys.4chan.org/" + g.BOARD + "/imgboard.php", { + onload: DeleteButton.load, + onerror: DeleteButton.error + }, { + type: 'post', + form: data, + pwd: pwd + }); + }, + load: function() { + var doc, msg, tc; + doc = d.implementation.createHTMLDocument(''); + doc.documentElement.innerHTML = this.response; + if (doc.title === '4chan - Banned') { + tc = 'Banned!'; + } else if (msg = doc.getElementById('errmsg')) { + tc = msg.textContent; + } else { + tc = 'Deleted'; + } + return DeleteButton.el.textContent = tc; + }, + error: function() { + return DeleteButton.el.textContent = 'Error'; } }; diff --git a/script.coffee b/script.coffee index a537e5f78..3b42631c2 100644 --- a/script.coffee +++ b/script.coffee @@ -2619,8 +2619,40 @@ DeleteButton = $.add $('.postInfo', post.el), a $.on a, 'click', DeleteButton.delete delete: -> - $.x('preceding-sibling::input', @).checked = true - $.id('delPassword').nextElementSibling.click() + if m = d.cookie.match(/4chan_pass=([^;]+)/) + pwd = decodeURIComponent m[1] + else + @textContent = 'Error: no password found' + return + + DeleteButton.el = @ + $.off @, 'click', DeleteButton.delete + @textContent = 'Deleting...' + + id = $.x('preceding-sibling::input', @).name + data = new FormData() + data.append id, 'delete' + data.append 'mode', 'usrdel' + $.ajax "https://sys.4chan.org/#{g.BOARD}/imgboard.php", { + onload: DeleteButton.load + onerror: DeleteButton.error + }, { + type: 'post' + form: data + pwd: pwd + } + load: -> + doc = d.implementation.createHTMLDocument '' + doc.documentElement.innerHTML = @response + if doc.title is '4chan - Banned' # Ban/warn check + tc = 'Banned!' + else if msg = doc.getElementById 'errmsg' # error! + tc = msg.textContent + else + tc = 'Deleted' + DeleteButton.el.textContent = tc + error: -> + DeleteButton.el.textContent = 'Error' ReportButton = init: -> From d6aa2ef83ea47c3ec7e9f2bd82ee8ae14ce652ea Mon Sep 17 00:00:00 2001 From: James Campos Date: Sun, 10 Jun 2012 15:45:22 -0700 Subject: [PATCH 07/39] ajax: form -> data https://developer.mozilla.org/en/DOM/XMLHttpRequest#send() formdata is just one type of data that can be sent --- 4chan_x.user.js | 18 +++++++++--------- script.coffee | 10 +++++----- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 6563f2c59..7a1ec8f3e 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -311,11 +311,11 @@ return d.getElementById(id); }, ajax: function(url, callbacks, opts) { - var form, headers, key, r, type, upCallbacks, val; + var data, headers, key, r, type, upCallbacks, val; if (opts == null) { opts = {}; } - type = opts.type, headers = opts.headers, upCallbacks = opts.upCallbacks, form = opts.form; + type = opts.type, headers = opts.headers, upCallbacks = opts.upCallbacks, data = opts.data; r = new XMLHttpRequest(); r.open(type || 'get', url, true); for (key in headers) { @@ -324,10 +324,10 @@ } $.extend(r, callbacks); $.extend(r.upload, upCallbacks); - if (typeof form === 'string') { - r.sendAsBinary(form); + if (typeof data === 'string') { + r.sendAsBinary(data); } else { - r.send(form); + r.send(data); } return r; }, @@ -1975,7 +1975,7 @@ return QR.el.dispatchEvent(e); }, submit: function(e) { - var callbacks, captcha, captchas, challenge, err, form, m, name, opts, post, reply, response, threadID, val; + var callbacks, captcha, captchas, challenge, data, err, m, name, opts, post, reply, response, threadID, val; if (e != null) { e.preventDefault(); } @@ -2042,11 +2042,11 @@ recaptcha_challenge_field: challenge, recaptcha_response_field: response + ' ' }; - form = new FormData(); + data = new FormData(); for (name in post) { val = post[name]; if (val) { - form.append(name, val); + data.append(name, val); } } callbacks = { @@ -2063,7 +2063,7 @@ } }; opts = { - form: form, + data: data, type: 'POST', upCallbacks: { onload: function() { diff --git a/script.coffee b/script.coffee index c40a271f3..eae2559a5 100644 --- a/script.coffee +++ b/script.coffee @@ -266,14 +266,14 @@ $.extend $, id: (id) -> d.getElementById id ajax: (url, callbacks, opts={}) -> - {type, headers, upCallbacks, form} = opts + {type, headers, upCallbacks, data} = opts r = new XMLHttpRequest() r.open type or 'get', url, true for key, val of headers r.setRequestHeader key, val $.extend r, callbacks $.extend r.upload, upCallbacks - if typeof form is 'string' then r.sendAsBinary form else r.send form + if typeof data is 'string' then r.sendAsBinary data else r.send data r cache: (url, cb) -> if req = $.cache.requests[url] @@ -1546,9 +1546,9 @@ QR = recaptcha_challenge_field: challenge recaptcha_response_field: response + ' ' - form = new FormData() + data = new FormData() for name, val of post - form.append name, val if val + data.append name, val if val callbacks = onload: -> @@ -1562,7 +1562,7 @@ QR = target: '_blank' textContent: 'Connection error, or you are banned.' opts = - form: form + data: data type: 'POST' upCallbacks: onload: -> From f7a9fb526e78b7a9ce4df5a70cc29fc5d60a496f Mon Sep 17 00:00:00 2001 From: James Campos Date: Sun, 10 Jun 2012 15:49:24 -0700 Subject: [PATCH 08/39] smarter ajax type checking --- 4chan_x.user.js | 7 +++++-- script.coffee | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 7a1ec8f3e..eb6f816e0 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -317,7 +317,11 @@ } type = opts.type, headers = opts.headers, upCallbacks = opts.upCallbacks, data = opts.data; r = new XMLHttpRequest(); - r.open(type || 'get', url, true); + if (data) { + type || (type = 'post'); + } + type || (type = 'get'); + r.open(type, url, true); for (key in headers) { val = headers[key]; r.setRequestHeader(key, val); @@ -2064,7 +2068,6 @@ }; opts = { data: data, - type: 'POST', upCallbacks: { onload: function() { return QR.status({ diff --git a/script.coffee b/script.coffee index eae2559a5..003c05065 100644 --- a/script.coffee +++ b/script.coffee @@ -268,7 +268,9 @@ $.extend $, ajax: (url, callbacks, opts={}) -> {type, headers, upCallbacks, data} = opts r = new XMLHttpRequest() - r.open type or 'get', url, true + type or= 'post' if data + type or= 'get' + r.open type, url, true for key, val of headers r.setRequestHeader key, val $.extend r, callbacks @@ -1563,7 +1565,6 @@ QR = textContent: 'Connection error, or you are banned.' opts = data: data - type: 'POST' upCallbacks: onload: -> # Upload done, waiting for response. From e770265266f33266e924ad0a39a79b33c5fd22ba Mon Sep 17 00:00:00 2001 From: James Campos Date: Sun, 10 Jun 2012 16:28:22 -0700 Subject: [PATCH 09/39] $.formData --- 4chan_x.user.js | 23 +++++++++++++++-------- script.coffee | 12 +++++++++--- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index eb6f816e0..477fb133f 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -310,6 +310,19 @@ id: function(id) { return d.getElementById(id); }, + formData: function(arg) { + var fd, key, val; + if (arg instanceof HTMLElement) { + fd = new FormData(arg); + } else { + fd = new FormData(); + for (key in arg) { + val = arg[key]; + fd.append(key, val); + } + } + return fd; + }, ajax: function(url, callbacks, opts) { var data, headers, key, r, type, upCallbacks, val; if (opts == null) { @@ -1979,7 +1992,7 @@ return QR.el.dispatchEvent(e); }, submit: function(e) { - var callbacks, captcha, captchas, challenge, data, err, m, name, opts, post, reply, response, threadID, val; + var callbacks, captcha, captchas, challenge, data, err, m, opts, post, reply, response, threadID; if (e != null) { e.preventDefault(); } @@ -2046,13 +2059,7 @@ recaptcha_challenge_field: challenge, recaptcha_response_field: response + ' ' }; - data = new FormData(); - for (name in post) { - val = post[name]; - if (val) { - data.append(name, val); - } - } + data = $.formData(post); callbacks = { onload: function() { return QR.response(this.response); diff --git a/script.coffee b/script.coffee index 003c05065..da202318b 100644 --- a/script.coffee +++ b/script.coffee @@ -265,6 +265,14 @@ $.extend $, cb JSON.parse e.newValue if e.key is "#{Main.namespace}#{key}" id: (id) -> d.getElementById id + formData: (arg) -> + if arg instanceof HTMLElement + fd = new FormData arg + else + fd = new FormData() + for key, val of arg + fd.append key, val + fd ajax: (url, callbacks, opts={}) -> {type, headers, upCallbacks, data} = opts r = new XMLHttpRequest() @@ -1548,9 +1556,7 @@ QR = recaptcha_challenge_field: challenge recaptcha_response_field: response + ' ' - data = new FormData() - for name, val of post - data.append name, val if val + data = $.formData post callbacks = onload: -> From 8ec03036aa252ad51a06e21288f8e391854b1ffa Mon Sep 17 00:00:00 2001 From: James Campos Date: Tue, 12 Jun 2012 09:36:02 -0700 Subject: [PATCH 10/39] pig disgusting × --- 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 285785f74..a535d1901 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3421,7 +3421,7 @@ init: function() { this.a = $.el('a', { className: 'delete_button', - innerHTML: '[ X ]', + innerHTML: '[ × ]', href: 'javascript:;' }); return Main.callbacks.push(this.node); diff --git a/script.coffee b/script.coffee index 3b42631c2..b5dd13192 100644 --- a/script.coffee +++ b/script.coffee @@ -2610,7 +2610,7 @@ DeleteButton = init: -> @a = $.el 'a', className: 'delete_button' - innerHTML: '[ X ]' + innerHTML: '[ × ]' href: 'javascript:;' Main.callbacks.push @node node: (post) -> From a9d285f7174cf26de3ec3cd62770f2f7041ea035 Mon Sep 17 00:00:00 2001 From: James Campos Date: Tue, 12 Jun 2012 09:45:56 -0700 Subject: [PATCH 11/39] css braces --- 4chan_x.user.js | 8 +++++++- script.coffee | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index a535d1901..3eb88cc44 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3421,7 +3421,7 @@ init: function() { this.a = $.el('a', { className: 'delete_button', - innerHTML: '[ × ]', + innerHTML: '×', href: 'javascript:;' }); return Main.callbacks.push(this.node); @@ -4738,6 +4738,12 @@ div.opContainer {\ text-decoration: none;\ border-bottom: 1px dashed;\ }\ +.delete_button::before {\ + content: "[ "\ +}\ +.delete_button::after {\ + content: " ]"\ +}\ ' }; diff --git a/script.coffee b/script.coffee index b5dd13192..89a33333e 100644 --- a/script.coffee +++ b/script.coffee @@ -2610,7 +2610,7 @@ DeleteButton = init: -> @a = $.el 'a', className: 'delete_button' - innerHTML: '[ × ]' + innerHTML: '×' href: 'javascript:;' Main.callbacks.push @node node: (post) -> @@ -3696,6 +3696,12 @@ div.opContainer { text-decoration: none; border-bottom: 1px dashed; } +.delete_button::before { + content: "[ " +} +.delete_button::after { + content: " ]" +} ' Main.init() From 743b141b1ad8a81a011f0592d2766b1e244178df Mon Sep 17 00:00:00 2001 From: James Campos Date: Tue, 12 Jun 2012 09:55:40 -0700 Subject: [PATCH 12/39] derp, append pwd to data, not xhr options --- 4chan_x.user.js | 4 ++-- script.coffee | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 3eb88cc44..999596e97 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3449,13 +3449,13 @@ data = new FormData(); data.append(id, 'delete'); data.append('mode', 'usrdel'); + data.append('pwd', pwd); return $.ajax("https://sys.4chan.org/" + g.BOARD + "/imgboard.php", { onload: DeleteButton.load, onerror: DeleteButton.error }, { type: 'post', - form: data, - pwd: pwd + form: data }); }, load: function() { diff --git a/script.coffee b/script.coffee index 89a33333e..04288cbf4 100644 --- a/script.coffee +++ b/script.coffee @@ -2633,13 +2633,13 @@ DeleteButton = data = new FormData() data.append id, 'delete' data.append 'mode', 'usrdel' + data.append 'pwd', pwd $.ajax "https://sys.4chan.org/#{g.BOARD}/imgboard.php", { onload: DeleteButton.load onerror: DeleteButton.error }, { type: 'post' form: data - pwd: pwd } load: -> doc = d.implementation.createHTMLDocument '' From 1e2aa40e22f75aa75e3300943fc03ccf348b325f Mon Sep 17 00:00:00 2001 From: James Campos Date: Tue, 12 Jun 2012 10:02:32 -0700 Subject: [PATCH 13/39] mayhem --- 4chan_x.user.js | 11 ++--------- script.coffee | 5 ++--- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 477fb133f..1a959c2fc 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -330,10 +330,7 @@ } type = opts.type, headers = opts.headers, upCallbacks = opts.upCallbacks, data = opts.data; r = new XMLHttpRequest(); - if (data) { - type || (type = 'post'); - } - type || (type = 'get'); + type || (type = data && 'post' || 'get'); r.open(type, url, true); for (key in headers) { val = headers[key]; @@ -341,11 +338,7 @@ } $.extend(r, callbacks); $.extend(r.upload, upCallbacks); - if (typeof data === 'string') { - r.sendAsBinary(data); - } else { - r.send(data); - } + r.send(data); return r; }, cache: function(url, cb) { diff --git a/script.coffee b/script.coffee index da202318b..6005d5a37 100644 --- a/script.coffee +++ b/script.coffee @@ -276,14 +276,13 @@ $.extend $, ajax: (url, callbacks, opts={}) -> {type, headers, upCallbacks, data} = opts r = new XMLHttpRequest() - type or= 'post' if data - type or= 'get' + type or= data and 'post' or 'get' r.open type, url, true for key, val of headers r.setRequestHeader key, val $.extend r, callbacks $.extend r.upload, upCallbacks - if typeof data is 'string' then r.sendAsBinary data else r.send data + r.send data r cache: (url, cb) -> if req = $.cache.requests[url] From 23672d022fcbb4ad1ae9ccdf980a40f2bd88be09 Mon Sep 17 00:00:00 2001 From: James Campos Date: Tue, 12 Jun 2012 10:07:14 -0700 Subject: [PATCH 14/39] unicode nbsp --- 4chan_x.user.js | 5 +++-- script.coffee | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 999596e97..83e6ab431 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -4738,11 +4738,12 @@ div.opContainer {\ text-decoration: none;\ border-bottom: 1px dashed;\ }\ +/* \u00A0 is nbsp */\ .delete_button::before {\ - content: "[ "\ + content: "[\u00A0"\ }\ .delete_button::after {\ - content: " ]"\ + content: "\u00A0]"\ }\ ' }; diff --git a/script.coffee b/script.coffee index 04288cbf4..805dbf77f 100644 --- a/script.coffee +++ b/script.coffee @@ -3696,11 +3696,12 @@ div.opContainer { text-decoration: none; border-bottom: 1px dashed; } +/* \u00A0 is nbsp */ .delete_button::before { - content: "[ " + content: "[\u00A0" } .delete_button::after { - content: " ]" + content: "\u00A0]" } ' From 91efc92fe11bd789719dd3662f9e4c7f059f9608 Mon Sep 17 00:00:00 2001 From: James Campos Date: Tue, 12 Jun 2012 10:27:10 -0700 Subject: [PATCH 15/39] self --- 4chan_x.user.js | 11 +++++++---- script.coffee | 8 +++++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 83e6ab431..2e76f00c9 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3435,7 +3435,7 @@ return $.on(a, 'click', DeleteButton["delete"]); }, "delete": function() { - var data, id, m, pwd; + var data, id, m, pwd, self; if (m = d.cookie.match(/4chan_pass=([^;]+)/)) { pwd = decodeURIComponent(m[1]); } else { @@ -3445,20 +3445,23 @@ DeleteButton.el = this; $.off(this, 'click', DeleteButton["delete"]); this.textContent = 'Deleting...'; + self = this; id = $.x('preceding-sibling::input', this).name; data = new FormData(); data.append(id, 'delete'); data.append('mode', 'usrdel'); data.append('pwd', pwd); return $.ajax("https://sys.4chan.org/" + g.BOARD + "/imgboard.php", { - onload: DeleteButton.load, + onload: function() { + return DeleteButton.load(self); + }, onerror: DeleteButton.error }, { type: 'post', form: data }); }, - load: function() { + load: function(self) { var doc, msg, tc; doc = d.implementation.createHTMLDocument(''); doc.documentElement.innerHTML = this.response; @@ -3469,7 +3472,7 @@ } else { tc = 'Deleted'; } - return DeleteButton.el.textContent = tc; + return self.textContent = tc; }, error: function() { return DeleteButton.el.textContent = 'Error'; diff --git a/script.coffee b/script.coffee index 805dbf77f..368417e70 100644 --- a/script.coffee +++ b/script.coffee @@ -2629,19 +2629,21 @@ DeleteButton = $.off @, 'click', DeleteButton.delete @textContent = 'Deleting...' + self = this + id = $.x('preceding-sibling::input', @).name data = new FormData() data.append id, 'delete' data.append 'mode', 'usrdel' data.append 'pwd', pwd $.ajax "https://sys.4chan.org/#{g.BOARD}/imgboard.php", { - onload: DeleteButton.load + onload: -> DeleteButton.load self onerror: DeleteButton.error }, { type: 'post' form: data } - load: -> + load: (self) -> doc = d.implementation.createHTMLDocument '' doc.documentElement.innerHTML = @response if doc.title is '4chan - Banned' # Ban/warn check @@ -2650,7 +2652,7 @@ DeleteButton = tc = msg.textContent else tc = 'Deleted' - DeleteButton.el.textContent = tc + self.textContent = tc error: -> DeleteButton.el.textContent = 'Error' From 82743a39dc5e54b9c5472e99edfcab7bcba7468f Mon Sep 17 00:00:00 2001 From: James Campos Date: Tue, 12 Jun 2012 10:29:25 -0700 Subject: [PATCH 16/39] derp --- 4chan_x.user.js | 11 ++++++----- script.coffee | 12 +++++------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 2e76f00c9..acd016ecf 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3442,20 +3442,21 @@ this.textContent = 'Error: no password found'; return; } - DeleteButton.el = this; $.off(this, 'click', DeleteButton["delete"]); this.textContent = 'Deleting...'; - self = this; id = $.x('preceding-sibling::input', this).name; data = new FormData(); data.append(id, 'delete'); data.append('mode', 'usrdel'); data.append('pwd', pwd); + self = this; return $.ajax("https://sys.4chan.org/" + g.BOARD + "/imgboard.php", { onload: function() { return DeleteButton.load(self); }, - onerror: DeleteButton.error + onerror: function() { + return DeleteButton.error(self); + } }, { type: 'post', form: data @@ -3474,8 +3475,8 @@ } return self.textContent = tc; }, - error: function() { - return DeleteButton.el.textContent = 'Error'; + error: function(self) { + return self.textContent = 'Error'; } }; diff --git a/script.coffee b/script.coffee index 368417e70..9b2cd4d7e 100644 --- a/script.coffee +++ b/script.coffee @@ -2625,20 +2625,18 @@ DeleteButton = @textContent = 'Error: no password found' return - DeleteButton.el = @ $.off @, 'click', DeleteButton.delete @textContent = 'Deleting...' - self = this - id = $.x('preceding-sibling::input', @).name data = new FormData() data.append id, 'delete' data.append 'mode', 'usrdel' data.append 'pwd', pwd + self = this $.ajax "https://sys.4chan.org/#{g.BOARD}/imgboard.php", { - onload: -> DeleteButton.load self - onerror: DeleteButton.error + onload: -> DeleteButton.load self + onerror: -> DeleteButton.error self }, { type: 'post' form: data @@ -2653,8 +2651,8 @@ DeleteButton = else tc = 'Deleted' self.textContent = tc - error: -> - DeleteButton.el.textContent = 'Error' + error: (self) -> + self.textContent = 'Error' ReportButton = init: -> From c47e058e7c7a347da33a2443f9b7b74f2d8290dc Mon Sep 17 00:00:00 2001 From: James Campos Date: Tue, 12 Jun 2012 10:32:27 -0700 Subject: [PATCH 17/39] derp --- 4chan_x.user.js | 6 +++--- script.coffee | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index acd016ecf..25a89f79e 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3452,7 +3452,7 @@ self = this; return $.ajax("https://sys.4chan.org/" + g.BOARD + "/imgboard.php", { onload: function() { - return DeleteButton.load(self); + return DeleteButton.load(self, this.response); }, onerror: function() { return DeleteButton.error(self); @@ -3462,10 +3462,10 @@ form: data }); }, - load: function(self) { + load: function(self, html) { var doc, msg, tc; doc = d.implementation.createHTMLDocument(''); - doc.documentElement.innerHTML = this.response; + doc.documentElement.innerHTML = html; if (doc.title === '4chan - Banned') { tc = 'Banned!'; } else if (msg = doc.getElementById('errmsg')) { diff --git a/script.coffee b/script.coffee index 9b2cd4d7e..98767c132 100644 --- a/script.coffee +++ b/script.coffee @@ -2635,15 +2635,15 @@ DeleteButton = data.append 'pwd', pwd self = this $.ajax "https://sys.4chan.org/#{g.BOARD}/imgboard.php", { - onload: -> DeleteButton.load self + onload: -> DeleteButton.load self, @response onerror: -> DeleteButton.error self }, { type: 'post' form: data } - load: (self) -> + load: (self, html) -> doc = d.implementation.createHTMLDocument '' - doc.documentElement.innerHTML = @response + doc.documentElement.innerHTML = html if doc.title is '4chan - Banned' # Ban/warn check tc = 'Banned!' else if msg = doc.getElementById 'errmsg' # error! From ab94fcfb79dfd8a107cd0e26b788b86f31290cb6 Mon Sep 17 00:00:00 2001 From: James Campos Date: Tue, 12 Jun 2012 10:41:49 -0700 Subject: [PATCH 18/39] formData: HTMLElement -> HTMLFormElement --- 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 1a959c2fc..0215bab6a 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -312,7 +312,7 @@ }, formData: function(arg) { var fd, key, val; - if (arg instanceof HTMLElement) { + if (arg instanceof HTMLFormElement) { fd = new FormData(arg); } else { fd = new FormData(); diff --git a/script.coffee b/script.coffee index 6005d5a37..43fc6f1b8 100644 --- a/script.coffee +++ b/script.coffee @@ -266,7 +266,7 @@ $.extend $, id: (id) -> d.getElementById id formData: (arg) -> - if arg instanceof HTMLElement + if arg instanceof HTMLFormElement fd = new FormData arg else fd = new FormData() From 0af6c74e709f6d08268437c15ac588bd713a398b Mon Sep 17 00:00:00 2001 From: James Campos Date: Tue, 12 Jun 2012 10:48:23 -0700 Subject: [PATCH 19/39] no u --- 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 25a89f79e..e35f484b5 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -4744,10 +4744,10 @@ div.opContainer {\ }\ /* \u00A0 is nbsp */\ .delete_button::before {\ - content: "[\u00A0"\ + content: "[\\00a0"\ }\ .delete_button::after {\ - content: "\u00A0]"\ + content: "\\00a0]"\ }\ ' }; diff --git a/script.coffee b/script.coffee index 98767c132..f2b0ab77d 100644 --- a/script.coffee +++ b/script.coffee @@ -3698,10 +3698,10 @@ div.opContainer { } /* \u00A0 is nbsp */ .delete_button::before { - content: "[\u00A0" + content: "[\\00a0" } .delete_button::after { - content: "\u00A0]" + content: "\\00a0]" } ' From b0e001415425cfad3eb96e569bdc70f11ccac9fe Mon Sep 17 00:00:00 2001 From: James Campos Date: Tue, 12 Jun 2012 11:12:45 -0700 Subject: [PATCH 20/39] update comment --- 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 e35f484b5..d9fee1ed5 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -4742,7 +4742,7 @@ div.opContainer {\ text-decoration: none;\ border-bottom: 1px dashed;\ }\ -/* \u00A0 is nbsp */\ +/* \\00A0 is nbsp */\ .delete_button::before {\ content: "[\\00a0"\ }\ diff --git a/script.coffee b/script.coffee index f2b0ab77d..eedd97457 100644 --- a/script.coffee +++ b/script.coffee @@ -3696,7 +3696,7 @@ div.opContainer { text-decoration: none; border-bottom: 1px dashed; } -/* \u00A0 is nbsp */ +/* \\00A0 is nbsp */ .delete_button::before { content: "[\\00a0" } From 51e6aae6402dfd4598537bdb070208ca0d3793f1 Mon Sep 17 00:00:00 2001 From: James Campos Date: Tue, 12 Jun 2012 11:15:00 -0700 Subject: [PATCH 21/39] make arg name ambiguous / misleading --- 4chan_x.user.js | 10 +++++----- script.coffee | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 0215bab6a..29adb3ac0 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -324,13 +324,13 @@ return fd; }, ajax: function(url, callbacks, opts) { - var data, headers, key, r, type, upCallbacks, val; + var form, headers, key, r, type, upCallbacks, val; if (opts == null) { opts = {}; } - type = opts.type, headers = opts.headers, upCallbacks = opts.upCallbacks, data = opts.data; + type = opts.type, headers = opts.headers, upCallbacks = opts.upCallbacks, form = opts.form; r = new XMLHttpRequest(); - type || (type = data && 'post' || 'get'); + type || (type = form && 'post' || 'get'); r.open(type, url, true); for (key in headers) { val = headers[key]; @@ -338,7 +338,7 @@ } $.extend(r, callbacks); $.extend(r.upload, upCallbacks); - r.send(data); + r.send(form); return r; }, cache: function(url, cb) { @@ -2067,7 +2067,7 @@ } }; opts = { - data: data, + form: data, upCallbacks: { onload: function() { return QR.status({ diff --git a/script.coffee b/script.coffee index 43fc6f1b8..18f99d331 100644 --- a/script.coffee +++ b/script.coffee @@ -274,15 +274,15 @@ $.extend $, fd.append key, val fd ajax: (url, callbacks, opts={}) -> - {type, headers, upCallbacks, data} = opts + {type, headers, upCallbacks, form} = opts r = new XMLHttpRequest() - type or= data and 'post' or 'get' + type or= form and 'post' or 'get' r.open type, url, true for key, val of headers r.setRequestHeader key, val $.extend r, callbacks $.extend r.upload, upCallbacks - r.send data + r.send form r cache: (url, cb) -> if req = $.cache.requests[url] @@ -1569,7 +1569,7 @@ QR = target: '_blank' textContent: 'Connection error, or you are banned.' opts = - data: data + form: data upCallbacks: onload: -> # Upload done, waiting for response. From bd5616ebdb4b93365a68e13a2117721c59140044 Mon Sep 17 00:00:00 2001 From: James Campos Date: Tue, 12 Jun 2012 12:14:09 -0700 Subject: [PATCH 22/39] work on cross quote, shuffle --- 4chan_x.user.js | 14 +++++++------- script.coffee | 18 ++++++++++-------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index d9fee1ed5..39d667293 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3435,22 +3435,22 @@ return $.on(a, 'click', DeleteButton["delete"]); }, "delete": function() { - var data, id, m, pwd, self; + var board, data, id, m, pwd, self; + $.off(this, 'click', DeleteButton["delete"]); + this.textContent = 'Deleting...'; if (m = d.cookie.match(/4chan_pass=([^;]+)/)) { pwd = decodeURIComponent(m[1]); } else { - this.textContent = 'Error: no password found'; - return; + pwd = $.id('delPassword').value; } - $.off(this, 'click', DeleteButton["delete"]); - this.textContent = 'Deleting...'; id = $.x('preceding-sibling::input', this).name; + board = $.x('preceding-sibling::span[1]/a', this).pathname.match(/\w+/)[0]; + self = this; data = new FormData(); data.append(id, 'delete'); data.append('mode', 'usrdel'); data.append('pwd', pwd); - self = this; - return $.ajax("https://sys.4chan.org/" + g.BOARD + "/imgboard.php", { + return $.ajax("https://sys.4chan.org/" + board + "/imgboard.php", { onload: function() { return DeleteButton.load(self, this.response); }, diff --git a/script.coffee b/script.coffee index eedd97457..ecd530c7c 100644 --- a/script.coffee +++ b/script.coffee @@ -2619,28 +2619,30 @@ DeleteButton = $.add $('.postInfo', post.el), a $.on a, 'click', DeleteButton.delete delete: -> - if m = d.cookie.match(/4chan_pass=([^;]+)/) - pwd = decodeURIComponent m[1] - else - @textContent = 'Error: no password found' - return - $.off @, 'click', DeleteButton.delete @textContent = 'Deleting...' + if m = d.cookie.match(/4chan_pass=([^;]+)/) + pwd = decodeURIComponent m[1] + else + pwd = $.id('delPassword').value id = $.x('preceding-sibling::input', @).name + board = $.x('preceding-sibling::span[1]/a', @).pathname.match(/\w+/)[0] + self = this + data = new FormData() data.append id, 'delete' data.append 'mode', 'usrdel' data.append 'pwd', pwd - self = this - $.ajax "https://sys.4chan.org/#{g.BOARD}/imgboard.php", { + + $.ajax "https://sys.4chan.org/#{board}/imgboard.php", { onload: -> DeleteButton.load self, @response onerror: -> DeleteButton.error self }, { type: 'post' form: data } + load: (self, html) -> doc = d.implementation.createHTMLDocument '' doc.documentElement.innerHTML = html From 457f3ec977d4a0b9f0f97fc2e54fe685942782eb Mon Sep 17 00:00:00 2001 From: James Campos Date: Wed, 13 Jun 2012 05:54:19 -0700 Subject: [PATCH 23/39] no data --- 4chan_x.user.js | 5 ++--- script.coffee | 4 +--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 29adb3ac0..37bf5a0e4 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1985,7 +1985,7 @@ return QR.el.dispatchEvent(e); }, submit: function(e) { - var callbacks, captcha, captchas, challenge, data, err, m, opts, post, reply, response, threadID; + var callbacks, captcha, captchas, challenge, err, m, opts, post, reply, response, threadID; if (e != null) { e.preventDefault(); } @@ -2052,7 +2052,6 @@ recaptcha_challenge_field: challenge, recaptcha_response_field: response + ' ' }; - data = $.formData(post); callbacks = { onload: function() { return QR.response(this.response); @@ -2067,7 +2066,7 @@ } }; opts = { - form: data, + form: $.formData(post), upCallbacks: { onload: function() { return QR.status({ diff --git a/script.coffee b/script.coffee index 18f99d331..20083919c 100644 --- a/script.coffee +++ b/script.coffee @@ -1555,8 +1555,6 @@ QR = recaptcha_challenge_field: challenge recaptcha_response_field: response + ' ' - data = $.formData post - callbacks = onload: -> QR.response @response @@ -1569,7 +1567,7 @@ QR = target: '_blank' textContent: 'Connection error, or you are banned.' opts = - form: data + form: $.formData post upCallbacks: onload: -> # Upload done, waiting for response. From 3efe11ae322ea4e29eaa57557a532709a1e33798 Mon Sep 17 00:00:00 2001 From: James Campos Date: Wed, 13 Jun 2012 05:59:01 -0700 Subject: [PATCH 24/39] rm redundant parens --- script.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script.coffee b/script.coffee index ecd530c7c..b8f1b1b89 100644 --- a/script.coffee +++ b/script.coffee @@ -2622,7 +2622,7 @@ DeleteButton = $.off @, 'click', DeleteButton.delete @textContent = 'Deleting...' - if m = d.cookie.match(/4chan_pass=([^;]+)/) + if m = d.cookie.match /4chan_pass=([^;]+)/ pwd = decodeURIComponent m[1] else pwd = $.id('delPassword').value From e18120acd2eecba84573e23d17e2226d2a43fdd2 Mon Sep 17 00:00:00 2001 From: James Campos Date: Wed, 13 Jun 2012 06:01:18 -0700 Subject: [PATCH 25/39] readd listener on connection error --- 4chan_x.user.js | 3 ++- script.coffee | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 39d667293..2ead934f9 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3476,7 +3476,8 @@ return self.textContent = tc; }, error: function(self) { - return self.textContent = 'Error'; + self.textContent = 'Error'; + return $.on('click', self, DeleteButton["delete"]); } }; diff --git a/script.coffee b/script.coffee index b8f1b1b89..24f45f327 100644 --- a/script.coffee +++ b/script.coffee @@ -2655,6 +2655,7 @@ DeleteButton = self.textContent = tc error: (self) -> self.textContent = 'Error' + $.on 'click', self, DeleteButton.delete ReportButton = init: -> From d7781ec3fd11a6270dcd69d56f81af37eb6ec488 Mon Sep 17 00:00:00 2001 From: James Campos Date: Wed, 13 Jun 2012 06:03:17 -0700 Subject: [PATCH 26/39] data -> form --- 4chan_x.user.js | 12 ++++++------ script.coffee | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 2ead934f9..763518aa8 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3435,7 +3435,7 @@ return $.on(a, 'click', DeleteButton["delete"]); }, "delete": function() { - var board, data, id, m, pwd, self; + var board, form, id, m, pwd, self; $.off(this, 'click', DeleteButton["delete"]); this.textContent = 'Deleting...'; if (m = d.cookie.match(/4chan_pass=([^;]+)/)) { @@ -3446,10 +3446,10 @@ id = $.x('preceding-sibling::input', this).name; board = $.x('preceding-sibling::span[1]/a', this).pathname.match(/\w+/)[0]; self = this; - data = new FormData(); - data.append(id, 'delete'); - data.append('mode', 'usrdel'); - data.append('pwd', pwd); + form = new FormData(); + form.append(id, 'delete'); + form.append('mode', 'usrdel'); + form.append('pwd', pwd); return $.ajax("https://sys.4chan.org/" + board + "/imgboard.php", { onload: function() { return DeleteButton.load(self, this.response); @@ -3459,7 +3459,7 @@ } }, { type: 'post', - form: data + form: form }); }, load: function(self, html) { diff --git a/script.coffee b/script.coffee index 24f45f327..70570a838 100644 --- a/script.coffee +++ b/script.coffee @@ -2630,17 +2630,17 @@ DeleteButton = board = $.x('preceding-sibling::span[1]/a', @).pathname.match(/\w+/)[0] self = this - data = new FormData() - data.append id, 'delete' - data.append 'mode', 'usrdel' - data.append 'pwd', pwd + form = new FormData() + form.append id, 'delete' + form.append 'mode', 'usrdel' + form.append 'pwd', pwd $.ajax "https://sys.4chan.org/#{board}/imgboard.php", { onload: -> DeleteButton.load self, @response onerror: -> DeleteButton.error self }, { type: 'post' - form: data + form: form } load: (self, html) -> From c383397b197e340e50a793357b50810c1d62f498 Mon Sep 17 00:00:00 2001 From: James Campos Date: Wed, 13 Jun 2012 06:17:35 -0700 Subject: [PATCH 27/39] use $.formData --- 4chan_x.user.js | 12 +++++++----- script.coffee | 9 +++++---- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 644a451a1..22a70660c 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3437,7 +3437,7 @@ return $.on(a, 'click', DeleteButton["delete"]); }, "delete": function() { - var board, form, id, m, pwd, self; + var board, form, id, m, o, pwd, self; $.off(this, 'click', DeleteButton["delete"]); this.textContent = 'Deleting...'; if (m = d.cookie.match(/4chan_pass=([^;]+)/)) { @@ -3448,10 +3448,12 @@ id = $.x('preceding-sibling::input', this).name; board = $.x('preceding-sibling::span[1]/a', this).pathname.match(/\w+/)[0]; self = this; - form = new FormData(); - form.append(id, 'delete'); - form.append('mode', 'usrdel'); - form.append('pwd', pwd); + o = { + mode: 'usrdel', + pwd: pwd + }; + o[id] = 'delete'; + form = $.formData(o); return $.ajax("https://sys.4chan.org/" + board + "/imgboard.php", { onload: function() { return DeleteButton.load(self, this.response); diff --git a/script.coffee b/script.coffee index c847e28c6..5f101d162 100644 --- a/script.coffee +++ b/script.coffee @@ -2634,10 +2634,11 @@ DeleteButton = board = $.x('preceding-sibling::span[1]/a', @).pathname.match(/\w+/)[0] self = this - form = new FormData() - form.append id, 'delete' - form.append 'mode', 'usrdel' - form.append 'pwd', pwd + o = + mode: 'usrdel' + pwd: pwd + o[id] = 'delete' + form = $.formData o $.ajax "https://sys.4chan.org/#{board}/imgboard.php", { onload: -> DeleteButton.load self, @response From eb33a23e6789dc737a2dd83aec666df26d114cb0 Mon Sep 17 00:00:00 2001 From: James Campos Date: Wed, 13 Jun 2012 06:31:56 -0700 Subject: [PATCH 28/39] connection error --- 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 22a70660c..bd8d78050 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3480,8 +3480,8 @@ return self.textContent = tc; }, error: function(self) { - self.textContent = 'Error'; - return $.on('click', self, DeleteButton["delete"]); + self.textContent = 'Connection error, retrying...'; + return DeleteButton["delete"].call(self); } }; diff --git a/script.coffee b/script.coffee index 5f101d162..8cbace1d4 100644 --- a/script.coffee +++ b/script.coffee @@ -2659,8 +2659,8 @@ DeleteButton = tc = 'Deleted' self.textContent = tc error: (self) -> - self.textContent = 'Error' - $.on 'click', self, DeleteButton.delete + self.textContent = 'Connection error, retrying...' + DeleteButton.delete.call self ReportButton = init: -> From 0392164a4cd290ed46a158c036c892dfc4adad0d Mon Sep 17 00:00:00 2001 From: James Campos Date: Wed, 13 Jun 2012 06:44:44 -0700 Subject: [PATCH 29/39] don't automate that which could be automated --- 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 bd8d78050..5065f390a 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3480,8 +3480,8 @@ return self.textContent = tc; }, error: function(self) { - self.textContent = 'Connection error, retrying...'; - return DeleteButton["delete"].call(self); + self.textContent = 'Connection error, please retry.'; + return $.on(self, 'click', DeleteButton["delete"]); } }; diff --git a/script.coffee b/script.coffee index 8cbace1d4..489d3b121 100644 --- a/script.coffee +++ b/script.coffee @@ -2659,8 +2659,8 @@ DeleteButton = tc = 'Deleted' self.textContent = tc error: (self) -> - self.textContent = 'Connection error, retrying...' - DeleteButton.delete.call self + self.textContent = 'Connection error, please retry.' + $.on self, 'click', DeleteButton.delete ReportButton = init: -> From fed053152174548e360644c4672639cb9912937a Mon Sep 17 00:00:00 2001 From: James Campos Date: Wed, 13 Jun 2012 06:57:43 -0700 Subject: [PATCH 30/39] $.on if error --- 4chan_x.user.js | 1 + script.coffee | 1 + 2 files changed, 2 insertions(+) diff --git a/4chan_x.user.js b/4chan_x.user.js index 5065f390a..9e8ecabd2 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3474,6 +3474,7 @@ tc = 'Banned!'; } else if (msg = doc.getElementById('errmsg')) { tc = msg.textContent; + $.on(self, 'click', DeleteButton["delete"]); } else { tc = 'Deleted'; } diff --git a/script.coffee b/script.coffee index 489d3b121..111337bde 100644 --- a/script.coffee +++ b/script.coffee @@ -2655,6 +2655,7 @@ DeleteButton = tc = 'Banned!' else if msg = doc.getElementById 'errmsg' # error! tc = msg.textContent + $.on self, 'click', DeleteButton.delete else tc = 'Deleted' self.textContent = tc From b6c0f54393f34670466101405ad6c151df1930ed Mon Sep 17 00:00:00 2001 From: James Campos Date: Wed, 13 Jun 2012 07:27:03 -0700 Subject: [PATCH 31/39] rm css content --- 4chan_x.user.js | 21 +++++++-------------- script.coffee | 19 ++++++------------- 2 files changed, 13 insertions(+), 27 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 9e8ecabd2..94402b5fd 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3423,7 +3423,7 @@ init: function() { this.a = $.el('a', { className: 'delete_button', - innerHTML: '×', + innerHTML: '[ × ]', href: 'javascript:;' }); return Main.callbacks.push(this.node); @@ -3467,21 +3467,21 @@ }); }, load: function(self, html) { - var doc, msg, tc; + var doc, msg, s; doc = d.implementation.createHTMLDocument(''); doc.documentElement.innerHTML = html; if (doc.title === '4chan - Banned') { - tc = 'Banned!'; + s = 'Banned!'; } else if (msg = doc.getElementById('errmsg')) { - tc = msg.textContent; + s = msg.textContent; $.on(self, 'click', DeleteButton["delete"]); } else { - tc = 'Deleted'; + s = 'Deleted'; } - return self.textContent = tc; + return self.innerHTML = "[ " + s + " ]"; }, error: function(self) { - self.textContent = 'Connection error, please retry.'; + self.innerHTML = '[ Connection error, please retry. ]'; return $.on(self, 'click', DeleteButton["delete"]); } }; @@ -4748,13 +4748,6 @@ div.opContainer {\ text-decoration: none;\ border-bottom: 1px dashed;\ }\ -/* \\00A0 is nbsp */\ -.delete_button::before {\ - content: "[\\00a0"\ -}\ -.delete_button::after {\ - content: "\\00a0]"\ -}\ ' }; diff --git a/script.coffee b/script.coffee index 111337bde..973de3032 100644 --- a/script.coffee +++ b/script.coffee @@ -2614,7 +2614,7 @@ DeleteButton = init: -> @a = $.el 'a', className: 'delete_button' - innerHTML: '×' + innerHTML: '[ × ]' href: 'javascript:;' Main.callbacks.push @node node: (post) -> @@ -2652,15 +2652,15 @@ DeleteButton = doc = d.implementation.createHTMLDocument '' doc.documentElement.innerHTML = html if doc.title is '4chan - Banned' # Ban/warn check - tc = 'Banned!' + s = 'Banned!' else if msg = doc.getElementById 'errmsg' # error! - tc = msg.textContent + s = msg.textContent $.on self, 'click', DeleteButton.delete else - tc = 'Deleted' - self.textContent = tc + s = 'Deleted' + self.innerHTML = "[ #{s} ]" error: (self) -> - self.textContent = 'Connection error, please retry.' + self.innerHTML = '[ Connection error, please retry. ]' $.on self, 'click', DeleteButton.delete ReportButton = @@ -3705,13 +3705,6 @@ div.opContainer { text-decoration: none; border-bottom: 1px dashed; } -/* \\00A0 is nbsp */ -.delete_button::before { - content: "[\\00a0" -} -.delete_button::after { - content: "\\00a0]" -} ' Main.init() From 9594c9372225aa58adc8389ad24184b4ed33e9ee Mon Sep 17 00:00:00 2001 From: James Campos Date: Wed, 13 Jun 2012 07:28:45 -0700 Subject: [PATCH 32/39] type: 'post' is redundant now --- 4chan_x.user.js | 1 - script.coffee | 1 - 2 files changed, 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 94402b5fd..5b9d807a7 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3462,7 +3462,6 @@ return DeleteButton.error(self); } }, { - type: 'post', form: form }); }, diff --git a/script.coffee b/script.coffee index 973de3032..ae692854d 100644 --- a/script.coffee +++ b/script.coffee @@ -2644,7 +2644,6 @@ DeleteButton = onload: -> DeleteButton.load self, @response onerror: -> DeleteButton.error self }, { - type: 'post' form: form } From 5a64b7b06c66a616fe00f6475a1c3b0364f9f441 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 13 Jun 2012 16:34:32 +0200 Subject: [PATCH 33/39] Create and dispatch 'input' events for keybind tags and quote insertion. --- 4chan_x.user.js | 14 ++++++++++---- changelog | 2 ++ script.coffee | 16 +++++++++++----- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 37bf5a0e4..7a619c391 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1254,13 +1254,16 @@ return key; }, tags: function(tag, ta) { - var range, selEnd, selStart, value; + var e, range, selEnd, selStart, value; value = ta.value; selStart = ta.selectionStart; selEnd = ta.selectionEnd; ta.value = value.slice(0, selStart) + ("[" + tag + "]") + value.slice(selStart, selEnd) + ("[/" + tag + "]") + value.slice(selEnd); range = ("[" + tag + "]").length + selEnd; - return ta.setSelectionRange(range, range); + ta.setSelectionRange(range, range); + e = d.createEvent('Event'); + e.initEvent('input', true, false); + return ta.dispatchEvent(e); }, img: function(thread, all) { var thumb; @@ -1560,10 +1563,13 @@ } ta = $('textarea', QR.el); caretPos = ta.selectionStart; - QR.selected.el.lastChild.textContent = QR.selected.com = ta.value = ta.value.slice(0, caretPos) + text + ta.value.slice(ta.selectionEnd); + ta.value = ta.value.slice(0, caretPos) + text + ta.value.slice(ta.selectionEnd); ta.focus(); range = caretPos + text.length; - return ta.setSelectionRange(range, range); + ta.setSelectionRange(range, range); + e = d.createEvent('Event'); + e.initEvent('input', true, false); + return ta.dispatchEvent(e); }, drag: function(e) { var i; diff --git a/changelog b/changelog index 79ba5bcfb..1430e4914 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- Mayhem + Fix spoiler/code tag keybinds being ignored on post submission. 2.31.6 - Mayhem diff --git a/script.coffee b/script.coffee index 20083919c..1b3c6202e 100644 --- a/script.coffee +++ b/script.coffee @@ -914,6 +914,11 @@ Keybinds = # Move the caret to the end of the selection. ta.setSelectionRange range, range + # Fire the 'input' event + e = d.createEvent 'Event' + e.initEvent 'input', true, false + ta.dispatchEvent e + img: (thread, all) -> if all $.id('imageExpand').click() @@ -1143,16 +1148,17 @@ QR = ta = $ 'textarea', QR.el caretPos = ta.selectionStart # Replace selection for text. - # onchange event isn't triggered, save value. - QR.selected.el.lastChild.textContent = - QR.selected.com = - ta.value = - ta.value[...caretPos] + text + ta.value[ta.selectionEnd..] + ta.value = ta.value[...caretPos] + text + ta.value[ta.selectionEnd..] ta.focus() # Move the caret to the end of the new quote. range = caretPos + text.length ta.setSelectionRange range, range + # Fire the 'input' event + e = d.createEvent 'Event' + e.initEvent 'input', true, false + ta.dispatchEvent e + drag: (e) -> # Let it drag anything from the page. i = if e.type is 'dragstart' then 'off' else 'on' From 7d3a687b5ad6685efda907b2779009e50e97f26d Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 13 Jun 2012 16:42:09 +0200 Subject: [PATCH 34/39] RecaptchaState.timeout is giving the correct value again. The Recaptcha script is refreshing the captcha every 4 minutes, we don't have refresh it on your side too. --- 4chan_x.user.js | 4 +--- script.coffee | 7 +------ 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 2cdd8ad99..3dac75424 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1855,9 +1855,7 @@ challenge = this.challenge.firstChild.value; this.img.alt = challenge; this.img.src = "//www.google.com/recaptcha/api/image?c=" + challenge; - this.input.value = null; - clearTimeout(this.timeoutID); - return this.timeoutID = setTimeout(this.reload, 4 * $.MINUTE); + return this.input.value = null; }, count: function(count) { this.input.placeholder = (function() { diff --git a/script.coffee b/script.coffee index df8b9ee9a..a66f7f2fe 100644 --- a/script.coffee +++ b/script.coffee @@ -1373,18 +1373,13 @@ QR = @count captchas.length @reload() load: -> - # Timeout was available at RecaptchaState.timeout in seconds. - # Timeout is now set by moot: 5 minutes. + # Timeout is available at RecaptchaState.timeout in seconds. # We use 5-1 minutes to give upload some time. @timeout = Date.now() + 4*$.MINUTE challenge = @challenge.firstChild.value @img.alt = challenge @img.src = "//www.google.com/recaptcha/api/image?c=#{challenge}" @input.value = null - # Refresh captchas every 4 minutes to avoid filling perished ones. - # This used to be done by the recaptcha script, but it doesn't take into account moot's custom value. - clearTimeout @timeoutID - @timeoutID = setTimeout @reload, 4*$.MINUTE count: (count) -> @input.placeholder = switch count when 0 From 02ac826003bf5dca0ffc92c744a44834d5a367ce Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 13 Jun 2012 17:04:33 +0200 Subject: [PATCH 35/39] Reflect the stub filter parameter in recursive filtering. --- 4chan_x.user.js | 5 +++-- script.coffee | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 3dac75424..2f92de2d3 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -717,7 +717,7 @@ return Main.callbacks.push(this.node); }, node: function(post) { - var el, quote, _i, _len, _ref; + var el, quote, show_stub, _i, _len, _ref; if (post.isInlined) { return; } @@ -727,7 +727,8 @@ if ((el = $.id(quote.hash.slice(1))) && el.hidden) { $.addClass(quote, 'filtered'); if (Conf['Recursive Filtering']) { - ReplyHiding.hide(post.root); + show_stub = !!$.x('preceding-sibling::div[contains(@class,"stub")]', el); + ReplyHiding.hide(post.root, show_stub); } } } diff --git a/script.coffee b/script.coffee index a66f7f2fe..97c8dfd9a 100644 --- a/script.coffee +++ b/script.coffee @@ -564,7 +564,9 @@ StrikethroughQuotes = for quote in post.quotes if (el = $.id quote.hash[1..]) and el.hidden $.addClass quote, 'filtered' - ReplyHiding.hide post.root if Conf['Recursive Filtering'] + if Conf['Recursive Filtering'] + show_stub = !!$.x 'preceding-sibling::div[contains(@class,"stub")]', el + ReplyHiding.hide post.root, show_stub return ExpandComment = From 852c1165122be4774686d161ffcd794f3e96cf53 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 13 Jun 2012 17:27:21 +0200 Subject: [PATCH 36/39] Prevent the page from resizing when opening options and removing scrollbars. --- 4chan_x.user.js | 13 +++++++++++-- script.coffee | 13 +++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 2f92de2d3..2376b0869 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2366,7 +2366,8 @@ }); $.add(overlay, dialog); $.add(d.body, overlay); - d.body.style.setProperty('overflow', 'hidden', null); + d.body.style.setProperty('width', "" + d.body.clientWidth + "px", null); + $.addClass(d.body, 'unscroll'); Options.backlink.call(back); Options.time.call(time); Options.fileInfo.call(fileInfo); @@ -2374,7 +2375,8 @@ }, close: function() { $.rm(this); - return d.body.style.removeProperty('overflow'); + d.body.style.removeProperty('width'); + return $.rmClass(d.body, 'unscroll'); }, clearHidden: function() { $["delete"]("hiddenReplies/" + g.BOARD + "/"); @@ -4623,6 +4625,13 @@ textarea.field {\ right: 5px;\ }\ \ +body {\ + box-sizing: border-box;\ + -moz-box-sizing: border-box;\ +}\ +body.unscroll {\ + overflow: hidden;\ +}\ #overlay {\ top: 0;\ right: 0;\ diff --git a/script.coffee b/script.coffee index 97c8dfd9a..2e456aea8 100644 --- a/script.coffee +++ b/script.coffee @@ -1838,7 +1838,8 @@ Options = $.on dialog, 'click', (e) -> e.stopPropagation() $.add overlay, dialog $.add d.body, overlay - d.body.style.setProperty 'overflow', 'hidden', null + d.body.style.setProperty 'width', "#{d.body.clientWidth}px", null + $.addClass d.body, 'unscroll' Options.backlink.call back Options.time.call time @@ -1847,7 +1848,8 @@ Options = close: -> $.rm this - d.body.style.removeProperty 'overflow' + d.body.style.removeProperty 'width' + $.rmClass d.body, 'unscroll' clearHidden: -> #'hidden' might be misleading; it's the number of IDs we're *looking* for, @@ -3578,6 +3580,13 @@ textarea.field { right: 5px; } +body { + box-sizing: border-box; + -moz-box-sizing: border-box; +} +body.unscroll { + overflow: hidden; +} #overlay { top: 0; right: 0; From 1fe97ca11aed9c616efaa1434afd8c0224cf9552 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 13 Jun 2012 17:37:16 +0200 Subject: [PATCH 37/39] Release 2.32.0. --- 4chan_x.user.js | 6 +++--- Cakefile | 2 +- changelog | 2 ++ latest.js | 2 +- script.coffee | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 2376b0869..cc7202beb 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan x -// @version 2.31.6 +// @version 2.32.0 // @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.31.6 + * 4chan X 2.32.0 * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -4359,7 +4359,7 @@ return $.globalEval(("(" + code + ")()").replace('_id_', bq.id)); }, namespace: '4chan_x.', - version: '2.31.6', + version: '2.32.0', callbacks: [], css: '\ /* dialog styling */\ diff --git a/Cakefile b/Cakefile index 82361fbed..45546dd40 100644 --- a/Cakefile +++ b/Cakefile @@ -2,7 +2,7 @@ {exec} = require 'child_process' fs = require 'fs' -VERSION = '2.31.6' +VERSION = '2.32.0' HEADER = """ // ==UserScript== diff --git a/changelog b/changelog index 56bc76c41..dd3801425 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master + +2.32.0 - aeosynth delete button - Mayhem diff --git a/latest.js b/latest.js index 552b509c6..bebd335af 100644 --- a/latest.js +++ b/latest.js @@ -1 +1 @@ -postMessage({version:'2.31.6'},'*') \ No newline at end of file +postMessage({version:'2.32.0'},'*') \ No newline at end of file diff --git a/script.coffee b/script.coffee index 2e456aea8..de6052d87 100644 --- a/script.coffee +++ b/script.coffee @@ -3314,7 +3314,7 @@ Main = $.globalEval "(#{code})()".replace '_id_', bq.id namespace: '4chan_x.' - version: '2.31.6' + version: '2.32.0' callbacks: [] css: ' /* dialog styling */ From 2e186e553fedbb18ef5ef5cbce88d335b4d1b2f7 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 13 Jun 2012 18:52:40 +0200 Subject: [PATCH 38/39] Release 2.32.1. --- 4chan_x.user.js | 10 ++++++---- Cakefile | 2 +- changelog | 4 ++++ latest.js | 2 +- script.coffee | 4 ++-- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index cc7202beb..5c4e48d1d 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan x -// @version 2.32.0 +// @version 2.32.1 // @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.32.0 + * 4chan X 2.32.1 * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -319,7 +319,9 @@ fd = new FormData(); for (key in arg) { val = arg[key]; - fd.append(key, val); + if (val) { + fd.append(key, val); + } } } return fd; @@ -4359,7 +4361,7 @@ return $.globalEval(("(" + code + ")()").replace('_id_', bq.id)); }, namespace: '4chan_x.', - version: '2.32.0', + version: '2.32.1', callbacks: [], css: '\ /* dialog styling */\ diff --git a/Cakefile b/Cakefile index 45546dd40..c85c10f42 100644 --- a/Cakefile +++ b/Cakefile @@ -2,7 +2,7 @@ {exec} = require 'child_process' fs = require 'fs' -VERSION = '2.32.0' +VERSION = '2.32.1' HEADER = """ // ==UserScript== diff --git a/changelog b/changelog index dd3801425..ffd74a58e 100644 --- a/changelog +++ b/changelog @@ -1,5 +1,9 @@ master +2.32.1 +- Mayhem + Fix images uploaded as spoilers. + 2.32.0 - aeosynth delete button diff --git a/latest.js b/latest.js index bebd335af..9499499d7 100644 --- a/latest.js +++ b/latest.js @@ -1 +1 @@ -postMessage({version:'2.32.0'},'*') \ No newline at end of file +postMessage({version:'2.32.1'},'*') \ No newline at end of file diff --git a/script.coffee b/script.coffee index de6052d87..bc914b779 100644 --- a/script.coffee +++ b/script.coffee @@ -272,7 +272,7 @@ $.extend $, else fd = new FormData() for key, val of arg - fd.append key, val + fd.append key, val if val fd ajax: (url, callbacks, opts={}) -> {type, headers, upCallbacks, form} = opts @@ -3314,7 +3314,7 @@ Main = $.globalEval "(#{code})()".replace '_id_', bq.id namespace: '4chan_x.' - version: '2.32.0' + version: '2.32.1' callbacks: [] css: ' /* dialog styling */ From a3e352acb2ae383b5ef56203484d31597f2858dd Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 13 Jun 2012 20:17:38 +0200 Subject: [PATCH 39/39] /co/ has an image limit of 250. --- 4chan_x.user.js | 3 ++- script.coffee | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 5c4e48d1d..b6f08cc7d 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3531,8 +3531,9 @@ switch (g.BOARD) { case 'a': case 'b': - case 'mlp': case 'v': + case 'co': + case 'mlp': return 251; case 'vg': return 501; diff --git a/script.coffee b/script.coffee index bc914b779..bc1faec5a 100644 --- a/script.coffee +++ b/script.coffee @@ -2693,7 +2693,7 @@ ThreadStats = @posts = @images = 0 @imgLimit = switch g.BOARD - when 'a', 'b', 'mlp', 'v' + when 'a', 'b', 'v', 'co', 'mlp' 251 when 'vg' 501