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 = $ '#recaptcha_response_field'
recaptcha.addEventListener('keydown', recaptchaListener, true) recaptcha.addEventListener('keydown', recaptchaListener, true)
#major features expandClick = ->
if getConfig 'Image Expansion' thumbs = $$ 'img[md5]'
g.callbacks.push (root) -> if @checked #Expand
thumbs = $$ 'img[md5]', root
for thumb in thumbs 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) -> imageClick = (e) ->
e.preventDefault() e.preventDefault()
thumb = @firstChild thumb = @firstChild
if thumb.className is 'hide' if thumb.className is 'hide'
imageContract this thumbShow thumb
else else
imageExpand this thumbHide thumb
imageContract = (a) -> thumbShow = (thumb) ->
thumb = a.firstChild
thumb.className = '' thumb.className = ''
remove a.lastChild remove thumb.nextSibling
imageExpand = (a) -> thumbHide = (thumb) ->
thumb = a.firstChild
thumb.className = 'hide' thumb.className = 'hide'
link = thumb.parentNode
img = n 'img', img = n 'img',
src: a.href src: link.href
a.appendChild img 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' if getConfig 'Localize Time'
g.callbacks.push (root) -> g.callbacks.push (root) ->

View File

@ -1,5 +1,5 @@
(function() { (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) { var __slice = Array.prototype.slice, __indexOf = Array.prototype.indexOf || function(item) {
for (var i = 0, l = this.length; i < l; i++) { for (var i = 0, l = this.length; i < l; i++) {
if (this[i] === item) return i; if (this[i] === item) return i;
@ -1194,7 +1194,55 @@
} }
recaptcha = $('#recaptcha_response_field'); recaptcha = $('#recaptcha_response_field');
recaptcha.addEventListener('keydown', recaptchaListener, true); 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')) { 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) { g.callbacks.push(function(root) {
var thumb, thumbs, _i, _len, _results; var thumb, thumbs, _i, _len, _results;
thumbs = $$('img[md5]', root); thumbs = $$('img[md5]', root);
@ -1206,31 +1254,6 @@
return _results; 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')) { if (getConfig('Localize Time')) {
g.callbacks.push(function(root) { g.callbacks.push(function(root) {
var date, day, dotw, hour, min_sec, month, s, span, spans, year, _i, _len, _ref, _results; var date, day, dotw, hour, min_sec, month, s, span, spans, year, _i, _len, _ref, _results;