From cc04f1b9e9d5bb33d7dd9d6f238f028942f73406 Mon Sep 17 00:00:00 2001 From: James Campos Date: Tue, 15 Jan 2013 23:27:21 -0800 Subject: [PATCH 01/19] post.hasPdf --- 4chan_x.user.js | 12 +++++++----- script.coffee | 10 ++++++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 992e74ebc..fb5803d1d 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -4630,7 +4630,7 @@ return; } $.id('postcount').textContent = ++ThreadStats.posts; - if (!post.img) { + if (!post.img || post.hasPdf) { return; } imgcount = $.id('imagecount'); @@ -4920,7 +4920,7 @@ return Main.callbacks.push(this.node); }, node: function(post) { - if (!post.img) { + if (!post.img || post.hasPdf) { return; } return $.on(post.img, 'mouseover', ImageHover.mouseover); @@ -5025,7 +5025,7 @@ }, node: function(post) { var a; - if (!post.img) { + if (!post.img || post.hasPdf) { return; } a = post.img.parentNode; @@ -5544,7 +5544,7 @@ } }, preParse: function(node) { - var el, img, parentClass, post; + var el, img, imgParent, parentClass, post; parentClass = node.parentNode.className; el = $('.post', node); post = { @@ -5563,8 +5563,10 @@ img: false }; if (img = $('img[data-md5]', el)) { - post.fileInfo = img.parentNode.previousElementSibling; + imgParent = img.parentNode; post.img = img; + post.fileInfo = imgParent.previousElementSibling; + post.hasPdf = /\.pdf$/.test(imgParent.href); } Main.prettify(post.blockquote); return post; diff --git a/script.coffee b/script.coffee index a0a18901b..8f8021a83 100644 --- a/script.coffee +++ b/script.coffee @@ -3796,7 +3796,7 @@ ThreadStats = node: (post) -> return if post.isInlined $.id('postcount').textContent = ++ThreadStats.posts - return unless post.img + return if (!post.img or post.hasPdf) imgcount = $.id 'imagecount' imgcount.textContent = ++ThreadStats.images if ThreadStats.images > ThreadStats.imgLimit @@ -4012,7 +4012,7 @@ ImageHover = init: -> Main.callbacks.push @node node: (post) -> - return unless post.img + return if (!post.img or post.hasPdf) $.on post.img, 'mouseover', ImageHover.mouseover mouseover: -> # Make sure to remove the previous image hover @@ -4078,7 +4078,7 @@ ImageExpand = @dialog() node: (post) -> - return unless post.img + return if (!post.img or post.hasPdf) a = post.img.parentNode $.on a, 'click', ImageExpand.cb.toggle if ImageExpand.on and !post.el.hidden @@ -4506,8 +4506,10 @@ Main = if img = $ 'img[data-md5]', el # Make sure to not add deleted images, # those do not have a data-md5 attribute. - post.fileInfo = img.parentNode.previousElementSibling + imgParent = img.parentNode post.img = img + post.fileInfo = imgParent.previousElementSibling + post.hasPdf = /\.pdf$/.test imgParent.href Main.prettify post.blockquote post node: (nodes, notify) -> From 92adcaf28a1ce746d126eaed24d01c7847f6ebba Mon Sep 17 00:00:00 2001 From: James Campos Date: Tue, 15 Jan 2013 23:28:56 -0800 Subject: [PATCH 02/19] ImageExpand.expand: return if pdf --- 4chan_x.user.js | 10 +++++++--- script.coffee | 9 +++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index fb5803d1d..9a665b310 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -5127,20 +5127,24 @@ thumb.nextSibling.hidden = true; return $.rmClass(thumb.parentNode.parentNode.parentNode, 'image_expanded'); }, - expand: function(thumb, url) { + expand: function(thumb, src) { var a, img; if ($.x('ancestor-or-self::*[@hidden]', thumb)) { return; } + a = thumb.parentNode; + src || (src = a.href); + if (/\.pdf$/.test(src)) { + return; + } thumb.hidden = true; $.addClass(thumb.parentNode.parentNode.parentNode, 'image_expanded'); if (img = thumb.nextSibling) { img.hidden = false; return; } - a = thumb.parentNode; img = $.el('img', { - src: url || a.href + src: src }); $.on(img, 'error', ImageExpand.error); return $.add(a, img); diff --git a/script.coffee b/script.coffee index 8f8021a83..7d8759332 100644 --- a/script.coffee +++ b/script.coffee @@ -4144,18 +4144,19 @@ ImageExpand = thumb.nextSibling.hidden = true $.rmClass thumb.parentNode.parentNode.parentNode, 'image_expanded' - expand: (thumb, url) -> + expand: (thumb, src) -> # Do not expand images of hidden/filtered replies, or already expanded pictures. return if $.x 'ancestor-or-self::*[@hidden]', thumb + a = thumb.parentNode + src or= a.href + return if /\.pdf$/.test src thumb.hidden = true $.addClass thumb.parentNode.parentNode.parentNode, 'image_expanded' if img = thumb.nextSibling # Expand already loaded picture img.hidden = false return - a = thumb.parentNode - img = $.el 'img', - src: url or a.href + img = $.el 'img', { src } $.on img, 'error', ImageExpand.error $.add a, img From 1b81a791051ca552af958a87dde2b30007aaa7db Mon Sep 17 00:00:00 2001 From: James Campos Date: Wed, 16 Jan 2013 02:31:48 -0800 Subject: [PATCH 03/19] tweak --- 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 9a665b310..66b391c1b 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -4630,7 +4630,7 @@ return; } $.id('postcount').textContent = ++ThreadStats.posts; - if (!post.img || post.hasPdf) { + if (!post.img) { return; } imgcount = $.id('imagecount'); diff --git a/script.coffee b/script.coffee index 7d8759332..1f41b1973 100644 --- a/script.coffee +++ b/script.coffee @@ -3796,7 +3796,7 @@ ThreadStats = node: (post) -> return if post.isInlined $.id('postcount').textContent = ++ThreadStats.posts - return if (!post.img or post.hasPdf) + return unless post.img imgcount = $.id 'imagecount' imgcount.textContent = ++ThreadStats.images if ThreadStats.images > ThreadStats.imgLimit From ac6dd4368202b8d3d13a1cad92c62bec14554590 Mon Sep 17 00:00:00 2001 From: James Campos Date: Wed, 16 Jan 2013 02:33:04 -0800 Subject: [PATCH 04/19] changelog --- changelog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/changelog b/changelog index ba12ffb8f..db000d913 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- James Campos + Don't expand pdfs - Mayhem Add /po/ archive redirection for threads, images and post resurrection. From 9d0121a551906cb1a55cf6ee09aacdf7b2453791 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Fri, 18 Jan 2013 22:05:57 +0100 Subject: [PATCH 05/19] Fuck you moot, don't add titles to mobile elements. --- 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 992e74ebc..0cf89cbda 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1787,7 +1787,7 @@ return $.on(d, 'dragstart dragend', QR.drag); }, node: function(post) { - return $.on($('a[title="Quote this post"]', post.el), 'click', QR.quote); + return $.on($('.postInfo a[title="Quote this post"]', post.el), 'click', QR.quote); }, open: function() { if (QR.el) { diff --git a/changelog b/changelog index ba12ffb8f..e692103a3 100644 --- a/changelog +++ b/changelog @@ -1,6 +1,7 @@ master - Mayhem Add /po/ archive redirection for threads, images and post resurrection. + Fix quoting. 2.37.3 - Mayhem diff --git a/script.coffee b/script.coffee index a0a18901b..25133576f 100644 --- a/script.coffee +++ b/script.coffee @@ -1380,7 +1380,7 @@ QR = $.on d, 'dragstart dragend', QR.drag node: (post) -> - $.on $('a[title="Quote this post"]', post.el), 'click', QR.quote + $.on $('.postInfo a[title="Quote this post"]', post.el), 'click', QR.quote open: -> if QR.el From bef8de6e7035bfc4fe4fc48e682037a0e0deb04b Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Fri, 18 Jan 2013 22:06:55 +0100 Subject: [PATCH 06/19] Release 2.37.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 ef8329edb..dc42b47e0 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan x -// @version 2.37.3 +// @version 2.37.4 // @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.3 + * 4chan X 2.37.4 * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -5632,7 +5632,7 @@ return $.globalEval(("(" + code + ")()").replace('_id_', bq.id)); }, namespace: '4chan_x.', - version: '2.37.3', + version: '2.37.4', callbacks: [], css: '\ /* dialog styling */\ diff --git a/Cakefile b/Cakefile index 0e7e9a509..2b3e96524 100644 --- a/Cakefile +++ b/Cakefile @@ -2,7 +2,7 @@ {exec} = require 'child_process' fs = require 'fs' -VERSION = '2.37.3' +VERSION = '2.37.4' HEADER = """ // ==UserScript== diff --git a/changelog b/changelog index a6b2dc673..924430c5b 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master + +2.37.4 - James Campos Don't expand pdfs - Mayhem diff --git a/latest.js b/latest.js index dda29cbcb..975f6a82e 100644 --- a/latest.js +++ b/latest.js @@ -1 +1 @@ -postMessage({version:'2.37.3'},'*') \ No newline at end of file +postMessage({version:'2.37.4'},'*') \ No newline at end of file diff --git a/script.coffee b/script.coffee index fb2e00925..3ac469375 100644 --- a/script.coffee +++ b/script.coffee @@ -4541,7 +4541,7 @@ Main = $.globalEval "(#{code})()".replace '_id_', bq.id namespace: '4chan_x.' - version: '2.37.3' + version: '2.37.4' callbacks: [] css: ' /* dialog styling */ From dadbb4e792c7d29a9453cff10d84e25a31226be9 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 20 Jan 2013 13:23:49 +0100 Subject: [PATCH 07/19] Fix quoting inside inlined backlinks. Fix #900 Well that's interesting: selectors with Element.querySelector|All will search for corresponding elements inside the whole document, and will only return elements that are inside your given root element. --- 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 dc42b47e0..c9df2cbf6 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1787,7 +1787,7 @@ return $.on(d, 'dragstart dragend', QR.drag); }, node: function(post) { - return $.on($('.postInfo a[title="Quote this post"]', post.el), 'click', QR.quote); + return $.on($('a[title="Quote this post"]', $('.postInfo', post.el)), 'click', QR.quote); }, open: function() { if (QR.el) { diff --git a/changelog b/changelog index 924430c5b..15c0f124d 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- Mayhem + Fix quoting inside inlined backlinks. 2.37.4 - James Campos diff --git a/script.coffee b/script.coffee index 3ac469375..2244b3e79 100644 --- a/script.coffee +++ b/script.coffee @@ -1380,7 +1380,7 @@ QR = $.on d, 'dragstart dragend', QR.drag node: (post) -> - $.on $('.postInfo a[title="Quote this post"]', post.el), 'click', QR.quote + $.on $('a[title="Quote this post"]', $('.postInfo', post.el)), 'click', QR.quote open: -> if QR.el From 8edd4d5e64c290efeabdd9870f0b1610ffdb1c6f Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 20 Jan 2013 13:48:45 +0100 Subject: [PATCH 08/19] Release 2.37.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 c9df2cbf6..3f9f64251 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan x -// @version 2.37.4 +// @version 2.37.5 // @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.4 + * 4chan X 2.37.5 * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -5632,7 +5632,7 @@ return $.globalEval(("(" + code + ")()").replace('_id_', bq.id)); }, namespace: '4chan_x.', - version: '2.37.4', + version: '2.37.5', callbacks: [], css: '\ /* dialog styling */\ diff --git a/Cakefile b/Cakefile index 2b3e96524..452909466 100644 --- a/Cakefile +++ b/Cakefile @@ -2,7 +2,7 @@ {exec} = require 'child_process' fs = require 'fs' -VERSION = '2.37.4' +VERSION = '2.37.5' HEADER = """ // ==UserScript== diff --git a/changelog b/changelog index 15c0f124d..2a54aad3f 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master + +2.37.5 - Mayhem Fix quoting inside inlined backlinks. diff --git a/latest.js b/latest.js index 975f6a82e..e7d56e74f 100644 --- a/latest.js +++ b/latest.js @@ -1 +1 @@ -postMessage({version:'2.37.4'},'*') \ No newline at end of file +postMessage({version:'2.37.5'},'*') \ No newline at end of file diff --git a/script.coffee b/script.coffee index 2244b3e79..e0f5f3de2 100644 --- a/script.coffee +++ b/script.coffee @@ -4541,7 +4541,7 @@ Main = $.globalEval "(#{code})()".replace '_id_', bq.id namespace: '4chan_x.' - version: '2.37.4' + version: '2.37.5' callbacks: [] css: ' /* dialog styling */ From fa5f51f1df5113e5832f44bfa4c5a0d6baafc454 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 22 Jan 2013 20:19:18 +0100 Subject: [PATCH 09/19] Fix image expanding. --- 4chan_x.user.js | 4 ++-- changelog | 2 ++ script.coffee | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 3f9f64251..3feacc991 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -5139,7 +5139,7 @@ } thumb.hidden = true; $.addClass(thumb.parentNode.parentNode.parentNode, 'image_expanded'); - if (img = thumb.nextSibling) { + if ((img = thumb.nextSibling) && img.nodeName === 'IMG') { img.hidden = false; return; } @@ -5147,7 +5147,7 @@ src: src }); $.on(img, 'error', ImageExpand.error); - return $.add(a, img); + return $.after(thumb, img); }, error: function() { var src, thumb, timeoutID, url; diff --git a/changelog b/changelog index 2a54aad3f..26ae45ae8 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- Mayhem + Fix image expanding. 2.37.5 - Mayhem diff --git a/script.coffee b/script.coffee index e0f5f3de2..5e14de5dd 100644 --- a/script.coffee +++ b/script.coffee @@ -4152,13 +4152,13 @@ ImageExpand = return if /\.pdf$/.test src thumb.hidden = true $.addClass thumb.parentNode.parentNode.parentNode, 'image_expanded' - if img = thumb.nextSibling + if (img = thumb.nextSibling) && img.nodeName is 'IMG' # Expand already loaded picture img.hidden = false return img = $.el 'img', { src } $.on img, 'error', ImageExpand.error - $.add a, img + $.after thumb, img error: -> thumb = @previousSibling From 1f94b35df4b58dc0c1fd7e45406b93e1222c0e9a Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 22 Jan 2013 20:22:28 +0100 Subject: [PATCH 10/19] Release 2.37.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 3feacc991..bd01854a9 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan x -// @version 2.37.5 +// @version 2.37.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 Nicolas Stepien * http://mayhemydg.github.com/4chan-x/ - * 4chan X 2.37.5 + * 4chan X 2.37.6 * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -5632,7 +5632,7 @@ return $.globalEval(("(" + code + ")()").replace('_id_', bq.id)); }, namespace: '4chan_x.', - version: '2.37.5', + version: '2.37.6', callbacks: [], css: '\ /* dialog styling */\ diff --git a/Cakefile b/Cakefile index 452909466..5ec06402a 100644 --- a/Cakefile +++ b/Cakefile @@ -2,7 +2,7 @@ {exec} = require 'child_process' fs = require 'fs' -VERSION = '2.37.5' +VERSION = '2.37.6' HEADER = """ // ==UserScript== diff --git a/changelog b/changelog index 26ae45ae8..072314455 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master + +2.37.6 - Mayhem Fix image expanding. diff --git a/latest.js b/latest.js index e7d56e74f..26f123028 100644 --- a/latest.js +++ b/latest.js @@ -1 +1 @@ -postMessage({version:'2.37.5'},'*') \ No newline at end of file +postMessage({version:'2.37.6'},'*') \ No newline at end of file diff --git a/script.coffee b/script.coffee index 5e14de5dd..82be337d3 100644 --- a/script.coffee +++ b/script.coffee @@ -4541,7 +4541,7 @@ Main = $.globalEval "(#{code})()".replace '_id_', bq.id namespace: '4chan_x.' - version: '2.37.5' + version: '2.37.6' callbacks: [] css: ' /* dialog styling */ From b587719af8335f6fc03a1be1e7f3f01bc335eac4 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 6 Feb 2013 20:26:25 +0100 Subject: [PATCH 11/19] Close #921. --- 4chan_x.user.js | 4 ++++ changelog | 2 ++ script.coffee | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index bd01854a9..a97adabe6 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -4782,6 +4782,7 @@ return "//archive.foolz.us/" + board + "/full_image/" + filename; case 'u': return "//nsfw.foolz.us/" + board + "/full_image/" + filename; + case 'int': case 'po': return "http://archive.thedarkcave.org/" + board + "/full_image/" + filename; case 'ck': @@ -4820,6 +4821,8 @@ case 'u': case 'kuku': return "//nsfw.foolz.us/_/api/chan/post/?board=" + board + "&num=" + postID; + case 'c': + case 'int': case 'po': return "http://archive.thedarkcave.org/_/api/chan/post/?board=" + board + "&num=" + postID; } @@ -4850,6 +4853,7 @@ case 'kuku': url = Redirect.path('//nsfw.foolz.us', 'foolfuuka', data); break; + case 'int': case 'po': url = Redirect.path('http://archive.thedarkcave.org', 'foolfuuka', data); break; diff --git a/changelog b/changelog index 072314455..aceb901c2 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- Mayhem + Add /int/ archive redirection for threads, and post resurrection. 2.37.6 - Mayhem diff --git a/script.coffee b/script.coffee index 82be337d3..fd573c7ba 100644 --- a/script.coffee +++ b/script.coffee @@ -3944,7 +3944,7 @@ 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' + when 'c', 'int', 'po' "http://archive.thedarkcave.org/_/api/chan/post/?board=#{board}&num=#{postID}" to: (data) -> unless data.isSearch @@ -3955,7 +3955,7 @@ Redirect = url = Redirect.path '//archive.foolz.us', 'foolfuuka', data when 'u', 'kuku' url = Redirect.path '//nsfw.foolz.us', 'foolfuuka', data - when 'po' + when 'int', 'po' url = Redirect.path 'http://archive.thedarkcave.org', 'foolfuuka', data when 'ck', 'lit' url = Redirect.path '//fuuka.warosu.org', 'fuuka', data From b49664a11ae81b1c52303079d39cba30cdad3049 Mon Sep 17 00:00:00 2001 From: queue Date: Thu, 7 Feb 2013 01:49:15 -0700 Subject: [PATCH 12/19] Implement relative dates, close #758 Squash of 21 commits: -- Document "%R" relative time formatter Sounds reasonable, don't you think? -- Implement %R time formatter original code do not steal -- Add absolute time as title on date elements -- Update relative post times if necessary Coupled code, I know. Would be better to have a 'threadupdate' event to subscribe to, oh well. -- Update changelog -- Rewrite relative date formatter function Aeosynth-approved, or at least acknoledged -- Reimplement relative post times in namespace Less quick-and-dirty, more right. Still need to polyfill visibility -- Polyfill and correct usage of page visibility Reselecting the tab always flushes (since ui thread block will be percieved as part of the tab switch), but background flushes don't queue when tab is not visible. This is actually a better implementation than html5chan has right now, will need to backport it later. -- Remove %R reference in documentation -- Clean up RelativeDates code Aeosynth approved (TM) (C) -- Move page visibility polyfill to Main -- Remove unnecessary ? -- Replace $.hidden() fn with d.hidden -- Use visibility polyfill for QR -- Remove all future relative dates Looks like it's all over after this. -- Compact pluralize condition -- Fix alignment -- Change RelativeDates.flush -> @flush -- Remove initial setTimeout Is unnecessary, as node is called, which will call flush at least once and set the timeout again. -- Improve absolute date display and cache diff Title tooltip now uses either time formatting rice or the original 4chan timestamp instead of toString(). the diff between a date and now is now shared between `relative` and `setUpdate` to avoid recalculation. -- Remove re-calling of Time formatting Relying on the ordering of `node` callbacks, so textContext will already have the formatted time. --- 4chan_x.user.js | 103 ++++++++++++++++++++++++++++++++++---- changelog | 2 + script.coffee | 129 +++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 216 insertions(+), 18 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index a97adabe6..5c9007b86 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -81,7 +81,7 @@ */ (function() { - 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; + 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, RelativeDates, ReplyHiding, ReportLink, RevealSpoilers, Sauce, StrikethroughQuotes, ThreadHiding, ThreadStats, Time, TitlePost, UI, Unread, Updater, Watcher, d, g, _base; Config = { main: { @@ -91,6 +91,7 @@ '404 Redirect': [true, 'Redirect dead threads and images'], 'Keybinds': [true, 'Binds actions to keys'], 'Time Formatting': [true, 'Arbitrarily formatted timestamps, using your local time'], + 'Relative Post Dates': [false, 'Display post times as "3 minutes ago" or similar. Hover tooltip will display the original or formatted timestamp'], 'File Info Formatting': [true, 'Reformats the file information'], 'Comment Expansion': [true, 'Expand too long comments'], 'Thread Expansion': [true, 'View all replies'], @@ -516,8 +517,19 @@ 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; + debounce: function(wait, fn) { + var timeout; + timeout = null; + return function() { + if (timeout) { + clearTimeout(timeout); + } else { + fn.apply(this, arguments); + } + return timeout = setTimeout((function() { + return timeout = null; + }), wait); + }; } }); @@ -1841,7 +1853,7 @@ if (QR.captcha.isEnabled && /captcha|verification/i.test(el.textContent)) { $('[autocomplete]', QR.el).focus(); } - if ($.hidden()) { + if (d.hidden) { return alert(el.textContent); } }, @@ -3033,7 +3045,7 @@ } $.add(d.body, dialog); $.on(d, 'QRPostSuccessful', this.cb.post); - return $.on(d, 'visibilitychange ovisibilitychange mozvisibilitychange webkitvisibilitychange', this.cb.visibility); + return $.on(d, 'visibilitychange', this.cb.visibility); }, /* http://freesound.org/people/pierrecartoons1979/sounds/90112/ @@ -3052,7 +3064,7 @@ return setTimeout(Updater.update, 500); }, visibility: function() { - if ($.hidden()) { + if (d.hidden) { return; } Updater.unsuccessfulFetchCount = 0; @@ -3088,7 +3100,7 @@ return Updater.scrollBG = this.checked ? function() { return true; } : function() { - return !$.hidden(); + return !d.hidden; }; }, load: function() { @@ -3159,7 +3171,7 @@ Updater.count.className = count ? 'new' : null; } if (count) { - if (Conf['Beep'] && $.hidden() && (Unread.replies.length === 0)) { + if (Conf['Beep'] && d.hidden && (Unread.replies.length === 0)) { Updater.audio.play(); } Updater.unsuccessfulFetchCount = 0; @@ -3187,7 +3199,7 @@ var i, j; i = +Conf['Interval']; j = Math.min(this.unsuccessfulFetchCount, 9); - if (!$.hidden()) { + if (!d.hidden) { j = Math.min(j, 6); } return Math.max(i, [5, 10, 15, 20, 30, 60, 90, 120, 240, 300][j]); @@ -3537,6 +3549,59 @@ } }; + RelativeDates = { + INTERVAL: $.MINUTE, + init: function() { + Main.callbacks.push(this.node); + return $.on(d, 'visibilitychange', this.flush); + }, + node: function(post) { + var dateEl, diff, utc; + dateEl = $('.postInfo > .dateTime', post.el); + utc = dateEl.dataset.utc * 1000; + dateEl.title = dateEl.textContent; + diff = Date.now() - utc; + dateEl.textContent = RelativeDates.relative(diff); + RelativeDates.setUpdate(dateEl, diff); + return RelativeDates.flush(); + }, + relative: function(diff) { + var number, rounded, unit; + unit = (number = diff / $.DAY) > 1 ? 'day' : (number = diff / $.HOUR) > 1 ? 'hour' : (number = diff / $.MINUTE) > 1 ? 'minute' : (number = diff / $.SECOND, 'second'); + rounded = Math.round(number); + if (rounded !== 1) { + unit += 's'; + } + return "" + rounded + " " + unit + " ago"; + }, + stale: [], + flush: $.debounce($.SECOND, function() { + var dateEl, diff, _i, _len, _ref; + if (d.hidden) { + return; + } + _ref = RelativeDates.stale; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + dateEl = _ref[_i]; + if (d.contains(dateEl)) { + diff = Date.now() - dateEl.dataset.utc * 1000; + dateEl.textContent = RelativeDates.relative(diff); + RelativeDates.setUpdate(dateEl, diff); + } + } + RelativeDates.stale = []; + clearTimeout(RelativeDates.timeout); + return RelativeDates.timeout = setTimeout(RelativeDates.flush, RelativeDates.INTERVAL); + }), + setUpdate: function(dateEl, diff) { + var delay; + delay = diff > $.HOUR ? diff % $.HOUR : diff > $.MINUTE ? diff % $.MINUTE : diff % $.SECOND; + return setTimeout((function() { + return RelativeDates.stale.push(dateEl); + }), delay); + } + }; + FileInfo = { init: function() { if (g.BOARD === 'f') { @@ -4782,7 +4847,6 @@ return "//archive.foolz.us/" + board + "/full_image/" + filename; case 'u': return "//nsfw.foolz.us/" + board + "/full_image/" + filename; - case 'int': case 'po': return "http://archive.thedarkcave.org/" + board + "/full_image/" + filename; case 'ck': @@ -5308,12 +5372,28 @@ settings.disableAll = true; localStorage.setItem('4chan-settings', JSON.stringify(settings)); } + Main.polyfill(); if (g.CATALOG) { return $.ready(Main.catalog); } else { return Main.features(); } }, + polyfill: function() { + var event, prefix, property; + if (!('visibilityState' in document)) { + prefix = 'mozVisibilityState' in document ? 'moz' : 'webkitvisibilityState' in document ? 'webkit' : 'o'; + property = prefix + 'VisibilityState'; + event = prefix + 'visibilitychange'; + d.visibilityState = d[property]; + d.hidden = d.visibilityState === 'hidden'; + return $.on(d, event, function() { + d.visibilityState = d[property]; + d.hidden = d.visibilityState === 'hidden'; + return $.event(d, new CustomEvent('visibilitychange')); + }); + } + }, catalog: function() { if (Conf['Catalog Links']) { CatalogLinks.init(); @@ -5375,6 +5455,9 @@ if (Conf['Time Formatting']) { Time.init(); } + if (Conf['Relative Post Dates']) { + RelativeDates.init(); + } if (Conf['File Info Formatting']) { FileInfo.init(); } diff --git a/changelog b/changelog index aceb901c2..8e774c7b0 100644 --- a/changelog +++ b/changelog @@ -1,6 +1,8 @@ master - Mayhem Add /int/ archive redirection for threads, and post resurrection. +- Queue + Add relative time ("35 seconds ago") date formatting option. 2.37.6 - Mayhem diff --git a/script.coffee b/script.coffee index fd573c7ba..6acfa8868 100644 --- a/script.coffee +++ b/script.coffee @@ -6,6 +6,7 @@ Config = '404 Redirect': [true, 'Redirect dead threads and images'] 'Keybinds': [true, 'Binds actions to keys'] 'Time Formatting': [true, 'Arbitrarily formatted timestamps, using your local time'] + 'Relative Post Dates': [false, 'Display post times as "3 minutes ago" or similar. Hover tooltip will display the original or formatted timestamp'] 'File Info Formatting': [true, 'Reformats the file information'] 'Comment Expansion': [true, 'Expand too long comments'] 'Thread Expansion': [true, 'View all replies'] @@ -397,8 +398,19 @@ $.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 + # a function that will execute at most every 'wait' ms. executes immediately + # if possible, else discards invocation + debounce: (wait, fn) -> + timeout = null + return -> + if timeout + # stop current reset + clearTimeout timeout + else + fn.apply this, arguments + + # after wait, let next invocation execute immediately + timeout = setTimeout (-> timeout = null), wait $.cache.requests = {} @@ -1422,7 +1434,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 $.hidden() + alert el.textContent if d.hidden cleanError: -> $('.warning', QR.el).textContent = null @@ -2458,7 +2470,7 @@ Updater = $.add d.body, dialog $.on d, 'QRPostSuccessful', @cb.post - $.on d, 'visibilitychange ovisibilitychange mozvisibilitychange webkitvisibilitychange', @cb.visibility + $.on d, 'visibilitychange', @cb.visibility ### http://freesound.org/people/pierrecartoons1979/sounds/90112/ @@ -2472,7 +2484,7 @@ Updater = Updater.unsuccessfulFetchCount = 0 setTimeout Updater.update, 500 visibility: -> - return if $.hidden() + return if d.hidden # Reset the counter when we focus this tab. Updater.unsuccessfulFetchCount = 0 if Updater.timer.textContent < -Conf['Interval'] @@ -2500,7 +2512,7 @@ Updater = if @checked -> true else - -> ! $.hidden() + -> ! d.hidden load: -> switch @status when 404 @@ -2555,7 +2567,7 @@ Updater = Updater.count.className = if count then 'new' else null if count - if Conf['Beep'] and $.hidden() and (Unread.replies.length is 0) + if Conf['Beep'] and d.hidden and (Unread.replies.length is 0) Updater.audio.play() Updater.unsuccessfulFetchCount = 0 else @@ -2580,7 +2592,7 @@ Updater = getInterval: -> i = +Conf['Interval'] j = Math.min @unsuccessfulFetchCount, 9 - unless $.hidden() + unless d.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] @@ -2827,6 +2839,82 @@ Time = S: -> Time.zeroPad Time.date.getSeconds() y: -> Time.date.getFullYear() - 2000 +RelativeDates = + INTERVAL: $.MINUTE + init: -> + Main.callbacks.push @node + + # flush when page becomes visible again + $.on d, 'visibilitychange', @flush + node: (post) -> + dateEl = $ '.postInfo > .dateTime', post.el + + utc = dateEl.dataset.utc * 1000 # convert data-utc to milliseconds + + # Show original absolute time as tooltip so users can still know exact times + # Since "Time Formatting" runs `node` before us, the title tooltip will + # pick up the user-formatted time instead of 4chan time when enabled. + dateEl.title = dateEl.textContent + + diff = Date.now() - utc + + dateEl.textContent = RelativeDates.relative diff + RelativeDates.setUpdate dateEl, diff + + # Main calls @node whenever a DOM node is added (update, inline post, + # whatever), so use also this reflow opportunity to flush any other dates + # flush is debounced, so this won't burn too much cpu + RelativeDates.flush() + + # diff is milliseconds from now + relative: (diff) -> + unit = if (number = (diff / $.DAY)) > 1 + 'day' + else if (number = (diff / $.HOUR)) > 1 + 'hour' + else if (number = (diff / $.MINUTE)) > 1 + 'minute' + else + number = diff / $.SECOND + 'second' + + rounded = Math.round number + unit += 's' if rounded isnt 1 # pluralize + + "#{rounded} #{unit} ago" + + # changing all relative dates as soon as possible incurs many annoying + # redraws and scroll stuttering. Thus, sacrifice accuracy for UX/CPU economy, + # and perform redraws when the DOM is otherwise being manipulated (and scroll + # stuttering won't be noticed), falling back to INTERVAL while the page + # is visible. + # + # each individual dateTime element will be added to the stale list when it + # needs to change. + stale: [] + flush: $.debounce($.SECOND, -> + # no point in changing the dates until the user sees them + return if d.hidden + for dateEl in RelativeDates.stale + if d.contains dateEl # not removed from DOM + diff = Date.now() - dateEl.dataset.utc * 1000 + dateEl.textContent = RelativeDates.relative diff + RelativeDates.setUpdate dateEl, diff + RelativeDates.stale = [] + clearTimeout RelativeDates.timeout + RelativeDates.timeout = setTimeout RelativeDates.flush, RelativeDates.INTERVAL) + + # Add element to stale list when the relative date string would change + # diff is in milliseconds between dateEl and now + setUpdate: (dateEl, diff) -> + delay = if diff > $.HOUR + diff % $.HOUR + else if diff > $.MINUTE + diff % $.MINUTE + else + diff % $.SECOND + setTimeout (-> RelativeDates.stale.push dateEl), delay + FileInfo = init: -> return if g.BOARD is 'f' @@ -4274,11 +4362,33 @@ Main = settings.disableAll = true localStorage.setItem '4chan-settings', JSON.stringify settings + Main.polyfill() + if g.CATALOG $.ready Main.catalog else Main.features() + polyfill: -> + # page visibility API + unless 'visibilityState' of document + prefix = if 'mozVisibilityState' of document + 'moz' + else if 'webkitvisibilityState' of document + 'webkit' + else + 'o' + + property = prefix + 'VisibilityState' + event = prefix + 'visibilitychange' + + d.visibilityState = d[property] + d.hidden = d.visibilityState is 'hidden' + $.on d, event, -> + d.visibilityState = d[property] + d.hidden = d.visibilityState is 'hidden' + $.event d, new CustomEvent 'visibilitychange' + catalog: -> if Conf['Catalog Links'] CatalogLinks.init() @@ -4337,6 +4447,9 @@ Main = if Conf['Time Formatting'] Time.init() + if Conf['Relative Post Dates'] + RelativeDates.init() + if Conf['File Info Formatting'] FileInfo.init() From 43aae50ac595aaf70990bd28566940e4e4f71da8 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 7 Feb 2013 13:22:24 +0100 Subject: [PATCH 13/19] thedarkcave now has https support. --- 4chan_x.user.js | 7 +++---- script.coffee | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index a97adabe6..17851beaa 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -4782,9 +4782,8 @@ return "//archive.foolz.us/" + board + "/full_image/" + filename; case 'u': return "//nsfw.foolz.us/" + board + "/full_image/" + filename; - case 'int': case 'po': - return "http://archive.thedarkcave.org/" + board + "/full_image/" + filename; + return "//archive.thedarkcave.org/" + board + "/full_image/" + filename; case 'ck': case 'lit': return "//fuuka.warosu.org/" + board + "/full_image/" + filename; @@ -4824,7 +4823,7 @@ case 'c': case 'int': case 'po': - return "http://archive.thedarkcave.org/_/api/chan/post/?board=" + board + "&num=" + postID; + return "//archive.thedarkcave.org/_/api/chan/post/?board=" + board + "&num=" + postID; } }, to: function(data) { @@ -4855,7 +4854,7 @@ break; case 'int': case 'po': - url = Redirect.path('http://archive.thedarkcave.org', 'foolfuuka', data); + url = Redirect.path('//archive.thedarkcave.org', 'foolfuuka', data); break; case 'ck': case 'lit': diff --git a/script.coffee b/script.coffee index fd573c7ba..a9658ab9a 100644 --- a/script.coffee +++ b/script.coffee @@ -3929,7 +3929,7 @@ Redirect = when 'u' "//nsfw.foolz.us/#{board}/full_image/#{filename}" when 'po' - "http://archive.thedarkcave.org/#{board}/full_image/#{filename}" + "//archive.thedarkcave.org/#{board}/full_image/#{filename}" when 'ck', 'lit' "//fuuka.warosu.org/#{board}/full_image/#{filename}" when 'cgl', 'g', 'mu', 'w' @@ -3945,7 +3945,7 @@ Redirect = when 'u', 'kuku' "//nsfw.foolz.us/_/api/chan/post/?board=#{board}&num=#{postID}" when 'c', 'int', 'po' - "http://archive.thedarkcave.org/_/api/chan/post/?board=#{board}&num=#{postID}" + "//archive.thedarkcave.org/_/api/chan/post/?board=#{board}&num=#{postID}" to: (data) -> unless data.isSearch {threadID} = data @@ -3956,7 +3956,7 @@ Redirect = when 'u', 'kuku' url = Redirect.path '//nsfw.foolz.us', 'foolfuuka', data when 'int', 'po' - url = Redirect.path 'http://archive.thedarkcave.org', 'foolfuuka', data + url = Redirect.path '//archive.thedarkcave.org', 'foolfuuka', data when 'ck', 'lit' url = Redirect.path '//fuuka.warosu.org', 'fuuka', data when 'diy', 'sci' From bed90cfd0317f1bce20a8924117549114c9805d9 Mon Sep 17 00:00:00 2001 From: queue Date: Thu, 7 Feb 2013 10:31:35 -0700 Subject: [PATCH 14/19] Reduce recalculation needed for RelativeDates Capture more state in closure scopes. Pretty clever, at the expense of simplicity. --- 4chan_x.user.js | 39 +++++++++++++++++++++-------------- script.coffee | 54 +++++++++++++++++++++++++++++++------------------ 2 files changed, 58 insertions(+), 35 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 5c9007b86..47e916545 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3558,11 +3558,11 @@ node: function(post) { var dateEl, diff, utc; dateEl = $('.postInfo > .dateTime', post.el); - utc = dateEl.dataset.utc * 1000; dateEl.title = dateEl.textContent; + utc = dateEl.dataset.utc * 1000; diff = Date.now() - utc; dateEl.textContent = RelativeDates.relative(diff); - RelativeDates.setUpdate(dateEl, diff); + RelativeDates.setUpdate(dateEl, utc, diff); return RelativeDates.flush(); }, relative: function(diff) { @@ -3576,29 +3576,38 @@ }, stale: [], flush: $.debounce($.SECOND, function() { - var dateEl, diff, _i, _len, _ref; + var now, update, _i, _len, _ref; if (d.hidden) { return; } + now = Date.now(); _ref = RelativeDates.stale; for (_i = 0, _len = _ref.length; _i < _len; _i++) { - dateEl = _ref[_i]; - if (d.contains(dateEl)) { - diff = Date.now() - dateEl.dataset.utc * 1000; - dateEl.textContent = RelativeDates.relative(diff); - RelativeDates.setUpdate(dateEl, diff); - } + update = _ref[_i]; + update(now); } RelativeDates.stale = []; clearTimeout(RelativeDates.timeout); return RelativeDates.timeout = setTimeout(RelativeDates.flush, RelativeDates.INTERVAL); }), - setUpdate: function(dateEl, diff) { - var delay; - delay = diff > $.HOUR ? diff % $.HOUR : diff > $.MINUTE ? diff % $.MINUTE : diff % $.SECOND; - return setTimeout((function() { - return RelativeDates.stale.push(dateEl); - }), delay); + setUpdate: function(dateEl, utc, diff) { + var markStale, setOwnTimeout, update; + setOwnTimeout = function(diff) { + var delay; + delay = diff > $.HOUR ? diff % $.HOUR : diff > $.MINUTE ? diff % $.MINUTE : diff % $.SECOND; + return setTimeout(markStale, delay); + }; + update = function(now) { + if (d.contains(dateEl)) { + diff = now - utc; + dateEl.textContent = RelativeDates.relative(diff); + return setOwnTimeout(diff); + } + }; + markStale = function() { + return RelativeDates.stale.push(update); + }; + return setOwnTimeout(diff); } }; diff --git a/script.coffee b/script.coffee index 6acfa8868..7a004c54d 100644 --- a/script.coffee +++ b/script.coffee @@ -2849,17 +2849,18 @@ RelativeDates = node: (post) -> dateEl = $ '.postInfo > .dateTime', post.el - utc = dateEl.dataset.utc * 1000 # convert data-utc to milliseconds - # Show original absolute time as tooltip so users can still know exact times # Since "Time Formatting" runs `node` before us, the title tooltip will # pick up the user-formatted time instead of 4chan time when enabled. dateEl.title = dateEl.textContent + # convert data-utc to milliseconds + utc = dateEl.dataset.utc * 1000 + diff = Date.now() - utc dateEl.textContent = RelativeDates.relative diff - RelativeDates.setUpdate dateEl, diff + RelativeDates.setUpdate dateEl, utc, diff # Main calls @node whenever a DOM node is added (update, inline post, # whatever), so use also this reflow opportunity to flush any other dates @@ -2889,31 +2890,44 @@ RelativeDates = # stuttering won't be noticed), falling back to INTERVAL while the page # is visible. # - # each individual dateTime element will be added to the stale list when it - # needs to change. + # each individual dateTime element will add its update() function to the stale list + # when it to be called. stale: [] flush: $.debounce($.SECOND, -> # no point in changing the dates until the user sees them return if d.hidden - for dateEl in RelativeDates.stale - if d.contains dateEl # not removed from DOM - diff = Date.now() - dateEl.dataset.utc * 1000 - dateEl.textContent = RelativeDates.relative diff - RelativeDates.setUpdate dateEl, diff + + now = Date.now() + update now for update in RelativeDates.stale RelativeDates.stale = [] + + # reset automatic flush clearTimeout RelativeDates.timeout RelativeDates.timeout = setTimeout RelativeDates.flush, RelativeDates.INTERVAL) - # Add element to stale list when the relative date string would change - # diff is in milliseconds between dateEl and now - setUpdate: (dateEl, diff) -> - delay = if diff > $.HOUR - diff % $.HOUR - else if diff > $.MINUTE - diff % $.MINUTE - else - diff % $.SECOND - setTimeout (-> RelativeDates.stale.push dateEl), delay + # create function `update()`, closed over dateEl and diff, that, when called + # from `flush()`, updates the element, and re-calls `setOwnTimeout()` to + # re-add `update()` to the stale list later. + setUpdate: (dateEl, utc, diff) -> + setOwnTimeout = (diff) -> + delay = if diff > $.HOUR + diff % $.HOUR + else if diff > $.MINUTE + diff % $.MINUTE + else + diff % $.SECOND + setTimeout markStale, delay + + update = (now) -> + if d.contains dateEl # not removed from DOM + diff = now - utc + dateEl.textContent = RelativeDates.relative diff + setOwnTimeout diff + + markStale = -> RelativeDates.stale.push update + + # kick off initial timeout with current diff + setOwnTimeout diff FileInfo = init: -> From 280575e6f5a60539168eb5ebfe61fe3ff53c4cd1 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 7 Feb 2013 20:31:01 +0100 Subject: [PATCH 15/19] Release 2.38.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 190d83a1a..00db3d6a0 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan x -// @version 2.37.6 +// @version 2.38.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.37.6 + * 4chan X 2.38.0 * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -5728,7 +5728,7 @@ return $.globalEval(("(" + code + ")()").replace('_id_', bq.id)); }, namespace: '4chan_x.', - version: '2.37.6', + version: '2.38.0', callbacks: [], css: '\ /* dialog styling */\ diff --git a/Cakefile b/Cakefile index 5ec06402a..fe3173817 100644 --- a/Cakefile +++ b/Cakefile @@ -2,7 +2,7 @@ {exec} = require 'child_process' fs = require 'fs' -VERSION = '2.37.6' +VERSION = '2.38.0' HEADER = """ // ==UserScript== diff --git a/changelog b/changelog index 8e774c7b0..aa2ba6244 100644 --- a/changelog +++ b/changelog @@ -1,8 +1,10 @@ master + +2.38.0 +- Queue + Add relative time ("35 seconds ago"), disabled by default. - Mayhem Add /int/ archive redirection for threads, and post resurrection. -- Queue - Add relative time ("35 seconds ago") date formatting option. 2.37.6 - Mayhem diff --git a/latest.js b/latest.js index 26f123028..8ccc26fef 100644 --- a/latest.js +++ b/latest.js @@ -1 +1 @@ -postMessage({version:'2.37.6'},'*') \ No newline at end of file +postMessage({version:'2.38.0'},'*') \ No newline at end of file diff --git a/script.coffee b/script.coffee index 90b0de36e..5ba636df7 100644 --- a/script.coffee +++ b/script.coffee @@ -4668,7 +4668,7 @@ Main = $.globalEval "(#{code})()".replace '_id_', bq.id namespace: '4chan_x.' - version: '2.37.6' + version: '2.38.0' callbacks: [] css: ' /* dialog styling */ From 7cc62847e7f0bb2e5ff4ab9bcc675bd9e61f9a50 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 7 Feb 2013 20:34:43 +0100 Subject: [PATCH 16/19] Change changelog. It's called relative dates everywhere else. --- changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog b/changelog index aa2ba6244..a10db0c1d 100644 --- a/changelog +++ b/changelog @@ -2,7 +2,7 @@ master 2.38.0 - Queue - Add relative time ("35 seconds ago"), disabled by default. + Add Relative Post Dates ("35 seconds ago"), disabled by default. - Mayhem Add /int/ archive redirection for threads, and post resurrection. From c7afc923e0b6a5362c9fa11ec36ae6228832bbc7 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 9 Feb 2013 03:51:07 +0100 Subject: [PATCH 17/19] typo, blame @qqueue --- 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 00db3d6a0..219371d42 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -5391,7 +5391,7 @@ polyfill: function() { var event, prefix, property; if (!('visibilityState' in document)) { - prefix = 'mozVisibilityState' in document ? 'moz' : 'webkitvisibilityState' in document ? 'webkit' : 'o'; + prefix = 'mozVisibilityState' in document ? 'moz' : 'webkitVisibilityState' in document ? 'webkit' : 'o'; property = prefix + 'VisibilityState'; event = prefix + 'visibilitychange'; d.visibilityState = d[property]; diff --git a/script.coffee b/script.coffee index 5ba636df7..b119492ad 100644 --- a/script.coffee +++ b/script.coffee @@ -4388,7 +4388,7 @@ Main = unless 'visibilityState' of document prefix = if 'mozVisibilityState' of document 'moz' - else if 'webkitvisibilityState' of document + else if 'webkitVisibilityState' of document 'webkit' else 'o' From 6bcbf3deeb78116335d94f1932a172a98de1016a Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 9 Feb 2013 21:23:30 +0100 Subject: [PATCH 18/19] Shorter Relative Post Dates description. --- script.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script.coffee b/script.coffee index b119492ad..7c378ff80 100644 --- a/script.coffee +++ b/script.coffee @@ -6,7 +6,7 @@ Config = '404 Redirect': [true, 'Redirect dead threads and images'] 'Keybinds': [true, 'Binds actions to keys'] 'Time Formatting': [true, 'Arbitrarily formatted timestamps, using your local time'] - 'Relative Post Dates': [false, 'Display post times as "3 minutes ago" or similar. Hover tooltip will display the original or formatted timestamp'] + 'Relative Post Dates': [false, 'Display dates as "3 minutes ago" f.e., tooltip shows the timestamp'] 'File Info Formatting': [true, 'Reformats the file information'] 'Comment Expansion': [true, 'Expand too long comments'] 'Thread Expansion': [true, 'View all replies'] From fb9edd517643a5e6d2c9afc7857e3066bf04a3a5 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 9 Feb 2013 21:26:55 +0100 Subject: [PATCH 19/19] Release 2.38.1. --- 4chan_x.user.js | 6 +++--- Cakefile | 2 +- changelog | 4 ++++ latest.js | 2 +- script.coffee | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 219371d42..3a6e585bb 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan x -// @version 2.38.0 +// @version 2.38.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.38.0 + * 4chan X 2.38.1 * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -5728,7 +5728,7 @@ return $.globalEval(("(" + code + ")()").replace('_id_', bq.id)); }, namespace: '4chan_x.', - version: '2.38.0', + version: '2.38.1', callbacks: [], css: '\ /* dialog styling */\ diff --git a/Cakefile b/Cakefile index fe3173817..656f0ce6b 100644 --- a/Cakefile +++ b/Cakefile @@ -2,7 +2,7 @@ {exec} = require 'child_process' fs = require 'fs' -VERSION = '2.38.0' +VERSION = '2.38.1' HEADER = """ // ==UserScript== diff --git a/changelog b/changelog index a10db0c1d..77bfc088d 100644 --- a/changelog +++ b/changelog @@ -1,5 +1,9 @@ master +2.38.1 +- Mayhem + Fix a little regression introduced in 2.38.0 for webkit browsers. + 2.38.0 - Queue Add Relative Post Dates ("35 seconds ago"), disabled by default. diff --git a/latest.js b/latest.js index 8ccc26fef..cfd9adaef 100644 --- a/latest.js +++ b/latest.js @@ -1 +1 @@ -postMessage({version:'2.38.0'},'*') \ No newline at end of file +postMessage({version:'2.38.1'},'*') \ No newline at end of file diff --git a/script.coffee b/script.coffee index 7c378ff80..55a3debe7 100644 --- a/script.coffee +++ b/script.coffee @@ -4668,7 +4668,7 @@ Main = $.globalEval "(#{code})()".replace '_id_', bq.id namespace: '4chan_x.' - version: '2.38.0' + version: '2.38.1' callbacks: [] css: ' /* dialog styling */