From 8341bad88181614bc235ae856a3a18e1a16c70d3 Mon Sep 17 00:00:00 2001 From: James Campos Date: Mon, 20 Feb 2012 21:49:31 -0800 Subject: [PATCH 1/4] expandImages -> expandImage (singular) --- 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 19688495e..83bf616d2 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -169,7 +169,7 @@ expandThread: ['e', 'Expand thread'], watch: ['w', 'Watch thread'], hide: ['x', 'Hide thread'], - expandImages: ['m', 'Expand selected image'], + expandImage: ['m', 'Expand selected image'], expandAllImages: ['M', 'Expand all images'], update: ['u', 'Update now'], unreadCountTo0: ['z', 'Reset unread status'] @@ -969,7 +969,7 @@ case conf.expandThread: expandThread.toggle(thread); break; - case conf.expandImages: + case conf.expandImage: keybinds.img(thread); break; case conf.nextThread: diff --git a/script.coffee b/script.coffee index cde610667..4755f4b06 100644 --- a/script.coffee +++ b/script.coffee @@ -120,7 +120,7 @@ config = expandThread: ['e', 'Expand thread'] watch: ['w', 'Watch thread'] hide: ['x', 'Hide thread'] - expandImages: ['m', 'Expand selected image'] + expandImage: ['m', 'Expand selected image'] expandAllImages: ['M', 'Expand all images'] update: ['u', 'Update now'] unreadCountTo0: ['z', 'Reset unread status'] @@ -789,7 +789,7 @@ keybinds = keybinds.open thread when conf.expandThread expandThread.toggle thread - when conf.expandImages + when conf.expandImage keybinds.img thread when conf.nextThread return if g.REPLY From 7637becde37af924c5649cf24d1e73c3f05e2220 Mon Sep 17 00:00:00 2001 From: James Campos Date: Mon, 20 Feb 2012 21:53:40 -0800 Subject: [PATCH 2/4] expand from current --- 4chan_x.user.js | 24 ++++++++++++++++-------- script.coffee | 9 ++++++++- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 83bf616d2..6c45d450e 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -101,7 +101,8 @@ 'Image Expansion': [true, 'Expand images'], 'Image Hover': [false, 'Show full image on mouseover'], 'Sauce': [true, 'Add sauce to images'], - 'Reveal Spoilers': [false, 'Replace spoiler thumbnails by the original thumbnail'] + 'Reveal Spoilers': [false, 'Replace spoiler thumbnails by the original thumbnail'], + 'Expand From Current': [true, 'Expand images from current position to thread end.'] }, Monitoring: { 'Thread Updater': [true, 'Update threads. Has more options in its own dialog.'], @@ -3435,18 +3436,25 @@ return imgExpand.toggle(this); }, all: function() { - var thumb, _i, _j, _len, _len2, _ref, _ref2; + var i, thumb, thumbs, _i, _j, _len, _len2, _len3, _ref; imgExpand.on = this.checked; if (imgExpand.on) { - _ref = $$('img[md5]'); - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - thumb = _ref[_i]; + thumbs = $$('img[md5]'); + if (conf['Expand From Current']) { + for (i = 0, _len = thumbs.length; i < _len; i++) { + thumb = thumbs[i]; + if (thumb.getBoundingClientRect().top > 0) break; + } + thumbs = thumbs.slice(i); + } + for (_i = 0, _len2 = thumbs.length; _i < _len2; _i++) { + thumb = thumbs[_i]; imgExpand.expand(thumb); } } else { - _ref2 = $$('img[md5][hidden]'); - for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) { - thumb = _ref2[_j]; + _ref = $$('img[md5][hidden]'); + for (_j = 0, _len3 = _ref.length; _j < _len3; _j++) { + thumb = _ref[_j]; imgExpand.contract(thumb); } } diff --git a/script.coffee b/script.coffee index 4755f4b06..00a4f51d5 100644 --- a/script.coffee +++ b/script.coffee @@ -24,6 +24,7 @@ config = 'Image Hover': [false, 'Show full image on mouseover'] 'Sauce': [true, 'Add sauce to images'] 'Reveal Spoilers': [false, 'Replace spoiler thumbnails by the original thumbnail'] + 'Expand From Current': [true, 'Expand images from current position to thread end.'] Monitoring: 'Thread Updater': [true, 'Update threads. Has more options in its own dialog.'] 'Unread Count': [true, 'Show unread post count in tab title'] @@ -2767,7 +2768,13 @@ imgExpand = all: -> imgExpand.on = @checked if imgExpand.on #expand - for thumb in $$ 'img[md5]' + thumbs = $$ 'img[md5]' + if conf['Expand From Current'] + for thumb, i in thumbs + if thumb.getBoundingClientRect().top > 0 + break + thumbs = thumbs[i...] + for thumb in thumbs imgExpand.expand thumb else #contract for thumb in $$ 'img[md5][hidden]' From 4fed7ab9667f5b5ba90a3d06a2611502798c5849 Mon Sep 17 00:00:00 2001 From: James Campos Date: Tue, 21 Feb 2012 11:44:41 -0800 Subject: [PATCH 3/4] expand from current default disabled --- 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 0fc9f62ba..d38e29b79 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -102,7 +102,7 @@ 'Image Hover': [false, 'Show full image on mouseover'], 'Sauce': [true, 'Add sauce to images'], 'Reveal Spoilers': [false, 'Replace spoiler thumbnails by the original thumbnail'], - 'Expand From Current': [true, 'Expand images from current position to thread end.'] + 'Expand From Current': [false, 'Expand images from current position to thread end.'] }, Monitoring: { 'Thread Updater': [true, 'Update threads. Has more options in its own dialog.'], diff --git a/script.coffee b/script.coffee index 0972fe59d..f59258130 100644 --- a/script.coffee +++ b/script.coffee @@ -24,7 +24,7 @@ config = 'Image Hover': [false, 'Show full image on mouseover'] 'Sauce': [true, 'Add sauce to images'] 'Reveal Spoilers': [false, 'Replace spoiler thumbnails by the original thumbnail'] - 'Expand From Current': [true, 'Expand images from current position to thread end.'] + 'Expand From Current': [false, 'Expand images from current position to thread end.'] Monitoring: 'Thread Updater': [true, 'Update threads. Has more options in its own dialog.'] 'Unread Count': [true, 'Show unread post count in tab title'] From 7122b2935da8313719d2d1cb2f2f62ed599e944c Mon Sep 17 00:00:00 2001 From: James Campos Date: Tue, 21 Feb 2012 11:48:43 -0800 Subject: [PATCH 4/4] mention `new option` in changelog --- changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog b/changelog index 061b24184..f8232873b 100644 --- a/changelog +++ b/changelog @@ -1,6 +1,6 @@ master - aeosynth / ahodesuka - expand images from current position + new option: expand images from current position - ahodesuka Add Open Reply in New Tab option for replies made from the main board (not dumping). Scroll back up (top of anchor - 42px) when unexpanding images.