From 7ab272005aa6631ef4d7f71eb4289326e329351c Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 31 Jul 2012 16:20:11 +0200 Subject: [PATCH 01/20] maidlab.jp -> heinessen.com --- 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 a58ef7e37..c86c7abf2 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -4555,7 +4555,7 @@ case 'r9k': case 'toy': case 'x': - url = "http://archive.maidlab.jp/" + path; + url = "http://archive.heinessen.com/" + path; if (threadID && postID) { url += "#p" + postID; } diff --git a/script.coffee b/script.coffee index 43b4c503f..c06fdcab1 100644 --- a/script.coffee +++ b/script.coffee @@ -3558,7 +3558,7 @@ Redirect = # when 'cgl', 'g', 'w' # "//archive.rebeccablacktech.com/#{board}/full_image/#{filename}" # when 'an', 'k', 'toy', 'x' - # "http://archive.maidlab.jp/#{board}/full_image/#{filename}" + # "http://archive.heinessen.com/#{board}/full_image/#{filename}" # when 'e' # "https://md401.homelinux.net/4chan/cgi-board.pl/#{board}/full_image/#{filename}" post: (board, postID) -> @@ -3597,7 +3597,7 @@ Redirect = if threadID and postID url += "#p#{postID}" when 'an', 'fit', 'k', 'r9k', 'toy', 'x' - url = "http://archive.maidlab.jp/#{path}" + url = "http://archive.heinessen.com/#{path}" if threadID and postID url += "#p#{postID}" when 'e' From 0d136c967ae9da8001fa8bf78637a661b5d2e7da Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Mon, 6 Aug 2012 20:41:18 +0200 Subject: [PATCH 02/20] Fix error when highlighting and toping an alone thread. --- 4chan_x.user.js | 6 ++++-- script.coffee | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index c86c7abf2..88c72d29a 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -657,8 +657,10 @@ $.addClass(root, result["class"]); if (isOP && result.top && !g.REPLY) { thisThread = root.parentNode; - if (firstThread = $('div[class="postContainer opContainer"]').parentNode) { - $.before(firstThread, [thisThread, thisThread.nextElementSibling]); + if (firstThread = $('div[class="postContainer opContainer"]')) { + if (firstThread !== root) { + $.before(firstThread.parentNode, [thisThread, thisThread.nextElementSibling]); + } } } } diff --git a/script.coffee b/script.coffee index c06fdcab1..b72a3146d 100644 --- a/script.coffee +++ b/script.coffee @@ -531,8 +531,9 @@ Filter = # Put the highlighted OPs' thread on top of the board page... thisThread = root.parentNode # ...before the first non highlighted thread. - if firstThread = $('div[class="postContainer opContainer"]').parentNode - $.before firstThread, [thisThread, thisThread.nextElementSibling] + if firstThread = $ 'div[class="postContainer opContainer"]' + unless firstThread is root + $.before firstThread.parentNode, [thisThread, thisThread.nextElementSibling] name: (post) -> $('.name', post.el).textContent From 2de968891c429ba89c70cf470bc8bceddf373c64 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 8 Aug 2012 16:59:35 +0200 Subject: [PATCH 03/20] Add /q/ archive redirection. Close #648. --- 4chan_x.user.js | 3 +++ changelog | 2 ++ script.coffee | 6 +++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 88c72d29a..a331f1e99 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -4467,6 +4467,7 @@ case 'a': case 'jp': case 'm': + case 'q': case 'sp': case 'tg': case 'vg': @@ -4482,6 +4483,7 @@ case 'co': case 'jp': case 'm': + case 'q': case 'sp': case 'tg': case 'tv': @@ -4507,6 +4509,7 @@ case 'co': case 'jp': case 'm': + case 'q': case 'sp': case 'tg': case 'tv': diff --git a/changelog b/changelog index f0603e95d..73169da46 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- Mayhem + Add /q/ archive redirection. 2.34.3 - Mayhem diff --git a/script.coffee b/script.coffee index b72a3146d..6e1731a1d 100644 --- a/script.coffee +++ b/script.coffee @@ -3551,7 +3551,7 @@ Redirect = image: (board, filename) -> # Do not use g.BOARD, the image url can originate from a cross-quote. switch board - when 'a', 'jp', 'm', 'sp', 'tg', 'vg', 'wsg' + when 'a', 'jp', 'm', 'q', 'sp', 'tg', 'vg', 'wsg' "//archive.foolz.us/#{board}/full_image/#{filename}" when 'u' "//nsfw.foolz.us/#{board}/full_image/#{filename}" @@ -3564,7 +3564,7 @@ Redirect = # "https://md401.homelinux.net/4chan/cgi-board.pl/#{board}/full_image/#{filename}" post: (board, postID) -> switch board - when 'a', 'co', 'jp', 'm', 'sp', 'tg', 'tv', 'v', 'vg', 'wsg', 'dev', 'foolz' + when 'a', 'co', 'jp', 'm', 'q', 'sp', 'tg', 'tv', 'v', 'vg', 'wsg', 'dev', 'foolz' "//archive.foolz.us/api/chan/post/board/#{board}/num/#{postID}/format/json" when 'u', 'kuku' "//nsfw.foolz.us/api/chan/post/board/#{board}/num/#{postID}/format/json" @@ -3577,7 +3577,7 @@ Redirect = else "#{board}/post/#{postID}" switch board - when 'a', 'co', 'jp', 'm', 'sp', 'tg', 'tv', 'v', 'vg', 'wsg', 'dev', 'foolz' + when 'a', 'co', 'jp', 'm', 'q', 'sp', 'tg', 'tv', 'v', 'vg', 'wsg', 'dev', 'foolz' url = "//archive.foolz.us/#{path}/" if threadID and postID url += "##{postID}" From f2ff7ab1be1a8ad41c74fb805d7c3d7e66da9d46 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 8 Aug 2012 17:40:02 +0200 Subject: [PATCH 04/20] Add user ID and developper support in parseArchivedPost. --- 4chan_x.user.js | 73 ++++++++++++++++++++++++++++++++++------------ script.coffee | 77 ++++++++++++++++++++++++++++++++++++------------- 2 files changed, 111 insertions(+), 39 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index a331f1e99..036f4f56e 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3526,7 +3526,7 @@ } }, parseArchivedPost: function(req, board, postID, root, cb) { - var bq, br, capcode, data, email, file, filename, filesize, isOP, name, nameBlock, pc, pi, piM, span, spoiler, subject, threadID, threshold, thumb_src, timestamp, trip; + var bq, br, capcode, data, email, file, filename, filesize, isOP, name, nameBlock, pc, pi, piM, span, spoiler, subject, threadID, threshold, thumb_src, timestamp, trip, userID; data = JSON.parse(req.response); $.addClass(root, 'archivedPost'); if (data.error) { @@ -3537,6 +3537,7 @@ isOP = postID === threadID; name = data.name, trip = data.trip, timestamp = data.timestamp; subject = data.title; + userID = data.poster_hash; piM = $.el('div', { id: "pim" + postID, className: 'postInfoM mobile', @@ -3571,7 +3572,7 @@ pi = $.el('div', { id: "pi" + postID, className: 'postInfo desktop', - innerHTML: " data.fourchan_date No." + postID + "" + (isOP ? '   ' : '') + " " + innerHTML: " data.fourchan_date No." + postID + "" }); $('.subject', pi).textContent = subject; nameBlock = $('.nameBlock', pi); @@ -3587,6 +3588,14 @@ className: 'name', textContent: data.name })); + if (userID) { + $.add(nameBlock, [ + $.tn(' '), $.el('span', { + className: "posteruid id_" + userID, + innerHTML: "(ID: " + userID + ")" + }) + ]); + } if (trip) { $.add(nameBlock, [ $.tn(' '), $.el('span', { @@ -3595,23 +3604,49 @@ }) ]); } - if (capcode !== 'N') { - $.add(nameBlock, [ - $.tn(' '), $.el('strong', { - className: capcode === 'A' ? 'capcode capcodeAdmin' : 'capcode', - textContent: capcode === 'A' ? '## Admin' : '## Mod' - }) - ]); - nameBlock = $('.nameBlock', pi); - $.addClass(nameBlock, capcode === 'A' ? 'capcodeAdmin' : 'capcodeMod'); - $.add(nameBlock, [ - $.tn(' '), $.el('img', { - src: capcode === 'A' ? '//static.4chan.org/image/adminicon.gif' : '//static.4chan.org/image/modicon.gif', - alt: capcode === 'A' ? 'This user is the 4chan Administrator.' : 'This user is a 4chan Moderator.', - title: capcode === 'A' ? 'This user is the 4chan Administrator.' : 'This user is a 4chan Moderator.', - className: 'identityIcon' - }) - ]); + nameBlock = $('.nameBlock', pi); + switch (capcode) { + case 'A': + $.addClass(nameBlock, 'capcodeAdmin'); + $.add(nameBlock, [ + $.tn(' '), $.el('strong', { + className: 'capcode', + textContent: '## Admin' + }), $.tn(' '), $.el('img', { + src: '//static.4chan.org/image/adminicon.gif', + alt: 'This user is the 4chan Administrator.', + title: 'This user is the 4chan Administrator.', + className: 'identityIcon' + }) + ]); + break; + case 'M': + $.addClass(nameBlock, 'capcodeMod'); + $.add(nameBlock, [ + $.tn(' '), $.el('strong', { + className: 'capcode', + textContent: '## Mod' + }), $.tn(' '), $.el('img', { + src: '//static.4chan.org/image/modicon.gif', + alt: 'This user is a 4chan Moderator.', + title: 'This user is a 4chan Moderator.', + className: 'identityIcon' + }) + ]); + break; + case 'D': + $.addClass(nameBlock, 'capcodeDeveloper'); + $.add(nameBlock, [ + $.tn(' '), $.el('strong', { + className: 'capcode', + textContent: '## Developer' + }), $.tn(' '), $.el('img', { + src: '//static.4chan.org/image/developericon.gif', + alt: 'This user is a 4chan Developer.', + title: 'title="This user is a 4chan Developer.', + className: 'identityIcon' + }) + ]); } bq = $.el('blockquote', { id: "m" + postID, diff --git a/script.coffee b/script.coffee index 6e1731a1d..9172135df 100644 --- a/script.coffee +++ b/script.coffee @@ -2778,6 +2778,7 @@ Get = isOP = postID is threadID {name, trip, timestamp} = data subject = data.title + userID = data.poster_hash # post info (mobile) piM = $.el 'div', @@ -2814,7 +2815,7 @@ Get = pi = $.el 'div', id: "pi#{postID}" className: 'postInfo desktop' - innerHTML: " data.fourchan_date No.#{postID}#{if isOP then '   ' else ''} " + innerHTML: " data.fourchan_date No.#{postID}" # subject $('.subject', pi).textContent = subject nameBlock = $ '.nameBlock', pi @@ -2827,27 +2828,63 @@ Get = $.add nameBlock, $.el 'span', className: 'name' textContent: data.name + if userID + $.add nameBlock, [$.tn(' '), $.el('span', + className: "posteruid id_#{userID}" + innerHTML: "(ID: #{userID})" + )] if trip $.add nameBlock, [$.tn(' '), $.el('span', className: 'postertrip', textContent: trip)] - if capcode isnt 'N' # 'A'dmin or 'M'od - $.add nameBlock, [ - $.tn(' '), - $.el('strong', - className: if capcode is 'A' then 'capcode capcodeAdmin' else 'capcode', - textContent: if capcode is 'A' then '## Admin' else '## Mod' - ) - ] - nameBlock = $ '.nameBlock', pi - $.addClass nameBlock, if capcode is 'A' then 'capcodeAdmin' else 'capcodeMod' - $.add nameBlock, [ - $.tn(' '), - $.el('img', - src: if capcode is 'A' then '//static.4chan.org/image/adminicon.gif' else '//static.4chan.org/image/modicon.gif', - alt: if capcode is 'A' then 'This user is the 4chan Administrator.' else 'This user is a 4chan Moderator.', - title: if capcode is 'A' then 'This user is the 4chan Administrator.' else 'This user is a 4chan Moderator.', - className: 'identityIcon' - ) - ] + nameBlock = $ '.nameBlock', pi + switch capcode # 'A'dmin or 'M'od or 'D'eveloper + when 'A' + $.addClass nameBlock, 'capcodeAdmin' + $.add nameBlock, [ + $.tn(' '), + $.el('strong', + className: 'capcode' + textContent: '## Admin' + ), + $.tn(' '), + $.el('img', + src: '//static.4chan.org/image/adminicon.gif' + alt: 'This user is the 4chan Administrator.' + title: 'This user is the 4chan Administrator.' + className: 'identityIcon' + ) + ] + when 'M' + $.addClass nameBlock, 'capcodeMod' + $.add nameBlock, [ + $.tn(' '), + $.el('strong', + className: 'capcode' + textContent: '## Mod' + ), + $.tn(' '), + $.el('img', + src: '//static.4chan.org/image/modicon.gif' + alt: 'This user is a 4chan Moderator.' + title: 'This user is a 4chan Moderator.' + className: 'identityIcon' + ) + ] + when 'D' + $.addClass nameBlock, 'capcodeDeveloper' + $.add nameBlock, [ + $.tn(' '), + $.el('strong', + className: 'capcode' + textContent: '## Developer' + ), + $.tn(' '), + $.el('img', + src: '//static.4chan.org/image/developericon.gif' + alt: 'This user is a 4chan Developer.' + title: 'title="This user is a 4chan Developer.' + className: 'identityIcon' + ) + ] # comment bq = $.el 'blockquote', From c6a44d095c33e710fa49f7b21fd2cddf86d8bf52 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 8 Aug 2012 17:52:10 +0200 Subject: [PATCH 05/20] Tiny refactor. --- 4chan_x.user.js | 14 +++++++------- script.coffee | 18 +++++++++--------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 036f4f56e..5fc160ad6 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -564,15 +564,15 @@ if (boards !== 'global' && boards.split(',').indexOf(g.BOARD) === -1) { continue; } - try { - if (key === 'md5') { - regexp = regexp[1]; - } else { + if (key === 'md5') { + regexp = regexp[1]; + } else { + try { regexp = RegExp(regexp[1], regexp[2]); + } catch (err) { + alert(err.message); + continue; } - } catch (e) { - alert(e.message); - continue; } op = ((_ref2 = filter.match(/[^t]op:(yes|no|only)/)) != null ? _ref2[1] : void 0) || 'no'; stub = (function() { diff --git a/script.coffee b/script.coffee index 9172135df..220ca5a75 100644 --- a/script.coffee +++ b/script.coffee @@ -437,17 +437,17 @@ Filter = if boards isnt 'global' and boards.split(',').indexOf(g.BOARD) is -1 continue - try - if key is 'md5' - # MD5 filter will use strings instead of regular expressions. - regexp = regexp[1] - else + if key is 'md5' + # MD5 filter will use strings instead of regular expressions. + regexp = regexp[1] + else + try # Please, don't write silly regular expressions. regexp = RegExp regexp[1], regexp[2] - catch e - # I warned you, bro. - alert e.message - continue + catch err + # I warned you, bro. + alert err.message + continue # Filter OPs along with their threads, replies only, or both. # Defaults to replies only. From f82895197b32aff2152572ebff70fcdbbc7e2f23 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 8 Aug 2012 17:53:48 +0200 Subject: [PATCH 06/20] Release 2.34.4. --- 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 5fc160ad6..73bb166c4 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan x -// @version 2.34.3 +// @version 2.34.4 // @namespace aeosynth // @description Adds various features. // @copyright 2009-2011 James Campos @@ -23,7 +23,7 @@ * Copyright (c) 2009-2011 James Campos * Copyright (c) 2012 Nicolas Stepien * http://mayhemydg.github.com/4chan-x/ - * 4chan X 2.34.3 + * 4chan X 2.34.4 * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -5243,7 +5243,7 @@ return $.globalEval(("(" + code + ")()").replace('_id_', bq.id)); }, namespace: '4chan_x.', - version: '2.34.3', + version: '2.34.4', callbacks: [], css: '\ /* dialog styling */\ diff --git a/Cakefile b/Cakefile index 2e5f4b805..4ced5b458 100644 --- a/Cakefile +++ b/Cakefile @@ -2,7 +2,7 @@ {exec} = require 'child_process' fs = require 'fs' -VERSION = '2.34.3' +VERSION = '2.34.4' HEADER = """ // ==UserScript== diff --git a/changelog b/changelog index 73169da46..79471f118 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master + +2.34.4 - Mayhem Add /q/ archive redirection. diff --git a/latest.js b/latest.js index ad1ae4685..fca18ca46 100644 --- a/latest.js +++ b/latest.js @@ -1 +1 @@ -postMessage({version:'2.34.3'},'*') \ No newline at end of file +postMessage({version:'2.34.4'},'*') \ No newline at end of file diff --git a/script.coffee b/script.coffee index 220ca5a75..594cf6b77 100644 --- a/script.coffee +++ b/script.coffee @@ -4111,7 +4111,7 @@ Main = $.globalEval "(#{code})()".replace '_id_', bq.id namespace: '4chan_x.' - version: '2.34.3' + version: '2.34.4' callbacks: [] css: ' /* dialog styling */ From 1dbd1f364017ea5e9b792dfb726df22cce506fc6 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Fri, 10 Aug 2012 20:32:41 +0200 Subject: [PATCH 07/20] Unexpand threads to show 3 replies only in /q/. --- 4chan_x.user.js | 9 +++++---- script.coffee | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 73bb166c4..3ad1e5627 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -948,6 +948,7 @@ switch (g.BOARD) { case 'b': case 'vg': + case 'q': return 3; case 't': return 1; @@ -1877,10 +1878,10 @@ return (count > 1500 ? $.addClass : $.rmClass)(counter, 'warning'); }, drag: function(e) { - var i; - i = e.type === 'dragstart' ? 'off' : 'on'; - $[i](d, 'dragover', QR.dragOver); - return $[i](d, 'drop', QR.dropFile); + var toggle; + toggle = e.type === 'dragstart' ? $.off : $.on; + toggle(d, 'dragover', QR.dragOver); + return toggle(d, 'drop', QR.dropFile); }, dragOver: function(e) { e.preventDefault(); diff --git a/script.coffee b/script.coffee index 594cf6b77..c79f0f130 100644 --- a/script.coffee +++ b/script.coffee @@ -771,7 +771,7 @@ ExpandThread = a.textContent = a.textContent.replace '-', '+' #goddamit moot num = switch g.BOARD - when 'b', 'vg' then 3 + when 'b', 'vg', 'q' then 3 when 't' then 1 else 5 replies = $$ '.replyContainer', thread @@ -1455,9 +1455,9 @@ QR = drag: (e) -> # Let it drag anything from the page. - i = if e.type is 'dragstart' then 'off' else 'on' - $[i] d, 'dragover', QR.dragOver - $[i] d, 'drop', QR.dropFile + toggle = if e.type is 'dragstart' then $.off else $.on + toggle d, 'dragover', QR.dragOver + toggle d, 'drop', QR.dropFile dragOver: (e) -> e.preventDefault() e.dataTransfer.dropEffect = 'copy' # cursor feedback From d42e4962f0f24d73c0dd41d338af3efe4bbb4a3a Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 11 Aug 2012 18:06:12 +0200 Subject: [PATCH 08/20] =?UTF-8?q?md401.homelinux.net=20->=20www.clich?= =?UTF-8?q?=C3=A9.net?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 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 3ad1e5627..72b1466ae 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -4602,7 +4602,7 @@ } break; case 'e': - url = "https://md401.homelinux.net/4chan/cgi-board.pl/" + path; + url = "https://www.cliché.net/4chan/cgi-board.pl/" + path; if (threadID && postID) { url += "#p" + postID; } diff --git a/script.coffee b/script.coffee index c79f0f130..0f09ec60d 100644 --- a/script.coffee +++ b/script.coffee @@ -3598,7 +3598,7 @@ Redirect = # when 'an', 'k', 'toy', 'x' # "http://archive.heinessen.com/#{board}/full_image/#{filename}" # when 'e' - # "https://md401.homelinux.net/4chan/cgi-board.pl/#{board}/full_image/#{filename}" + # "https://www.cliché.net/4chan/cgi-board.pl/#{board}/full_image/#{filename}" post: (board, postID) -> switch board when 'a', 'co', 'jp', 'm', 'q', 'sp', 'tg', 'tv', 'v', 'vg', 'wsg', 'dev', 'foolz' @@ -3639,7 +3639,7 @@ Redirect = if threadID and postID url += "#p#{postID}" when 'e' - url = "https://md401.homelinux.net/4chan/cgi-board.pl/#{path}" + url = "https://www.cliché.net/4chan/cgi-board.pl/#{path}" if threadID and postID url += "#p#{postID}" else From d50294cb5ad0849149508c7cb1a6a9257c6c592d Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Mon, 13 Aug 2012 17:22:31 +0200 Subject: [PATCH 09/20] Fix cooldown on /q/. --- 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 72b1466ae..518e38337 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2497,7 +2497,7 @@ location.pathname = "/" + g.BOARD + "/res/" + postID; } else { QR.cooldown.auto = QR.replies.length > 1; - QR.cooldown.set(/sage/i.test(reply.email) ? 60 : 30); + QR.cooldown.set(g.BOARD === 'q' || /sage/i.test(reply.email) ? 60 : 30); if (Conf['Open Reply in New Tab'] && !g.REPLY && !QR.cooldown.auto) { $.open("//boards.4chan.org/" + g.BOARD + "/res/" + threadID + "#p" + postID); } diff --git a/changelog b/changelog index 79471f118..0f1747e57 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- Mayhem + Fix cooldown on /q/. 2.34.4 - Mayhem diff --git a/script.coffee b/script.coffee index 0f09ec60d..2584ef6b6 100644 --- a/script.coffee +++ b/script.coffee @@ -1960,7 +1960,7 @@ QR = else # Enable auto-posting if we have stuff to post, disable it otherwise. QR.cooldown.auto = QR.replies.length > 1 - QR.cooldown.set if /sage/i.test reply.email then 60 else 30 + QR.cooldown.set if g.BOARD is 'q' or /sage/i.test reply.email then 60 else 30 if Conf['Open Reply in New Tab'] && !g.REPLY && !QR.cooldown.auto $.open "//boards.4chan.org/#{g.BOARD}/res/#{threadID}#p#{postID}" From a045d238e3d3b4d6ae4f55f2e1876ac8b89f8903 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 19 Aug 2012 22:55:39 +0200 Subject: [PATCH 10/20] Update image limit for /vg/ according to >>>/q/116439 --- 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 518e38337..66fbddcae 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -4346,7 +4346,7 @@ case 'mlp': return 251; case 'vg': - return 501; + return 376; default: return 151; } diff --git a/script.coffee b/script.coffee index 2584ef6b6..e6e074260 100644 --- a/script.coffee +++ b/script.coffee @@ -3453,7 +3453,7 @@ ThreadStats = when 'a', 'b', 'v', 'co', 'mlp' 251 when 'vg' - 501 + 376 else 151 Main.callbacks.push @node From 26c18d1526faf0b4736f27c9bfb6a30717294100 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 19 Aug 2012 22:59:21 +0200 Subject: [PATCH 11/20] Add /mlp/ archive redirection. #518 --- 4chan_x.user.js | 1 + changelog | 1 + script.coffee | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 66fbddcae..9ac585538 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -4593,6 +4593,7 @@ case 'an': case 'fit': case 'k': + case 'mlp': case 'r9k': case 'toy': case 'x': diff --git a/changelog b/changelog index 0f1747e57..7a06abbea 100644 --- a/changelog +++ b/changelog @@ -1,6 +1,7 @@ master - Mayhem Fix cooldown on /q/. + Add /mlp/ archive redirection. 2.34.4 - Mayhem diff --git a/script.coffee b/script.coffee index e6e074260..57796ffc3 100644 --- a/script.coffee +++ b/script.coffee @@ -3634,7 +3634,7 @@ Redirect = url = "//archive.rebeccablacktech.com/#{path}" if threadID and postID url += "#p#{postID}" - when 'an', 'fit', 'k', 'r9k', 'toy', 'x' + when 'an', 'fit', 'k', 'mlp', 'r9k', 'toy', 'x' url = "http://archive.heinessen.com/#{path}" if threadID and postID url += "#p#{postID}" From 8a965fe9fce8e1c3d62d6bb0cd543be941e069c0 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Mon, 20 Aug 2012 00:18:39 +0200 Subject: [PATCH 12/20] Prevent upload if the subject is required. Close #660. --- 4chan_x.user.js | 17 +++++++++++++---- script.coffee | 15 +++++++++++---- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 9ac585538..31a87b407 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2354,7 +2354,7 @@ })); }, submit: function(e) { - var callbacks, captcha, captchas, challenge, err, m, opts, post, reply, response, threadID; + var callbacks, captcha, captchas, challenge, err, m, opts, post, reply, response, threadID, _ref; if (e != null) { e.preventDefault(); } @@ -2366,9 +2366,18 @@ QR.abort(); reply = QR.replies[0]; threadID = g.THREAD_ID || $('select', QR.el).value; - if (!(threadID === 'new' && reply.file || threadID !== 'new' && (reply.com || reply.file))) { - err = 'No file selected.'; - } else if (QR.captchaIsEnabled) { + if (threadID === 'new') { + if (((_ref = g.BOARD) === 'vg' || _ref === 'q') && !reply.sub) { + err = 'New threads require a subject.'; + } else if (!reply.file) { + err = 'No file selected.'; + } + } else { + if (!(reply.com || reply.file)) { + err = 'No file selected.'; + } + } + if (QR.captchaIsEnabled && !err) { captchas = $.get('captchas', []); while ((captcha = captchas[0]) && captcha.time < Date.now()) { captchas.shift(); diff --git a/script.coffee b/script.coffee index 57796ffc3..8b3973982 100644 --- a/script.coffee +++ b/script.coffee @@ -1824,14 +1824,21 @@ QR = QR.status() return QR.abort() - reply = QR.replies[0] + reply = QR.replies[0] threadID = g.THREAD_ID or $('select', QR.el).value # prevent errors - unless threadID is 'new' and reply.file or threadID isnt 'new' and (reply.com or reply.file) - err = 'No file selected.' - else if QR.captchaIsEnabled + if threadID is 'new' + if g.BOARD in ['vg', 'q'] and !reply.sub + err = 'New threads require a subject.' + else unless reply.file + err = 'No file selected.' + else + unless reply.com or reply.file + err = 'No file selected.' + + if QR.captchaIsEnabled and !err # get oldest valid captcha captchas = $.get 'captchas', [] # remove old captchas From f48f4c37a91ff57035a97c6518fc74ba8cccb279 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Mon, 20 Aug 2012 00:54:56 +0200 Subject: [PATCH 13/20] Support fileless thread creation. --- 4chan_x.user.js | 5 +++-- changelog | 1 + script.coffee | 21 +++++++++++---------- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 31a87b407..f7f0cbd4f 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2354,7 +2354,7 @@ })); }, submit: function(e) { - var callbacks, captcha, captchas, challenge, err, m, opts, post, reply, response, threadID, _ref; + var callbacks, captcha, captchas, challenge, err, m, opts, post, reply, response, textOnly, threadID, _ref; if (e != null) { e.preventDefault(); } @@ -2369,7 +2369,7 @@ if (threadID === 'new') { if (((_ref = g.BOARD) === 'vg' || _ref === 'q') && !reply.sub) { err = 'New threads require a subject.'; - } else if (!reply.file) { + } else if (!(reply.file || (textOnly = !!$('input[name=textonly]', $.id('postForm'))))) { err = 'No file selected.'; } } else { @@ -2422,6 +2422,7 @@ com: reply.com, upfile: reply.file, spoiler: reply.spoiler, + textonly: textOnly, mode: 'regist', pwd: (m = d.cookie.match(/4chan_pass=([^;]+)/)) ? decodeURIComponent(m[1]) : $('input[name=pwd]').value, recaptcha_challenge_field: challenge, diff --git a/changelog b/changelog index 7a06abbea..1eb3236b8 100644 --- a/changelog +++ b/changelog @@ -1,6 +1,7 @@ master - Mayhem Fix cooldown on /q/. + Fix thread creation with no file on /q/. Add /mlp/ archive redirection. 2.34.4 diff --git a/script.coffee b/script.coffee index 8b3973982..0eba6f5e5 100644 --- a/script.coffee +++ b/script.coffee @@ -1832,8 +1832,8 @@ QR = if threadID is 'new' if g.BOARD in ['vg', 'q'] and !reply.sub err = 'New threads require a subject.' - else unless reply.file - err = 'No file selected.' + 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.' @@ -1876,14 +1876,15 @@ QR = QR.status progress: '...' post = - resto: threadID - name: reply.name - email: reply.email - sub: reply.sub - com: reply.com - upfile: reply.file - spoiler: reply.spoiler - mode: 'regist' + resto: threadID + name: reply.name + email: reply.email + sub: reply.sub + com: reply.com + upfile: reply.file + spoiler: reply.spoiler + textonly: textOnly + mode: 'regist' pwd: if m = d.cookie.match(/4chan_pass=([^;]+)/) then decodeURIComponent m[1] else $('input[name=pwd]').value recaptcha_challenge_field: challenge recaptcha_response_field: response + ' ' From 7fb4c97611e46ba923ec9387c22730f012cd1dde Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Mon, 20 Aug 2012 23:27:15 +0200 Subject: [PATCH 14/20] Fix #668 --- 4chan_x.user.js | 3 +++ changelog | 1 + script.coffee | 2 ++ 3 files changed, 6 insertions(+) diff --git a/4chan_x.user.js b/4chan_x.user.js index f7f0cbd4f..1439d11b7 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3799,6 +3799,9 @@ _ref = post.quotes; for (_i = 0, _len = _ref.length; _i < _len; _i++) { quote = _ref[_i]; + if (quote.parentNode.getAttribute('style') === 'font-size: smaller;') { + break; + } if (qid = quote.hash.slice(2)) { quotes[qid] = true; } diff --git a/changelog b/changelog index 1eb3236b8..27e44b225 100644 --- a/changelog +++ b/changelog @@ -2,6 +2,7 @@ master - Mayhem Fix cooldown on /q/. Fix thread creation with no file on /q/. + Fix 'Administrator/Moderator/Developer Replies' creating extra backlinks on /q/. Add /mlp/ archive redirection. 2.34.4 diff --git a/script.coffee b/script.coffee index 0eba6f5e5..a91b8a489 100644 --- a/script.coffee +++ b/script.coffee @@ -3021,6 +3021,8 @@ QuoteBacklink = return if post.isInlined quotes = {} for quote in post.quotes + # Stop at 'Admin/Mod/Dev Replies:' on /q/ + break if quote.parentNode.getAttribute('style') is 'font-size: smaller;' # Don't process >>>/b/. if qid = quote.hash[2..] # Duplicate quotes get overwritten. From c7e5f3afab4f70faacedf44964f9006b161bf41d Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Mon, 20 Aug 2012 23:29:15 +0200 Subject: [PATCH 15/20] Release 2.34.5. --- 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 1439d11b7..f07f3adbb 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan x -// @version 2.34.4 +// @version 2.34.5 // @namespace aeosynth // @description Adds various features. // @copyright 2009-2011 James Campos @@ -23,7 +23,7 @@ * Copyright (c) 2009-2011 James Campos * Copyright (c) 2012 Nicolas Stepien * http://mayhemydg.github.com/4chan-x/ - * 4chan X 2.34.4 + * 4chan X 2.34.5 * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -5258,7 +5258,7 @@ return $.globalEval(("(" + code + ")()").replace('_id_', bq.id)); }, namespace: '4chan_x.', - version: '2.34.4', + version: '2.34.5', callbacks: [], css: '\ /* dialog styling */\ diff --git a/Cakefile b/Cakefile index 4ced5b458..5925c4d1c 100644 --- a/Cakefile +++ b/Cakefile @@ -2,7 +2,7 @@ {exec} = require 'child_process' fs = require 'fs' -VERSION = '2.34.4' +VERSION = '2.34.5' HEADER = """ // ==UserScript== diff --git a/changelog b/changelog index 27e44b225..0e7291d76 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master + +2.34.5 - Mayhem Fix cooldown on /q/. Fix thread creation with no file on /q/. diff --git a/latest.js b/latest.js index fca18ca46..d22f8e383 100644 --- a/latest.js +++ b/latest.js @@ -1 +1 @@ -postMessage({version:'2.34.4'},'*') \ No newline at end of file +postMessage({version:'2.34.5'},'*') \ No newline at end of file diff --git a/script.coffee b/script.coffee index a91b8a489..c44864ab6 100644 --- a/script.coffee +++ b/script.coffee @@ -4121,7 +4121,7 @@ Main = $.globalEval "(#{code})()".replace '_id_', bq.id namespace: '4chan_x.' - version: '2.34.4' + version: '2.34.5' callbacks: [] css: ' /* dialog styling */ From 2fac05917d1d0d3a80806740270febce298f4a13 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 22 Aug 2012 23:58:09 +0200 Subject: [PATCH 16/20] Spoilered images do not show the filename, use the .title of the fileinfo. --- 4chan_x.user.js | 26 +++++++++++++++++--------- changelog | 2 ++ script.coffee | 29 +++++++++++++++-------------- 3 files changed, 34 insertions(+), 23 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index f07f3adbb..845d83bca 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -487,6 +487,15 @@ $.add(d.head, script); return $.rm(script); }, + shortenFilename: function(filename, isOP) { + var threshold; + threshold = isOP ? 40 : 30; + if (filename.replace(/\.\w+$/, '').length > threshold) { + return "" + filename.slice(0, threshold - 5) + "(...)" + (filename.match(/\.\w+$/)); + } else { + return filename; + } + }, bytesToString: function(size) { var unit; unit = 0; @@ -3378,23 +3387,23 @@ return Main.callbacks.push(this.node); }, node: function(post) { - var alt, node, span; + var alt, filename, node, _ref; if (post.isInlined && !post.isCrosspost || !post.fileInfo) { return; } node = post.fileInfo.firstElementChild; alt = post.img.alt; - span = $('span', node); + filename = ((_ref = $('span', node)) != null ? _ref.title : void 0) || node.title; FileInfo.data = { link: post.img.parentNode.href, spoiler: /^Spoiler/.test(alt), size: alt.match(/\d+\.?\d*/)[0], unit: alt.match(/\w+$/)[0], - resolution: span.previousSibling.textContent.match(/\d+x\d+|PDF/)[0], - fullname: span.title, - shortname: span.textContent + resolution: node.textContent.match(/\d+x\d+|PDF/)[0], + fullname: filename, + shortname: $.shortenFilename(filename, post.isOP) }; - node.setAttribute('data-filename', span.title); + node.setAttribute('data-filename', filename); return node.innerHTML = FileInfo.funk(FileInfo); }, setFormats: function() { @@ -3537,7 +3546,7 @@ } }, parseArchivedPost: function(req, board, postID, root, cb) { - var bq, br, capcode, data, email, file, filename, filesize, isOP, name, nameBlock, pc, pi, piM, span, spoiler, subject, threadID, threshold, thumb_src, timestamp, trip, userID; + var bq, br, capcode, data, email, file, filename, filesize, isOP, name, nameBlock, pc, pi, piM, span, spoiler, subject, threadID, thumb_src, timestamp, trip, userID; data = JSON.parse(req.response); $.addClass(root, 'archivedPost'); if (data.error) { @@ -3710,8 +3719,7 @@ })); span = $('span[title]', file); span.title = filename; - threshold = isOP ? 40 : 30; - span.textContent = filename.replace(/\.\w+$/, '').length > threshold ? "" + filename.slice(0, threshold - 5) + "(...)" + (filename.match(/\.\w+$/)) : filename; + span.textContent = $.shortenFilename(filename, isOP); thumb_src = data.media_status === 'available' ? "src=" + data.thumb_link : ''; $.add(file, $.el('a', { className: spoiler ? 'fileThumb imgspoiler' : 'fileThumb', diff --git a/changelog b/changelog index 0e7291d76..e6998b29f 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +-Mayhem + Fix support of change in 4chan's HTML about hidden filename in case of spoiler. 2.34.5 - Mayhem diff --git a/script.coffee b/script.coffee index c44864ab6..f5b190c1d 100644 --- a/script.coffee +++ b/script.coffee @@ -368,6 +368,15 @@ $.extend $, script = $.el 'script', textContent: code $.add d.head, script $.rm script + shortenFilename: (filename, isOP) -> + # FILENAME SHORTENING SCIENCE: + # OPs have a +10 characters threshold. + # The file extension is not taken into account. + threshold = if isOP then 40 else 30 + if filename.replace(/\.\w+$/, '').length > threshold + "#{filename[...threshold - 5]}(...)#{filename.match(/\.\w+$/)}" + else + filename bytesToString: (size) -> unit = 0 # Bytes while size >= 1024 @@ -2675,17 +2684,17 @@ FileInfo = return if post.isInlined and not post.isCrosspost or not post.fileInfo node = post.fileInfo.firstElementChild alt = post.img.alt - span = $ 'span', node + filename = $('span', node)?.title or node.title FileInfo.data = link: post.img.parentNode.href spoiler: /^Spoiler/.test alt size: alt.match(/\d+\.?\d*/)[0] unit: alt.match(/\w+$/)[0] - resolution: span.previousSibling.textContent.match(/\d+x\d+|PDF/)[0] - fullname: span.title - shortname: span.textContent + resolution: node.textContent.match(/\d+x\d+|PDF/)[0] + fullname: filename + shortname: $.shortenFilename filename, post.isOP # XXX GM/Scriptish - node.setAttribute 'data-filename', span.title + node.setAttribute 'data-filename', filename node.innerHTML = FileInfo.funk FileInfo setFormats: -> code = Conf['fileInfo'].replace /%([BKlLMnNprs])/g, (s, c) -> @@ -2954,15 +2963,7 @@ Get = innerHTML: "File: #{data.media_orig}-(#{if spoiler then 'Spoiler Image, ' else ''}#{filesize}, #{data.media_w}x#{data.media_h}, )" span = $ 'span[title]', file span.title = filename - threshold = if isOP then 40 else 30 - span.textContent = - # FILENAME SHORTENING SCIENCE: - # OPs have a +10 characters threshold. - # The file extension is not taken into account. - if filename.replace(/\.\w+$/, '').length > threshold - "#{filename[...threshold - 5]}(...)#{filename.match(/\.\w+$/)}" - else - filename + span.textContent = $.shortenFilename filename, isOP thumb_src = if data.media_status is 'available' then "src=#{data.thumb_link}" else '' $.add file, $.el 'a', className: if spoiler then 'fileThumb imgspoiler' else 'fileThumb' From 1ed515dd20cf9df8925b2058346a898d2b6e0170 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 22 Aug 2012 23:59:20 +0200 Subject: [PATCH 17/20] Release 2.34.6. --- 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 845d83bca..890e9c851 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan x -// @version 2.34.5 +// @version 2.34.6 // @namespace aeosynth // @description Adds various features. // @copyright 2009-2011 James Campos @@ -23,7 +23,7 @@ * Copyright (c) 2009-2011 James Campos * Copyright (c) 2012 Nicolas Stepien * http://mayhemydg.github.com/4chan-x/ - * 4chan X 2.34.5 + * 4chan X 2.34.6 * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -5266,7 +5266,7 @@ return $.globalEval(("(" + code + ")()").replace('_id_', bq.id)); }, namespace: '4chan_x.', - version: '2.34.5', + version: '2.34.6', callbacks: [], css: '\ /* dialog styling */\ diff --git a/Cakefile b/Cakefile index 5925c4d1c..1a4824766 100644 --- a/Cakefile +++ b/Cakefile @@ -2,7 +2,7 @@ {exec} = require 'child_process' fs = require 'fs' -VERSION = '2.34.5' +VERSION = '2.34.6' HEADER = """ // ==UserScript== diff --git a/changelog b/changelog index e6998b29f..ae5f18729 100644 --- a/changelog +++ b/changelog @@ -1,6 +1,8 @@ master --Mayhem - Fix support of change in 4chan's HTML about hidden filename in case of spoiler. + +2.34.6 +- Mayhem + Fix error caused by change in 4chan's HTML about hidden filename in case of spoiler. 2.34.5 - Mayhem diff --git a/latest.js b/latest.js index d22f8e383..9f9b93342 100644 --- a/latest.js +++ b/latest.js @@ -1 +1 @@ -postMessage({version:'2.34.5'},'*') \ No newline at end of file +postMessage({version:'2.34.6'},'*') \ No newline at end of file diff --git a/script.coffee b/script.coffee index f5b190c1d..504dd8b3b 100644 --- a/script.coffee +++ b/script.coffee @@ -4122,7 +4122,7 @@ Main = $.globalEval "(#{code})()".replace '_id_', bq.id namespace: '4chan_x.' - version: '2.34.5' + version: '2.34.6' callbacks: [] css: ' /* dialog styling */ From 47c6bbd350e747e24257c8151f62e08c07540e12 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 23 Aug 2012 01:33:59 +0200 Subject: [PATCH 18/20] Fix one-word-captcha. Thank !MyImoutol6 for this. --- 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 890e9c851..80990bae2 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2435,7 +2435,7 @@ mode: 'regist', pwd: (m = d.cookie.match(/4chan_pass=([^;]+)/)) ? decodeURIComponent(m[1]) : $('input[name=pwd]').value, recaptcha_challenge_field: challenge, - recaptcha_response_field: response + ' ' + recaptcha_response_field: response.replace(/^\s+/, 'a ').replace(/\s+$/, ' a') }; callbacks = { onload: function() { diff --git a/changelog b/changelog index ae5f18729..6eea4e7c0 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- Mayhem + Fix one-word-captcha, you'll need to leave a space for the fake word now. 2.34.6 - Mayhem diff --git a/script.coffee b/script.coffee index 504dd8b3b..ea2de6d13 100644 --- a/script.coffee +++ b/script.coffee @@ -1896,7 +1896,7 @@ QR = mode: 'regist' pwd: if m = d.cookie.match(/4chan_pass=([^;]+)/) then decodeURIComponent m[1] else $('input[name=pwd]').value recaptcha_challenge_field: challenge - recaptcha_response_field: response + ' ' + recaptcha_response_field: response.replace(/^\s+/, 'a ').replace /\s+$/, ' a' callbacks = onload: -> From 0248c180bd54d173e93ebc29541fd6792cb40149 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 23 Aug 2012 15:56:37 +0200 Subject: [PATCH 19/20] Release 2.34.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 80990bae2..504ed3233 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan x -// @version 2.34.6 +// @version 2.34.7 // @namespace aeosynth // @description Adds various features. // @copyright 2009-2011 James Campos @@ -23,7 +23,7 @@ * Copyright (c) 2009-2011 James Campos * Copyright (c) 2012 Nicolas Stepien * http://mayhemydg.github.com/4chan-x/ - * 4chan X 2.34.6 + * 4chan X 2.34.7 * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -5266,7 +5266,7 @@ return $.globalEval(("(" + code + ")()").replace('_id_', bq.id)); }, namespace: '4chan_x.', - version: '2.34.6', + version: '2.34.7', callbacks: [], css: '\ /* dialog styling */\ diff --git a/Cakefile b/Cakefile index 1a4824766..3ab7973d0 100644 --- a/Cakefile +++ b/Cakefile @@ -2,7 +2,7 @@ {exec} = require 'child_process' fs = require 'fs' -VERSION = '2.34.6' +VERSION = '2.34.7' HEADER = """ // ==UserScript== diff --git a/changelog b/changelog index 6eea4e7c0..43ad1d398 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master + +2.34.7 - Mayhem Fix one-word-captcha, you'll need to leave a space for the fake word now. diff --git a/latest.js b/latest.js index 9f9b93342..5c611770a 100644 --- a/latest.js +++ b/latest.js @@ -1 +1 @@ -postMessage({version:'2.34.6'},'*') \ No newline at end of file +postMessage({version:'2.34.7'},'*') \ No newline at end of file diff --git a/script.coffee b/script.coffee index ea2de6d13..82436346f 100644 --- a/script.coffee +++ b/script.coffee @@ -4122,7 +4122,7 @@ Main = $.globalEval "(#{code})()".replace '_id_', bq.id namespace: '4chan_x.' - version: '2.34.6' + version: '2.34.7' callbacks: [] css: ' /* dialog styling */ From 58f40bf9173a9d5dcb44eb84d4b8aa6c8136860f Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 23 Aug 2012 22:05:44 +0200 Subject: [PATCH 20/20] Fix shortened filename too short for OPs. --- 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 504ed3233..3b9f3295e 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -489,7 +489,7 @@ }, shortenFilename: function(filename, isOP) { var threshold; - threshold = isOP ? 40 : 30; + threshold = 30 + 10 * isOP; if (filename.replace(/\.\w+$/, '').length > threshold) { return "" + filename.slice(0, threshold - 5) + "(...)" + (filename.match(/\.\w+$/)); } else { @@ -3401,7 +3401,7 @@ unit: alt.match(/\w+$/)[0], resolution: node.textContent.match(/\d+x\d+|PDF/)[0], fullname: filename, - shortname: $.shortenFilename(filename, post.isOP) + shortname: $.shortenFilename(filename, post.ID === post.threadID) }; node.setAttribute('data-filename', filename); return node.innerHTML = FileInfo.funk(FileInfo); diff --git a/script.coffee b/script.coffee index 82436346f..32d38b95f 100644 --- a/script.coffee +++ b/script.coffee @@ -372,7 +372,7 @@ $.extend $, # FILENAME SHORTENING SCIENCE: # OPs have a +10 characters threshold. # The file extension is not taken into account. - threshold = if isOP then 40 else 30 + threshold = 30 + 10 * isOP if filename.replace(/\.\w+$/, '').length > threshold "#{filename[...threshold - 5]}(...)#{filename.match(/\.\w+$/)}" else @@ -2692,7 +2692,7 @@ FileInfo = unit: alt.match(/\w+$/)[0] resolution: node.textContent.match(/\d+x\d+|PDF/)[0] fullname: filename - shortname: $.shortenFilename filename, post.isOP + shortname: $.shortenFilename filename, post.ID is post.threadID # XXX GM/Scriptish node.setAttribute 'data-filename', filename node.innerHTML = FileInfo.funk FileInfo