From 0fc4beecc198e62f904e9aaecc8f162bc796dba4 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Fri, 16 Nov 2012 14:58:39 +0100 Subject: [PATCH 01/51] rbt updates --- 4chan_x.user.js | 2 +- script.coffee | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 0f1645756..fc17a2628 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -4758,6 +4758,7 @@ return "//fuuka.warosu.org/" + board + "/full_image/" + filename; case 'cgl': case 'g': + case 'mu': case 'w': return "//rbt.asia/" + board + "/full_image/" + filename; case 'an': @@ -4825,7 +4826,6 @@ case 'cgl': case 'g': case 'mu': - case 'soc': case 'w': url = Redirect.path("//rbt.asia", 'fuuka', data); break; diff --git a/script.coffee b/script.coffee index ef13fc32d..8c7c4a5a9 100644 --- a/script.coffee +++ b/script.coffee @@ -3907,7 +3907,7 @@ Redirect = "//nsfw.foolz.us/#{board}/full_image/#{filename}" when 'ck', 'lit' "//fuuka.warosu.org/#{board}/full_image/#{filename}" - when 'cgl', 'g', 'w' + when 'cgl', 'g', 'mu', 'w' "//rbt.asia/#{board}/full_image/#{filename}" when 'an', 'k', 'toy', 'x' "http://archive.heinessen.com/#{board}/full_image/#{filename}" @@ -3930,7 +3930,7 @@ Redirect = url = Redirect.path "//fuuka.warosu.org", 'fuuka', data when 'diy', 'sci' url = Redirect.path "//archive.installgentoo.net", 'fuuka', data - when 'cgl', 'g', 'mu', 'soc', 'w' + when 'cgl', 'g', 'mu', 'w' url = Redirect.path "//rbt.asia", 'fuuka', data when 'an', 'fit', 'k', 'mlp', 'r9k', 'toy', 'x' url = Redirect.path "http://archive.heinessen.com", 'fuuka', data From 63ffca71d5d1be46fe20035586e25e926f8607e1 Mon Sep 17 00:00:00 2001 From: noface Date: Fri, 16 Nov 2012 18:34:29 +0100 Subject: [PATCH 02/51] Add support for post with QR and tags on /f/. --- 4chan_x.user.js | 19 ++++++++++++++----- script.coffee | 27 +++++++++++++++++++++------ 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index fc17a2628..840dbdbe3 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1738,7 +1738,7 @@ $.on(link.firstChild, 'click', function() { QR.open(); if (!g.REPLY) { - QR.threadSelector.value = 'new'; + QR.threadSelector.value = g.BOARD !== 'f' ? 'new' : '9999'; } return $('textarea', QR.el).focus(); }); @@ -2418,10 +2418,10 @@ id = thread.id.slice(1); threads += ""; } - QR.threadSelector = $.el('select', { + QR.threadSelector = g.BOARD !== 'f' ? $.el('select', { innerHTML: threads, title: 'Create a new thread / Reply to a thread' - }); + }) : $('select[name="filetag"]'); $.prepend($('.move > span', QR.el), QR.threadSelector); $.on(QR.threadSelector, 'mousedown', function(e) { return e.stopPropagation(); @@ -2483,7 +2483,9 @@ } QR.abort(); reply = QR.replies[0]; - threadID = g.THREAD_ID || QR.threadSelector.value; + if (!((g.BOARD === 'f') && !g.REPLY)) { + threadID = g.THREAD_ID || QR.threadSelector.value; + } if (threadID === 'new') { if (((_ref = g.BOARD) === 'vg' || _ref === 'q') && !reply.sub) { err = 'New threads require a subject.'; @@ -2544,6 +2546,7 @@ sub: reply.sub, com: reply.com, upfile: reply.file, + filetag: !g.REPLY ? QR.threadSelector.value : void 0, spoiler: reply.spoiler, textonly: textOnly, mode: 'regist', @@ -2591,7 +2594,10 @@ err = $.el('span', { innerHTML: /^You were issued a warning/.test($('.boxcontent', doc).textContent.trim()) ? "You were issued a warning on " + bs[0].innerHTML + " as " + bs[3].innerHTML + ".
Warning reason: " + bs[1].innerHTML : "You are banned! ;_;
Please click HERE to see the reason." }); - } else if (err = doc.getElementById('errmsg')) { + } else if (err = doc.getElementById('errmsg') || (err = $('center', doc))) { + if ($('font', err)) { + err.textContent = err.textContent.replace(/Return$/, ''); + } if ((_ref = $('a', err)) != null) { _ref.target = '_blank'; } @@ -2599,6 +2605,9 @@ err = 'Connection error with sys.4chan.org.'; } if (err) { + if (err.nodeName === 'CENTER') { + err = err.textContent; + } if (/captcha|verification/i.test(err.textContent) || err === 'Connection error with sys.4chan.org.') { if (/mistyped/i.test(err.textContent)) { err.textContent = 'Error: You seem to have mistyped the CAPTCHA.'; diff --git a/script.coffee b/script.coffee index 8c7c4a5a9..5d69ccc5f 100644 --- a/script.coffee +++ b/script.coffee @@ -1342,7 +1342,12 @@ QR = link = $.el 'h1', innerHTML: "#{if g.REPLY then 'Reply to Thread' else 'Start a Thread'}" $.on link.firstChild, 'click', -> QR.open() - QR.threadSelector.value = 'new' unless g.REPLY + unless g.REPLY + QR.threadSelector.value = + unless g.BOARD is 'f' + 'new' + else + '9999' $('textarea', QR.el).focus() $.before $.id('postForm'), link @@ -1885,9 +1890,13 @@ QR = for thread in $$ '.thread' id = thread.id[1..] threads += "" - QR.threadSelector = $.el 'select' - innerHTML: threads - title: 'Create a new thread / Reply to a thread' + QR.threadSelector = + unless g.BOARD is 'f' + $.el 'select' + innerHTML: threads + title: 'Create a new thread / Reply to a thread' + else + $ 'select[name="filetag"]' $.prepend $('.move > span', QR.el), QR.threadSelector $.on QR.threadSelector, 'mousedown', (e) -> e.stopPropagation() $.on $('#autohide', QR.el), 'change', QR.toggleHide @@ -1933,7 +1942,8 @@ QR = QR.abort() reply = QR.replies[0] - threadID = g.THREAD_ID or QR.threadSelector.value + unless (g.BOARD is 'f') and not g.REPLY + threadID = g.THREAD_ID or QR.threadSelector.value # prevent errors if threadID is 'new' @@ -1994,6 +2004,7 @@ QR = sub: reply.sub com: reply.com upfile: reply.file + filetag: QR.threadSelector.value unless g.REPLY spoiler: reply.spoiler textonly: textOnly mode: 'regist' @@ -2036,12 +2047,16 @@ QR = "You were issued a warning on #{bs[0].innerHTML} as #{bs[3].innerHTML}.
Warning reason: #{bs[1].innerHTML}" else "You are banned! ;_;
Please click HERE to see the reason." - else if err = doc.getElementById 'errmsg' # error! + else if err = doc.getElementById('errmsg') or err = $('center', doc) # error! + if $ 'font', err + err.textContent = err.textContent.replace /Return$/, '' $('a', err)?.target = '_blank' # duplicate image link else unless msg = $ 'b', doc err = 'Connection error with sys.4chan.org.' if err + if err.nodeName is 'CENTER' + err = err.textContent if /captcha|verification/i.test(err.textContent) or err is 'Connection error with sys.4chan.org.' # Remove the obnoxious 4chan Pass ad. if /mistyped/i.test err.textContent From 53127cd8c627b68eec02d252da5d91b5ec6a2b69 Mon Sep 17 00:00:00 2001 From: noface Date: Fri, 16 Nov 2012 19:06:41 +0100 Subject: [PATCH 03/51] Corrections. --- 4chan_x.user.js | 32 +++++++++++++++----------------- changelog | 2 ++ script.coffee | 37 +++++++++++++++++++------------------ 3 files changed, 36 insertions(+), 35 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 840dbdbe3..7ba6d0511 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1738,7 +1738,7 @@ $.on(link.firstChild, 'click', function() { QR.open(); if (!g.REPLY) { - QR.threadSelector.value = g.BOARD !== 'f' ? 'new' : '9999'; + QR.threadSelector.value = g.BOARD === 'f' ? '9999' : 'new'; } return $('textarea', QR.el).focus(); }); @@ -2418,10 +2418,10 @@ id = thread.id.slice(1); threads += ""; } - QR.threadSelector = g.BOARD !== 'f' ? $.el('select', { + QR.threadSelector = g.BOARD === 'f' ? $('select[name=filetag]').cloneNode(true) : $.el('select', { innerHTML: threads, title: 'Create a new thread / Reply to a thread' - }) : $('select[name="filetag"]'); + }); $.prepend($('.move > span', QR.el), QR.threadSelector); $.on(QR.threadSelector, 'mousedown', function(e) { return e.stopPropagation(); @@ -2472,7 +2472,7 @@ })); }, submit: function(e) { - var callbacks, captcha, captchas, challenge, err, m, opts, post, reply, response, textOnly, threadID, _ref; + var callbacks, captcha, captchas, challenge, err, filetag, m, opts, post, reply, response, textOnly, threadID, _ref; if (e != null) { e.preventDefault(); } @@ -2483,19 +2483,23 @@ } QR.abort(); reply = QR.replies[0]; - if (!((g.BOARD === 'f') && !g.REPLY)) { + if (g.BOARD === 'f' && !g.REPLY) { + filetag = QR.threadSelector.value; + threadID = 'new'; + } else { threadID = g.THREAD_ID || QR.threadSelector.value; } if (threadID === 'new') { + threadID = null; if (((_ref = g.BOARD) === 'vg' || _ref === 'q') && !reply.sub) { err = 'New threads require a subject.'; } else if (!(reply.file || (textOnly = !!$('input[name=textonly]', $.id('postForm'))))) { err = 'No file selected.'; + } else if (g.BOARD === 'f' && filetag === '9999') { + err = 'Invalid tag specified.'; } - } else { - if (!(reply.com || reply.file)) { - err = 'No file selected.'; - } + } else if (!(reply.com || reply.file)) { + err = 'No file selected.'; } if (QR.captchaIsEnabled && !err) { captchas = $.get('captchas', []); @@ -2546,7 +2550,7 @@ sub: reply.sub, com: reply.com, upfile: reply.file, - filetag: !g.REPLY ? QR.threadSelector.value : void 0, + filetag: filetag, spoiler: reply.spoiler, textonly: textOnly, mode: 'regist', @@ -2594,10 +2598,7 @@ err = $.el('span', { innerHTML: /^You were issued a warning/.test($('.boxcontent', doc).textContent.trim()) ? "You were issued a warning on " + bs[0].innerHTML + " as " + bs[3].innerHTML + ".
Warning reason: " + bs[1].innerHTML : "You are banned! ;_;
Please click HERE to see the reason." }); - } else if (err = doc.getElementById('errmsg') || (err = $('center', doc))) { - if ($('font', err)) { - err.textContent = err.textContent.replace(/Return$/, ''); - } + } else if (err = doc.getElementById('errmsg')) { if ((_ref = $('a', err)) != null) { _ref.target = '_blank'; } @@ -2605,9 +2606,6 @@ err = 'Connection error with sys.4chan.org.'; } if (err) { - if (err.nodeName === 'CENTER') { - err = err.textContent; - } if (/captcha|verification/i.test(err.textContent) || err === 'Connection error with sys.4chan.org.') { if (/mistyped/i.test(err.textContent)) { err.textContent = 'Error: You seem to have mistyped the CAPTCHA.'; diff --git a/changelog b/changelog index 68c432a54..3ccfff60b 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- noface + Added tags support on /f/. 2.36.1 - noface diff --git a/script.coffee b/script.coffee index 5d69ccc5f..6fc861a8f 100644 --- a/script.coffee +++ b/script.coffee @@ -1343,11 +1343,11 @@ QR = $.on link.firstChild, 'click', -> QR.open() unless g.REPLY - QR.threadSelector.value = - unless g.BOARD is 'f' - 'new' - else - '9999' + QR.threadSelector.value = + if g.BOARD is 'f' + '9999' + else + 'new' $('textarea', QR.el).focus() $.before $.id('postForm'), link @@ -1891,12 +1891,12 @@ QR = id = thread.id[1..] threads += "" QR.threadSelector = - unless g.BOARD is 'f' + if g.BOARD is 'f' + $('select[name=filetag]').cloneNode true + else $.el 'select' innerHTML: threads title: 'Create a new thread / Reply to a thread' - else - $ 'select[name="filetag"]' $.prepend $('.move > span', QR.el), QR.threadSelector $.on QR.threadSelector, 'mousedown', (e) -> e.stopPropagation() $.on $('#autohide', QR.el), 'change', QR.toggleHide @@ -1942,17 +1942,22 @@ QR = QR.abort() reply = QR.replies[0] - unless (g.BOARD is 'f') and not g.REPLY + if g.BOARD is 'f' and not g.REPLY + filetag = QR.threadSelector.value + threadID = 'new' + else threadID = g.THREAD_ID or QR.threadSelector.value # prevent errors if threadID is 'new' + threadID = null if g.BOARD in ['vg', 'q'] and !reply.sub err = 'New threads require a subject.' else unless reply.file or textOnly = !!$ 'input[name=textonly]', $.id 'postForm' - err = 'No file selected.' - else - unless reply.com or reply.file + err = 'No file selected.' + else if g.BOARD is 'f' and filetag is '9999' + err = 'Invalid tag specified.' + else unless reply.com or reply.file err = 'No file selected.' if QR.captchaIsEnabled and !err @@ -2004,7 +2009,7 @@ QR = sub: reply.sub com: reply.com upfile: reply.file - filetag: QR.threadSelector.value unless g.REPLY + filetag: filetag spoiler: reply.spoiler textonly: textOnly mode: 'regist' @@ -2047,16 +2052,12 @@ QR = "You were issued a warning on #{bs[0].innerHTML} as #{bs[3].innerHTML}.
Warning reason: #{bs[1].innerHTML}" else "You are banned! ;_;
Please click HERE to see the reason." - else if err = doc.getElementById('errmsg') or err = $('center', doc) # error! - if $ 'font', err - err.textContent = err.textContent.replace /Return$/, '' + else if err = doc.getElementById 'errmsg' # error! $('a', err)?.target = '_blank' # duplicate image link else unless msg = $ 'b', doc err = 'Connection error with sys.4chan.org.' if err - if err.nodeName is 'CENTER' - err = err.textContent if /captcha|verification/i.test(err.textContent) or err is 'Connection error with sys.4chan.org.' # Remove the obnoxious 4chan Pass ad. if /mistyped/i.test err.textContent From f27bd8aa95b6611acf2e352743ef431150433bbc Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 17 Nov 2012 16:17:57 +0100 Subject: [PATCH 04/51] Release 2.36.2. --- 4chan_x.user.js | 6 +++--- Cakefile | 2 +- changelog | 6 +++++- latest.js | 2 +- script.coffee | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 7ba6d0511..1ac9e7e59 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan x -// @version 2.36.1 +// @version 2.36.2 // @namespace aeosynth // @description Adds various features. // @copyright 2009-2011 James Campos @@ -27,7 +27,7 @@ * Copyright (c) 2009-2011 James Campos * Copyright (c) 2012 Nicolas Stepien * http://mayhemydg.github.com/4chan-x/ - * 4chan X 2.36.1 + * 4chan X 2.36.2 * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -5519,7 +5519,7 @@ return $.globalEval(("(" + code + ")()").replace('_id_', bq.id)); }, namespace: '4chan_x.', - version: '2.36.1', + version: '2.36.2', callbacks: [], css: '\ /* dialog styling */\ diff --git a/Cakefile b/Cakefile index fc26f90b1..665ab9e64 100644 --- a/Cakefile +++ b/Cakefile @@ -2,7 +2,7 @@ {exec} = require 'child_process' fs = require 'fs' -VERSION = '2.36.1' +VERSION = '2.36.2' HEADER = """ // ==UserScript== diff --git a/changelog b/changelog index 3ccfff60b..50c5d0adf 100644 --- a/changelog +++ b/changelog @@ -1,6 +1,10 @@ master + +2.36.2 - noface - Added tags support on /f/. + Add tags support on /f/. +- Mayhem + Add /mu/ archived image redirection. 2.36.1 - noface diff --git a/latest.js b/latest.js index a000e475e..bab1c381d 100644 --- a/latest.js +++ b/latest.js @@ -1 +1 @@ -postMessage({version:'2.36.1'},'*') \ No newline at end of file +postMessage({version:'2.36.2'},'*') \ No newline at end of file diff --git a/script.coffee b/script.coffee index 6fc861a8f..76b464246 100644 --- a/script.coffee +++ b/script.coffee @@ -4462,7 +4462,7 @@ Main = $.globalEval "(#{code})()".replace '_id_', bq.id namespace: '4chan_x.' - version: '2.36.1' + version: '2.36.2' callbacks: [] css: ' /* dialog styling */ From 199ca9d01f0b3ee2b069895b634760066f841c81 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 29 Nov 2012 13:09:29 +0100 Subject: [PATCH 05/51] Fix #827 --- 4chan_x.user.js | 10 +++++----- changelog | 2 ++ script.coffee | 8 ++++---- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 1ac9e7e59..b6c866b77 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1388,7 +1388,7 @@ return $.on(d, 'keydown', Keybinds.keydown); }, keydown: function(e) { - var key, link, o, target, thread; + var form, key, o, target, thread; if (!(key = Keybinds.keyCode(e))) { return; } @@ -1455,13 +1455,13 @@ window.location = "/" + g.BOARD + "/0#delform"; break; case Conf.nextPage: - if (link = $('link[rel=next]', d.head)) { - window.location = link.href; + if (form = $('.next form')) { + window.location = form.action; } break; case Conf.previousPage: - if (link = $('link[rel=prev]', d.head)) { - window.location.href = link.href; + if (form = $('.prev form')) { + window.location = form.action; } break; case Conf.nextThread: diff --git a/changelog b/changelog index 50c5d0adf..0ae7d5a39 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- Mayhem + Fix next/previous page keybinds. 2.36.2 - noface diff --git a/script.coffee b/script.coffee index 76b464246..289340833 100644 --- a/script.coffee +++ b/script.coffee @@ -1151,11 +1151,11 @@ Keybinds = when Conf.zero window.location = "/#{g.BOARD}/0#delform" when Conf.nextPage - if link = $ 'link[rel=next]', d.head - window.location = link.href + if form = $ '.next form' + window.location = form.action when Conf.previousPage - if link = $ 'link[rel=prev]', d.head - window.location.href = link.href + if form = $ '.prev form' + window.location = form.action # Thread Navigation when Conf.nextThread return if g.REPLY From fdaee4641e31bd00d3113d1b4c888cc034c630f9 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 29 Nov 2012 13:13:39 +0100 Subject: [PATCH 06/51] Release 2.36.3. --- 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 b6c866b77..2f227f015 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan x -// @version 2.36.2 +// @version 2.36.3 // @namespace aeosynth // @description Adds various features. // @copyright 2009-2011 James Campos @@ -27,7 +27,7 @@ * Copyright (c) 2009-2011 James Campos * Copyright (c) 2012 Nicolas Stepien * http://mayhemydg.github.com/4chan-x/ - * 4chan X 2.36.2 + * 4chan X 2.36.3 * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -5519,7 +5519,7 @@ return $.globalEval(("(" + code + ")()").replace('_id_', bq.id)); }, namespace: '4chan_x.', - version: '2.36.2', + version: '2.36.3', callbacks: [], css: '\ /* dialog styling */\ diff --git a/Cakefile b/Cakefile index 665ab9e64..e63130186 100644 --- a/Cakefile +++ b/Cakefile @@ -2,7 +2,7 @@ {exec} = require 'child_process' fs = require 'fs' -VERSION = '2.36.2' +VERSION = '2.36.3' HEADER = """ // ==UserScript== diff --git a/changelog b/changelog index 0ae7d5a39..c6d68cd70 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master + +2.36.3 - Mayhem Fix next/previous page keybinds. diff --git a/latest.js b/latest.js index bab1c381d..2e99c809e 100644 --- a/latest.js +++ b/latest.js @@ -1 +1 @@ -postMessage({version:'2.36.2'},'*') \ No newline at end of file +postMessage({version:'2.36.3'},'*') \ No newline at end of file diff --git a/script.coffee b/script.coffee index 289340833..39b22d211 100644 --- a/script.coffee +++ b/script.coffee @@ -4462,7 +4462,7 @@ Main = $.globalEval "(#{code})()".replace '_id_', bq.id namespace: '4chan_x.' - version: '2.36.2' + version: '2.36.3' callbacks: [] css: ' /* dialog styling */ From c307874b10f42de4379c02f4ac6319defdf8a5f5 Mon Sep 17 00:00:00 2001 From: noface Date: Wed, 5 Dec 2012 18:36:11 +0100 Subject: [PATCH 07/51] Add Catalog Links toggle. --- 4chan_x.user.js | 68 ++++++++++++++++++++++++++++++++++++++++++++++++- changelog | 2 ++ script.coffee | 48 ++++++++++++++++++++++++++++++++++ 3 files changed, 117 insertions(+), 1 deletion(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 2f227f015..f5d838b69 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -81,12 +81,13 @@ */ (function() { - var $, $$, Anonymize, ArchiveLink, AutoGif, Build, Conf, Config, DeleteLink, DownloadLink, ExpandComment, ExpandThread, Favicon, FileInfo, Filter, Get, ImageExpand, ImageHover, Keybinds, Main, Menu, Nav, Options, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, Quotify, Redirect, ReplyHiding, ReportLink, RevealSpoilers, Sauce, StrikethroughQuotes, ThreadHiding, ThreadStats, Time, TitlePost, UI, Unread, Updater, Watcher, d, g, _base; + var $, $$, Anonymize, ArchiveLink, AutoGif, Build, CatalogLinks, Conf, Config, DeleteLink, DownloadLink, ExpandComment, ExpandThread, Favicon, FileInfo, Filter, Get, ImageExpand, ImageHover, Keybinds, Main, Menu, Nav, Options, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, Quotify, Redirect, ReplyHiding, ReportLink, RevealSpoilers, Sauce, StrikethroughQuotes, ThreadHiding, ThreadStats, Time, TitlePost, UI, Unread, Updater, Watcher, d, g, _base; Config = { main: { Enhancing: { 'Disable 4chan\'s extension': [true, 'Avoid conflicts between 4chan X and 4chan\'s inline extension.'], + 'Catalog Links': [true, 'Turn Navigation links into links to each board\'s catalog.'], '404 Redirect': [true, 'Redirect dead threads and images'], 'Keybinds': [true, 'Binds actions to keys'], 'Time Formatting': [true, 'Arbitrarily formatted timestamps, using your local time'], @@ -5155,6 +5156,66 @@ } }; + CatalogLinks = { + init: function() { + var el, i, nav, _i, _len, _ref; + el = $.el('span', { + innerHTML: "[Catalog " + (!g.CATALOG ? 'On' : 'Off') + "]", + id: 'toggleCatalog' + }); + _ref = ['boardNavDesktop', 'boardNavDesktopFoot']; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + nav = _ref[_i]; + $.on(el.firstElementChild, 'click', this.toggle); + $.add($.id(nav), el); + el = $.el('span', { + innerHTML: el.innerHTML, + id: 'toggleCatalogFoot' + }); + } + if ($.get('CatalogIsToggled')) { + i = g.CATALOG ? 0 : 1; + while (i < 2) { + this.toggle(); + i++; + } + return; + } + if (g.CATALOG) { + return this.toggle(); + } + }, + toggle: function() { + var a, el, isDead, nav, split, _i, _len, _ref; + _ref = ['boardNavDesktop', 'boardNavDesktopFoot']; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + nav = _ref[_i]; + a = $.id(nav).firstElementChild; + while (a.href && (split = a.href.split('/'))) { + if (!/^rs|status/.test(split[2])) { + if ((isDead = split[3] === 'f') && g.CATALOG || split[4] === 'catalog') { + a.href = a.href.replace(/catalog$/, ''); + a.title = a.title.replace(/\ -\ Catalog$/, ''); + } else if (!isDead) { + a.href += 'catalog'; + a.title += ' - Catalog'; + } + } + a = a.nextElementSibling; + } + if (/On$/.test((el = a.parentNode.lastChild.firstElementChild).textContent)) { + el.textContent = 'Catalog Off'; + el.title = 'Turn Catalog Links off.'; + $.set('CatalogIsToggled', true); + } else { + el.textContent = 'Catalog On'; + el.title = 'Turn Catalog Links on.'; + $["delete"]('CatalogIsToggled'); + } + } + } + }; + Main = { init: function() { var cutoff, hiddenThreads, id, key, now, path, pathname, settings, temp, timestamp, val, _ref; @@ -5165,6 +5226,8 @@ if (temp === 'res') { g.REPLY = true; g.THREAD_ID = pathname[2]; + } else if (temp === 'catalog') { + g.CATALOG = true; } for (key in Conf) { val = Conf[key]; @@ -5341,6 +5404,9 @@ } } Favicon.init(); + if (Conf['Catalog Links']) { + CatalogLinks.init(); + } if (Conf['Quick Reply']) { QR.init(); } diff --git a/changelog b/changelog index c6d68cd70..7ade900b8 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- noface + Add Catalog Links toggle. 2.36.3 - Mayhem diff --git a/script.coffee b/script.coffee index 39b22d211..7127af1f3 100644 --- a/script.coffee +++ b/script.coffee @@ -2,6 +2,7 @@ Config = main: Enhancing: 'Disable 4chan\'s extension': [true, 'Avoid conflicts between 4chan X and 4chan\'s inline extension.'] + 'Catalog Links': [true, 'Turn Navigation links into links to each board\'s catalog.'] '404 Redirect': [true, 'Redirect dead threads and images'] 'Keybinds': [true, 'Binds actions to keys'] 'Time Formatting': [true, 'Arbitrarily formatted timestamps, using your local time'] @@ -4171,6 +4172,48 @@ ImageExpand = resize: -> ImageExpand.style.textContent = ".fitheight img[data-md5] + img {max-height:#{d.documentElement.clientHeight}px;}" +CatalogLinks = + init: -> + el = $.el 'span', + innerHTML: + "[Catalog #{unless g.CATALOG then 'On' else 'Off'}]" + id: 'toggleCatalog' + for nav in ['boardNavDesktop', 'boardNavDesktopFoot'] + $.on el.firstElementChild, 'click', @toggle + $.add $.id(nav), el + el = $.el 'span', innerHTML: el.innerHTML, id: 'toggleCatalogFoot' + + if $.get 'CatalogIsToggled' + i = if g.CATALOG then 0 else 1 + while i < 2 + @toggle() + i++ + return + @toggle() if g.CATALOG + + toggle: -> + for nav in ['boardNavDesktop', 'boardNavDesktopFoot'] + a = $.id(nav).firstElementChild + while a.href and split = a.href.split '/' + unless /^rs|status/.test split[2] + if (isDead = split[3] is 'f') and g.CATALOG or split[4] is 'catalog' + a.href = a.href.replace /catalog$/, '' + a.title = a.title.replace /\ -\ Catalog$/, '' + else if not isDead + a.href += 'catalog' + a.title += ' - Catalog' + a = a.nextElementSibling + + if /On$/.test (el = a.parentNode.lastChild.firstElementChild).textContent + el.textContent = 'Catalog Off' + el.title = 'Turn Catalog Links off.' + $.set 'CatalogIsToggled', true + else + el.textContent = 'Catalog On' + el.title = 'Turn Catalog Links on.' + $.delete 'CatalogIsToggled' + return + Main = init: -> Main.flatten null, Config @@ -4181,6 +4224,8 @@ Main = if temp is 'res' g.REPLY = true g.THREAD_ID = pathname[2] + else if temp is 'catalog' + g.CATALOG = true # Load values from localStorage. for key, val of Conf @@ -4335,6 +4380,9 @@ Main = $.addClass a, 'current' Favicon.init() + if Conf['Catalog Links'] + CatalogLinks.init() + # Major features. if Conf['Quick Reply'] QR.init() From 6c622fa7c2388a707255651fcbb3ed5b88ef40f3 Mon Sep 17 00:00:00 2001 From: noface Date: Fri, 7 Dec 2012 03:37:17 +0100 Subject: [PATCH 08/51] Fix Anonymizer not working on hovered posts. --- 4chan_x.user.js | 5 ++++- changelog | 2 ++ script.coffee | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 2f227f015..43c2c32b5 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -4198,7 +4198,10 @@ FileInfo.node(post); } if (Conf['Resurrect Quotes']) { - return Quotify.node(post); + Quotify.node(post); + } + if (Conf['Anonymize']) { + return Anonymize.node(post); } }); $.on(this, 'mousemove', UI.hover); diff --git a/changelog b/changelog index c6d68cd70..8d253f276 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- noface + Fix Anonymize not working on hovered posts. 2.36.3 - Mayhem diff --git a/script.coffee b/script.coffee index 39b22d211..52d98f3af 100644 --- a/script.coffee +++ b/script.coffee @@ -3448,6 +3448,8 @@ QuotePreview = FileInfo.node post if Conf['Resurrect Quotes'] Quotify.node post + if Conf['Anonymize'] + Anonymize.node post $.on @, 'mousemove', UI.hover $.on @, 'mouseout click', QuotePreview.mouseout From 65b1e168b3a547634ee67078bab9c03c83aedc8f Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Mon, 10 Dec 2012 14:41:58 +0100 Subject: [PATCH 09/51] Start catalog support. Close #834. --- 4chan_x.user.js | 56 ++++++++++++++++++++++++++++++++++++++++++------- changelog | 3 +++ script.coffee | 43 ++++++++++++++++++++++++++++++------- 3 files changed, 87 insertions(+), 15 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 2f227f015..39d3723ff 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -318,8 +318,9 @@ return $.on(d, 'DOMContentLoaded', cb); }, sync: function(key, cb) { + key = Main.namespace + key; return $.on(window, 'storage', function(e) { - if (e.key === ("" + Main.namespace + key)) { + if (e.key === key) { return cb(JSON.parse(e.newValue)); } }); @@ -1042,7 +1043,10 @@ ThreadHiding = { init: function() { var a, hiddenThreads, thread, _i, _len, _ref; - hiddenThreads = $.get("hiddenThreads/" + g.BOARD + "/", {}); + hiddenThreads = ThreadHiding.sync(); + if (g.CATALOG) { + return; + } _ref = $$('.thread'); for (_i = 0, _len = _ref.length; _i < _len; _i++) { thread = _ref[_i]; @@ -1058,6 +1062,25 @@ } } }, + sync: function() { + var hiddenThreads, hiddenThreadsCatalog, id; + hiddenThreads = $.get("hiddenThreads/" + g.BOARD + "/", {}); + hiddenThreadsCatalog = JSON.parse(localStorage.getItem("4chan-hide-t-" + g.BOARD)); + if (g.CATALOG) { + for (id in hiddenThreads) { + hiddenThreadsCatalog[id] = true; + } + localStorage.setItem("4chan-hide-t-" + g.BOARD, JSON.stringify(hiddenThreadsCatalog)); + } else { + for (id in hiddenThreadsCatalog) { + if (!(id in hiddenThreads)) { + hiddenThreads[id] = Date.now(); + } + } + $.set("hiddenThreads/" + g.BOARD + "/", hiddenThreads); + } + return hiddenThreads; + }, cb: function() { return ThreadHiding.toggle($.x('ancestor::div[parent::div[@class="board"]]', this)); }, @@ -5157,14 +5180,18 @@ Main = { init: function() { - var cutoff, hiddenThreads, id, key, now, path, pathname, settings, temp, timestamp, val, _ref; + var key, path, pathname, settings, temp, val; Main.flatten(null, Config); path = location.pathname; pathname = path.slice(1).split('/'); g.BOARD = pathname[0], temp = pathname[1]; - if (temp === 'res') { - g.REPLY = true; - g.THREAD_ID = pathname[2]; + switch (temp) { + case 'res': + g.REPLY = true; + g.THREAD_ID = pathname[2]; + break; + case 'catalog': + g.CATALOG = true; } for (key in Conf) { val = Conf[key]; @@ -5212,6 +5239,19 @@ settings.disableAll = true; localStorage.setItem('4chan-settings', JSON.stringify(settings)); } + if (g.CATALOG) { + return $.ready(Main.catalog); + } else { + return Main.features(); + } + }, + catalog: function() { + if (Conf['Thread Hiding']) { + return ThreadHiding.init(); + } + }, + features: function() { + var cutoff, hiddenThreads, id, now, timestamp, _ref; Options.init(); if (Conf['Quick Reply'] && Conf['Hide Original Post Form']) { Main.css += '#postForm { display: none; }'; @@ -5314,9 +5354,9 @@ if (Conf['Indicate Cross-thread Quotes']) { QuoteCT.init(); } - return $.ready(Main.ready); + return $.ready(Main.featuresReady); }, - ready: function() { + featuresReady: function() { var MutationObserver, a, board, nav, node, nodes, observer, _i, _j, _len, _len1, _ref, _ref1; if (/^4chan - 404/.test(d.title)) { if (Conf['404 Redirect'] && /^\d+$/.test(g.THREAD_ID)) { diff --git a/changelog b/changelog index c6d68cd70..b65714749 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,7 @@ master +- Mayhem + Added catalog support: + Sync thread hiding between index and catalog. 2.36.3 - Mayhem diff --git a/script.coffee b/script.coffee index 39b22d211..7633d8480 100644 --- a/script.coffee +++ b/script.coffee @@ -269,8 +269,9 @@ $.extend $, fc() $.on d, 'DOMContentLoaded', cb sync: (key, cb) -> + key = Main.namespace + key $.on window, 'storage', (e) -> - cb JSON.parse e.newValue if e.key is "#{Main.namespace}#{key}" + cb JSON.parse e.newValue if e.key is key id: (id) -> d.getElementById id formData: (arg) -> @@ -832,7 +833,8 @@ ExpandThread = ThreadHiding = init: -> - hiddenThreads = $.get "hiddenThreads/#{g.BOARD}/", {} + hiddenThreads = ThreadHiding.sync() + return if g.CATALOG for thread in $$ '.thread' a = $.el 'a', className: 'hide_thread_button' @@ -845,6 +847,20 @@ ThreadHiding = ThreadHiding.hide thread return + sync: -> + hiddenThreads = $.get "hiddenThreads/#{g.BOARD}/", {} + hiddenThreadsCatalog = JSON.parse localStorage.getItem "4chan-hide-t-#{g.BOARD}" + if g.CATALOG + for id of hiddenThreads + hiddenThreadsCatalog[id] = true + localStorage.setItem "4chan-hide-t-#{g.BOARD}", JSON.stringify hiddenThreadsCatalog + else + for id of hiddenThreadsCatalog + unless id of hiddenThreads + hiddenThreads[id] = Date.now() + $.set "hiddenThreads/#{g.BOARD}/", hiddenThreads + hiddenThreads + cb: -> ThreadHiding.toggle $.x 'ancestor::div[parent::div[@class="board"]]', @ @@ -4178,9 +4194,12 @@ Main = path = location.pathname pathname = path[1..].split '/' [g.BOARD, temp] = pathname - if temp is 'res' - g.REPLY = true - g.THREAD_ID = pathname[2] + switch temp + when 'res' + g.REPLY = true + g.THREAD_ID = pathname[2] + when 'catalog' + g.CATALOG = true # Load values from localStorage. for key, val of Conf @@ -4213,6 +4232,16 @@ Main = settings.disableAll = true localStorage.setItem '4chan-settings', JSON.stringify settings + if g.CATALOG + $.ready Main.catalog + else + Main.features() + + catalog: -> + if Conf['Thread Hiding'] + ThreadHiding.init() + + features: -> Options.init() if Conf['Quick Reply'] and Conf['Hide Original Post Form'] @@ -4314,9 +4343,9 @@ Main = if Conf['Indicate Cross-thread Quotes'] QuoteCT.init() - $.ready Main.ready + $.ready Main.featuresReady - ready: -> + featuresReady: -> if /^4chan - 404/.test d.title if Conf['404 Redirect'] and /^\d+$/.test g.THREAD_ID location.href = From b4f68be7325fe6f87e5f9f87c75cd6ababb1de56 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Mon, 10 Dec 2012 18:25:39 +0100 Subject: [PATCH 10/51] Add /c/ archive redirection. --- 4chan_x.user.js | 15 ++++++++++----- changelog | 1 + script.coffee | 14 +++++++++----- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index e8f132f10..a4fb76b6f 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -4799,6 +4799,8 @@ case 'toy': case 'x': return "http://archive.heinessen.com/" + board + "/full_image/" + filename; + case 'c': + return "//archive.nyafuu.org/" + board + "/full_image/" + filename; } }, post: function(board, postID) { @@ -4846,21 +4848,21 @@ break; case 'u': case 'kuku': - url = Redirect.path("//nsfw.foolz.us", 'foolfuuka', data); + url = Redirect.path('//nsfw.foolz.us', 'foolfuuka', data); break; case 'ck': case 'lit': - url = Redirect.path("//fuuka.warosu.org", 'fuuka', data); + url = Redirect.path('//fuuka.warosu.org', 'fuuka', data); break; case 'diy': case 'sci': - url = Redirect.path("//archive.installgentoo.net", 'fuuka', data); + url = Redirect.path('//archive.installgentoo.net', 'fuuka', data); break; case 'cgl': case 'g': case 'mu': case 'w': - url = Redirect.path("//rbt.asia", 'fuuka', data); + url = Redirect.path('//rbt.asia', 'fuuka', data); break; case 'an': case 'fit': @@ -4869,7 +4871,10 @@ case 'r9k': case 'toy': case 'x': - url = Redirect.path("http://archive.heinessen.com", 'fuuka', data); + url = Redirect.path('http://archive.heinessen.com', 'fuuka', data); + break; + case 'c': + url = Redirect.path('//archive.nyafuu.org', 'fuuka', data); break; default: if (threadID) { diff --git a/changelog b/changelog index 5d271b7ca..034ec6cfe 100644 --- a/changelog +++ b/changelog @@ -4,6 +4,7 @@ master - Mayhem Added catalog support: Sync thread hiding between index and catalog. + Add /c/ archived thread and image redirection. 2.36.3 - Mayhem diff --git a/script.coffee b/script.coffee index d6f220bed..f19d50ffb 100644 --- a/script.coffee +++ b/script.coffee @@ -3945,6 +3945,8 @@ Redirect = "//rbt.asia/#{board}/full_image/#{filename}" when 'an', 'k', 'toy', 'x' "http://archive.heinessen.com/#{board}/full_image/#{filename}" + when 'c' + "//archive.nyafuu.org/#{board}/full_image/#{filename}" post: (board, postID) -> switch board when 'a', 'co', 'jp', 'm', 'q', 'sp', 'tg', 'tv', 'v', 'vg', 'wsg', 'dev', 'foolz' @@ -3959,15 +3961,17 @@ Redirect = when 'a', 'co', 'jp', 'm', 'q', 'sp', 'tg', 'tv', 'v', 'vg', 'wsg', 'dev', 'foolz' url = Redirect.path '//archive.foolz.us', 'foolfuuka', data when 'u', 'kuku' - url = Redirect.path "//nsfw.foolz.us", 'foolfuuka', data + url = Redirect.path '//nsfw.foolz.us', 'foolfuuka', data when 'ck', 'lit' - url = Redirect.path "//fuuka.warosu.org", 'fuuka', data + url = Redirect.path '//fuuka.warosu.org', 'fuuka', data when 'diy', 'sci' - url = Redirect.path "//archive.installgentoo.net", 'fuuka', data + url = Redirect.path '//archive.installgentoo.net', 'fuuka', data when 'cgl', 'g', 'mu', 'w' - url = Redirect.path "//rbt.asia", 'fuuka', data + url = Redirect.path '//rbt.asia', 'fuuka', data when 'an', 'fit', 'k', 'mlp', 'r9k', 'toy', 'x' - url = Redirect.path "http://archive.heinessen.com", 'fuuka', data + url = Redirect.path 'http://archive.heinessen.com', 'fuuka', data + when 'c' + url = Redirect.path '//archive.nyafuu.org', 'fuuka', data else if threadID url = "//boards.4chan.org/#{board}/" From 715e1fb54e6d482d1fdcc81b31b1f7fed8016d27 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 11 Dec 2012 11:16:45 +0100 Subject: [PATCH 11/51] Fix noface's code. --- 4chan_x.user.js | 69 +++++++++++++++++++------------------------------ script.coffee | 57 ++++++++++++++++++---------------------- 2 files changed, 52 insertions(+), 74 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index dd78c56d6..31f1bf014 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -5189,60 +5189,45 @@ CatalogLinks = { init: function() { - var el, i, nav, _i, _len, _ref; + var clone, el, nav, _i, _len, _ref; el = $.el('span', { - innerHTML: "[Catalog " + (!g.CATALOG ? 'On' : 'Off') + "]", - id: 'toggleCatalog' + className: 'toggleCatalog', + innerHTML: '[]' }); _ref = ['boardNavDesktop', 'boardNavDesktopFoot']; for (_i = 0, _len = _ref.length; _i < _len; _i++) { nav = _ref[_i]; - $.on(el.firstElementChild, 'click', this.toggle); - $.add($.id(nav), el); - el = $.el('span', { - innerHTML: el.innerHTML, - id: 'toggleCatalogFoot' - }); - } - if ($.get('CatalogIsToggled')) { - i = g.CATALOG ? 0 : 1; - while (i < 2) { - this.toggle(); - i++; - } - return; - } - if (g.CATALOG) { - return this.toggle(); + clone = el.cloneNode(true); + $.on(clone.firstElementChild, 'click', this.toggle); + $.add($.id(nav), clone); } + return this.toggle(true); }, - toggle: function() { - var a, el, isDead, nav, split, _i, _len, _ref; + toggle: function(onLoad) { + var a, board, nav, root, useCatalog, _i, _j, _len, _len1, _ref, _ref1; + if (onLoad === true) { + useCatalog = $.get('CatalogIsToggled', g.CATALOG); + } else { + useCatalog = this.textContent === 'Catalog Off'; + $.set('CatalogIsToggled', useCatalog); + } _ref = ['boardNavDesktop', 'boardNavDesktopFoot']; for (_i = 0, _len = _ref.length; _i < _len; _i++) { nav = _ref[_i]; - a = $.id(nav).firstElementChild; - while (a.href && (split = a.href.split('/'))) { - if (!/^rs|status/.test(split[2])) { - if ((isDead = split[3] === 'f') && g.CATALOG || split[4] === 'catalog') { - a.href = a.href.replace(/catalog$/, ''); - a.title = a.title.replace(/\ -\ Catalog$/, ''); - } else if (!isDead) { - a.href += 'catalog'; - a.title += ' - Catalog'; - } + root = $.id(nav); + _ref1 = $$('a[href*="boards.4chan.org"]', root); + for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { + a = _ref1[_j]; + board = a.pathname.split('/')[1]; + if (board === 'f') { + a.pathname = '/f/'; + continue; } - a = a.nextElementSibling; - } - if (/On$/.test((el = a.parentNode.lastChild.firstElementChild).textContent)) { - el.textContent = 'Catalog Off'; - el.title = 'Turn Catalog Links off.'; - $.set('CatalogIsToggled', true); - } else { - el.textContent = 'Catalog On'; - el.title = 'Turn Catalog Links on.'; - $["delete"]('CatalogIsToggled'); + a.pathname = "/" + board + "/" + (useCatalog ? 'catalog' : ''); } + a = $('.toggleCatalog', root).firstElementChild; + a.textContent = "Catalog " + (useCatalog ? 'On' : 'Off'); + a.title = "Turn catalog links " + (useCatalog ? 'off' : 'on') + "."; } } }; diff --git a/script.coffee b/script.coffee index a6e2e0a0a..405328d7e 100644 --- a/script.coffee +++ b/script.coffee @@ -4197,43 +4197,36 @@ ImageExpand = CatalogLinks = init: -> el = $.el 'span', - innerHTML: - "[Catalog #{unless g.CATALOG then 'On' else 'Off'}]" - id: 'toggleCatalog' + className: 'toggleCatalog' + innerHTML: '[]' for nav in ['boardNavDesktop', 'boardNavDesktopFoot'] - $.on el.firstElementChild, 'click', @toggle - $.add $.id(nav), el - el = $.el 'span', innerHTML: el.innerHTML, id: 'toggleCatalogFoot' + clone = el.cloneNode true + $.on clone.firstElementChild, 'click', @toggle + $.add $.id(nav), clone - if $.get 'CatalogIsToggled' - i = if g.CATALOG then 0 else 1 - while i < 2 - @toggle() - i++ - return - @toggle() if g.CATALOG + # Set links on load. + @toggle true + + toggle: (onLoad) -> + if onLoad is true + useCatalog = $.get 'CatalogIsToggled', g.CATALOG + else + useCatalog = @textContent is 'Catalog Off' + $.set 'CatalogIsToggled', useCatalog - toggle: -> for nav in ['boardNavDesktop', 'boardNavDesktopFoot'] - a = $.id(nav).firstElementChild - while a.href and split = a.href.split '/' - unless /^rs|status/.test split[2] - if (isDead = split[3] is 'f') and g.CATALOG or split[4] is 'catalog' - a.href = a.href.replace /catalog$/, '' - a.title = a.title.replace /\ -\ Catalog$/, '' - else if not isDead - a.href += 'catalog' - a.title += ' - Catalog' - a = a.nextElementSibling + root = $.id nav + for a in $$ 'a[href*="boards.4chan.org"]', root + board = a.pathname.split('/')[1] + if board is 'f' + # 4chan links to /f/'s catalog even if it doesn't have one. + a.pathname = '/f/' + continue + a.pathname = "/#{board}/#{if useCatalog then 'catalog' else ''}" - if /On$/.test (el = a.parentNode.lastChild.firstElementChild).textContent - el.textContent = 'Catalog Off' - el.title = 'Turn Catalog Links off.' - $.set 'CatalogIsToggled', true - else - el.textContent = 'Catalog On' - el.title = 'Turn Catalog Links on.' - $.delete 'CatalogIsToggled' + a = $('.toggleCatalog', root).firstElementChild + a.textContent = "Catalog #{if useCatalog then 'On' else 'Off'}" + a.title = "Turn catalog links #{if useCatalog then 'off' else 'on'}." return Main = From 1ac0315734ad5e7e5cd176efab2bf784623b6181 Mon Sep 17 00:00:00 2001 From: noface Date: Tue, 11 Dec 2012 11:52:51 +0100 Subject: [PATCH 12/51] Remove default settings button when 'Disable 4chan\'s extension' is enabled. --- 4chan_x.user.js | 9 +++++++-- script.coffee | 6 +++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 31f1bf014..20647b02b 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2696,7 +2696,7 @@ return $.ready(Options.initReady); }, initReady: function() { - var a, settings, _i, _len, _ref; + var a, setting, settings, _i, _len, _ref; _ref = ['navtopright', 'navbotright']; for (_i = 0, _len = _ref.length; _i < _len; _i++) { settings = _ref[_i]; @@ -2706,7 +2706,12 @@ textContent: '4chan X Settings' }); $.on(a, 'click', Options.dialog); - $.prepend($.id(settings), [$.tn('['), a, $.tn('] ')]); + setting = $.id(settings); + if (Conf['Disable 4chan\'s extension']) { + $.replace(setting.childNodes[1], a); + continue; + } + $.prepend(setting, [$.tn('['), a, $.tn('] ')]); } if (!$.get('firstrun')) { $.set('firstrun', true); diff --git a/script.coffee b/script.coffee index 405328d7e..0f33a5a8d 100644 --- a/script.coffee +++ b/script.coffee @@ -2148,7 +2148,11 @@ Options = className: 'settingsWindowLink' textContent: '4chan X Settings' $.on a, 'click', Options.dialog - $.prepend $.id(settings), [$.tn('['), a, $.tn('] ')] + setting = $.id settings + if Conf['Disable 4chan\'s extension'] + $.replace setting.childNodes[1], a + continue + $.prepend setting, [$.tn('['), a, $.tn('] ')] unless $.get 'firstrun' $.set 'firstrun', true # Prevent race conditions From e130614363c48317d473ad151a8426695059350a Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 11 Dec 2012 12:09:47 +0100 Subject: [PATCH 13/51] Simplify quote resurrection now that 4chan parses these for us. --- 4chan_x.user.js | 71 +++++++++++++++++--------------------- script.coffee | 92 ++++++++++++++++++------------------------------- 2 files changed, 65 insertions(+), 98 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 31f1bf014..28c5d94ab 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -4308,52 +4308,43 @@ return Main.callbacks.push(this.node); }, node: function(post) { - var a, board, data, i, id, index, m, node, nodes, quote, quotes, snapshot, text, _i, _j, _len, _ref; + var a, board, deadlink, id, m, postBoard, quote, _i, _len, _ref; if (post.isInlined && !post.isCrosspost) { return; } - snapshot = d.evaluate('.//text()[not(parent::a)]', post.blockquote, null, 6, null); - for (i = _i = 0, _ref = snapshot.snapshotLength; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) { - node = snapshot.snapshotItem(i); - data = node.data; - if (!(quotes = data.match(/>>(>\/[a-z\d]+\/)?\d+/g))) { - continue; + _ref = $$('.quote.deadlink', post.blockquote); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + deadlink = _ref[_i]; + quote = deadlink.textContent; + a = $.el('a', { + textContent: "" + quote + "\u00A0(Dead)" + }); + id = quote.match(/\d+$/)[0]; + if (m = quote.match(/^>>>\/([a-z\d]+)/)) { + board = m[1]; + } else if (postBoard) { + board = postBoard; + } else { + board = postBoard = $('a[title="Highlight this post"]', post.el).pathname.split('/')[1]; } - nodes = []; - for (_j = 0, _len = quotes.length; _j < _len; _j++) { - quote = quotes[_j]; - index = data.indexOf(quote); - if (text = data.slice(0, index)) { - nodes.push($.tn(text)); + if (board === g.BOARD && $.id("p" + id)) { + a.href = "#p" + id; + a.className = 'quotelink'; + } else { + a.href = Redirect.to({ + board: board, + threadID: 0, + postID: id + }); + a.className = 'deadlink'; + a.target = '_blank'; + if (Redirect.post(board, id)) { + $.addClass(a, 'quotelink'); + a.setAttribute('data-board', board); + a.setAttribute('data-id', id); } - id = quote.match(/\d+$/)[0]; - board = (m = quote.match(/^>>>\/([a-z\d]+)/)) ? m[1] : $('a[title="Highlight this post"]', post.el).pathname.split('/')[1]; - nodes.push(a = $.el('a', { - textContent: "" + quote + "\u00A0(Dead)" - })); - if (board === g.BOARD && $.id("p" + id)) { - a.href = "#p" + id; - a.className = 'quotelink'; - } else { - a.href = Redirect.to({ - board: board, - threadID: 0, - postID: id - }); - a.className = 'deadlink'; - a.target = '_blank'; - if (Redirect.post(board, id)) { - $.addClass(a, 'quotelink'); - a.setAttribute('data-board', board); - a.setAttribute('data-id', id); - } - } - data = data.slice(index + quote.length); } - if (data) { - nodes.push($.tn(data)); - } - $.replace(node, nodes); + $.replace(deadlink, a); } } }; diff --git a/script.coffee b/script.coffee index 405328d7e..b1c15f04d 100644 --- a/script.coffee +++ b/script.coffee @@ -3522,67 +3522,43 @@ Quotify = Main.callbacks.push @node node: (post) -> return if post.isInlined and not post.isCrosspost + for deadlink in $$ '.quote.deadlink', post.blockquote + quote = deadlink.textContent + a = $.el 'a', + # \u00A0 is nbsp + textContent: "#{quote}\u00A0(Dead)" - # XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE is 6 - # Get all the text nodes that are not inside an anchor. - snapshot = d.evaluate './/text()[not(parent::a)]', post.blockquote, null, 6, null + id = quote.match(/\d+$/)[0] - for i in [0...snapshot.snapshotLength] - node = snapshot.snapshotItem i - data = node.data + if m = quote.match /^>>>\/([a-z\d]+)/ + board = m[1] + else if postBoard + board = postBoard + else + # Get the post's board, whether it's inlined or not. + board = postBoard = $('a[title="Highlight this post"]', post.el).pathname.split('/')[1] - unless quotes = data.match />>(>\/[a-z\d]+\/)?\d+/g - # Only accept nodes with potentially valid links - continue - - nodes = [] - - for quote in quotes - index = data.indexOf quote - if text = data[...index] - # Potential text before this valid quote. - nodes.push $.tn text - - id = quote.match(/\d+$/)[0] - board = - if m = quote.match /^>>>\/([a-z\d]+)/ - m[1] - else - # Get the post's board, whether it's inlined or not. - $('a[title="Highlight this post"]', post.el).pathname.split('/')[1] - - nodes.push a = $.el 'a', - # \u00A0 is nbsp - textContent: "#{quote}\u00A0(Dead)" - - if board is g.BOARD and $.id "p#{id}" - a.href = "#p#{id}" - a.className = 'quotelink' - else - a.href = - Redirect.to - board: board - threadID: 0 - postID: id - a.className = 'deadlink' - a.target = '_blank' - if Redirect.post board, id - $.addClass a, 'quotelink' - # XXX WTF Scriptish/Greasemonkey? - # Setting dataset attributes that way doesn't affect the HTML, - # but are, I suspect, kept as object key/value pairs and GC'd later. - # a.dataset.board = board - # a.dataset.id = id - a.setAttribute 'data-board', board - a.setAttribute 'data-id', id - - data = data[index + quote.length..] - - if data - # Potential text after the last valid quote. - nodes.push $.tn data - - $.replace node, nodes + if board is g.BOARD and $.id "p#{id}" + a.href = "#p#{id}" + a.className = 'quotelink' + else + a.href = + Redirect.to + board: board + threadID: 0 + postID: id + a.className = 'deadlink' + a.target = '_blank' + if Redirect.post board, id + $.addClass a, 'quotelink' + # XXX WTF Scriptish/Greasemonkey? + # Setting dataset attributes that way doesn't affect the HTML, + # but are, I suspect, kept as object key/value pairs and GC'd later. + # a.dataset.board = board + # a.dataset.id = id + a.setAttribute 'data-board', board + a.setAttribute 'data-id', id + $.replace deadlink, a return DeleteLink = From 4c85e87d7e7b1763154ac3f10e422d73fdd1f881 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 11 Dec 2012 13:11:28 +0100 Subject: [PATCH 14/51] Don't parse catalog quotelinks. Hopefully I didn't miss any. --- 4chan_x.user.js | 24 +++++++++++++----------- script.coffee | 19 ++++++++++--------- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 16c30759c..f27b0685e 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -856,12 +856,13 @@ _ref = post.quotes; for (_i = 0, _len = _ref.length; _i < _len; _i++) { quote = _ref[_i]; - if ((el = $.id(quote.hash.slice(1))) && el.hidden) { - $.addClass(quote, 'filtered'); - if (Conf['Recursive Filtering'] && post.ID !== post.threadID) { - show_stub = !!$.x('preceding-sibling::div[contains(@class,"stub")]', el); - ReplyHiding.hide(post.root, show_stub); - } + if (!((el = $.id(quote.hash.slice(1))) && !/catalog$/.test(quote.pathname) && el.hidden)) { + continue; + } + $.addClass(quote, 'filtered'); + if (Conf['Recursive Filtering'] && post.ID !== post.threadID) { + show_stub = !!$.x('preceding-sibling::div[contains(@class,"stub")]', el); + ReplyHiding.hide(post.root, show_stub); } } } @@ -4024,7 +4025,7 @@ if (quote.parentNode.parentNode.className === 'capcodeReplies') { break; } - if (qid = quote.hash.slice(2)) { + if (!/catalog$/.test(quote.pathname) && (qid = quote.hash.slice(2))) { quotes[qid] = true; } } @@ -4065,7 +4066,7 @@ _ref = post.quotes; for (_i = 0, _len = _ref.length; _i < _len; _i++) { quote = _ref[_i]; - if (!(quote.hash || /\bdeadlink\b/.test(quote.className))) { + if (!(quote.hash && !/catalog$/.test(quote.pathname) || /\bdeadlink\b/.test(quote.className))) { continue; } $.on(quote, 'click', QuoteInline.toggle); @@ -4158,9 +4159,10 @@ _ref = post.quotes; for (_i = 0, _len = _ref.length; _i < _len; _i++) { quote = _ref[_i]; - if (quote.hash || /\bdeadlink\b/.test(quote.className)) { - $.on(quote, 'mouseover', QuotePreview.mouseover); + if (!(quote.hash && !/catalog$/.test(quote.pathname) || /\bdeadlink\b/.test(quote.className))) { + continue; } + $.on(quote, 'mouseover', QuotePreview.mouseover); } _ref1 = post.backlinks; for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { @@ -4297,7 +4299,7 @@ _ref = post.quotes; for (_i = 0, _len = _ref.length; _i < _len; _i++) { quote = _ref[_i]; - if (!quote.hash) { + if (!(quote.hash && !/catalog$/.test(quote.pathname))) { continue; } path = quote.pathname.split('/'); diff --git a/script.coffee b/script.coffee index 3f958fcfd..b6c6f126c 100644 --- a/script.coffee +++ b/script.coffee @@ -706,11 +706,11 @@ StrikethroughQuotes = node: (post) -> return if post.isInlined for quote in post.quotes - if (el = $.id quote.hash[1..]) and el.hidden - $.addClass quote, 'filtered' - if Conf['Recursive Filtering'] and post.ID isnt post.threadID - show_stub = !!$.x 'preceding-sibling::div[contains(@class,"stub")]', el - ReplyHiding.hide post.root, show_stub + continue unless (el = $.id quote.hash[1..]) and !/catalog$/.test(quote.pathname) and el.hidden + $.addClass quote, 'filtered' + if Conf['Recursive Filtering'] and post.ID isnt post.threadID + show_stub = !!$.x 'preceding-sibling::div[contains(@class,"stub")]', el + ReplyHiding.hide post.root, show_stub return ExpandComment = @@ -3319,7 +3319,7 @@ QuoteBacklink = # Stop at 'Admin/Mod/Dev Replies:' on /q/ break if quote.parentNode.parentNode.className is 'capcodeReplies' # Don't process >>>/b/. - if qid = quote.hash[2..] + if !/catalog$/.test(quote.pathname) and qid = quote.hash[2..] # Duplicate quotes get overwritten. quotes[qid] = true a = $.el 'a', @@ -3347,7 +3347,7 @@ QuoteInline = Main.callbacks.push @node node: (post) -> for quote in post.quotes - continue unless quote.hash or /\bdeadlink\b/.test quote.className + continue unless quote.hash and !/catalog$/.test(quote.pathname) or /\bdeadlink\b/.test quote.className $.on quote, 'click', QuoteInline.toggle for quote in post.backlinks $.on quote, 'click', QuoteInline.toggle @@ -3416,7 +3416,8 @@ QuotePreview = Main.callbacks.push @node node: (post) -> for quote in post.quotes - $.on quote, 'mouseover', QuotePreview.mouseover if quote.hash or /\bdeadlink\b/.test quote.className + continue unless quote.hash and !/catalog$/.test(quote.pathname) or /\bdeadlink\b/.test quote.className + $.on quote, 'mouseover', QuotePreview.mouseover for quote in post.backlinks $.on quote, 'mouseover', QuotePreview.mouseover return @@ -3511,7 +3512,7 @@ QuoteCT = node: (post) -> return if post.isInlined and not post.isCrosspost for quote in post.quotes - unless quote.hash + unless quote.hash and !/catalog$/.test quote.pathname # Make sure this isn't a link to the board we're on. continue path = quote.pathname.split '/' From 642519834a1ce0ca85d966dbee7d699978df3def Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 11 Dec 2012 15:05:00 +0100 Subject: [PATCH 15/51] Release 2.37.0. --- 4chan_x.user.js | 6 +++--- Cakefile | 2 +- changelog | 6 ++++-- latest.js | 2 +- script.coffee | 2 +- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index f27b0685e..4e2b31cfb 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan x -// @version 2.36.3 +// @version 2.37.0 // @namespace aeosynth // @description Adds various features. // @copyright 2009-2011 James Campos @@ -27,7 +27,7 @@ * Copyright (c) 2009-2011 James Campos * Copyright (c) 2012 Nicolas Stepien * http://mayhemydg.github.com/4chan-x/ - * 4chan X 2.36.3 + * 4chan X 2.37.0 * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -5617,7 +5617,7 @@ return $.globalEval(("(" + code + ")()").replace('_id_', bq.id)); }, namespace: '4chan_x.', - version: '2.36.3', + version: '2.37.0', callbacks: [], css: '\ /* dialog styling */\ diff --git a/Cakefile b/Cakefile index e63130186..fd4299ed2 100644 --- a/Cakefile +++ b/Cakefile @@ -2,7 +2,7 @@ {exec} = require 'child_process' fs = require 'fs' -VERSION = '2.36.3' +VERSION = '2.37.0' HEADER = """ // ==UserScript== diff --git a/changelog b/changelog index e1fbb271e..3c64215f6 100644 --- a/changelog +++ b/changelog @@ -1,10 +1,12 @@ master + +2.37.0 - noface Add Catalog Links toggle. Fix Anonymize not working on hovered posts. - Mayhem - Added catalog support: - Sync thread hiding between index and catalog. + Added catalog support. + Sync thread hiding between index and catalog. Add /c/ archived thread and image redirection. 2.36.3 diff --git a/latest.js b/latest.js index 2e99c809e..261d781cd 100644 --- a/latest.js +++ b/latest.js @@ -1 +1 @@ -postMessage({version:'2.36.3'},'*') \ No newline at end of file +postMessage({version:'2.37.0'},'*') \ No newline at end of file diff --git a/script.coffee b/script.coffee index b6c6f126c..b29899db7 100644 --- a/script.coffee +++ b/script.coffee @@ -4520,7 +4520,7 @@ Main = $.globalEval "(#{code})()".replace '_id_', bq.id namespace: '4chan_x.' - version: '2.36.3' + version: '2.37.0' callbacks: [] css: ' /* dialog styling */ From f28bfd4e7ec6e69fc3982c2f1d1728b755280cd1 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 13 Dec 2012 12:00:17 +0100 Subject: [PATCH 16/51] Fix #853 --- 4chan_x.user.js | 10 ++-------- changelog | 2 ++ script.coffee | 9 +++------ 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 4e2b31cfb..132b85c04 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1991,23 +1991,17 @@ } id = this.previousSibling.hash.slice(2); text = ">>" + id + "\n"; - sel = window.getSelection(); + sel = d.getSelection(); if ((s = sel.toString().trim()) && id === ((_ref = $.x('ancestor-or-self::blockquote', sel.anchorNode)) != null ? _ref.id.match(/\d+$/)[0] : void 0)) { - if ($.engine === 'presto') { - s = d.getSelection().trim(); - } s = s.replace(/\n/g, '\n>'); text += ">" + s + "\n"; } ta = $('textarea', QR.el); caretPos = ta.selectionStart; ta.value = ta.value.slice(0, caretPos) + text + ta.value.slice(ta.selectionEnd); - ta.focus(); range = caretPos + text.length; - if ($.engine === 'presto') { - range += text.match(/\n/g).length; - } ta.setSelectionRange(range, range); + ta.focus(); return $.event(ta, new Event('input')); }, characterCount: function() { diff --git a/changelog b/changelog index 3c64215f6..055026b08 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- Mayhem + Fix selection quoting on Opera. 2.37.0 - noface diff --git a/script.coffee b/script.coffee index b29899db7..29f182e2d 100644 --- a/script.coffee +++ b/script.coffee @@ -1552,10 +1552,9 @@ QR = id = @previousSibling.hash[2..] text = ">>#{id}\n" - sel = window.getSelection() + sel = d.getSelection() if (s = sel.toString().trim()) and id is $.x('ancestor-or-self::blockquote', sel.anchorNode)?.id.match(/\d+$/)[0] - # XXX Opera needs d.getSelection() to retain linebreaks from the selected text - s = d.getSelection().trim() if $.engine is 'presto' + # XXX Opera doesn't retain `\n`s? s = s.replace /\n/g, '\n>' text += ">#{s}\n" @@ -1563,12 +1562,10 @@ QR = caretPos = ta.selectionStart # Replace selection for text. 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 - # XXX Opera counts newlines as double - range += text.match(/\n/g).length if $.engine is 'presto' ta.setSelectionRange range, range + ta.focus() # Fire the 'input' event $.event ta, new Event 'input' From 9f18c25805c4302b606b102e4167cba79d883019 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 13 Dec 2012 12:08:33 +0100 Subject: [PATCH 17/51] Fix #846 --- 4chan_x.user.js | 2 +- changelog | 1 + script.coffee | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 132b85c04..06b61ae35 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2366,7 +2366,7 @@ return this.input.alt = count; }, reload: function(focus) { - window.location = 'javascript:Recaptcha.reload("t")'; + $.globalEval('javascript:Recaptcha.reload("t")'); if (focus) { return QR.captcha.input.focus(); } diff --git a/changelog b/changelog index 055026b08..e8ac104b4 100644 --- a/changelog +++ b/changelog @@ -1,6 +1,7 @@ master - Mayhem Fix selection quoting on Opera. + Fix history bug with Persistent QR enabled on Chrome. 2.37.0 - noface diff --git a/script.coffee b/script.coffee index 29f182e2d..8db247473 100644 --- a/script.coffee +++ b/script.coffee @@ -1840,7 +1840,7 @@ QR = @input.alt = count # For XTRM RICE. reload: (focus) -> # the "t" argument prevents the input from being focused - window.location = 'javascript:Recaptcha.reload("t")' + $.globalEval 'javascript:Recaptcha.reload("t")' # Focus if we meant to. QR.captcha.input.focus() if focus keydown: (e) -> From e326d923329560a56095dff29117dd50e0f4de47 Mon Sep 17 00:00:00 2001 From: noface Date: Thu, 13 Dec 2012 17:39:12 +0100 Subject: [PATCH 18/51] Anonymize on stubs. --- 4chan_x.user.js | 2 +- changelog | 2 ++ script.coffee | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 06b61ae35..fd8158dfe 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1204,7 +1204,7 @@ }); a = stub.firstChild; $.on(a, 'click', ReplyHiding.toggle); - $.add(a, $.tn($('.desktop > .nameBlock', el).textContent)); + $.add(a, $.tn(Conf['Anonymize'] ? 'Anonymize' : $('.desktop > .nameBlock', el).textContent)); if (Conf['Menu']) { menuButton = Menu.a.cloneNode(true); $.on(menuButton, 'click', Menu.toggle); diff --git a/changelog b/changelog index e8ac104b4..794d8c25f 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- noface + Fix Anonymize not working on stubs. - Mayhem Fix selection quoting on Opera. Fix history bug with Persistent QR enabled on Chrome. diff --git a/script.coffee b/script.coffee index 8db247473..b1af3ad96 100644 --- a/script.coffee +++ b/script.coffee @@ -954,7 +954,7 @@ ReplyHiding = innerHTML: '[ + ] ' a = stub.firstChild $.on a, 'click', ReplyHiding.toggle - $.add a, $.tn $('.desktop > .nameBlock', el).textContent + $.add a, $.tn if Conf['Anonymize'] then 'Anonymize' else $('.desktop > .nameBlock', el).textContent if Conf['Menu'] menuButton = Menu.a.cloneNode true $.on menuButton, 'click', Menu.toggle From d224b21f274233667f2867e9ee0e3b2147987063 Mon Sep 17 00:00:00 2001 From: noface Date: Thu, 13 Dec 2012 18:29:39 +0100 Subject: [PATCH 19/51] Oh god. --- 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 fd8158dfe..01df454a3 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1204,7 +1204,7 @@ }); a = stub.firstChild; $.on(a, 'click', ReplyHiding.toggle); - $.add(a, $.tn(Conf['Anonymize'] ? 'Anonymize' : $('.desktop > .nameBlock', el).textContent)); + $.add(a, $.tn(Conf['Anonymize'] ? 'Anonymous' : $('.desktop > .nameBlock', el).textContent)); if (Conf['Menu']) { menuButton = Menu.a.cloneNode(true); $.on(menuButton, 'click', Menu.toggle); diff --git a/script.coffee b/script.coffee index b1af3ad96..deec847fa 100644 --- a/script.coffee +++ b/script.coffee @@ -954,7 +954,7 @@ ReplyHiding = innerHTML: '[ + ] ' a = stub.firstChild $.on a, 'click', ReplyHiding.toggle - $.add a, $.tn if Conf['Anonymize'] then 'Anonymize' else $('.desktop > .nameBlock', el).textContent + $.add a, $.tn if Conf['Anonymize'] then 'Anonymous' else $('.desktop > .nameBlock', el).textContent if Conf['Menu'] menuButton = Menu.a.cloneNode true $.on menuButton, 'click', Menu.toggle From 5ffb6168cb9475c995790531ec6d5455b1c24d0d Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Fri, 14 Dec 2012 18:13:15 +0100 Subject: [PATCH 20/51] Fix warning. --- 4chan_x.user.js | 8 ++++---- changelog | 1 + script.coffee | 17 +++++++++-------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 06b61ae35..8675b5f67 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2609,13 +2609,13 @@ return QR.ajax = $.ajax($.id('postForm').parentNode.action, callbacks, opts); }, response: function(html) { - var bs, doc, err, msg, persona, postID, reply, threadID, _, _ref, _ref1; + var ban, board, doc, err, msg, persona, postID, reply, threadID, _, _ref, _ref1; doc = d.implementation.createHTMLDocument(''); doc.documentElement.innerHTML = html; - if (doc.title === '4chan - Banned') { - bs = $$('b', doc); + if (ban = $('.banType', doc)) { + board = $('.board', doc).innerHTML; err = $.el('span', { - innerHTML: /^You were issued a warning/.test($('.boxcontent', doc).textContent.trim()) ? "You were issued a warning on " + bs[0].innerHTML + " as " + bs[3].innerHTML + ".
Warning reason: " + bs[1].innerHTML : "You are banned! ;_;
Please click HERE to see the reason." + innerHTML: ban.textContent.toLowerCase() === 'banned' ? ("You are banned on " + board + "! ;_;
") + "Click here to see the reason." : ("You were issued a warning on " + board + " as " + ($('.nameBlock', doc).innerHTML) + ".
") + ("Reason: " + ($('.reason', doc).innerHTML)) }); } else if (err = doc.getElementById('errmsg')) { if ((_ref = $('a', err)) != null) { diff --git a/changelog b/changelog index e8ac104b4..f461f3f50 100644 --- a/changelog +++ b/changelog @@ -2,6 +2,7 @@ master - Mayhem Fix selection quoting on Opera. Fix history bug with Persistent QR enabled on Chrome. + Fix posting warning not displaying the reason. 2.37.0 - noface diff --git a/script.coffee b/script.coffee index 8db247473..405755095 100644 --- a/script.coffee +++ b/script.coffee @@ -2058,14 +2058,15 @@ QR = response: (html) -> doc = d.implementation.createHTMLDocument '' doc.documentElement.innerHTML = html - if doc.title is '4chan - Banned' # Ban/warn check - bs = $$ 'b', doc - err = $.el 'span', - innerHTML: - if /^You were issued a warning/.test $('.boxcontent', doc).textContent.trim() - "You were issued a warning on #{bs[0].innerHTML} as #{bs[3].innerHTML}.
Warning reason: #{bs[1].innerHTML}" - else - "You are banned! ;_;
Please click HERE to see the reason." + if ban = $ '.banType', doc # banned/warning + board = $('.board', doc).innerHTML + err = $.el 'span', innerHTML: + if ban.textContent.toLowerCase() is 'banned' + "You are banned on #{board}! ;_;
" + + "Click here to see the reason." + else + "You were issued a warning on #{board} as #{$('.nameBlock', doc).innerHTML}.
" + + "Reason: #{$('.reason', doc).innerHTML}" else if err = doc.getElementById 'errmsg' # error! $('a', err)?.target = '_blank' # duplicate image link else unless msg = $ 'b', doc From d155eed8d77294bece1823cd08a6cdc5a8ea7106 Mon Sep 17 00:00:00 2001 From: noface Date: Sat, 15 Dec 2012 11:08:14 +0100 Subject: [PATCH 21/51] Fix deadquotes showing up in code-tags. --- 4chan_x.user.js | 4 ++++ changelog | 1 + script.coffee | 5 +++++ 3 files changed, 10 insertions(+) diff --git a/4chan_x.user.js b/4chan_x.user.js index 8c622a4c0..14c34fd06 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -4316,6 +4316,10 @@ _ref = $$('.quote.deadlink', post.blockquote); for (_i = 0, _len = _ref.length; _i < _len; _i++) { deadlink = _ref[_i]; + if (deadlink.parentElement.className === 'prettyprint') { + $.replace(deadlink, deadlink.firstChild); + continue; + } quote = deadlink.textContent; a = $.el('a', { textContent: "" + quote + "\u00A0(Dead)" diff --git a/changelog b/changelog index 3139d6d31..3ffc20c2c 100644 --- a/changelog +++ b/changelog @@ -1,6 +1,7 @@ master - noface Fix Anonymize not working on stubs. + Fix deadquotes showing up in code-tags. - Mayhem Fix selection quoting on Opera. Fix history bug with Persistent QR enabled on Chrome. diff --git a/script.coffee b/script.coffee index 4f6e93a89..dea587a50 100644 --- a/script.coffee +++ b/script.coffee @@ -3526,6 +3526,11 @@ Quotify = node: (post) -> return if post.isInlined and not post.isCrosspost for deadlink in $$ '.quote.deadlink', post.blockquote + + if deadlink.parentElement.className is 'prettyprint' + $.replace deadlink, deadlink.firstChild + continue + quote = deadlink.textContent a = $.el 'a', # \u00A0 is nbsp From debd002aab2538e89f06d973a1b1945cd621195e Mon Sep 17 00:00:00 2001 From: noface Date: Sat, 15 Dec 2012 13:55:43 +0100 Subject: [PATCH 22/51] Corrections. --- 4chan_x.user.js | 4 ++-- changelog | 2 +- script.coffee | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 14c34fd06..63a31bb07 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -4316,8 +4316,8 @@ _ref = $$('.quote.deadlink', post.blockquote); for (_i = 0, _len = _ref.length; _i < _len; _i++) { deadlink = _ref[_i]; - if (deadlink.parentElement.className === 'prettyprint') { - $.replace(deadlink, deadlink.firstChild); + if (deadlink.parentNode.className === 'prettyprint') { + $.replace(deadlink, Array.prototype.slice.call(deadlink.childNodes)); continue; } quote = deadlink.textContent; diff --git a/changelog b/changelog index 3ffc20c2c..f093c26bb 100644 --- a/changelog +++ b/changelog @@ -1,11 +1,11 @@ master - noface Fix Anonymize not working on stubs. - Fix deadquotes showing up in code-tags. - Mayhem Fix selection quoting on Opera. Fix history bug with Persistent QR enabled on Chrome. Fix posting warning not displaying the reason. + Fix deadquotes showing up in code-tags. 2.37.0 - noface diff --git a/script.coffee b/script.coffee index dea587a50..aa0d8c912 100644 --- a/script.coffee +++ b/script.coffee @@ -3527,8 +3527,8 @@ Quotify = return if post.isInlined and not post.isCrosspost for deadlink in $$ '.quote.deadlink', post.blockquote - if deadlink.parentElement.className is 'prettyprint' - $.replace deadlink, deadlink.firstChild + if deadlink.parentNode.className is 'prettyprint' + $.replace deadlink, Array::slice.call deadlink.childNodes continue quote = deadlink.textContent From 763311f7dd88cb8b991ade45b5ffdc54203377be Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 15 Dec 2012 15:54:49 +0100 Subject: [PATCH 23/51] Add a / to foolfukka path redirection. That'll avoid reloading a page when clicking on `No.` to highlight a post. --- 4chan_x.user.js | 3 +++ script.coffee | 2 ++ 2 files changed, 5 insertions(+) diff --git a/4chan_x.user.js b/4chan_x.user.js index 63a31bb07..72ffc7796 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -4899,6 +4899,9 @@ postID = postID.match(/\d+/)[0]; } path = threadID ? "" + board + "/thread/" + threadID : "" + board + "/post/" + postID; + if (archiver === 'foolfuuka') { + path += '/'; + } if (threadID && postID) { path += archiver === 'foolfuuka' ? "#" + postID : "#p" + postID; } diff --git a/script.coffee b/script.coffee index aa0d8c912..3c2c86073 100644 --- a/script.coffee +++ b/script.coffee @@ -3988,6 +3988,8 @@ Redirect = "#{board}/thread/#{threadID}" else "#{board}/post/#{postID}" + if archiver is 'foolfuuka' + path += '/' if threadID and postID path += if archiver is 'foolfuuka' From 363ea695d7c08514fa7257281f59452913604a5f Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 16 Dec 2012 12:22:47 +0100 Subject: [PATCH 24/51] Don't scroll back when contracting an image if the image isn't partially visible. Close #859 --- 4chan_x.user.js | 28 +++++++++++++++------------- script.coffee | 15 +++++++++------ 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 72ffc7796..808f94e1a 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -5094,19 +5094,21 @@ thumb = a.firstChild; if (thumb.hidden) { rect = a.getBoundingClientRect(); - if ($.engine === 'webkit') { - if (rect.top < 0) { - d.body.scrollTop += rect.top - 42; - } - if (rect.left < 0) { - d.body.scrollLeft += rect.left; - } - } else { - if (rect.top < 0) { - d.documentElement.scrollTop += rect.top - 42; - } - if (rect.left < 0) { - d.documentElement.scrollLeft += rect.left; + if (rect.bottom > 0) { + if ($.engine === 'webkit') { + if (rect.top < 0) { + d.body.scrollTop += rect.top - 42; + } + if (rect.left < 0) { + d.body.scrollLeft += rect.left; + } + } else { + if (rect.top < 0) { + d.documentElement.scrollTop += rect.top - 42; + } + if (rect.left < 0) { + d.documentElement.scrollLeft += rect.left; + } } } return ImageExpand.contract(thumb); diff --git a/script.coffee b/script.coffee index 3c2c86073..a82e65cc7 100644 --- a/script.coffee +++ b/script.coffee @@ -4116,12 +4116,15 @@ ImageExpand = thumb = a.firstChild if thumb.hidden rect = a.getBoundingClientRect() - if $.engine is 'webkit' - d.body.scrollTop += rect.top - 42 if rect.top < 0 - d.body.scrollLeft += rect.left if rect.left < 0 - else - d.documentElement.scrollTop += rect.top - 42 if rect.top < 0 - d.documentElement.scrollLeft += rect.left if rect.left < 0 + if rect.bottom > 0 # should be at least partially visible. + # Scroll back to the thumbnail when contracting the image + # to avoid being left miles away from the relevant post. + if $.engine is 'webkit' + d.body.scrollTop += rect.top - 42 if rect.top < 0 + d.body.scrollLeft += rect.left if rect.left < 0 + else + d.documentElement.scrollTop += rect.top - 42 if rect.top < 0 + d.documentElement.scrollLeft += rect.left if rect.left < 0 ImageExpand.contract thumb else ImageExpand.expand thumb From 0b48315ee74e8394f5952112d399e2d96c45ae86 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 16 Dec 2012 12:25:44 +0100 Subject: [PATCH 25/51] Close #860. --- 4chan_x.user.js | 3 +++ script.coffee | 1 + 2 files changed, 4 insertions(+) diff --git a/4chan_x.user.js b/4chan_x.user.js index 808f94e1a..8058b60bb 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1633,6 +1633,9 @@ }, open: function(thread, tab) { var id, url; + if (g.REPLY) { + return; + } id = thread.id.slice(1); url = "//boards.4chan.org/" + g.BOARD + "/res/" + id; if (tab) { diff --git a/script.coffee b/script.coffee index a82e65cc7..d7d5b96bb 100644 --- a/script.coffee +++ b/script.coffee @@ -1256,6 +1256,7 @@ Keybinds = $('textarea', QR.el).focus() open: (thread, tab) -> + return if g.REPLY id = thread.id[1..] url = "//boards.4chan.org/#{g.BOARD}/res/#{id}" if tab From 2bc6d2fd04027a9143595e64af421cb94ecda908 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 16 Dec 2012 12:51:13 +0100 Subject: [PATCH 26/51] Fix #864 --- 4chan_x.user.js | 6 ++++-- script.coffee | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 8058b60bb..8030fba6c 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -4312,7 +4312,7 @@ return Main.callbacks.push(this.node); }, node: function(post) { - var a, board, deadlink, id, m, postBoard, quote, _i, _len, _ref; + var a, board, deadlink, id, m, postBoard, quote, _i, _len, _ref, _ref1; if (post.isInlined && !post.isCrosspost) { return; } @@ -4327,7 +4327,9 @@ a = $.el('a', { textContent: "" + quote + "\u00A0(Dead)" }); - id = quote.match(/\d+$/)[0]; + if (!(id = (_ref1 = quote.match(/\d+$/)) != null ? _ref1[0] : void 0)) { + continue; + } if (m = quote.match(/^>>>\/([a-z\d]+)/)) { board = m[1]; } else if (postBoard) { diff --git a/script.coffee b/script.coffee index d7d5b96bb..f240fa326 100644 --- a/script.coffee +++ b/script.coffee @@ -3537,7 +3537,7 @@ Quotify = # \u00A0 is nbsp textContent: "#{quote}\u00A0(Dead)" - id = quote.match(/\d+$/)[0] + continue unless id = quote.match(/\d+$/)?[0] if m = quote.match /^>>>\/([a-z\d]+)/ board = m[1] From 027af4ec50dd8750eebea1b0ac7d49414f81ea5f Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 18 Dec 2012 13:49:39 +0100 Subject: [PATCH 27/51] Release 2.37.1. --- 4chan_x.user.js | 8 ++++---- Cakefile | 2 +- changelog | 2 ++ latest.js | 2 +- script.coffee | 4 ++-- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 8030fba6c..478d3bf94 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan x -// @version 2.37.0 +// @version 2.37.1 // @namespace aeosynth // @description Adds various features. // @copyright 2009-2011 James Campos @@ -27,7 +27,7 @@ * Copyright (c) 2009-2011 James Campos * Copyright (c) 2012 Nicolas Stepien * http://mayhemydg.github.com/4chan-x/ - * 4chan X 2.37.0 + * 4chan X 2.37.1 * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -2630,7 +2630,7 @@ if (err) { if (/captcha|verification/i.test(err.textContent) || err === 'Connection error with sys.4chan.org.') { if (/mistyped/i.test(err.textContent)) { - err.textContent = 'Error: You seem to have mistyped the CAPTCHA.'; + err = 'Error: You seem to have mistyped the CAPTCHA.'; } QR.cooldown.auto = QR.captchaIsEnabled ? !!$.get('captchas', []).length : true; QR.cooldown.set({ @@ -5625,7 +5625,7 @@ return $.globalEval(("(" + code + ")()").replace('_id_', bq.id)); }, namespace: '4chan_x.', - version: '2.37.0', + version: '2.37.1', callbacks: [], css: '\ /* dialog styling */\ diff --git a/Cakefile b/Cakefile index fd4299ed2..879b1caa0 100644 --- a/Cakefile +++ b/Cakefile @@ -2,7 +2,7 @@ {exec} = require 'child_process' fs = require 'fs' -VERSION = '2.37.0' +VERSION = '2.37.1' HEADER = """ // ==UserScript== diff --git a/changelog b/changelog index f093c26bb..0d7755904 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master + +2.37.1 - noface Fix Anonymize not working on stubs. - Mayhem diff --git a/latest.js b/latest.js index 261d781cd..c71e44f35 100644 --- a/latest.js +++ b/latest.js @@ -1 +1 @@ -postMessage({version:'2.37.0'},'*') \ No newline at end of file +postMessage({version:'2.37.1'},'*') \ No newline at end of file diff --git a/script.coffee b/script.coffee index f240fa326..c8446097a 100644 --- a/script.coffee +++ b/script.coffee @@ -2077,7 +2077,7 @@ QR = if /captcha|verification/i.test(err.textContent) or err is 'Connection error with sys.4chan.org.' # Remove the obnoxious 4chan Pass ad. if /mistyped/i.test err.textContent - err.textContent = 'Error: You seem to have mistyped the CAPTCHA.' + err = 'Error: You seem to have mistyped the CAPTCHA.' # Enable auto-post if we have some cached captchas. QR.cooldown.auto = if QR.captchaIsEnabled @@ -4529,7 +4529,7 @@ Main = $.globalEval "(#{code})()".replace '_id_', bq.id namespace: '4chan_x.' - version: '2.37.0' + version: '2.37.1' callbacks: [] css: ' /* dialog styling */ From c32b6dba59fce423bd0f6b0cc8ade7d565cc9b9b Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 18 Dec 2012 15:54:24 +0100 Subject: [PATCH 28/51] Tiny greentext fix. --- 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 478d3bf94..5df7d0c89 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3752,7 +3752,7 @@ return ''; } }); - comment = bq.innerHTML.replace(/(^|>)(>[^<$]+)(<|$)/g, '$1$2$3'); + comment = bq.innerHTML.replace(/(^|>)(>[^<$]*)(<|$)/g, '$1$2$3'); o = { postID: postID, threadID: data.thread_num, diff --git a/script.coffee b/script.coffee index c8446097a..7e895ec15 100644 --- a/script.coffee +++ b/script.coffee @@ -2976,7 +2976,7 @@ Get = when '[/banned]' '' # greentext - comment = bq.innerHTML.replace /(^|>)(>[^<$]+)(<|$)/g, '$1$2$3' + comment = bq.innerHTML.replace /(^|>)(>[^<$]*)(<|$)/g, '$1$2$3' o = # id From a5a5f297e41039b175bf2c589e089b003dcaee39 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 18 Dec 2012 16:11:15 +0100 Subject: [PATCH 29/51] Close #858 --- 4chan_x.user.js | 8 ++++---- script.coffee | 14 +++++++++----- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 5df7d0c89..9c28ba84a 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1834,7 +1834,7 @@ $.add(el, err); } QR.open(); - if (QR.captchaIsEnabled && /captcha|verification/i.test(el.textContent)) { + if (QR.captcha.isEnabled && /captcha|verification/i.test(el.textContent)) { $('[autocomplete]', QR.el).focus(); } if (d.hidden || d.oHidden || d.mozHidden || d.webkitHidden) { @@ -2286,7 +2286,7 @@ if (-1 !== d.cookie.indexOf('pass_enabled=')) { return; } - if (!(QR.captchaIsEnabled = !!$.id('captchaFormPart'))) { + if (!(this.isEnabled = !!$.id('captchaFormPart'))) { return; } if ($.id('recaptcha_challenge_field_holder')) { @@ -2523,7 +2523,7 @@ } else if (!(reply.com || reply.file)) { err = 'No file selected.'; } - if (QR.captchaIsEnabled && !err) { + if (QR.captcha.isEnabled && !err) { captchas = $.get('captchas', []); while ((captcha = captchas[0]) && captcha.time < Date.now()) { captchas.shift(); @@ -2632,7 +2632,7 @@ if (/mistyped/i.test(err.textContent)) { err = 'Error: You seem to have mistyped the CAPTCHA.'; } - QR.cooldown.auto = QR.captchaIsEnabled ? !!$.get('captchas', []).length : true; + QR.cooldown.auto = QR.captcha.isEnabled ? !!$.get('captchas', []).length : err === 'Connection error with sys.4chan.org.' ? true : false; QR.cooldown.set({ delay: 2 }); diff --git a/script.coffee b/script.coffee index 7e895ec15..af0fecb9a 100644 --- a/script.coffee +++ b/script.coffee @@ -1416,7 +1416,7 @@ QR = el.innerHTML = null $.add el, err QR.open() - if QR.captchaIsEnabled and /captcha|verification/i.test el.textContent + if QR.captcha.isEnabled and /captcha|verification/i.test el.textContent # Focus the captcha input on captcha error. $('[autocomplete]', QR.el).focus() alert el.textContent if d.hidden or d.oHidden or d.mozHidden or d.webkitHidden @@ -1780,7 +1780,7 @@ QR = captcha: init: -> return if -1 isnt d.cookie.indexOf 'pass_enabled=' - return unless QR.captchaIsEnabled = !!$.id 'captchaFormPart' + return unless @isEnabled = !!$.id 'captchaFormPart' if $.id 'recaptcha_challenge_field_holder' @ready() else @@ -1975,7 +1975,7 @@ QR = else unless reply.com or reply.file err = 'No file selected.' - if QR.captchaIsEnabled and !err + if QR.captcha.isEnabled and !err # get oldest valid captcha captchas = $.get 'captchas', [] # remove old captchas @@ -2080,10 +2080,14 @@ QR = err = 'Error: You seem to have mistyped the CAPTCHA.' # Enable auto-post if we have some cached captchas. QR.cooldown.auto = - if QR.captchaIsEnabled + if QR.captcha.isEnabled !!$.get('captchas', []).length - else + else if err is 'Connection error with sys.4chan.org.' true + else + # Something must've gone terribly wrong if you get captcha errors without captchas. + # Don't auto-post indefinitely in that case. + false # Too many frequent mistyped captchas will auto-ban you! # On connection error, the post most likely didn't go through. QR.cooldown.set delay: 2 From 1e88e5b08ef398c80cb4cc5cc1767138e80b3ee1 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 18 Dec 2012 16:14:38 +0100 Subject: [PATCH 30/51] Close #813 --- 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 9c28ba84a..dcec5987c 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3770,7 +3770,7 @@ })(), tripcode: data.trip, uniqueID: data.poster_hash, - email: data.email ? encodeURIComponent(data.email) : '', + email: data.email ? encodeURI(data.email) : '', subject: data.title_processed, flagCode: data.poster_country, flagName: data.poster_country_name_processed, @@ -3870,7 +3870,7 @@ capcode: data.capcode, tripcode: data.trip, uniqueID: data.id, - email: data.email ? encodeURIComponent(data.email.replace(/"/g, '"')) : '', + email: data.email ? encodeURI(data.email.replace(/"/g, '"')) : '', subject: data.sub, flagCode: data.country, flagName: data.country_name, diff --git a/script.coffee b/script.coffee index af0fecb9a..d6ce4e6b2 100644 --- a/script.coffee +++ b/script.coffee @@ -2995,7 +2995,7 @@ Get = when 'D' then 'developer' tripcode: data.trip uniqueID: data.poster_hash - email: if data.email then encodeURIComponent data.email else '' + email: if data.email then encodeURI data.email else '' subject: data.title_processed flagCode: data.poster_country flagName: data.poster_country_name_processed @@ -3076,7 +3076,7 @@ Build = capcode: data.capcode tripcode: data.trip uniqueID: data.id - email: if data.email then encodeURIComponent data.email.replace /"/g, '"' else '' + email: if data.email then encodeURI data.email.replace /"/g, '"' else '' subject: data.sub flagCode: data.country flagName: data.country_name From fe18eca332a10db3df18f33c6299b822aba01351 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 19 Dec 2012 13:54:37 +0100 Subject: [PATCH 31/51] Opera is getting better. Slowly. --- 4chan_x.user.js | 28 ++++------------------------ script.coffee | 21 ++++----------------- 2 files changed, 8 insertions(+), 41 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index dcec5987c..43bb9b55d 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2070,27 +2070,7 @@ return QR.resetFileInput(); }, resetFileInput: function() { - var clone, input; - input = $('[type=file]', QR.el); - input.value = null; - if ($.engine !== 'presto') { - return; - } - clone = $.el('input', { - type: 'file', - accept: input.accept, - max: input.max, - multiple: input.multiple, - size: input.size, - title: input.title - }); - $.on(clone, 'change', QR.fileInput); - $.on(clone, 'click', function(e) { - if (e.shiftKey) { - return QR.selected.rmFile() || e.preventDefault(); - } - }); - return $.replace(input, clone); + return $('[type=file]', QR.el).value = null; }, replies: [], reply: (function() { @@ -2150,10 +2130,10 @@ this.el.style.backgroundImage = null; return; } - url = window.URL || window.webkitURL; - if (typeof url.revokeObjectURL === "function") { - url.revokeObjectURL(this.url); + if (!(url = window.URL || window.webkitURL)) { + return; } + url.revokeObjectURL(this.url); fileUrl = url.createObjectURL(file); img = $.el('img'); $.on(img, 'load', function() { diff --git a/script.coffee b/script.coffee index d6ce4e6b2..4bda85f94 100644 --- a/script.coffee +++ b/script.coffee @@ -1623,20 +1623,7 @@ QR = $.addClass QR.el, 'dump' QR.resetFileInput() # reset input resetFileInput: -> - input = $ '[type=file]', QR.el - input.value = null - return unless $.engine is 'presto' - # XXX Opera needs extra care to reset its file input's value - clone = $.el 'input', - type: 'file' - accept: input.accept - max: input.max - multiple: input.multiple - size: input.size - title: input.title - $.on clone, 'change', QR.fileInput - $.on clone, 'click', (e) -> if e.shiftKey then QR.selected.rmFile() or e.preventDefault() - $.replace input, clone + $('[type=file]', QR.el).value = null replies: [] reply: class @@ -1680,9 +1667,9 @@ QR = unless /^image/.test file.type @el.style.backgroundImage = null return - url = window.URL or window.webkitURL - # XXX Opera does not support window.URL.revokeObjectURL - url.revokeObjectURL? @url + # XXX Opera does not support window.URL + return unless url = window.URL or window.webkitURL + url.revokeObjectURL @url # Create a redimensioned thumbnail. fileUrl = url.createObjectURL file From 19291a1771ce42a230cadc829a59478ada9d0076 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 19 Dec 2012 14:18:07 +0100 Subject: [PATCH 32/51] Fix issue mentioned in #834 --- 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 43bb9b55d..18ea61cd5 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1067,7 +1067,7 @@ sync: function() { var hiddenThreads, hiddenThreadsCatalog, id; hiddenThreads = $.get("hiddenThreads/" + g.BOARD + "/", {}); - hiddenThreadsCatalog = JSON.parse(localStorage.getItem("4chan-hide-t-" + g.BOARD)); + hiddenThreadsCatalog = JSON.parse(localStorage.getItem("4chan-hide-t-" + g.BOARD)) || {}; if (g.CATALOG) { for (id in hiddenThreads) { hiddenThreadsCatalog[id] = true; diff --git a/script.coffee b/script.coffee index 4bda85f94..5a49378a0 100644 --- a/script.coffee +++ b/script.coffee @@ -850,7 +850,7 @@ ThreadHiding = sync: -> hiddenThreads = $.get "hiddenThreads/#{g.BOARD}/", {} - hiddenThreadsCatalog = JSON.parse localStorage.getItem "4chan-hide-t-#{g.BOARD}" + hiddenThreadsCatalog = JSON.parse(localStorage.getItem "4chan-hide-t-#{g.BOARD}") or {} if g.CATALOG for id of hiddenThreads hiddenThreadsCatalog[id] = true From 3ae93486f2591e4746b8fe2d0dc6f24c94f30d0c Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 19 Dec 2012 14:23:04 +0100 Subject: [PATCH 33/51] Change sage cooldown to 60s on /q/. See #856 --- 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 18ea61cd5..c50954f23 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1880,7 +1880,7 @@ return 300; } })(), - sage: g.BOARD === 'q' ? 600 : 60, + sage: 60, file: g.BOARD === 'q' ? 300 : 30, post: g.BOARD === 'q' ? 60 : 30 }; diff --git a/script.coffee b/script.coffee index 5a49378a0..d7a1e78c2 100644 --- a/script.coffee +++ b/script.coffee @@ -1446,7 +1446,7 @@ QR = when 'q' then 86400 when 'b', 'soc', 'r9k' then 600 else 300 - sage: if g.BOARD is 'q' then 600 else 60 + sage: 60 file: if g.BOARD is 'q' then 300 else 30 post: if g.BOARD is 'q' then 60 else 30 QR.cooldown.cooldowns = $.get "#{g.BOARD}.cooldown", {} From 9bccd621481b4e9908517d3b3d46d3fa9f40495d Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Fri, 21 Dec 2012 19:57:45 +0100 Subject: [PATCH 34/51] Revert "Change sage cooldown to 60s on /q/. See #856" This reverts commit 3ae93486f2591e4746b8fe2d0dc6f24c94f30d0c. --- 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 c50954f23..18ea61cd5 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1880,7 +1880,7 @@ return 300; } })(), - sage: 60, + sage: g.BOARD === 'q' ? 600 : 60, file: g.BOARD === 'q' ? 300 : 30, post: g.BOARD === 'q' ? 60 : 30 }; diff --git a/script.coffee b/script.coffee index d7a1e78c2..5a49378a0 100644 --- a/script.coffee +++ b/script.coffee @@ -1446,7 +1446,7 @@ QR = when 'q' then 86400 when 'b', 'soc', 'r9k' then 600 else 300 - sage: 60 + sage: if g.BOARD is 'q' then 600 else 60 file: if g.BOARD is 'q' then 300 else 30 post: if g.BOARD is 'q' then 60 else 30 QR.cooldown.cooldowns = $.get "#{g.BOARD}.cooldown", {} From 85dd58d1d20ce0f46883dbce8bb9a5de8a8e10ac Mon Sep 17 00:00:00 2001 From: James Campos Date: Mon, 31 Dec 2012 01:55:00 -0800 Subject: [PATCH 35/51] $.hidden --- 4chan_x.user.js | 13 +++++++------ script.coffee | 11 ++++++----- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 18ea61cd5..55dfbbe6e 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -514,6 +514,9 @@ } size = unit > 1 ? Math.round(size * 100) / 100 : Math.round(size); return "" + size + " " + ['B', 'KB', 'MB', 'GB'][unit]; + }, + hidden: function() { + return d.hidden || d.oHidden || d.mozHidden || d.webkitHidden; } }); @@ -1837,7 +1840,7 @@ if (QR.captcha.isEnabled && /captcha|verification/i.test(el.textContent)) { $('[autocomplete]', QR.el).focus(); } - if (d.hidden || d.oHidden || d.mozHidden || d.webkitHidden) { + if ($.hidden()) { return alert(el.textContent); } }, @@ -3040,9 +3043,7 @@ return setTimeout(Updater.update, 500); }, visibility: function() { - var state; - state = d.visibilityState || d.oVisibilityState || d.mozVisibilityState || d.webkitVisibilityState; - if (state !== 'visible') { + if ($.hidden()) { return; } Updater.unsuccessfulFetchCount = 0; @@ -3078,7 +3079,7 @@ return Updater.scrollBG = this.checked ? function() { return true; } : function() { - return !(d.hidden || d.oHidden || d.mozHidden || d.webkitHidden); + return !$.hidden(); }; }, load: function() { @@ -3174,7 +3175,7 @@ var i, j; i = +Conf['Interval']; j = Math.min(this.unsuccessfulFetchCount, 9); - if (!(d.hidden || d.oHidden || d.mozHidden || d.webkitHidden)) { + if (!$.hidden()) { j = Math.min(j, 6); } return Math.max(i, [5, 10, 15, 20, 30, 60, 90, 120, 240, 300][j]); diff --git a/script.coffee b/script.coffee index 5a49378a0..f098cd9c6 100644 --- a/script.coffee +++ b/script.coffee @@ -396,6 +396,8 @@ $.extend $, # Round to an integer otherwise. Math.round size "#{size} #{['B', 'KB', 'MB', 'GB'][unit]}" + hidden: -> + d.hidden or d.oHidden or d.mozHidden or d.webkitHidden $.cache.requests = {} @@ -1419,7 +1421,7 @@ QR = if QR.captcha.isEnabled and /captcha|verification/i.test el.textContent # Focus the captcha input on captcha error. $('[autocomplete]', QR.el).focus() - alert el.textContent if d.hidden or d.oHidden or d.mozHidden or d.webkitHidden + alert el.textContent if $.hidden() cleanError: -> $('.warning', QR.el).textContent = null @@ -2463,8 +2465,7 @@ Updater = Updater.unsuccessfulFetchCount = 0 setTimeout Updater.update, 500 visibility: -> - state = d.visibilityState or d.oVisibilityState or d.mozVisibilityState or d.webkitVisibilityState - return if state isnt 'visible' + return if $.hidden() # Reset the counter when we focus this tab. Updater.unsuccessfulFetchCount = 0 if Updater.timer.textContent < -Conf['Interval'] @@ -2492,7 +2493,7 @@ Updater = if @checked -> true else - -> !(d.hidden or d.oHidden or d.mozHidden or d.webkitHidden) + -> ! $.hidden() load: -> switch @status when 404 @@ -2570,7 +2571,7 @@ Updater = getInterval: -> i = +Conf['Interval'] j = Math.min @unsuccessfulFetchCount, 9 - unless d.hidden or d.oHidden or d.mozHidden or d.webkitHidden + unless $.hidden() # Don't increase the refresh rate too much on visible tabs. j = Math.min j, 6 Math.max i, [5, 10, 15, 20, 30, 60, 90, 120, 240, 300][j] From 4cd5fd49c1889a9ffb9f6a9a7b5e8a64bc7dea89 Mon Sep 17 00:00:00 2001 From: James Campos Date: Mon, 31 Dec 2012 19:42:28 -0800 Subject: [PATCH 36/51] style: no `.` in 1 sentence descriptions --- 4chan_x.user.js | 34 +++++++++++++++++----------------- script.coffee | 34 +++++++++++++++++----------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 55dfbbe6e..6e14267fa 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -86,8 +86,8 @@ Config = { main: { Enhancing: { - 'Disable 4chan\'s extension': [true, 'Avoid conflicts between 4chan X and 4chan\'s inline extension.'], - 'Catalog Links': [true, 'Turn Navigation links into links to each board\'s catalog.'], + 'Disable 4chan\'s extension': [true, 'Avoid conflicts between 4chan X and 4chan\'s inline extension'], + 'Catalog Links': [true, 'Turn Navigation links into links to each board\'s catalog'], '404 Redirect': [true, 'Redirect dead threads and images'], 'Keybinds': [true, 'Binds actions to keys'], 'Time Formatting': [true, 'Arbitrarily formatted timestamps, using your local time'], @@ -112,14 +112,14 @@ 'Image Hover': [false, 'Show full image on mouseover'], 'Sauce': [true, 'Add sauce to images'], 'Reveal Spoilers': [false, 'Replace spoiler thumbnails by the original thumbnail'], - 'Expand From Current': [false, 'Expand images from current position to thread end.'] + 'Expand From Current': [false, 'Expand images from current position to thread end'] }, Menu: { - 'Menu': [true, 'Add a drop-down menu in posts.'], - 'Report Link': [true, 'Add a report link to the menu.'], - 'Delete Link': [true, 'Add post and image deletion links to the menu.'], - 'Download Link': [true, 'Add a download with original filename link to the menu. Chrome-only currently.'], - 'Archive Link': [true, 'Add an archive link to the menu.'] + 'Menu': [true, 'Add a drop-down menu in posts'], + 'Report Link': [true, 'Add a report link to the menu'], + 'Delete Link': [true, 'Add post and image deletion links to the menu'], + 'Download Link': [true, 'Add a download with original filename link to the menu (Chrome only)'], + 'Archive Link': [true, 'Add an archive link to the menu'] }, Monitoring: { 'Thread Updater': [true, 'Update threads. Has more options in its own dialog.'], @@ -132,15 +132,15 @@ 'Auto Watch Reply': [false, 'Automatically watch threads that you reply to'] }, Posting: { - 'Quick Reply': [true, 'Reply without leaving the page.'], - 'Cooldown': [true, 'Prevent "flood detected" errors.'], - 'Persistent QR': [false, 'The Quick reply won\'t disappear after posting.'], - 'Auto Hide QR': [true, 'Automatically hide the quick reply when posting.'], - 'Open Reply in New Tab': [false, 'Open replies in a new tab that are made from the main board.'], - 'Remember QR size': [false, 'Remember the size of the Quick reply (Firefox only).'], - 'Remember Subject': [false, 'Remember the subject field, instead of resetting after posting.'], - 'Remember Spoiler': [false, 'Remember the spoiler state, instead of resetting after posting.'], - 'Hide Original Post Form': [true, 'Replace the normal post form with a shortcut to open the QR.'] + 'Quick Reply': [true, 'Reply without leaving the page'], + 'Cooldown': [true, 'Prevent "flood detected" errors'], + 'Persistent QR': [false, 'The Quick reply won\'t disappear after posting'], + 'Auto Hide QR': [true, 'Automatically hide the quick reply when posting'], + 'Open Reply in New Tab': [false, 'Open replies in a new tab that are made from the main board'], + 'Remember QR size': [false, 'Remember the size of the Quick reply (Firefox only)'], + 'Remember Subject': [false, 'Remember the subject field, instead of resetting after posting'], + 'Remember Spoiler': [false, 'Remember the spoiler state, instead of resetting after posting'], + 'Hide Original Post Form': [true, 'Replace the normal post form with a shortcut to open the QR'] }, Quoting: { 'Quote Backlinks': [true, 'Add quote backlinks'], diff --git a/script.coffee b/script.coffee index f098cd9c6..9c485a45b 100644 --- a/script.coffee +++ b/script.coffee @@ -1,8 +1,8 @@ Config = main: Enhancing: - 'Disable 4chan\'s extension': [true, 'Avoid conflicts between 4chan X and 4chan\'s inline extension.'] - 'Catalog Links': [true, 'Turn Navigation links into links to each board\'s catalog.'] + 'Disable 4chan\'s extension': [true, 'Avoid conflicts between 4chan X and 4chan\'s inline extension'] + 'Catalog Links': [true, 'Turn Navigation links into links to each board\'s catalog'] '404 Redirect': [true, 'Redirect dead threads and images'] 'Keybinds': [true, 'Binds actions to keys'] 'Time Formatting': [true, 'Arbitrarily formatted timestamps, using your local time'] @@ -25,13 +25,13 @@ Config = 'Image Hover': [false, 'Show full image on mouseover'] 'Sauce': [true, 'Add sauce to images'] 'Reveal Spoilers': [false, 'Replace spoiler thumbnails by the original thumbnail'] - 'Expand From Current': [false, 'Expand images from current position to thread end.'] + 'Expand From Current': [false, 'Expand images from current position to thread end'] Menu: - 'Menu': [true, 'Add a drop-down menu in posts.'] - 'Report Link': [true, 'Add a report link to the menu.'] - 'Delete Link': [true, 'Add post and image deletion links to the menu.'] - 'Download Link': [true, 'Add a download with original filename link to the menu. Chrome-only currently.'] - 'Archive Link': [true, 'Add an archive link to the menu.'] + 'Menu': [true, 'Add a drop-down menu in posts'] + 'Report Link': [true, 'Add a report link to the menu'] + 'Delete Link': [true, 'Add post and image deletion links to the menu'] + 'Download Link': [true, 'Add a download with original filename link to the menu (Chrome only)'] + 'Archive Link': [true, 'Add an archive link to the menu'] Monitoring: 'Thread Updater': [true, 'Update threads. Has more options in its own dialog.'] 'Unread Count': [true, 'Show unread post count in tab title'] @@ -42,15 +42,15 @@ Config = 'Auto Watch': [true, 'Automatically watch threads that you start'] 'Auto Watch Reply': [false, 'Automatically watch threads that you reply to'] Posting: - 'Quick Reply': [true, 'Reply without leaving the page.'] - 'Cooldown': [true, 'Prevent "flood detected" errors.'] - 'Persistent QR': [false, 'The Quick reply won\'t disappear after posting.'] - 'Auto Hide QR': [true, 'Automatically hide the quick reply when posting.'] - 'Open Reply in New Tab': [false, 'Open replies in a new tab that are made from the main board.'] - 'Remember QR size': [false, 'Remember the size of the Quick reply (Firefox only).'] - 'Remember Subject': [false, 'Remember the subject field, instead of resetting after posting.'] - 'Remember Spoiler': [false, 'Remember the spoiler state, instead of resetting after posting.'] - 'Hide Original Post Form': [true, 'Replace the normal post form with a shortcut to open the QR.'] + 'Quick Reply': [true, 'Reply without leaving the page'] + 'Cooldown': [true, 'Prevent "flood detected" errors'] + 'Persistent QR': [false, 'The Quick reply won\'t disappear after posting'] + 'Auto Hide QR': [true, 'Automatically hide the quick reply when posting'] + 'Open Reply in New Tab': [false, 'Open replies in a new tab that are made from the main board'] + 'Remember QR size': [false, 'Remember the size of the Quick reply (Firefox only)'] + 'Remember Subject': [false, 'Remember the subject field, instead of resetting after posting'] + 'Remember Spoiler': [false, 'Remember the spoiler state, instead of resetting after posting'] + 'Hide Original Post Form': [true, 'Replace the normal post form with a shortcut to open the QR'] Quoting: 'Quote Backlinks': [true, 'Add quote backlinks'] 'OP Backlinks': [false, 'Add backlinks to the OP'] From e822ca45fafa02d57a91680f875c095de28950a1 Mon Sep 17 00:00:00 2001 From: James Campos Date: Mon, 31 Dec 2012 01:00:55 -0800 Subject: [PATCH 37/51] beep --- 4chan_x.user.js | 9 ++++++++- script.coffee | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 6e14267fa..d02b239c7 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -129,7 +129,8 @@ 'Thread Stats': [true, 'Display reply and image count'], 'Thread Watcher': [true, 'Bookmark threads'], 'Auto Watch': [true, 'Automatically watch threads that you start'], - 'Auto Watch Reply': [false, 'Automatically watch threads that you reply to'] + 'Auto Watch Reply': [false, 'Automatically watch threads that you reply to'], + 'Beep': [false, 'Beep, beep, motherfucker'] }, Posting: { 'Quick Reply': [true, 'Reply without leaving the page'], @@ -3034,6 +3035,9 @@ $.on(d, 'QRPostSuccessful', this.cb.post); return $.on(d, 'visibilitychange ovisibilitychange mozvisibilitychange webkitvisibilitychange', this.cb.visibility); }, + audio: $.el('audio', { + src: 'data:audio/wav;base64,UklGRjQDAABXQVZFZm10IBAAAAABAAEAgD4AAIA+AAABAAgAc21wbDwAAABBAAADAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABkYXRhzAIAAGMms8em0tleMV4zIpLVo8nhfSlcPR102Ki+5JspVEkdVtKzs+K1NEhUIT7DwKrcy0g6WygsrM2k1NpiLl0zIY/WpMrjgCdbPhxw2Kq+5Z4qUkkdU9K1s+K5NkVTITzBwqnczko3WikrqM+l1NxlLF0zIIvXpsnjgydZPhxs2ay95aIrUEkdUdC3suK8N0NUIjq+xKrcz002WioppdGm091pK1w0IIjYp8jkhydXPxxq2K295aUrTkoeTs65suK+OUFUIzi7xqrb0VA0WSoootKm0t5tKlo1H4TYqMfkiydWQBxm16+85actTEseS8y7seHAPD9TIza5yKra01QyWSson9On0d5wKVk2H4DYqcfkjidUQB1j1rG75KsvSkseScu8seDCPz1TJDW2yara1FYxWSwnm9Sn0N9zKVg2H33ZqsXkkihSQR1g1bK65K0wSEsfR8i+seDEQTxUJTOzy6rY1VowWC0mmNWoz993KVc3H3rYq8TklSlRQh1d1LS647AyR0wgRMbAsN/GRDpTJTKwzKrX1l4vVy4lldWpzt97KVY4IXbUr8LZljVPRCxhw7W3z6ZISkw1VK+4sMWvXEhSPk6buay9sm5JVkZNiLWqtrJ+TldNTnquqbCwilZXU1BwpKirrpNgWFhTaZmnpquZbFlbVmWOpaOonHZcXlljhaGhpZ1+YWBdYn2cn6GdhmdhYGN3lp2enIttY2Jjco+bnJuOdGZlZXCImJqakHpoZ2Zug5WYmZJ/bGlobX6RlpeSg3BqaW16jZSVkoZ0bGtteImSk5KIeG5tbnaFkJKRinxxbm91gY2QkIt/c3BwdH6Kj4+LgnZxcXR8iI2OjIR5c3J0e4WLjYuFe3VzdHmCioyLhn52dHR5gIiKioeAeHV1eH+GiYqHgXp2dnh9hIiJh4J8eHd4fIKHiIeDfXl4eHyBhoeHhH96eHmA' + }), cb: { post: function() { if (!Conf['Auto Update This']) { @@ -3150,6 +3154,9 @@ Updater.count.className = count ? 'new' : null; } if (count) { + if (Conf['Beep'] && (d.hidden || d.oHidden || d.mozHidden || d.webkitHidden) && (Unread.replies.length === 0)) { + Updater.audio.play(); + } Updater.unsuccessfulFetchCount = 0; } else { Updater.unsuccessfulFetchCount++; diff --git a/script.coffee b/script.coffee index 9c485a45b..504de7730 100644 --- a/script.coffee +++ b/script.coffee @@ -41,6 +41,7 @@ Config = 'Thread Watcher': [true, 'Bookmark threads'] 'Auto Watch': [true, 'Automatically watch threads that you start'] 'Auto Watch Reply': [false, 'Automatically watch threads that you reply to'] + 'Beep': [false, 'Beep, beep, motherfucker'] Posting: 'Quick Reply': [true, 'Reply without leaving the page'] 'Cooldown': [true, 'Prevent "flood detected" errors'] @@ -2459,6 +2460,8 @@ Updater = $.on d, 'QRPostSuccessful', @cb.post $.on d, 'visibilitychange ovisibilitychange mozvisibilitychange webkitvisibilitychange', @cb.visibility + audio: $.el('audio', src: 'data:audio/wav;base64,UklGRjQDAABXQVZFZm10IBAAAAABAAEAgD4AAIA+AAABAAgAc21wbDwAAABBAAADAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABkYXRhzAIAAGMms8em0tleMV4zIpLVo8nhfSlcPR102Ki+5JspVEkdVtKzs+K1NEhUIT7DwKrcy0g6WygsrM2k1NpiLl0zIY/WpMrjgCdbPhxw2Kq+5Z4qUkkdU9K1s+K5NkVTITzBwqnczko3WikrqM+l1NxlLF0zIIvXpsnjgydZPhxs2ay95aIrUEkdUdC3suK8N0NUIjq+xKrcz002WioppdGm091pK1w0IIjYp8jkhydXPxxq2K295aUrTkoeTs65suK+OUFUIzi7xqrb0VA0WSoootKm0t5tKlo1H4TYqMfkiydWQBxm16+85actTEseS8y7seHAPD9TIza5yKra01QyWSson9On0d5wKVk2H4DYqcfkjidUQB1j1rG75KsvSkseScu8seDCPz1TJDW2yara1FYxWSwnm9Sn0N9zKVg2H33ZqsXkkihSQR1g1bK65K0wSEsfR8i+seDEQTxUJTOzy6rY1VowWC0mmNWoz993KVc3H3rYq8TklSlRQh1d1LS647AyR0wgRMbAsN/GRDpTJTKwzKrX1l4vVy4lldWpzt97KVY4IXbUr8LZljVPRCxhw7W3z6ZISkw1VK+4sMWvXEhSPk6buay9sm5JVkZNiLWqtrJ+TldNTnquqbCwilZXU1BwpKirrpNgWFhTaZmnpquZbFlbVmWOpaOonHZcXlljhaGhpZ1+YWBdYn2cn6GdhmdhYGN3lp2enIttY2Jjco+bnJuOdGZlZXCImJqakHpoZ2Zug5WYmZJ/bGlobX6RlpeSg3BqaW16jZSVkoZ0bGtteImSk5KIeG5tbnaFkJKRinxxbm91gY2QkIt/c3BwdH6Kj4+LgnZxcXR8iI2OjIR5c3J0e4WLjYuFe3VzdHmCioyLhn52dHR5gIiKioeAeHV1eH+GiYqHgXp2dnh9hIiJh4J8eHd4fIKHiIeDfXl4eHyBhoeHhH96eHmA') + cb: post: -> return unless Conf['Auto Update This'] @@ -2548,6 +2551,8 @@ Updater = Updater.count.className = if count then 'new' else null if count + if Conf['Beep'] and (d.hidden or d.oHidden or d.mozHidden or d.webkitHidden) and (Unread.replies.length is 0) + Updater.audio.play() Updater.unsuccessfulFetchCount = 0 else Updater.unsuccessfulFetchCount++ From bc8055acb521740fc4230798c785e87704433413 Mon Sep 17 00:00:00 2001 From: James Campos Date: Mon, 31 Dec 2012 01:08:48 -0800 Subject: [PATCH 38/51] admin --- changelog | 2 ++ script.coffee | 2 ++ 2 files changed, 4 insertions(+) diff --git a/changelog b/changelog index 0d7755904..62cd3a000 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- aeosynth + Beep, beep, motherfucker 2.37.1 - noface diff --git a/script.coffee b/script.coffee index 504de7730..a2816f98c 100644 --- a/script.coffee +++ b/script.coffee @@ -2460,6 +2460,8 @@ Updater = $.on d, 'QRPostSuccessful', @cb.post $.on d, 'visibilitychange ovisibilitychange mozvisibilitychange webkitvisibilitychange', @cb.visibility + # http://freesound.org/people/pierrecartoons1979/sounds/90112/ + # cc-by-nc-3.0 audio: $.el('audio', src: 'data:audio/wav;base64,UklGRjQDAABXQVZFZm10IBAAAAABAAEAgD4AAIA+AAABAAgAc21wbDwAAABBAAADAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABkYXRhzAIAAGMms8em0tleMV4zIpLVo8nhfSlcPR102Ki+5JspVEkdVtKzs+K1NEhUIT7DwKrcy0g6WygsrM2k1NpiLl0zIY/WpMrjgCdbPhxw2Kq+5Z4qUkkdU9K1s+K5NkVTITzBwqnczko3WikrqM+l1NxlLF0zIIvXpsnjgydZPhxs2ay95aIrUEkdUdC3suK8N0NUIjq+xKrcz002WioppdGm091pK1w0IIjYp8jkhydXPxxq2K295aUrTkoeTs65suK+OUFUIzi7xqrb0VA0WSoootKm0t5tKlo1H4TYqMfkiydWQBxm16+85actTEseS8y7seHAPD9TIza5yKra01QyWSson9On0d5wKVk2H4DYqcfkjidUQB1j1rG75KsvSkseScu8seDCPz1TJDW2yara1FYxWSwnm9Sn0N9zKVg2H33ZqsXkkihSQR1g1bK65K0wSEsfR8i+seDEQTxUJTOzy6rY1VowWC0mmNWoz993KVc3H3rYq8TklSlRQh1d1LS647AyR0wgRMbAsN/GRDpTJTKwzKrX1l4vVy4lldWpzt97KVY4IXbUr8LZljVPRCxhw7W3z6ZISkw1VK+4sMWvXEhSPk6buay9sm5JVkZNiLWqtrJ+TldNTnquqbCwilZXU1BwpKirrpNgWFhTaZmnpquZbFlbVmWOpaOonHZcXlljhaGhpZ1+YWBdYn2cn6GdhmdhYGN3lp2enIttY2Jjco+bnJuOdGZlZXCImJqakHpoZ2Zug5WYmZJ/bGlobX6RlpeSg3BqaW16jZSVkoZ0bGtteImSk5KIeG5tbnaFkJKRinxxbm91gY2QkIt/c3BwdH6Kj4+LgnZxcXR8iI2OjIR5c3J0e4WLjYuFe3VzdHmCioyLhn52dHR5gIiKioeAeHV1eH+GiYqHgXp2dnh9hIiJh4J8eHd4fIKHiIeDfXl4eHyBhoeHhH96eHmA') cb: From a619f4fd9bc7e716e39eb6a2c4c01d223edf1388 Mon Sep 17 00:00:00 2001 From: James Campos Date: Mon, 31 Dec 2012 01:10:00 -0800 Subject: [PATCH 39/51] block comment --- 4chan_x.user.js | 5 +++++ script.coffee | 2 ++ 2 files changed, 7 insertions(+) diff --git a/4chan_x.user.js b/4chan_x.user.js index d02b239c7..082c7754c 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3035,6 +3035,11 @@ $.on(d, 'QRPostSuccessful', this.cb.post); return $.on(d, 'visibilitychange ovisibilitychange mozvisibilitychange webkitvisibilitychange', this.cb.visibility); }, + /* + # http://freesound.org/people/pierrecartoons1979/sounds/90112/ + # cc-by-nc-3.0 + */ + audio: $.el('audio', { src: 'data:audio/wav;base64,UklGRjQDAABXQVZFZm10IBAAAAABAAEAgD4AAIA+AAABAAgAc21wbDwAAABBAAADAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABkYXRhzAIAAGMms8em0tleMV4zIpLVo8nhfSlcPR102Ki+5JspVEkdVtKzs+K1NEhUIT7DwKrcy0g6WygsrM2k1NpiLl0zIY/WpMrjgCdbPhxw2Kq+5Z4qUkkdU9K1s+K5NkVTITzBwqnczko3WikrqM+l1NxlLF0zIIvXpsnjgydZPhxs2ay95aIrUEkdUdC3suK8N0NUIjq+xKrcz002WioppdGm091pK1w0IIjYp8jkhydXPxxq2K295aUrTkoeTs65suK+OUFUIzi7xqrb0VA0WSoootKm0t5tKlo1H4TYqMfkiydWQBxm16+85actTEseS8y7seHAPD9TIza5yKra01QyWSson9On0d5wKVk2H4DYqcfkjidUQB1j1rG75KsvSkseScu8seDCPz1TJDW2yara1FYxWSwnm9Sn0N9zKVg2H33ZqsXkkihSQR1g1bK65K0wSEsfR8i+seDEQTxUJTOzy6rY1VowWC0mmNWoz993KVc3H3rYq8TklSlRQh1d1LS647AyR0wgRMbAsN/GRDpTJTKwzKrX1l4vVy4lldWpzt97KVY4IXbUr8LZljVPRCxhw7W3z6ZISkw1VK+4sMWvXEhSPk6buay9sm5JVkZNiLWqtrJ+TldNTnquqbCwilZXU1BwpKirrpNgWFhTaZmnpquZbFlbVmWOpaOonHZcXlljhaGhpZ1+YWBdYn2cn6GdhmdhYGN3lp2enIttY2Jjco+bnJuOdGZlZXCImJqakHpoZ2Zug5WYmZJ/bGlobX6RlpeSg3BqaW16jZSVkoZ0bGtteImSk5KIeG5tbnaFkJKRinxxbm91gY2QkIt/c3BwdH6Kj4+LgnZxcXR8iI2OjIR5c3J0e4WLjYuFe3VzdHmCioyLhn52dHR5gIiKioeAeHV1eH+GiYqHgXp2dnh9hIiJh4J8eHd4fIKHiIeDfXl4eHyBhoeHhH96eHmA' }), diff --git a/script.coffee b/script.coffee index a2816f98c..f6d1a09c8 100644 --- a/script.coffee +++ b/script.coffee @@ -2460,8 +2460,10 @@ Updater = $.on d, 'QRPostSuccessful', @cb.post $.on d, 'visibilitychange ovisibilitychange mozvisibilitychange webkitvisibilitychange', @cb.visibility + ### # http://freesound.org/people/pierrecartoons1979/sounds/90112/ # cc-by-nc-3.0 + ### audio: $.el('audio', src: 'data:audio/wav;base64,UklGRjQDAABXQVZFZm10IBAAAAABAAEAgD4AAIA+AAABAAgAc21wbDwAAABBAAADAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABkYXRhzAIAAGMms8em0tleMV4zIpLVo8nhfSlcPR102Ki+5JspVEkdVtKzs+K1NEhUIT7DwKrcy0g6WygsrM2k1NpiLl0zIY/WpMrjgCdbPhxw2Kq+5Z4qUkkdU9K1s+K5NkVTITzBwqnczko3WikrqM+l1NxlLF0zIIvXpsnjgydZPhxs2ay95aIrUEkdUdC3suK8N0NUIjq+xKrcz002WioppdGm091pK1w0IIjYp8jkhydXPxxq2K295aUrTkoeTs65suK+OUFUIzi7xqrb0VA0WSoootKm0t5tKlo1H4TYqMfkiydWQBxm16+85actTEseS8y7seHAPD9TIza5yKra01QyWSson9On0d5wKVk2H4DYqcfkjidUQB1j1rG75KsvSkseScu8seDCPz1TJDW2yara1FYxWSwnm9Sn0N9zKVg2H33ZqsXkkihSQR1g1bK65K0wSEsfR8i+seDEQTxUJTOzy6rY1VowWC0mmNWoz993KVc3H3rYq8TklSlRQh1d1LS647AyR0wgRMbAsN/GRDpTJTKwzKrX1l4vVy4lldWpzt97KVY4IXbUr8LZljVPRCxhw7W3z6ZISkw1VK+4sMWvXEhSPk6buay9sm5JVkZNiLWqtrJ+TldNTnquqbCwilZXU1BwpKirrpNgWFhTaZmnpquZbFlbVmWOpaOonHZcXlljhaGhpZ1+YWBdYn2cn6GdhmdhYGN3lp2enIttY2Jjco+bnJuOdGZlZXCImJqakHpoZ2Zug5WYmZJ/bGlobX6RlpeSg3BqaW16jZSVkoZ0bGtteImSk5KIeG5tbnaFkJKRinxxbm91gY2QkIt/c3BwdH6Kj4+LgnZxcXR8iI2OjIR5c3J0e4WLjYuFe3VzdHmCioyLhn52dHR5gIiKioeAeHV1eH+GiYqHgXp2dnh9hIiJh4J8eHd4fIKHiIeDfXl4eHyBhoeHhH96eHmA') cb: From 1ad81cecd35d09e43f522d88ddb56229e1a53066 Mon Sep 17 00:00:00 2001 From: James Campos Date: Mon, 31 Dec 2012 19:32:30 -0800 Subject: [PATCH 40/51] better description --- 4chan_x.user.js | 8 ++++---- changelog | 2 +- script.coffee | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 082c7754c..4ca487db0 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -130,7 +130,7 @@ 'Thread Watcher': [true, 'Bookmark threads'], 'Auto Watch': [true, 'Automatically watch threads that you start'], 'Auto Watch Reply': [false, 'Automatically watch threads that you reply to'], - 'Beep': [false, 'Beep, beep, motherfucker'] + 'Beep': [false, 'Beep on new post to completely read thread'] }, Posting: { 'Quick Reply': [true, 'Reply without leaving the page'], @@ -3036,8 +3036,8 @@ return $.on(d, 'visibilitychange ovisibilitychange mozvisibilitychange webkitvisibilitychange', this.cb.visibility); }, /* - # http://freesound.org/people/pierrecartoons1979/sounds/90112/ - # cc-by-nc-3.0 + http://freesound.org/people/pierrecartoons1979/sounds/90112/ + cc-by-nc-3.0 */ audio: $.el('audio', { @@ -3159,7 +3159,7 @@ Updater.count.className = count ? 'new' : null; } if (count) { - if (Conf['Beep'] && (d.hidden || d.oHidden || d.mozHidden || d.webkitHidden) && (Unread.replies.length === 0)) { + if (Conf['Beep'] && $.hidden() && (Unread.replies.length === 0)) { Updater.audio.play(); } Updater.unsuccessfulFetchCount = 0; diff --git a/changelog b/changelog index 62cd3a000..27004bb5b 100644 --- a/changelog +++ b/changelog @@ -1,6 +1,6 @@ master - aeosynth - Beep, beep, motherfucker + Beep on new post to completely read thread 2.37.1 - noface diff --git a/script.coffee b/script.coffee index f6d1a09c8..7f7549757 100644 --- a/script.coffee +++ b/script.coffee @@ -41,7 +41,7 @@ Config = 'Thread Watcher': [true, 'Bookmark threads'] 'Auto Watch': [true, 'Automatically watch threads that you start'] 'Auto Watch Reply': [false, 'Automatically watch threads that you reply to'] - 'Beep': [false, 'Beep, beep, motherfucker'] + 'Beep': [false, 'Beep on new post to completely read thread'] Posting: 'Quick Reply': [true, 'Reply without leaving the page'] 'Cooldown': [true, 'Prevent "flood detected" errors'] @@ -2461,8 +2461,8 @@ Updater = $.on d, 'visibilitychange ovisibilitychange mozvisibilitychange webkitvisibilitychange', @cb.visibility ### - # http://freesound.org/people/pierrecartoons1979/sounds/90112/ - # cc-by-nc-3.0 + http://freesound.org/people/pierrecartoons1979/sounds/90112/ + cc-by-nc-3.0 ### audio: $.el('audio', src: 'data:audio/wav;base64,UklGRjQDAABXQVZFZm10IBAAAAABAAEAgD4AAIA+AAABAAgAc21wbDwAAABBAAADAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABkYXRhzAIAAGMms8em0tleMV4zIpLVo8nhfSlcPR102Ki+5JspVEkdVtKzs+K1NEhUIT7DwKrcy0g6WygsrM2k1NpiLl0zIY/WpMrjgCdbPhxw2Kq+5Z4qUkkdU9K1s+K5NkVTITzBwqnczko3WikrqM+l1NxlLF0zIIvXpsnjgydZPhxs2ay95aIrUEkdUdC3suK8N0NUIjq+xKrcz002WioppdGm091pK1w0IIjYp8jkhydXPxxq2K295aUrTkoeTs65suK+OUFUIzi7xqrb0VA0WSoootKm0t5tKlo1H4TYqMfkiydWQBxm16+85actTEseS8y7seHAPD9TIza5yKra01QyWSson9On0d5wKVk2H4DYqcfkjidUQB1j1rG75KsvSkseScu8seDCPz1TJDW2yara1FYxWSwnm9Sn0N9zKVg2H33ZqsXkkihSQR1g1bK65K0wSEsfR8i+seDEQTxUJTOzy6rY1VowWC0mmNWoz993KVc3H3rYq8TklSlRQh1d1LS647AyR0wgRMbAsN/GRDpTJTKwzKrX1l4vVy4lldWpzt97KVY4IXbUr8LZljVPRCxhw7W3z6ZISkw1VK+4sMWvXEhSPk6buay9sm5JVkZNiLWqtrJ+TldNTnquqbCwilZXU1BwpKirrpNgWFhTaZmnpquZbFlbVmWOpaOonHZcXlljhaGhpZ1+YWBdYn2cn6GdhmdhYGN3lp2enIttY2Jjco+bnJuOdGZlZXCImJqakHpoZ2Zug5WYmZJ/bGlobX6RlpeSg3BqaW16jZSVkoZ0bGtteImSk5KIeG5tbnaFkJKRinxxbm91gY2QkIt/c3BwdH6Kj4+LgnZxcXR8iI2OjIR5c3J0e4WLjYuFe3VzdHmCioyLhn52dHR5gIiKioeAeHV1eH+GiYqHgXp2dnh9hIiJh4J8eHd4fIKHiIeDfXl4eHyBhoeHhH96eHmA') @@ -2555,7 +2555,7 @@ Updater = Updater.count.className = if count then 'new' else null if count - if Conf['Beep'] and (d.hidden or d.oHidden or d.mozHidden or d.webkitHidden) and (Unread.replies.length is 0) + if Conf['Beep'] and $.hidden() and (Unread.replies.length is 0) Updater.audio.play() Updater.unsuccessfulFetchCount = 0 else From d95d54ccf69c94f1f2bd0bba6db5f803eaa64831 Mon Sep 17 00:00:00 2001 From: James Campos Date: Tue, 1 Jan 2013 11:09:26 -0800 Subject: [PATCH 41/51] mv beep option from main to updater config --- 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 4ca487db0..a5ca8b019 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -129,8 +129,7 @@ 'Thread Stats': [true, 'Display reply and image count'], 'Thread Watcher': [true, 'Bookmark threads'], 'Auto Watch': [true, 'Automatically watch threads that you start'], - 'Auto Watch Reply': [false, 'Automatically watch threads that you reply to'], - 'Beep': [false, 'Beep on new post to completely read thread'] + 'Auto Watch Reply': [false, 'Automatically watch threads that you reply to'] }, Posting: { 'Quick Reply': [true, 'Reply without leaving the page'], @@ -201,6 +200,7 @@ }, updater: { checkbox: { + 'Beep': [false, 'Beep on new post to completely read thread'], 'Scrolling': [false, 'Scroll updated posts into view. Only enabled at bottom of page.'], 'Scroll BG': [false, 'Scroll background tabs'], 'Verbose': [true, 'Show countdown timer, new post count'], diff --git a/script.coffee b/script.coffee index 7f7549757..3fafa724f 100644 --- a/script.coffee +++ b/script.coffee @@ -41,7 +41,6 @@ Config = 'Thread Watcher': [true, 'Bookmark threads'] 'Auto Watch': [true, 'Automatically watch threads that you start'] 'Auto Watch Reply': [false, 'Automatically watch threads that you reply to'] - 'Beep': [false, 'Beep on new post to completely read thread'] Posting: 'Quick Reply': [true, 'Reply without leaving the page'] 'Cooldown': [true, 'Prevent "flood detected" errors'] @@ -160,6 +159,7 @@ Config = hide: ['x', 'Hide thread'] updater: checkbox: + 'Beep': [false, 'Beep on new post to completely read thread'] 'Scrolling': [false, 'Scroll updated posts into view. Only enabled at bottom of page.'] 'Scroll BG': [false, 'Scroll background tabs'] 'Verbose': [true, 'Show countdown timer, new post count'] From 669147f4be510f4c8aae3d6b8f7ce75bfbec3468 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 3 Jan 2013 15:19:33 +0100 Subject: [PATCH 42/51] Fix #878, 880 --- 4chan_x.user.js | 2 +- changelog | 2 ++ script.coffee | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 18ea61cd5..aded42c90 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -4296,7 +4296,7 @@ if (post.isInlined && !post.isCrosspost) { return; } - _ref = $$('.quote.deadlink', post.blockquote); + _ref = $$('.deadlink', post.blockquote); for (_i = 0, _len = _ref.length; _i < _len; _i++) { deadlink = _ref[_i]; if (deadlink.parentNode.className === 'prettyprint') { diff --git a/changelog b/changelog index 0d7755904..381c233a5 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- Mayhem + Fix dead quotes. 2.37.1 - noface diff --git a/script.coffee b/script.coffee index 5a49378a0..8b18dc17c 100644 --- a/script.coffee +++ b/script.coffee @@ -3517,7 +3517,7 @@ Quotify = Main.callbacks.push @node node: (post) -> return if post.isInlined and not post.isCrosspost - for deadlink in $$ '.quote.deadlink', post.blockquote + for deadlink in $$ '.deadlink', post.blockquote if deadlink.parentNode.className is 'prettyprint' $.replace deadlink, Array::slice.call deadlink.childNodes From 0477eb595c22b86ec2f959b911962e3ccbdffdca Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 3 Jan 2013 15:30:31 +0100 Subject: [PATCH 43/51] Quotify inside archived posts. --- 4chan_x.user.js | 1 + script.coffee | 2 ++ 2 files changed, 3 insertions(+) diff --git a/4chan_x.user.js b/4chan_x.user.js index 936c011f5..3a9c9043b 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3746,6 +3746,7 @@ } }); comment = bq.innerHTML.replace(/(^|>)(>[^<$]*)(<|$)/g, '$1$2$3'); + comment = comment.replace(/((>){2}(>\/[a-z\d]+\/)?\d+)/g, '$1'); o = { postID: postID, threadID: data.thread_num, diff --git a/script.coffee b/script.coffee index f1ed04842..6eda9ea16 100644 --- a/script.coffee +++ b/script.coffee @@ -2978,6 +2978,8 @@ Get = '' # greentext comment = bq.innerHTML.replace /(^|>)(>[^<$]*)(<|$)/g, '$1$2$3' + # quotes + comment = comment.replace /((>){2}(>\/[a-z\d]+\/)?\d+)/g, '$1' o = # id From c720b90a86a955e2be26cbcc156ad671ee647060 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 3 Jan 2013 15:34:15 +0100 Subject: [PATCH 44/51] When quoting on the index, only change the target thread if the textarea is empty. Close #879 --- 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 3a9c9043b..48331ffc0 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1993,7 +1993,8 @@ e.preventDefault(); } QR.open(); - if (!g.REPLY) { + ta = $('textarea', QR.el); + if (!(g.REPLY || ta.value)) { QR.threadSelector.value = $.x('ancestor::div[parent::div[@class="board"]]', this).id.slice(1); } id = this.previousSibling.hash.slice(2); @@ -2003,7 +2004,6 @@ s = s.replace(/\n/g, '\n>'); text += ">" + s + "\n"; } - ta = $('textarea', QR.el); caretPos = ta.selectionStart; ta.value = ta.value.slice(0, caretPos) + text + ta.value.slice(ta.selectionEnd); range = caretPos + text.length; diff --git a/script.coffee b/script.coffee index 6eda9ea16..dec870351 100644 --- a/script.coffee +++ b/script.coffee @@ -1550,7 +1550,8 @@ QR = quote: (e) -> e?.preventDefault() QR.open() - unless g.REPLY + ta = $ 'textarea', QR.el + unless g.REPLY or ta.value QR.threadSelector.value = $.x('ancestor::div[parent::div[@class="board"]]', @).id[1..] # Make sure we get the correct number, even with XXX censors id = @previousSibling.hash[2..] @@ -1562,7 +1563,6 @@ QR = s = s.replace /\n/g, '\n>' text += ">#{s}\n" - ta = $ 'textarea', QR.el caretPos = ta.selectionStart # Replace selection for text. ta.value = ta.value[...caretPos] + text + ta.value[ta.selectionEnd..] From 8e71bdc1bab5e9014827c5a603224da77f5b8189 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 3 Jan 2013 15:36:59 +0100 Subject: [PATCH 45/51] Release 2.37.2. --- 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 48331ffc0..0f03024f9 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan x -// @version 2.37.1 +// @version 2.37.2 // @namespace aeosynth // @description Adds various features. // @copyright 2009-2011 James Campos @@ -27,7 +27,7 @@ * Copyright (c) 2009-2011 James Campos * Copyright (c) 2012 Nicolas Stepien * http://mayhemydg.github.com/4chan-x/ - * 4chan X 2.37.1 + * 4chan X 2.37.2 * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -5619,7 +5619,7 @@ return $.globalEval(("(" + code + ")()").replace('_id_', bq.id)); }, namespace: '4chan_x.', - version: '2.37.1', + version: '2.37.2', callbacks: [], css: '\ /* dialog styling */\ diff --git a/Cakefile b/Cakefile index 879b1caa0..81e4d2e15 100644 --- a/Cakefile +++ b/Cakefile @@ -2,7 +2,7 @@ {exec} = require 'child_process' fs = require 'fs' -VERSION = '2.37.1' +VERSION = '2.37.2' HEADER = """ // ==UserScript== diff --git a/changelog b/changelog index 65ee0c184..72d0455e3 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master + +2.37.2 - aeosynth Beep on new post to completely read thread - Mayhem diff --git a/latest.js b/latest.js index c71e44f35..011aac32d 100644 --- a/latest.js +++ b/latest.js @@ -1 +1 @@ -postMessage({version:'2.37.1'},'*') \ No newline at end of file +postMessage({version:'2.37.2'},'*') \ No newline at end of file diff --git a/script.coffee b/script.coffee index dec870351..b934f446c 100644 --- a/script.coffee +++ b/script.coffee @@ -4532,7 +4532,7 @@ Main = $.globalEval "(#{code})()".replace '_id_', bq.id namespace: '4chan_x.' - version: '2.37.1' + version: '2.37.2' callbacks: [] css: ' /* dialog styling */ From 82e51f67235ee230845b3a78cacd74b9777c5e0e Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Mon, 7 Jan 2013 03:02:44 +0100 Subject: [PATCH 46/51] One more year. --- 4chan_x.user.js | 2 +- Cakefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 0f03024f9..c1cab46f4 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -4,7 +4,7 @@ // @namespace aeosynth // @description Adds various features. // @copyright 2009-2011 James Campos -// @copyright 2012 Nicolas Stepien +// @copyright 2012-2013 Nicolas Stepien // @license MIT; http://en.wikipedia.org/wiki/Mit_license // @include http://boards.4chan.org/* // @include https://boards.4chan.org/* diff --git a/Cakefile b/Cakefile index 81e4d2e15..99f797ce5 100644 --- a/Cakefile +++ b/Cakefile @@ -11,7 +11,7 @@ HEADER = """ // @namespace aeosynth // @description Adds various features. // @copyright 2009-2011 James Campos -// @copyright 2012 Nicolas Stepien +// @copyright 2012-2013 Nicolas Stepien // @license MIT; http://en.wikipedia.org/wiki/Mit_license // @include http://boards.4chan.org/* // @include https://boards.4chan.org/* From b6645773f32ddd841a33b398c7952db702fcd0c2 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 10 Jan 2013 09:39:59 +0100 Subject: [PATCH 47/51] Fix #888, #890 --- 4chan_x.user.js | 6 +++--- changelog | 2 ++ script.coffee | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index c1cab46f4..1bdc4a114 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2596,7 +2596,7 @@ return QR.ajax = $.ajax($.id('postForm').parentNode.action, callbacks, opts); }, response: function(html) { - var ban, board, doc, err, msg, persona, postID, reply, threadID, _, _ref, _ref1; + var ban, board, doc, err, persona, postID, reply, threadID, _, _ref, _ref1; doc = d.implementation.createHTMLDocument(''); doc.documentElement.innerHTML = html; if (ban = $('.banType', doc)) { @@ -2608,7 +2608,7 @@ if ((_ref = $('a', err)) != null) { _ref.target = '_blank'; } - } else if (!(msg = $('b', doc))) { + } else if (doc.title !== 'Post successful!') { err = 'Connection error with sys.4chan.org.'; } if (err) { @@ -2635,7 +2635,7 @@ sub: Conf['Remember Subject'] ? reply.sub : null }; $.set('QR.persona', persona); - _ref1 = msg.lastChild.textContent.match(/thread:(\d+),no:(\d+)/), _ = _ref1[0], threadID = _ref1[1], postID = _ref1[2]; + _ref1 = doc.body.lastChild.textContent.match(/thread:(\d+),no:(\d+)/), _ = _ref1[0], threadID = _ref1[1], postID = _ref1[2]; $.event(QR.el, new CustomEvent('QRPostSuccessful', { bubbles: true, detail: { diff --git a/changelog b/changelog index 72d0455e3..e521b62eb 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- Mayhem + Fix successful posting causing errors. 2.37.2 - aeosynth diff --git a/script.coffee b/script.coffee index b934f446c..8a59673b4 100644 --- a/script.coffee +++ b/script.coffee @@ -2060,7 +2060,7 @@ QR = "Reason: #{$('.reason', doc).innerHTML}" else if err = doc.getElementById 'errmsg' # error! $('a', err)?.target = '_blank' # duplicate image link - else unless msg = $ 'b', doc + else if doc.title isnt 'Post successful!' err = 'Connection error with sys.4chan.org.' if err @@ -2096,7 +2096,7 @@ QR = sub: if Conf['Remember Subject'] then reply.sub else null $.set 'QR.persona', persona - [_, threadID, postID] = msg.lastChild.textContent.match /thread:(\d+),no:(\d+)/ + [_, threadID, postID] = doc.body.lastChild.textContent.match /thread:(\d+),no:(\d+)/ # Post/upload confirmed as successful. $.event QR.el, new CustomEvent 'QRPostSuccessful', From 325d5920f1174650e20e830a7680d9a07c3d9a3a Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 10 Jan 2013 09:49:59 +0100 Subject: [PATCH 48/51] Fix #887 --- 4chan_x.user.js | 10 +++++----- changelog | 1 + script.coffee | 10 +++++----- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 1bdc4a114..75558473d 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -860,7 +860,7 @@ _ref = post.quotes; for (_i = 0, _len = _ref.length; _i < _len; _i++) { quote = _ref[_i]; - if (!((el = $.id(quote.hash.slice(1))) && !/catalog$/.test(quote.pathname) && el.hidden)) { + if (!((el = $.id(quote.hash.slice(1))) && quote.hostname === 'boards.4chan.org' && !/catalog$/.test(quote.pathname) && el.hidden)) { continue; } $.addClass(quote, 'filtered'); @@ -4016,7 +4016,7 @@ if (quote.parentNode.parentNode.className === 'capcodeReplies') { break; } - if (!/catalog$/.test(quote.pathname) && (qid = quote.hash.slice(2))) { + if (quote.hostname === 'boards.4chan.org' && !/catalog$/.test(quote.pathname) && (qid = quote.hash.slice(2))) { quotes[qid] = true; } } @@ -4057,7 +4057,7 @@ _ref = post.quotes; for (_i = 0, _len = _ref.length; _i < _len; _i++) { quote = _ref[_i]; - if (!(quote.hash && !/catalog$/.test(quote.pathname) || /\bdeadlink\b/.test(quote.className))) { + if (!(quote.hash && quote.hostname === 'boards.4chan.org' && !/catalog$/.test(quote.pathname) || /\bdeadlink\b/.test(quote.className))) { continue; } $.on(quote, 'click', QuoteInline.toggle); @@ -4150,7 +4150,7 @@ _ref = post.quotes; for (_i = 0, _len = _ref.length; _i < _len; _i++) { quote = _ref[_i]; - if (!(quote.hash && !/catalog$/.test(quote.pathname) || /\bdeadlink\b/.test(quote.className))) { + if (!(quote.hash && quote.hostname === 'boards.4chan.org' && !/catalog$/.test(quote.pathname) || /\bdeadlink\b/.test(quote.className))) { continue; } $.on(quote, 'mouseover', QuotePreview.mouseover); @@ -4290,7 +4290,7 @@ _ref = post.quotes; for (_i = 0, _len = _ref.length; _i < _len; _i++) { quote = _ref[_i]; - if (!(quote.hash && !/catalog$/.test(quote.pathname))) { + if (!(quote.hash && quote.hostname === 'boards.4chan.org' && !/catalog$/.test(quote.pathname))) { continue; } path = quote.pathname.split('/'); diff --git a/changelog b/changelog index e521b62eb..882f23734 100644 --- a/changelog +++ b/changelog @@ -1,6 +1,7 @@ master - Mayhem Fix successful posting causing errors. + Fix 4chan X trying to interact with >>>/board/rules links. 2.37.2 - aeosynth diff --git a/script.coffee b/script.coffee index 8a59673b4..354d85d04 100644 --- a/script.coffee +++ b/script.coffee @@ -709,7 +709,7 @@ StrikethroughQuotes = node: (post) -> return if post.isInlined for quote in post.quotes - continue unless (el = $.id quote.hash[1..]) and !/catalog$/.test(quote.pathname) and el.hidden + continue unless (el = $.id quote.hash[1..]) and quote.hostname is 'boards.4chan.org' and !/catalog$/.test(quote.pathname) and el.hidden $.addClass quote, 'filtered' if Conf['Recursive Filtering'] and post.ID isnt post.threadID show_stub = !!$.x 'preceding-sibling::div[contains(@class,"stub")]', el @@ -3321,7 +3321,7 @@ QuoteBacklink = # Stop at 'Admin/Mod/Dev Replies:' on /q/ break if quote.parentNode.parentNode.className is 'capcodeReplies' # Don't process >>>/b/. - if !/catalog$/.test(quote.pathname) and qid = quote.hash[2..] + if quote.hostname is 'boards.4chan.org' and !/catalog$/.test(quote.pathname) and qid = quote.hash[2..] # Duplicate quotes get overwritten. quotes[qid] = true a = $.el 'a', @@ -3349,7 +3349,7 @@ QuoteInline = Main.callbacks.push @node node: (post) -> for quote in post.quotes - continue unless quote.hash and !/catalog$/.test(quote.pathname) or /\bdeadlink\b/.test quote.className + continue unless quote.hash and quote.hostname is 'boards.4chan.org' and !/catalog$/.test(quote.pathname) or /\bdeadlink\b/.test quote.className $.on quote, 'click', QuoteInline.toggle for quote in post.backlinks $.on quote, 'click', QuoteInline.toggle @@ -3418,7 +3418,7 @@ QuotePreview = Main.callbacks.push @node node: (post) -> for quote in post.quotes - continue unless quote.hash and !/catalog$/.test(quote.pathname) or /\bdeadlink\b/.test quote.className + continue unless quote.hash and quote.hostname is 'boards.4chan.org' and !/catalog$/.test(quote.pathname) or /\bdeadlink\b/.test quote.className $.on quote, 'mouseover', QuotePreview.mouseover for quote in post.backlinks $.on quote, 'mouseover', QuotePreview.mouseover @@ -3514,7 +3514,7 @@ QuoteCT = node: (post) -> return if post.isInlined and not post.isCrosspost for quote in post.quotes - unless quote.hash and !/catalog$/.test quote.pathname + unless quote.hash and quote.hostname is 'boards.4chan.org' and !/catalog$/.test quote.pathname # Make sure this isn't a link to the board we're on. continue path = quote.pathname.split '/' From b1dce1ec2fd65bf411f22daf420592f8ce037e3c Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 10 Jan 2013 09:56:36 +0100 Subject: [PATCH 49/51] Release 2.37.3. --- 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 75558473d..e9eb52a54 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan x -// @version 2.37.2 +// @version 2.37.3 // @namespace aeosynth // @description Adds various features. // @copyright 2009-2011 James Campos @@ -27,7 +27,7 @@ * Copyright (c) 2009-2011 James Campos * Copyright (c) 2012 Nicolas Stepien * http://mayhemydg.github.com/4chan-x/ - * 4chan X 2.37.2 + * 4chan X 2.37.3 * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -5619,7 +5619,7 @@ return $.globalEval(("(" + code + ")()").replace('_id_', bq.id)); }, namespace: '4chan_x.', - version: '2.37.2', + version: '2.37.3', callbacks: [], css: '\ /* dialog styling */\ diff --git a/Cakefile b/Cakefile index 99f797ce5..0e7e9a509 100644 --- a/Cakefile +++ b/Cakefile @@ -2,7 +2,7 @@ {exec} = require 'child_process' fs = require 'fs' -VERSION = '2.37.2' +VERSION = '2.37.3' HEADER = """ // ==UserScript== diff --git a/changelog b/changelog index 882f23734..a3c03f3b9 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master + +2.37.3 - Mayhem Fix successful posting causing errors. Fix 4chan X trying to interact with >>>/board/rules links. diff --git a/latest.js b/latest.js index 011aac32d..dda29cbcb 100644 --- a/latest.js +++ b/latest.js @@ -1 +1 @@ -postMessage({version:'2.37.2'},'*') \ No newline at end of file +postMessage({version:'2.37.3'},'*') \ No newline at end of file diff --git a/script.coffee b/script.coffee index 354d85d04..e6fc716ae 100644 --- a/script.coffee +++ b/script.coffee @@ -4532,7 +4532,7 @@ Main = $.globalEval "(#{code})()".replace '_id_', bq.id namespace: '4chan_x.' - version: '2.37.2' + version: '2.37.3' callbacks: [] css: ' /* dialog styling */ From 6600d960b51748450ce50dd8ca8d50a3071b0b50 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 10 Jan 2013 10:23:07 +0100 Subject: [PATCH 50/51] Add /po/ archive redirection. --- 4chan_x.user.js | 7 +++++++ changelog | 2 ++ script.coffee | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/4chan_x.user.js b/4chan_x.user.js index e9eb52a54..992e74ebc 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -4782,6 +4782,8 @@ return "//archive.foolz.us/" + board + "/full_image/" + filename; case 'u': return "//nsfw.foolz.us/" + board + "/full_image/" + filename; + case 'po': + return "http://archive.thedarkcave.org/" + board + "/full_image/" + filename; case 'ck': case 'lit': return "//fuuka.warosu.org/" + board + "/full_image/" + filename; @@ -4818,6 +4820,8 @@ case 'u': case 'kuku': return "//nsfw.foolz.us/_/api/chan/post/?board=" + board + "&num=" + postID; + case 'po': + return "http://archive.thedarkcave.org/_/api/chan/post/?board=" + board + "&num=" + postID; } }, to: function(data) { @@ -4846,6 +4850,9 @@ case 'kuku': url = Redirect.path('//nsfw.foolz.us', 'foolfuuka', data); break; + case 'po': + url = Redirect.path('http://archive.thedarkcave.org', 'foolfuuka', data); + break; case 'ck': case 'lit': url = Redirect.path('//fuuka.warosu.org', 'fuuka', data); diff --git a/changelog b/changelog index a3c03f3b9..83d901b9c 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- Mayhem + Add /po/ archive redirection for threads, images and post resurection. 2.37.3 - Mayhem diff --git a/script.coffee b/script.coffee index e6fc716ae..a0a18901b 100644 --- a/script.coffee +++ b/script.coffee @@ -3928,6 +3928,8 @@ Redirect = "//archive.foolz.us/#{board}/full_image/#{filename}" when 'u' "//nsfw.foolz.us/#{board}/full_image/#{filename}" + when 'po' + "http://archive.thedarkcave.org/#{board}/full_image/#{filename}" when 'ck', 'lit' "//fuuka.warosu.org/#{board}/full_image/#{filename}" when 'cgl', 'g', 'mu', 'w' @@ -3942,6 +3944,8 @@ Redirect = "//archive.foolz.us/_/api/chan/post/?board=#{board}&num=#{postID}" when 'u', 'kuku' "//nsfw.foolz.us/_/api/chan/post/?board=#{board}&num=#{postID}" + when 'po' + "http://archive.thedarkcave.org/_/api/chan/post/?board=#{board}&num=#{postID}" to: (data) -> unless data.isSearch {threadID} = data @@ -3951,6 +3955,8 @@ Redirect = url = Redirect.path '//archive.foolz.us', 'foolfuuka', data when 'u', 'kuku' url = Redirect.path '//nsfw.foolz.us', 'foolfuuka', data + when 'po' + url = Redirect.path 'http://archive.thedarkcave.org', 'foolfuuka', data when 'ck', 'lit' url = Redirect.path '//fuuka.warosu.org', 'fuuka', data when 'diy', 'sci' From e5355e450bc9cdbd13afa4fdc40621377dd0ce01 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Fri, 11 Jan 2013 10:51:06 +0100 Subject: [PATCH 51/51] Typo. --- changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog b/changelog index 83d901b9c..ba12ffb8f 100644 --- a/changelog +++ b/changelog @@ -1,6 +1,6 @@ master - Mayhem - Add /po/ archive redirection for threads, images and post resurection. + Add /po/ archive redirection for threads, images and post resurrection. 2.37.3 - Mayhem