Select the types of activity you want to include in your feed.
@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
···1414 _node : null,
1515 _activeRoot : null,
1616 _visiblePHID : null,
1717+ _alignment: null,
17181819 fetchUrl : '/search/hovercard/',
1920···2930 getCard : function() {
3031 var self = JX.Hovercard;
3132 return self._node;
3333+ },
3434+3535+ getAlignment: function() {
3636+ var self = JX.Hovercard;
3737+ return self._alignment;
3238 },
33393440 show : function(root, phid) {
···8187 var d = JX.Vector.getDim(root);
8288 var n = JX.Vector.getDim(child);
8389 var v = JX.Vector.getViewport();
9090+ var s = JX.Vector.getScroll();
84918592 // Move the tip so it's nicely aligned.
8686- // I'm just doing north/south alignment for now
8787- // TODO: Fix southern graceful align
8893 var margin = 20;
8989- // We can't shift left by ~$margin or more here due to Pholio, Phriction
9090- var x = parseInt(p.x, 10) - margin / 2;
9191- var y = parseInt(p.y - n.y, 10) - margin;
9494+9595+9696+ // Try to align the card directly above the link, with left borders
9797+ // touching.
9898+ var x = p.x;
92999393- // If running off the edge of the viewport, make it margin / 2 away
9494- // from the far right edge of the viewport instead
9595- if ((x + n.x) > (v.x)) {
9696- x = x - parseInt(x + n.x - v.x + margin / 2, 10);
9797- // If more in the center, we can safely center
9898- } else if (x > (n.x / 2) + margin) {
9999- x = parseInt(p.x - (n.x / 2) + d.x, 10);
100100+ // If this would push us off the right side of the viewport, push things
101101+ // back to the left.
102102+ if ((x + n.x + margin) > (s.x + v.x)) {
103103+ x = (s.x + v.x) - n.x - margin;
100104 }
101105102102- // Temporarily disabled, since it gives weird results (you can only see
103103- // a hovercard once, as soon as it's hidden, it cannot be shown again)
104104- // if (y < n.y) {
105105- // // Place it southern, since northern is not enough space
106106- // y = p.y + d.y + margin;
107107- // }
106106+ // Try to put the card above the link.
107107+ var y = p.y - n.y - margin;
108108+ self._alignment = 'north';
109109+110110+ // If the card is near the top of the window, show it beneath the
111111+ // link we're hovering over instead.
112112+ if ((y + margin) < s.y) {
113113+ y = p.y + d.y + margin;
114114+ self._alignment = 'south';
115115+ }
108116109117 node.style.left = x + 'px';
110118 node.style.top = y + 'px';
+20-8
webroot/rsrc/js/core/behavior-hovercard.js
···40404141 var root = JX.Hovercard.getAnchor();
4242 var node = JX.Hovercard.getCard();
4343+ var align = JX.Hovercard.getAlignment();
43444444- // TODO: Add southern cases here, too
4545 var mouse = JX.$V(e);
4646 var node_pos = JX.$V(node);
4747 var node_dim = JX.Vector.getDim(node);
···50505151 var margin = 20;
52525353- // Cursor is above the node.
5454- if (mouse.y < node_pos.y - margin) {
5555- JX.Hovercard.hide();
5656- }
5353+ if (align == 'south') {
5454+ // Cursor is below the node.
5555+ if (mouse.y > node_pos.y + node_dim.y + margin) {
5656+ JX.Hovercard.hide();
5757+ }
57585858- // Cursor is below the root.
5959- if (mouse.y > root_pos.y + root_dim.y + margin) {
6060- JX.Hovercard.hide();
5959+ // Cursor is above the root.
6060+ if (mouse.y < root_pos.y - margin) {
6161+ JX.Hovercard.hide();
6262+ }
6363+ } else {
6464+ // Cursor is above the node.
6565+ if (mouse.y < node_pos.y - margin) {
6666+ JX.Hovercard.hide();
6767+ }
6868+6969+ // Cursor is below the root.
7070+ if (mouse.y > root_pos.y + root_dim.y + margin) {
7171+ JX.Hovercard.hide();
7272+ }
6173 }
62746375 // Cursor is too far to the left.