This commit is contained in:
James Campos 2011-07-10 21:02:13 -07:00
parent b33e25ac76
commit bdd2a0375f
2 changed files with 149 additions and 158 deletions

View File

@ -1080,19 +1080,19 @@
input = _ref2[_i]; input = _ref2[_i];
$.bind(input, 'click', $.cb.checked); $.bind(input, 'click', $.cb.checked);
} }
$.bind($('input[type=button]', dialog), 'click', options.cb.clearHidden); $.bind($('input[type=button]', dialog), 'click', options.clearHidden);
_ref3 = $$('#floaty a', dialog); _ref3 = $$('#floaty a', dialog);
for (_j = 0, _len2 = _ref3.length; _j < _len2; _j++) { for (_j = 0, _len2 = _ref3.length; _j < _len2; _j++) {
link = _ref3[_j]; link = _ref3[_j];
$.bind(link, 'click', options.tab); $.bind(link, 'click', options.tab);
} }
$.bind($('textarea[name=flavors]', dialog), 'change', $.cb.value); $.bind($('textarea[name=flavors]', dialog), 'change', $.cb.value);
$.bind($('input[name=time]', dialog), 'keyup', options.cb.time); $.bind($('input[name=time]', dialog), 'keyup', options.time);
_ref4 = $$('#keybinds input', dialog); _ref4 = $$('#keybinds input', dialog);
for (_k = 0, _len3 = _ref4.length; _k < _len3; _k++) { for (_k = 0, _len3 = _ref4.length; _k < _len3; _k++) {
input = _ref4[_k]; input = _ref4[_k];
input.value = $.getValue("key/" + input.name, config.hotkeys[input.name]); input.value = $.getValue("key/" + input.name, config.hotkeys[input.name]);
$.bind(input, 'keydown', options.cb.keybind); $.bind(input, 'keydown', options.keybind);
} }
/* /*
Two parent divs are necessary to center on all browsers. Two parent divs are necessary to center on all browsers.
@ -1105,7 +1105,7 @@
}); });
$.append(overlay, dialog); $.append(overlay, dialog);
$.append(d.body, overlay); $.append(d.body, overlay);
options.cb.time.call($('input[name=time]', dialog)); options.time.call($('input[name=time]', dialog));
$.bind(overlay, 'click', function() { $.bind(overlay, 'click', function() {
return $.rm(overlay); return $.rm(overlay);
}); });
@ -1123,7 +1123,6 @@
} }
return _results; return _results;
}, },
cb: {
clearHidden: function(e) { clearHidden: function(e) {
$.deleteValue("hiddenReplies/" + g.BOARD + "/"); $.deleteValue("hiddenReplies/" + g.BOARD + "/");
$.deleteValue("hiddenThreads/" + g.BOARD + "/"); $.deleteValue("hiddenThreads/" + g.BOARD + "/");
@ -1155,7 +1154,6 @@
Time.date = new Date(); Time.date = new Date();
return $('#timePreview').textContent = Time.funk(Time); return $('#timePreview').textContent = Time.funk(Time);
} }
}
}; };
cooldown = { cooldown = {
init: function() { init: function() {
@ -2301,10 +2299,9 @@
init: function() { init: function() {
unread.replies = []; unread.replies = [];
d.title = '(0) ' + d.title; d.title = '(0) ' + d.title;
$.bind(window, 'scroll', unread.cb.scroll); $.bind(window, 'scroll', unread.scroll);
return g.callbacks.push(unread.cb.node); return g.callbacks.push(unread.node);
}, },
cb: {
node: function(root) { node: function(root) {
if (root.className) { if (root.className) {
return; return;
@ -2332,7 +2329,6 @@
if (unread.replies.length === 0) { if (unread.replies.length === 0) {
return Favicon.update(); return Favicon.update();
} }
}
}, },
updateTitle: function() { updateTitle: function() {
return d.title = d.title.replace(/\d+/, unread.replies.length); return d.title = d.title.replace(/\d+/, unread.replies.length);
@ -2457,15 +2453,14 @@
}); });
$.hide(img); $.hide(img);
$.append(d.body, img); $.append(d.body, img);
return g.callbacks.push(imageHover.cb.node); return g.callbacks.push(imageHover.node);
}, },
cb: {
node: function(root) { node: function(root) {
var thumb; var thumb;
if (!(thumb = $('img[md5]', root))) { if (!(thumb = $('img[md5]', root))) {
return; return;
} }
$.bind(thumb, 'mouseover', imageHover.cb.mouseover); $.bind(thumb, 'mouseover', imageHover.mouseover);
$.bind(thumb, 'mousemove', ui.hover); $.bind(thumb, 'mousemove', ui.hover);
return $.bind(thumb, 'mouseout', ui.hoverend); return $.bind(thumb, 'mouseout', ui.hoverend);
}, },
@ -2477,7 +2472,6 @@
ui.el = el; ui.el = el;
return $.show(el); return $.show(el);
} }
}
}; };
imgPreloading = { imgPreloading = {
init: function() { init: function() {
@ -2505,12 +2499,11 @@
}; };
imgExpand = { imgExpand = {
init: function() { init: function() {
g.callbacks.push(imgExpand.cb.node); g.callbacks.push(imgExpand.node);
imgExpand.dialog(); imgExpand.dialog();
$.bind(window, 'resize', imgExpand.resize); $.bind(window, 'resize', imgExpand.resize);
return imgExpand.resize(); return imgExpand.resize();
}, },
cb: {
node: function(root) { node: function(root) {
var a, thumb; var a, thumb;
if (!(thumb = $('img[md5]', root))) { if (!(thumb = $('img[md5]', root))) {
@ -2522,6 +2515,7 @@
return imgExpand.toggle(a); return imgExpand.toggle(a);
} }
}, },
cb: {
toggle: function(e) { toggle: function(e) {
if (e.shiftKey || e.altKey || e.ctrlKey || e.button !== 0) { if (e.shiftKey || e.altKey || e.ctrlKey || e.button !== 0) {
return; return;

View File

@ -860,13 +860,13 @@ options =
for input in $$ 'input[type=checkbox]', dialog for input in $$ 'input[type=checkbox]', dialog
$.bind input, 'click', $.cb.checked $.bind input, 'click', $.cb.checked
$.bind $('input[type=button]', dialog), 'click', options.cb.clearHidden $.bind $('input[type=button]', dialog), 'click', options.clearHidden
$.bind link, 'click', options.tab for link in $$ '#floaty a', dialog $.bind link, 'click', options.tab for link in $$ '#floaty a', dialog
$.bind $('textarea[name=flavors]', dialog), 'change', $.cb.value $.bind $('textarea[name=flavors]', dialog), 'change', $.cb.value
$.bind $('input[name=time]', dialog), 'keyup', options.cb.time $.bind $('input[name=time]', dialog), 'keyup', options.time
for input in $$ '#keybinds input', dialog for input in $$ '#keybinds input', dialog
input.value = $.getValue "key/#{input.name}", config.hotkeys[input.name] input.value = $.getValue "key/#{input.name}", config.hotkeys[input.name]
$.bind input, 'keydown', options.cb.keybind $.bind input, 'keydown', options.keybind
### ###
Two parent divs are necessary to center on all browsers. Two parent divs are necessary to center on all browsers.
@ -878,7 +878,7 @@ options =
$.append overlay, dialog $.append overlay, dialog
$.append d.body, overlay $.append d.body, overlay
options.cb.time.call $('input[name=time]', dialog) options.time.call $('input[name=time]', dialog)
$.bind overlay, 'click', -> $.rm overlay $.bind overlay, 'click', -> $.rm overlay
$.bind dialog.firstElementChild, 'click', (e) -> e.stopPropagation() $.bind dialog.firstElementChild, 'click', (e) -> e.stopPropagation()
@ -890,7 +890,6 @@ options =
else else
$.hide div $.hide div
cb:
clearHidden: (e) -> clearHidden: (e) ->
#'hidden' might be misleading; it's the number of IDs we're *looking* for, #'hidden' might be misleading; it's the number of IDs we're *looking* for,
# not the number of posts actually hidden on the page. # not the number of posts actually hidden on the page.
@ -1766,10 +1765,9 @@ unread =
init: -> init: ->
unread.replies = [] unread.replies = []
d.title = '(0) ' + d.title d.title = '(0) ' + d.title
$.bind window, 'scroll', unread.cb.scroll $.bind window, 'scroll', unread.scroll
g.callbacks.push unread.cb.node g.callbacks.push unread.node
cb:
node: (root) -> node: (root) ->
return if root.className return if root.className
unread.replies.push root unread.replies.push root
@ -1860,11 +1858,10 @@ imageHover =
img = $.el 'img', id: 'iHover' img = $.el 'img', id: 'iHover'
$.hide img $.hide img
$.append d.body, img $.append d.body, img
g.callbacks.push imageHover.cb.node g.callbacks.push imageHover.node
cb:
node: (root) -> node: (root) ->
return unless thumb = $ 'img[md5]', root return unless thumb = $ 'img[md5]', root
$.bind thumb, 'mouseover', imageHover.cb.mouseover $.bind thumb, 'mouseover', imageHover.mouseover
$.bind thumb, 'mousemove', ui.hover $.bind thumb, 'mousemove', ui.hover
$.bind thumb, 'mouseout', ui.hoverend $.bind thumb, 'mouseout', ui.hoverend
mouseover: (e) -> mouseover: (e) ->
@ -1891,17 +1888,17 @@ imgGif =
imgExpand = imgExpand =
init: -> init: ->
g.callbacks.push imgExpand.cb.node g.callbacks.push imgExpand.node
imgExpand.dialog() imgExpand.dialog()
$.bind window, 'resize', imgExpand.resize $.bind window, 'resize', imgExpand.resize
imgExpand.resize() imgExpand.resize()
cb:
node: (root) -> node: (root) ->
return unless thumb = $ 'img[md5]', root return unless thumb = $ 'img[md5]', root
a = thumb.parentNode a = thumb.parentNode
$.bind a, 'click', imgExpand.cb.toggle $.bind a, 'click', imgExpand.cb.toggle
if imgExpand.on and root.className isnt 'inline' then imgExpand.toggle a if imgExpand.on and root.className isnt 'inline' then imgExpand.toggle a
cb:
toggle: (e) -> toggle: (e) ->
return if e.shiftKey or e.altKey or e.ctrlKey or e.button isnt 0 return if e.shiftKey or e.altKey or e.ctrlKey or e.button isnt 0
e.preventDefault() e.preventDefault()