diff --git a/4chan_x.coffee b/4chan_x.coffee
index ca47dce98..3fe394968 100644
--- a/4chan_x.coffee
+++ b/4chan_x.coffee
@@ -369,6 +369,40 @@ iframeLoad = ->
remove qr
recaptchaReload()
+imageClick = (e) ->
+ e.preventDefault()
+ thumb = @firstChild
+ if thumb.className is 'hide'
+ imageThumb thumb
+ else
+ imageFull thumb
+
+imageExpandClick = ->
+ thumbs = $$ 'img[md5]'
+ if @checked #expand
+ for thumb in thumbs
+ if thumb.className isnt 'hide'
+ #we want the thumbs hidden - we want full sized images
+ imageFull thumb
+ else #contract
+ for thumb in thumbs
+ if thumb.className is 'hide'
+ #we want thumbs shown
+ imageThumb thumb
+
+imageFull = (thumb) ->
+ # show full size image, hide thumb
+ thumb.className = 'hide'
+ link = thumb.parentNode
+ img = n 'img',
+ src: link.href
+ link.appendChild img
+
+imageThumb = (thumb) ->
+ #thumbify the image - show thumb, remove full sized image
+ thumb.className = ''
+ remove thumb.nextSibling
+
keydown = (e) ->
if document.activeElement.nodeName in ['TEXTAREA', 'INPUT']
char = null
@@ -932,42 +966,12 @@ for el in $$ '#recaptcha_table a'
recaptcha = $ '#recaptcha_response_field'
recaptcha.addEventListener('keydown', recaptchaListener, true)
-expandClick = ->
- thumbs = $$ 'img[md5]'
- if @checked #Expand
- for thumb in thumbs
- if thumb.className isnt 'hide'
- thumbHide thumb
- else
- for thumb in thumbs
- if thumb.className is 'hide'
- thumbShow thumb
-
-imageClick = (e) ->
- e.preventDefault()
- thumb = @firstChild
- if thumb.className is 'hide'
- thumbShow thumb
- else
- thumbHide thumb
-
-thumbShow = (thumb) ->
- thumb.className = ''
- remove thumb.nextSibling
-
-thumbHide = (thumb) ->
- thumb.className = 'hide'
- link = thumb.parentNode
- img = n 'img',
- src: link.href
- link.appendChild img
-
#major features
if getConfig 'Image Expansion'
delform = $ 'form[name=delform]'
expand = n 'div',
innerHTML: ""
- $("input", expand).addEventListener 'click', expandClick, true
+ $("input", expand).addEventListener 'click', imageExpandClick, true
inBefore delform.firstChild, expand
g.callbacks.push (root) ->
diff --git a/4chan_x.js b/4chan_x.js
index bfd0d3978..4947ebd77 100644
--- a/4chan_x.js
+++ b/4chan_x.js
@@ -1,5 +1,5 @@
(function() {
- var $, $$, AEOS, DAY, a, addTo, arr, as, autoWatch, autohide, b, board, callback, clearHidden, closeQR, config, cooldown, cutoff, d, delform, down, editSauce, el, expand, expandClick, expandComment, expandThread, formSubmit, g, getConfig, getThread, getTime, hide, hideReply, hideThread, href, html, i, id, iframe, iframeLoad, imageClick, img, inAfter, inBefore, input, inputs, keydown, keypress, l1, lastChecked, m, n, navbotr, navtopr, nodeInserted, now, omitted, onloadComment, onloadThread, options, optionsClose, parseResponse, pathname, qrListener, qrText, quickReply, recaptcha, recaptchaListener, recaptchaReload, redirect, remove, replace, replyNav, report, scroll, show, showReply, showThread, slice, span, src, stopPropagation, temp, text, textContent, thread, threadF, threads, thumbHide, thumbShow, tn, tzOffset, up, watch, watchX, watcher, watcherUpdate, x, zeroPad, _, _base, _fn, _i, _j, _k, _l, _len, _len2, _len3, _len4, _len5, _len6, _m, _ref, _ref2, _ref3, _ref4;
+ var $, $$, AEOS, DAY, a, addTo, arr, as, autoWatch, autohide, b, board, callback, clearHidden, closeQR, config, cooldown, cutoff, d, delform, down, editSauce, el, expand, expandComment, expandThread, formSubmit, g, getConfig, getThread, getTime, hide, hideReply, hideThread, href, html, i, id, iframe, iframeLoad, imageClick, imageExpandClick, imageFull, imageThumb, img, inAfter, inBefore, input, inputs, keydown, keypress, l1, lastChecked, m, n, navbotr, navtopr, nodeInserted, now, omitted, onloadComment, onloadThread, options, optionsClose, parseResponse, pathname, qrListener, qrText, quickReply, recaptcha, recaptchaListener, recaptchaReload, redirect, remove, replace, replyNav, report, scroll, show, showReply, showThread, slice, span, src, stopPropagation, temp, text, textContent, thread, threadF, threads, tn, tzOffset, up, watch, watchX, watcher, watcherUpdate, x, zeroPad, _, _base, _fn, _i, _j, _k, _l, _len, _len2, _len3, _len4, _len5, _len6, _m, _ref, _ref2, _ref3, _ref4;
var __slice = Array.prototype.slice, __indexOf = Array.prototype.indexOf || function(item) {
for (var i = 0, l = this.length; i < l; i++) {
if (this[i] === item) return i;
@@ -473,6 +473,48 @@
}
return recaptchaReload();
};
+ imageClick = function(e) {
+ var thumb;
+ e.preventDefault();
+ thumb = this.firstChild;
+ if (thumb.className === 'hide') {
+ return imageThumb(thumb);
+ } else {
+ return imageFull(thumb);
+ }
+ };
+ imageExpandClick = function() {
+ var thumb, thumbs, _i, _j, _len, _len2, _results, _results2;
+ thumbs = $$('img[md5]');
+ if (this.checked) {
+ _results = [];
+ for (_i = 0, _len = thumbs.length; _i < _len; _i++) {
+ thumb = thumbs[_i];
+ _results.push(thumb.className !== 'hide' ? imageFull(thumb) : void 0);
+ }
+ return _results;
+ } else {
+ _results2 = [];
+ for (_j = 0, _len2 = thumbs.length; _j < _len2; _j++) {
+ thumb = thumbs[_j];
+ _results2.push(thumb.className === 'hide' ? imageThumb(thumb) : void 0);
+ }
+ return _results2;
+ }
+ };
+ imageFull = function(thumb) {
+ var img, link;
+ thumb.className = 'hide';
+ link = thumb.parentNode;
+ img = n('img', {
+ src: link.href
+ });
+ return link.appendChild(img);
+ };
+ imageThumb = function(thumb) {
+ thumb.className = '';
+ return remove(thumb.nextSibling);
+ };
keydown = function(e) {
var char, _ref;
if ((_ref = document.activeElement.nodeName) === 'TEXTAREA' || _ref === 'INPUT') {
@@ -1194,54 +1236,12 @@
}
recaptcha = $('#recaptcha_response_field');
recaptcha.addEventListener('keydown', recaptchaListener, true);
- expandClick = function() {
- var thumb, thumbs, _i, _j, _len, _len2, _results, _results2;
- thumbs = $$('img[md5]');
- if (this.checked) {
- _results = [];
- for (_i = 0, _len = thumbs.length; _i < _len; _i++) {
- thumb = thumbs[_i];
- _results.push(thumb.className !== 'hide' ? thumbHide(thumb) : void 0);
- }
- return _results;
- } else {
- _results2 = [];
- for (_j = 0, _len2 = thumbs.length; _j < _len2; _j++) {
- thumb = thumbs[_j];
- _results2.push(thumb.className === 'hide' ? thumbShow(thumb) : void 0);
- }
- return _results2;
- }
- };
- imageClick = function(e) {
- var thumb;
- e.preventDefault();
- thumb = this.firstChild;
- if (thumb.className === 'hide') {
- return thumbShow(thumb);
- } else {
- return thumbHide(thumb);
- }
- };
- thumbShow = function(thumb) {
- thumb.className = '';
- return remove(thumb.nextSibling);
- };
- thumbHide = function(thumb) {
- var img, link;
- thumb.className = 'hide';
- link = thumb.parentNode;
- img = n('img', {
- src: link.href
- });
- return link.appendChild(img);
- };
if (getConfig('Image Expansion')) {
delform = $('form[name=delform]');
expand = n('div', {
innerHTML: ""
});
- $("input", expand).addEventListener('click', expandClick, true);
+ $("input", expand).addEventListener('click', imageExpandClick, true);
inBefore(delform.firstChild, expand);
g.callbacks.push(function(root) {
var thumb, thumbs, _i, _len, _results;