From 516cf60dc2c3b9e797c605687fc8f4ce91f43ab6 Mon Sep 17 00:00:00 2001 From: James Campos Date: Sat, 18 Dec 2010 23:33:06 -0800 Subject: [PATCH] keybind: M - expand all images --- 4chan_x.coffee | 13 ++++++++----- 4chan_x.js | 14 +++++++++----- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/4chan_x.coffee b/4chan_x.coffee index ee50d7a26..e9e76ab07 100644 --- a/4chan_x.coffee +++ b/4chan_x.coffee @@ -533,10 +533,13 @@ keypress = (e) -> if temp > 15 then temp = 15 location.pathname = "/#{g.BOARD}/#{temp}#0" when "M" - [thread] = getThread() - unless image = $ 'td.replyhl span.filesize ~ a[target]', thread - image = $ 'span.filesize ~ a[target]', thread - imageToggle image + if e.shiftKey + $("#imageExpand").click() + else + [thread] = getThread() + unless image = $ 'td.replyhl span.filesize ~ a[target]', thread + image = $ 'span.filesize ~ a[target]', thread + imageToggle image when "O" href = $("#{hash} ~ span[id] a:last-of-type").href GM_openInTab href @@ -986,7 +989,7 @@ recaptcha.addEventListener('keydown', recaptchaListener, true) if getConfig 'Image Expansion' delform = $ 'form[name=delform]' expand = n 'div', - innerHTML: "" + innerHTML: "" $("input", expand).addEventListener 'click', imageExpandClick, true inBefore delform.firstChild, expand diff --git a/4chan_x.js b/4chan_x.js index 380e4f4d3..12c6fbedc 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -697,11 +697,15 @@ return location.pathname = "/" + g.BOARD + "/" + temp + "#0"; break; case "M": - thread = getThread()[0]; - if (!(image = $('td.replyhl span.filesize ~ a[target]', thread))) { - image = $('span.filesize ~ a[target]', thread); + if (e.shiftKey) { + return $("#imageExpand").click(); + } else { + thread = getThread()[0]; + if (!(image = $('td.replyhl span.filesize ~ a[target]', thread))) { + image = $('span.filesize ~ a[target]', thread); + } + return imageToggle(image); } - return imageToggle(image); break; case "O": href = $("" + hash + " ~ span[id] a:last-of-type").href; @@ -1258,7 +1262,7 @@ if (getConfig('Image Expansion')) { delform = $('form[name=delform]'); expand = n('div', { - innerHTML: "" + innerHTML: "" }); $("input", expand).addEventListener('click', imageExpandClick, true); inBefore(delform.firstChild, expand);