From 8200c10840a999f61b101de9afd5afb110d5b1cd Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 11 Jun 2013 01:08:43 +0200 Subject: [PATCH 1/5] Fix #1150 --- 4chan_x.user.js | 94 ++++++++++++++++++++++++++++++++++++++----------- changelog | 2 ++ script.coffee | 4 +-- 3 files changed, 77 insertions(+), 23 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 2d813fe86..520dc72c7 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2291,13 +2291,13 @@ this.onready = function() { return _this.ready(); }; - return $.on($.id('recaptcha_widget_div'), 'DOMNodeInserted', this.onready); + return $.on($.id('captchaContainer'), 'DOMNodeInserted', this.onready); } }, ready: function() { var _this = this; if (this.challenge = $.id('recaptcha_challenge_field_holder')) { - $.off($.id('recaptcha_widget_div'), 'DOMNodeInserted', this.onready); + $.off($.id('captchaContainer'), 'DOMNodeInserted', this.onready); delete this.onready; } else { return; @@ -4940,20 +4940,33 @@ return "//archive.thedarkcave.org/" + board + "/full_image/" + filename; case 'hr': case 'tv': + case 'x': return "http://archive.4plebs.org/" + board + "/full_image/" + filename; case 'c': case 'w': case 'wg': return "//archive.nyafuu.org/" + board + "/full_image/" + filename; - case 'vg': - return "http://archive.nihil-ad-rem.net/" + board + "/full_image/" + filename; case 'd': + case 'h': + case 'v': return "//loveisover.me/" + board + "/full_image/" + filename; - case 'ck': - case 'fa': - case 'lit': + case 'vg': + return "http://nth.pensivenonsen.se/" + board + "/full_image/" + filename; + case 'adv': + case 'asp': + case 'cm': + case 'e': + case 'i': + case 'lgbt': + case 'n': + case 'o': + case 'p': + case 's': case 's4s': - return "//fuuka.warosu.org/" + board + "/full_image/" + filename; + case 't': + case 'trv': + case 'y': + return "//archive.foolzashit.com/" + board + "/full_image/" + filename; case 'cgl': case 'g': case 'mu': @@ -4961,8 +4974,13 @@ case 'an': case 'k': case 'toy': - case 'x': return "http://archive.heinessen.com/" + board + "/full_image/" + filename; + case '3': + case 'ck': + case 'fa': + case 'ic': + case 'lit': + return "//fuuka.warosu.org/" + board + "/full_image/" + filename; } }, post: function(board, postID) { @@ -4993,11 +5011,27 @@ case 'w': case 'wg': return "//archive.nyafuu.org/_/api/chan/post/?board=" + board + "&num=" + postID; - case 'v': - case 'vg': - return "http://archive.nihil-ad-rem.net/_/api/chan/post/?board=" + board + "&num=" + postID; case 'd': + case 'h': + case 'v': return "//loveisover.me/_/api/chan/post/?board=" + board + "&num=" + postID; + case 'vg': + return "http://nth.pensivenonsen.se/_/api/chan/post/?board=" + board + "&num=" + postID; + case 'adv': + case 'asp': + case 'cm': + case 'e': + case 'i': + case 'lgbt': + case 'n': + case 'o': + case 'p': + case 's': + case 's4s': + case 't': + case 'trv': + case 'y': + return "//archive.foolzashit.com/_/api/chan/post/?board=" + board + "&num=" + postID; } }, to: function(data) { @@ -5030,6 +5064,7 @@ url = Redirect.path('//archive.thedarkcave.org', 'foolfuuka', data); break; case 'hr': + case 'x': url = Redirect.path('http://archive.4plebs.org', 'foolfuuka', data); break; case 'c': @@ -5037,18 +5072,29 @@ case 'wg': url = Redirect.path('//archive.nyafuu.org', 'foolfuuka', data); break; - case 'v': - case 'vg': - url = Redirect.path('http://archive.nihil-ad-rem.net', 'foolfuuka', data); - break; case 'd': + case 'h': + case 'v': url = Redirect.path('//loveisover.me', 'foolfuuka', data); break; - case 'ck': - case 'fa': - case 'lit': + case 'vg': + url = Redirect.path('http://nth.pensivenonsen.se', 'foolfuuka', data); + break; + case 'adv': + case 'asp': + case 'cm': + case 'e': + case 'i': + case 'lgbt': + case 'n': + case 'o': + case 'p': + case 's': case 's4s': - url = Redirect.path('//fuuka.warosu.org', 'fuuka', data); + case 't': + case 'trv': + case 'y': + url = Redirect.path('//archive.foolzashit.com', 'foolfuuka', data); break; case 'diy': case 'g': @@ -5065,9 +5111,15 @@ case 'mlp': case 'r9k': case 'toy': - case 'x': url = Redirect.path('http://archive.heinessen.com', 'fuuka', data); break; + case '3': + case 'ck': + case 'fa': + case 'ic': + case 'lit': + url = Redirect.path('//fuuka.warosu.org', 'fuuka', data); + break; default: if (threadID) { url = "//boards.4chan.org/" + board + "/"; diff --git a/changelog b/changelog index 2c8d39353..0a39a9216 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- Mayhem + Fix QR. 2.39.5 - Mayhem diff --git a/script.coffee b/script.coffee index 302d99bec..1996dfba1 100644 --- a/script.coffee +++ b/script.coffee @@ -1787,10 +1787,10 @@ QR = @ready() else @onready = => @ready() - $.on $.id('recaptcha_widget_div'), 'DOMNodeInserted', @onready + $.on $.id('captchaContainer'), 'DOMNodeInserted', @onready ready: -> if @challenge = $.id 'recaptcha_challenge_field_holder' - $.off $.id('recaptcha_widget_div'), 'DOMNodeInserted', @onready + $.off $.id('captchaContainer'), 'DOMNodeInserted', @onready delete @onready else return From b117ad5e159b8d6800fe1460ba53a43cd4928a76 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 11 Jun 2013 01:10:46 +0200 Subject: [PATCH 2/5] Release 2.39.6. --- 4chan_x.user.js | 6 +++--- Cakefile | 2 +- changelog | 2 ++ latest.js | 2 +- script.coffee | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 520dc72c7..cd803f6f0 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan x -// @version 2.39.5 +// @version 2.39.6 // @namespace aeosynth // @description Adds various features. // @copyright 2009-2011 James Campos @@ -27,7 +27,7 @@ * Copyright (c) 2009-2011 James Campos * Copyright (c) 2012-2013 Nicolas Stepien * http://mayhemydg.github.io/4chan-x/ - * 4chan X 2.39.5 + * 4chan X 2.39.6 * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -5893,7 +5893,7 @@ return $.globalEval(("(" + code + ")()").replace('_id_', bq.id)); }, namespace: '4chan_x.', - version: '2.39.5', + version: '2.39.6', callbacks: [], css: '\ /* dialog styling */\ diff --git a/Cakefile b/Cakefile index 9c25140f4..6d46055a8 100644 --- a/Cakefile +++ b/Cakefile @@ -2,7 +2,7 @@ {exec} = require 'child_process' fs = require 'fs' -VERSION = '2.39.5' +VERSION = '2.39.6' HEADER = """ // ==UserScript== diff --git a/changelog b/changelog index 0a39a9216..ebde5d4bb 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master + +2.39.6 - Mayhem Fix QR. diff --git a/latest.js b/latest.js index 30b8eefce..719099c19 100644 --- a/latest.js +++ b/latest.js @@ -1 +1 @@ -postMessage({version:'2.39.5'},'*') \ No newline at end of file +postMessage({version:'2.39.6'},'*') \ No newline at end of file diff --git a/script.coffee b/script.coffee index 1996dfba1..40681cad5 100644 --- a/script.coffee +++ b/script.coffee @@ -4756,7 +4756,7 @@ Main = $.globalEval "(#{code})()".replace '_id_', bq.id namespace: '4chan_x.' - version: '2.39.5' + version: '2.39.6' callbacks: [] css: ' /* dialog styling */ From 86b44f1c60439edc18568799c120fced6a1b3e7d Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 18 Jun 2013 22:04:05 +0200 Subject: [PATCH 3/5] Update archive redirection for /pol/ and /vg/. --- 4chan_x.user.js | 12 +++++------- changelog | 2 ++ script.coffee | 16 +++++----------- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index cd803f6f0..4e6e32f8b 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -4930,6 +4930,7 @@ case 'm': case 'q': case 'tg': + case 'vg': case 'vp': case 'vr': case 'wsg': @@ -4950,8 +4951,6 @@ case 'h': case 'v': return "//loveisover.me/" + board + "/full_image/" + filename; - case 'vg': - return "http://nth.pensivenonsen.se/" + board + "/full_image/" + filename; case 'adv': case 'asp': case 'cm': @@ -4994,6 +4993,7 @@ case 'sp': case 'tg': case 'tv': + case 'vg': case 'vp': case 'vr': case 'wsg': @@ -5015,8 +5015,6 @@ case 'h': case 'v': return "//loveisover.me/_/api/chan/post/?board=" + board + "&num=" + postID; - case 'vg': - return "http://nth.pensivenonsen.se/_/api/chan/post/?board=" + board + "&num=" + postID; case 'adv': case 'asp': case 'cm': @@ -5026,6 +5024,7 @@ case 'n': case 'o': case 'p': + case 'pol': case 's': case 's4s': case 't': @@ -5050,6 +5049,7 @@ case 'sp': case 'tg': case 'tv': + case 'vg': case 'vp': case 'vr': case 'wsg': @@ -5077,9 +5077,6 @@ case 'v': url = Redirect.path('//loveisover.me', 'foolfuuka', data); break; - case 'vg': - url = Redirect.path('http://nth.pensivenonsen.se', 'foolfuuka', data); - break; case 'adv': case 'asp': case 'cm': @@ -5089,6 +5086,7 @@ case 'n': case 'o': case 'p': + case 'pol': case 's': case 's4s': case 't': diff --git a/changelog b/changelog index ebde5d4bb..4aca36703 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- Mayhem + Update archive redirection for /pol/ and /vg/. 2.39.6 - Mayhem diff --git a/script.coffee b/script.coffee index 40681cad5..d2101622a 100644 --- a/script.coffee +++ b/script.coffee @@ -4086,7 +4086,7 @@ Redirect = image: (board, filename) -> # Do not use g.BOARD, the image url can originate from a cross-quote. switch board - when 'a', 'gd', 'jp', 'm', 'q', 'tg', 'vp', 'vr', 'wsg' + when 'a', 'gd', 'jp', 'm', 'q', 'tg', 'vg', 'vp', 'vr', 'wsg' "//archive.foolz.us/#{board}/full_image/#{filename}" when 'u' "//nsfw.foolz.us/#{board}/full_image/#{filename}" @@ -4098,8 +4098,6 @@ Redirect = "//archive.nyafuu.org/#{board}/full_image/#{filename}" when 'd', 'h', 'v' "//loveisover.me/#{board}/full_image/#{filename}" - when 'vg' - "http://nth.pensivenonsen.se/#{board}/full_image/#{filename}" when 'adv', 'asp', 'cm', 'e', 'i', 'lgbt', 'n', 'o', 'p', 's', 's4s', 't', 'trv', 'y' "//archive.foolzashit.com/#{board}/full_image/#{filename}" when 'cgl', 'g', 'mu' @@ -4112,7 +4110,7 @@ Redirect = # XXX foolz had HSTS set for 120 days, which broke XHR+CORS+Redirection when on HTTP. # Remove necessary HTTPS procotol in September 2013. switch board - when 'a', 'co', 'gd', 'jp', 'm', 'q', 'sp', 'tg', 'tv', 'vp', 'vr', 'wsg' + when 'a', 'co', 'gd', 'jp', 'm', 'q', 'sp', 'tg', 'tv', 'vg', 'vp', 'vr', 'wsg' "https://archive.foolz.us/_/api/chan/post/?board=#{board}&num=#{postID}" when 'u' "https://nsfw.foolz.us/_/api/chan/post/?board=#{board}&num=#{postID}" @@ -4124,16 +4122,14 @@ Redirect = "//archive.nyafuu.org/_/api/chan/post/?board=#{board}&num=#{postID}" when 'd', 'h', 'v' "//loveisover.me/_/api/chan/post/?board=#{board}&num=#{postID}" - when 'vg' - "http://nth.pensivenonsen.se/_/api/chan/post/?board=#{board}&num=#{postID}" - when 'adv', 'asp', 'cm', 'e', 'i', 'lgbt', 'n', 'o', 'p', 's', 's4s', 't', 'trv', 'y' + when 'adv', 'asp', 'cm', 'e', 'i', 'lgbt', 'n', 'o', 'p', 'pol', 's', 's4s', 't', 'trv', 'y' "//archive.foolzashit.com/_/api/chan/post/?board=#{board}&num=#{postID}" to: (data) -> unless data.isSearch {threadID} = data {board} = data switch board - when 'a', 'co', 'gd', 'jp', 'm', 'q', 'sp', 'tg', 'tv', 'vp', 'vr', 'wsg' + when 'a', 'co', 'gd', 'jp', 'm', 'q', 'sp', 'tg', 'tv', 'vg', 'vp', 'vr', 'wsg' url = Redirect.path '//archive.foolz.us', 'foolfuuka', data when 'u' url = Redirect.path '//nsfw.foolz.us', 'foolfuuka', data @@ -4145,9 +4141,7 @@ Redirect = url = Redirect.path '//archive.nyafuu.org', 'foolfuuka', data when 'd', 'h', 'v' url = Redirect.path '//loveisover.me', 'foolfuuka', data - when 'vg' - url = Redirect.path 'http://nth.pensivenonsen.se', 'foolfuuka', data - when 'adv', 'asp', 'cm', 'e', 'i', 'lgbt', 'n', 'o', 'p', 's', 's4s', 't', 'trv', 'y' + when 'adv', 'asp', 'cm', 'e', 'i', 'lgbt', 'n', 'o', 'p', 'pol', 's', 's4s', 't', 'trv', 'y' url = Redirect.path '//archive.foolzashit.com', 'foolfuuka', data when 'diy', 'g', 'sci' url = Redirect.path '//archive.installgentoo.net', 'fuuka', data From cf8b73eaf53676e351ee572a26373b52400e713c Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 18 Jun 2013 22:18:32 +0200 Subject: [PATCH 4/5] Fix support for the report window. --- 4chan_x.user.js | 12 ++++++++---- script.coffee | 7 +++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 4e6e32f8b..caa19d14e 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -5484,7 +5484,7 @@ Main = { init: function() { - var key, path, pathname, settings, temp, val; + var asap, key, path, pathname, settings, temp, val; Main.flatten(null, Config); path = location.pathname; pathname = path.slice(1).split('/'); @@ -5504,10 +5504,13 @@ switch (location.hostname) { case 'sys.4chan.org': if (/report/.test(location.search)) { - $.ready(function() { + asap = function() { var field, form; + if (!(field = $.id('recaptcha_response_field'))) { + setTimeout(asap, 200); + return; + } form = $('form'); - field = $.id('recaptcha_response_field'); $.on(field, 'keydown', function(e) { if (e.keyCode === 8 && !e.target.value) { return window.location = 'javascript:Recaptcha.reload()'; @@ -5522,7 +5525,8 @@ } return form.submit(); }); - }); + }; + asap(); } return; case 'images.4chan.org': diff --git a/script.coffee b/script.coffee index d2101622a..e9d589403 100644 --- a/script.coffee +++ b/script.coffee @@ -4434,9 +4434,11 @@ Main = switch location.hostname when 'sys.4chan.org' if /report/.test location.search - $.ready -> + asap = -> + unless field = $.id 'recaptcha_response_field' + setTimeout asap, 200 + return form = $ 'form' - field = $.id 'recaptcha_response_field' $.on field, 'keydown', (e) -> window.location = 'javascript:Recaptcha.reload()' if e.keyCode is 8 and not e.target.value $.on form, 'submit', (e) -> @@ -4444,6 +4446,7 @@ Main = response = field.value.trim() field.value = "#{response} #{response}" unless /\s/.test response form.submit() + asap() return when 'images.4chan.org' $.ready -> From 2365616563ebc45c15b6c1f8ea13463ab590de52 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 18 Jun 2013 22:19:08 +0200 Subject: [PATCH 5/5] Release 2.39.7. --- 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 caa19d14e..6bdd9d0ab 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan x -// @version 2.39.6 +// @version 2.39.7 // @namespace aeosynth // @description Adds various features. // @copyright 2009-2011 James Campos @@ -27,7 +27,7 @@ * Copyright (c) 2009-2011 James Campos * Copyright (c) 2012-2013 Nicolas Stepien * http://mayhemydg.github.io/4chan-x/ - * 4chan X 2.39.6 + * 4chan X 2.39.7 * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -5895,7 +5895,7 @@ return $.globalEval(("(" + code + ")()").replace('_id_', bq.id)); }, namespace: '4chan_x.', - version: '2.39.6', + version: '2.39.7', callbacks: [], css: '\ /* dialog styling */\ diff --git a/Cakefile b/Cakefile index 6d46055a8..3e6c1bbc1 100644 --- a/Cakefile +++ b/Cakefile @@ -2,7 +2,7 @@ {exec} = require 'child_process' fs = require 'fs' -VERSION = '2.39.6' +VERSION = '2.39.7' HEADER = """ // ==UserScript== diff --git a/changelog b/changelog index 4aca36703..598fa09a1 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master + +2.39.7 - Mayhem Update archive redirection for /pol/ and /vg/. diff --git a/latest.js b/latest.js index 719099c19..2c161ee45 100644 --- a/latest.js +++ b/latest.js @@ -1 +1 @@ -postMessage({version:'2.39.6'},'*') \ No newline at end of file +postMessage({version:'2.39.7'},'*') \ No newline at end of file diff --git a/script.coffee b/script.coffee index e9d589403..f12023697 100644 --- a/script.coffee +++ b/script.coffee @@ -4753,7 +4753,7 @@ Main = $.globalEval "(#{code})()".replace '_id_', bq.id namespace: '4chan_x.' - version: '2.39.6' + version: '2.39.7' callbacks: [] css: ' /* dialog styling */