expand dialog

This commit is contained in:
James Campos 2010-12-10 08:53:57 -08:00
parent c68a4aa9c7
commit f1ef975747
2 changed files with 79 additions and 40 deletions

View File

@ -932,32 +932,48 @@ for el in $$ '#recaptcha_table a'
recaptcha = $ '#recaptcha_response_field'
recaptcha.addEventListener('keydown', recaptchaListener, true)
#major features
if getConfig 'Image Expansion'
g.callbacks.push (root) ->
thumbs = $$ 'img[md5]', root
expandClick = ->
thumbs = $$ 'img[md5]'
if @checked #Expand
for thumb in thumbs
thumb.parentNode.addEventListener 'click', imageClick, true
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'
imageContract this
thumbShow thumb
else
imageExpand this
thumbHide thumb
imageContract = (a) ->
thumb = a.firstChild
thumbShow = (thumb) ->
thumb.className = ''
remove a.lastChild
remove thumb.nextSibling
imageExpand = (a) ->
thumb = a.firstChild
thumbHide = (thumb) ->
thumb.className = 'hide'
link = thumb.parentNode
img = n 'img',
src: a.href
a.appendChild img
src: link.href
link.appendChild img
#major features
if getConfig 'Image Expansion'
delform = $ 'form[name=delform]'
expand = n 'div',
innerHTML: "<label>Expand Images<input type=checkbox></label>"
$("input", expand).addEventListener 'click', expandClick, true
inBefore delform.firstChild, expand
g.callbacks.push (root) ->
thumbs = $$ 'img[md5]', root
for thumb in thumbs
thumb.parentNode.addEventListener 'click', imageClick, true
if getConfig 'Localize Time'
g.callbacks.push (root) ->

View File

@ -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, expandComment, expandThread, formSubmit, g, getConfig, getThread, getTime, hide, hideReply, hideThread, href, html, i, id, iframe, iframeLoad, imageClick, imageContract, imageExpand, 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 $, $$, 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 __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;
@ -1194,7 +1194,55 @@
}
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: "<label>Expand Images<input type=checkbox></label>"
});
$("input", expand).addEventListener('click', expandClick, true);
inBefore(delform.firstChild, expand);
g.callbacks.push(function(root) {
var thumb, thumbs, _i, _len, _results;
thumbs = $$('img[md5]', root);
@ -1206,31 +1254,6 @@
return _results;
});
}
imageClick = function(e) {
var thumb;
e.preventDefault();
thumb = this.firstChild;
if (thumb.className === 'hide') {
return imageContract(this);
} else {
return imageExpand(this);
}
};
imageContract = function(a) {
var thumb;
thumb = a.firstChild;
thumb.className = '';
return remove(a.lastChild);
};
imageExpand = function(a) {
var img, thumb;
thumb = a.firstChild;
thumb.className = 'hide';
img = n('img', {
src: a.href
});
return a.appendChild(img);
};
if (getConfig('Localize Time')) {
g.callbacks.push(function(root) {
var date, day, dotw, hour, min_sec, month, s, span, spans, year, _i, _len, _ref, _results;