From 4da0721020f78ba9051961294339495165f8e566 Mon Sep 17 00:00:00 2001 From: Nick Krichevsky Date: Sun, 22 Feb 2015 20:59:33 -0500 Subject: [PATCH] Add workaround for hovering above/below the close/pin buttons --- popup.css | 6 +++--- popup.js | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/popup.css b/popup.css index 881c8a5..69a2867 100644 --- a/popup.css +++ b/popup.css @@ -62,7 +62,7 @@ i.close{ font-size: 14px; color:#000; } -i.close:hover{ +i.close:hover,i.close.fakeHover{ color:#E53935 } i.pin{ @@ -75,10 +75,10 @@ i.pin{ i.pin.pinned{ color:#1565C0; } -i.pin:hover{ +i.pin:hover,i.pin.fakeHover{ color:#1565C0; } -i.pin.pinned:hover{ +i.pin.pinned:hover,i.pin.pinned.fakeHover{ color:#000; } input#search{ diff --git a/popup.js b/popup.js index 99b922b..5c34448 100644 --- a/popup.js +++ b/popup.js @@ -180,7 +180,31 @@ function setupTabs(tabs,callback){ chrome.tabs.update(currentTab.id,{'highlighted':true,'active':true}); }); }); + + var mouseListenerFunction = function(event){ + if (event.clientX>=closeButton.getBoundingClientRect().left && event.clientX<=closeButton.getBoundingClientRect().right){ + console.log("Adding!"); + closeButton.classList.add('fakeHover'); + console.log(closeButton.classList); + } + else{ + closeButton.classList.remove('fakeHover'); + } + if (event.clientX>=pinButton.getBoundingClientRect().left && event.clientX<=pinButton.getBoundingClientRect().right){ + pinButton.classList.add('fakeHover'); + } + else{ + pinButton.classList.remove('fakeHover'); + } + } + + li.addEventListener('mousein', mouseListenerFunction); + li.addEventListener('mousemove', mouseListenerFunction); + li.addEventListener('mouseout', function(event){ + closeButton.classList.remove('fakeHover'); + pinButton.classList.remove('fakeHover'); + }); li.appendChild(textSpan); textSpan.appendChild(pinButton); textSpan.appendChild(closeButton);