Are you sure you want to delete this post?
+-+ (...) -
- Post too long. - setSelectedThread(thread.cid)} className="ttl-link">Click here - to view. +
++ +
+ Post too long. + setSelectedThread(thread.cid)} className="ttl-link">Click here + to view. +
) : null}+ +
(...) -
+
++ +
Post too long. - setSelectedThread(thread.cid)} className="ttl-link">Click here + setSelectedThread(thread.cid)} className="ttl-link">Click here to view.
) : null} @@ -1271,27 +1620,116 @@ const All = () => {+ +
{}} key={`mob-r-pm-${index}`} className="quotelink" - onClick={(event) => handleQuoteClick(reply, shortParentCid, thread.shortCid, event)} - onMouseOver={(event) => handleQuoteHover(reply, shortParentCid, thread.shortCid, event)} - onMouseLeave={removeHighlight}> + ref={el => { + quoteRefsMobile.current[reply.cid] = el; + }} + onClick={(event) => handleQuoteClick(reply, shortParentCid, event)} + onMouseOver={(event) => { + event.stopPropagation(); + handleQuoteHover(reply, shortParentCid, () => { + setOutOfViewCid(reply.parentCid); + const rect = quoteRefsMobile.current[reply.cid].getBoundingClientRect(); + const distanceToRight = window.innerWidth - rect.right; + const distanceToTop = rect.top; + const distanceToBottom = window.innerHeight - rect.bottom; + let top; + + if (distanceToTop < postOnHoverHeight / 2) { + top = window.scrollY - 5; + } else if (distanceToBottom < postOnHoverHeight / 2) { + top = window.scrollY - postOnHoverHeight + window.innerHeight - 10; + } else { + top = rect.top + window.scrollY - postOnHoverHeight / 2; + } + + if (distanceToRight < 200) { + setOutOfViewPosition({ + top, + right: window.innerWidth - rect.left - 10, + maxWidth: rect.left - 5 + }); + } else { + setOutOfViewPosition({ + top, + left: rect.left + rect.width + 5, + maxWidth: window.innerWidth - rect.left - rect.width - 5 + }); + } + }); + }} + onMouseLeave={() => { + removeHighlight(); + setOutOfViewCid(null); + }}> {`c/${shortParentCid}`}{shortParentCid === thread.shortCid ? " (OP)" : null}(...) -
+
++ +
Comment too long. - setSelectedThread(thread.cid)} className="ttl-link">Click here + setSelectedThread(thread.cid)} className="ttl-link">Click here to view.
{}} key={`mob-r-pm-${index}`} className="quotelink" - onClick={(event) => handleQuoteClick(reply, shortParentCid, thread.shortCid, event)} - onMouseOver={(event) => handleQuoteHover(reply, shortParentCid, thread.shortCid, event)} - onMouseLeave={removeHighlight}> + ref={el => { + quoteRefsMobile.current[reply.cid] = el; + }} + onClick={(event) => handleQuoteClick(reply, shortParentCid, event)} + onMouseOver={(event) => { + event.stopPropagation(); + handleQuoteHover(reply, shortParentCid, () => { + setOutOfViewCid(reply.parentCid); + const rect = quoteRefsMobile.current[reply.cid].getBoundingClientRect(); + const distanceToRight = window.innerWidth - rect.right; + const distanceToTop = rect.top; + const distanceToBottom = window.innerHeight - rect.bottom; + let top; + + if (distanceToTop < postOnHoverHeight / 2) { + top = window.scrollY - 5; + } else if (distanceToBottom < postOnHoverHeight / 2) { + top = window.scrollY - postOnHoverHeight + window.innerHeight - 10; + } else { + top = rect.top + window.scrollY - postOnHoverHeight / 2; + } + + if (distanceToRight < 200) { + setOutOfViewPosition({ + top, + right: window.innerWidth - rect.left - 10, + maxWidth: rect.left - 5 + }); + } else { + setOutOfViewPosition({ + top, + left: rect.left + rect.width + 5, + maxWidth: window.innerWidth - rect.left - rect.width - 5 + }); + } + }); + }} + onMouseLeave={() => { + removeHighlight(); + setOutOfViewCid(null); + }}> {`c/${shortParentCid}`}{shortParentCid === thread.shortCid ? " (OP)" : null}) : null} {reply.replyCount > 0 ? ( @@ -1299,11 +1737,49 @@ const All = () => { {reply.replies?.pages?.topAll.comments .sort((a, b) => a.timestamp - b.timestamp) .map((reply, index) => ( -+ +
Are you sure you want to delete this post?
+-+ (...) -
- Post too long. - setSelectedThread(thread.cid)} className="ttl-link">Click here - to view. +
++ +
+ Post too long. + setSelectedThread(thread.cid)} className="ttl-link">Click here + to view. +
) : null}+ +
:(...) -
+
++ +
Post too long. - setSelectedThread(thread.cid)} className="ttl-link">Click here + setSelectedThread(thread.cid)} className="ttl-link">Click here to view.
) : null}+ +
{}} key={`mob-r-pm-${index}`} className="quotelink" - onClick={(event) => handleQuoteClick(reply, shortParentCid, thread.shortCid, event)} - onMouseOver={(event) => handleQuoteHover(reply, shortParentCid, thread.shortCid, event)} - onMouseLeave={removeHighlight}> + ref={el => { + quoteRefsMobile.current[reply.cid] = el; + }} + onClick={(event) => handleQuoteClick(reply, shortParentCid, event)} + onMouseOver={(event) => { + event.stopPropagation(); + handleQuoteHover(reply, shortParentCid, () => { + setOutOfViewCid(reply.parentCid); + const rect = quoteRefsMobile.current[reply.cid].getBoundingClientRect(); + const distanceToRight = window.innerWidth - rect.right; + const distanceToTop = rect.top; + const distanceToBottom = window.innerHeight - rect.bottom; + let top; + + if (distanceToTop < postOnHoverHeight / 2) { + top = window.scrollY - 5; + } else if (distanceToBottom < postOnHoverHeight / 2) { + top = window.scrollY - postOnHoverHeight + window.innerHeight - 10; + } else { + top = rect.top + window.scrollY - postOnHoverHeight / 2; + } + + if (distanceToRight < 200) { + setOutOfViewPosition({ + top, + right: window.innerWidth - rect.left - 10, + maxWidth: rect.left - 5 + }); + } else { + setOutOfViewPosition({ + top, + left: rect.left + rect.width + 5, + maxWidth: window.innerWidth - rect.left - rect.width - 5 + }); + } + }); + }} + onMouseLeave={() => { + removeHighlight(); + setOutOfViewCid(null); + }}> {`c/${shortParentCid}`}{shortParentCid === thread.shortCid ? " (OP)" : null}(...) -
+
++ +
Comment too long. - setSelectedThread(thread.cid)} className="ttl-link">Click here + setSelectedThread(thread.cid)} className="ttl-link">Click here to view.
{}} key={`mob-r-pm-${index}`} className="quotelink" - onClick={(event) => handleQuoteClick(reply, shortParentCid, thread.shortCid, event)} - onMouseOver={(event) => handleQuoteHover(reply, shortParentCid, thread.shortCid, event)} - onMouseLeave={removeHighlight}> + ref={el => { + quoteRefsMobile.current[reply.cid] = el; + }} + onClick={(event) => handleQuoteClick(reply, shortParentCid, event)} + onMouseOver={(event) => { + event.stopPropagation(); + handleQuoteHover(reply, shortParentCid, () => { + setOutOfViewCid(reply.parentCid); + const rect = quoteRefsMobile.current[reply.cid].getBoundingClientRect(); + const distanceToRight = window.innerWidth - rect.right; + const distanceToTop = rect.top; + const distanceToBottom = window.innerHeight - rect.bottom; + let top; + + if (distanceToTop < postOnHoverHeight / 2) { + top = window.scrollY - 5; + } else if (distanceToBottom < postOnHoverHeight / 2) { + top = window.scrollY - postOnHoverHeight + window.innerHeight - 10; + } else { + top = rect.top + window.scrollY - postOnHoverHeight / 2; + } + + if (distanceToRight < 200) { + setOutOfViewPosition({ + top, + right: window.innerWidth - rect.left - 10, + maxWidth: rect.left - 5 + }); + } else { + setOutOfViewPosition({ + top, + left: rect.left + rect.width + 5, + maxWidth: window.innerWidth - rect.left - rect.width - 5 + }); + } + }); + }} + onMouseLeave={() => { + removeHighlight(); + setOutOfViewCid(null); + }}> {`c/${shortParentCid}`}{shortParentCid === thread.shortCid ? " (OP)" : null}) : null} {reply.replyCount > 0 ? ( @@ -1306,11 +1747,49 @@ const Subscriptions = () => { {reply.replies?.pages?.topAll.comments .sort((a, b) => a.timestamp - b.timestamp) .map((reply, index) => ( -+ +