ui.hover
This commit is contained in:
parent
969310bfff
commit
4dcbaba38a
61
4chan_x.js
61
4chan_x.js
@ -224,6 +224,16 @@
|
|||||||
d = document;
|
d = document;
|
||||||
d.removeEventListener('mousemove', ui.drag, true);
|
d.removeEventListener('mousemove', ui.drag, true);
|
||||||
return d.removeEventListener('mouseup', ui.dragend, true);
|
return d.removeEventListener('mouseup', ui.dragend, true);
|
||||||
|
},
|
||||||
|
hover: function(e) {
|
||||||
|
var bot, clientX, clientY, el, height, top;
|
||||||
|
clientX = e.clientX, clientY = e.clientY;
|
||||||
|
el = ui.el;
|
||||||
|
height = el.offsetHeight;
|
||||||
|
top = clientY - 120;
|
||||||
|
bot = top + height;
|
||||||
|
el.style.top = ui.winHeight < height || top < 0 ? '0px' : bot > ui.winHeight ? ui.winHeight - height + 'px' : top + 'px';
|
||||||
|
return el.style.left = clientX + 45;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
d = document;
|
d = document;
|
||||||
@ -1673,28 +1683,22 @@
|
|||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
quote = _ref[_i];
|
quote = _ref[_i];
|
||||||
$.bind(quote, 'mouseover', quotePreview.mouseover);
|
$.bind(quote, 'mouseover', quotePreview.mouseover);
|
||||||
$.bind(quote, 'mousemove', quotePreview.mousemove);
|
$.bind(quote, 'mousemove', ui.hover);
|
||||||
_results.push($.bind(quote, 'mouseout', quotePreview.mouseout));
|
_results.push($.bind(quote, 'mouseout', quotePreview.mouseout));
|
||||||
}
|
}
|
||||||
return _results;
|
return _results;
|
||||||
},
|
},
|
||||||
mouseover: function(e) {
|
mouseover: function(e) {
|
||||||
var id, preview, target;
|
var el, id, target;
|
||||||
target = e.target;
|
target = e.target;
|
||||||
id = target.textContent.replace(">>", '');
|
id = target.textContent.replace(">>", '');
|
||||||
preview = $('#qp');
|
el = $('#qp');
|
||||||
preview.innerHTML = d.getElementById(id).innerHTML;
|
el.innerHTML = d.getElementById(id).innerHTML;
|
||||||
return $.show(preview);
|
$.show(el);
|
||||||
},
|
return ui.el = el;
|
||||||
mousemove: function(e) {
|
|
||||||
var clientX, clientY, preview;
|
|
||||||
clientX = e.clientX, clientY = e.clientY;
|
|
||||||
preview = $('#qp');
|
|
||||||
preview.style.left = clientX + 45;
|
|
||||||
return preview.style.top = clientY - 120;
|
|
||||||
},
|
},
|
||||||
mouseout: function(e) {
|
mouseout: function(e) {
|
||||||
return $.hide($('#qr'));
|
return $.hide(ui.el);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
quickReport = {
|
quickReport = {
|
||||||
@ -1896,35 +1900,26 @@
|
|||||||
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
|
||||||
thumb = _ref2[_i];
|
thumb = _ref2[_i];
|
||||||
$.bind(thumb, 'mouseover', imageHover.cb.mouseover);
|
$.bind(thumb, 'mouseover', imageHover.cb.mouseover);
|
||||||
$.bind(thumb, 'mousemove', imageHover.cb.mousemove);
|
$.bind(thumb, 'mousemove', ui.hover);
|
||||||
_results.push($.bind(thumb, 'mouseout', imageHover.cb.mouseout));
|
_results.push($.bind(thumb, 'mouseout', imageHover.cb.mouseout));
|
||||||
}
|
}
|
||||||
return _results;
|
return _results;
|
||||||
},
|
},
|
||||||
mouseover: function(e) {
|
mouseover: function(e) {
|
||||||
var img, target;
|
var el, target;
|
||||||
target = e.target;
|
target = e.target;
|
||||||
img = $('#iHover');
|
el = $('#iHover');
|
||||||
img.src = target.parentNode.href;
|
el.src = target.parentNode.href;
|
||||||
$.show(img);
|
$.show(el);
|
||||||
imageHover.winHeight = d.body.clientHeight;
|
ui.el = el;
|
||||||
return imageHover.winWidth = d.body.clientWidth;
|
ui.winHeight = d.body.clientHeight;
|
||||||
},
|
return ui.winWidth = d.body.clientWidth;
|
||||||
mousemove: function(e) {
|
|
||||||
var bot, clientX, clientY, img, imgHeight, top;
|
|
||||||
clientX = e.clientX, clientY = e.clientY;
|
|
||||||
img = $('#iHover');
|
|
||||||
imgHeight = img.offsetHeight;
|
|
||||||
top = clientY - 120;
|
|
||||||
bot = top + imgHeight;
|
|
||||||
img.style.top = imageHover.winHeight < imgHeight || top < 0 ? '0px' : bot > imageHover.winHeight ? imageHover.winHeight - imgHeight + 'px' : top + 'px';
|
|
||||||
return img.style.left = clientX + 45;
|
|
||||||
},
|
},
|
||||||
mouseout: function(e) {
|
mouseout: function(e) {
|
||||||
var img;
|
var el;
|
||||||
img = $('#iHover');
|
el = ui.el;
|
||||||
$.hide(img);
|
$.hide(img);
|
||||||
return img.src = null;
|
return el.src = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -141,6 +141,21 @@ ui =
|
|||||||
d = document
|
d = document
|
||||||
d.removeEventListener 'mousemove', ui.drag, true
|
d.removeEventListener 'mousemove', ui.drag, true
|
||||||
d.removeEventListener 'mouseup', ui.dragend, true
|
d.removeEventListener 'mouseup', ui.dragend, true
|
||||||
|
hover: (e) ->
|
||||||
|
{clientX, clientY} = e
|
||||||
|
{el} = ui
|
||||||
|
height = el.offsetHeight
|
||||||
|
|
||||||
|
top = clientY - 120
|
||||||
|
bot = top + height
|
||||||
|
el.style.top =
|
||||||
|
if ui.winHeight < height or top < 0
|
||||||
|
'0px'
|
||||||
|
else if bot > ui.winHeight
|
||||||
|
ui.winHeight - height + 'px'
|
||||||
|
else
|
||||||
|
top + 'px'
|
||||||
|
el.style.left = clientX + 45
|
||||||
|
|
||||||
#convenience
|
#convenience
|
||||||
d = document
|
d = document
|
||||||
@ -1329,21 +1344,17 @@ quotePreview =
|
|||||||
node: (root) ->
|
node: (root) ->
|
||||||
for quote in $$ 'a.quotelink', root
|
for quote in $$ 'a.quotelink', root
|
||||||
$.bind quote, 'mouseover', quotePreview.mouseover
|
$.bind quote, 'mouseover', quotePreview.mouseover
|
||||||
$.bind quote, 'mousemove', quotePreview.mousemove
|
$.bind quote, 'mousemove', ui.hover
|
||||||
$.bind quote, 'mouseout', quotePreview.mouseout
|
$.bind quote, 'mouseout', quotePreview.mouseout
|
||||||
mouseover: (e) ->
|
mouseover: (e) ->
|
||||||
{target} = e
|
{target} = e
|
||||||
id = target.textContent.replace ">>", ''
|
id = target.textContent.replace ">>", ''
|
||||||
preview = $ '#qp'
|
el = $ '#qp'
|
||||||
preview.innerHTML = d.getElementById(id).innerHTML
|
el.innerHTML = d.getElementById(id).innerHTML
|
||||||
$.show preview
|
$.show el
|
||||||
mousemove: (e) ->
|
ui.el = el
|
||||||
{clientX, clientY} = e
|
|
||||||
preview = $ '#qp'
|
|
||||||
preview.style.left = clientX + 45
|
|
||||||
preview.style.top = clientY - 120
|
|
||||||
mouseout: (e) ->
|
mouseout: (e) ->
|
||||||
$.hide $ '#qr'
|
$.hide ui.el
|
||||||
|
|
||||||
quickReport =
|
quickReport =
|
||||||
init: ->
|
init: ->
|
||||||
@ -1468,34 +1479,20 @@ imageHover =
|
|||||||
node: (root) ->
|
node: (root) ->
|
||||||
for thumb in $$ 'img[md5]', root
|
for thumb in $$ 'img[md5]', root
|
||||||
$.bind thumb, 'mouseover', imageHover.cb.mouseover
|
$.bind thumb, 'mouseover', imageHover.cb.mouseover
|
||||||
$.bind thumb, 'mousemove', imageHover.cb.mousemove
|
$.bind thumb, 'mousemove', ui.hover
|
||||||
$.bind thumb, 'mouseout', imageHover.cb.mouseout
|
$.bind thumb, 'mouseout', imageHover.cb.mouseout
|
||||||
mouseover: (e) ->
|
mouseover: (e) ->
|
||||||
{target} = e
|
{target} = e
|
||||||
img = $ '#iHover'
|
el = $ '#iHover'
|
||||||
img.src = target.parentNode.href
|
el.src = target.parentNode.href
|
||||||
$.show img
|
$.show el
|
||||||
imageHover.winHeight = d.body.clientHeight
|
ui.el = el
|
||||||
imageHover.winWidth = d.body.clientWidth
|
ui.winHeight = d.body.clientHeight
|
||||||
mousemove: (e) ->
|
ui.winWidth = d.body.clientWidth
|
||||||
{clientX, clientY} = e
|
|
||||||
img = $ '#iHover'
|
|
||||||
imgHeight = img.offsetHeight
|
|
||||||
|
|
||||||
top = clientY - 120
|
|
||||||
bot = top + imgHeight
|
|
||||||
img.style.top =
|
|
||||||
if imageHover.winHeight < imgHeight or top < 0
|
|
||||||
'0px'
|
|
||||||
else if bot > imageHover.winHeight
|
|
||||||
imageHover.winHeight - imgHeight + 'px'
|
|
||||||
else
|
|
||||||
top + 'px'
|
|
||||||
img.style.left = clientX + 45
|
|
||||||
mouseout: (e) ->
|
mouseout: (e) ->
|
||||||
img = $ '#iHover'
|
{el} = ui
|
||||||
$.hide img
|
$.hide img
|
||||||
img.src = null
|
el.src = null
|
||||||
|
|
||||||
imgPreloading =
|
imgPreloading =
|
||||||
init: ->
|
init: ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user