Skip to content

Commit

Permalink
fix(popup): put mouseover link on right side of mouse on lower left
Browse files Browse the repository at this point in the history
  • Loading branch information
fent committed Nov 4, 2018
1 parent 0e9ea61 commit e37100b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions popup/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,11 @@ const hoverLinks = ($video) => {
$link.addEventListener('mouseover', (e) => {
e.stopPropagation();
$hoverLink.textContent = url;
// Place the link on the right side if the mouse is close to
// the lower left side of the window.
$hoverLink.classList.toggle('right',
window.innerHeight - e.clientY < VIDEO_HEIGHT &&
e.clientX < window.innerWidth / 2);
document.body.append($hoverLink);
});
$link.addEventListener('mouseleave', () => {
Expand Down
6 changes: 6 additions & 0 deletions popup/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -509,3 +509,9 @@ a.close[data-title]:hover:after {
line-height: 15px;
z-index: 99;
}

.mouseover-link.right {
left: unset;
right: 0;
max-width: 50%;
}

0 comments on commit e37100b

Please sign in to comment.