github-dark-theme icon indicating copy to clipboard operation
github-dark-theme copied to clipboard

mouseleave event

Open devhl-labs opened this issue 5 years ago • 1 comments

Please consider adding this code to the content script. I was going to do a PR, but when I build the manifest does not have the content script and I'm not sure how to change that part. When the mouse leaves the highlighted row, the highlight will go away. With the default GitHub color scheme, I did not notice the highlighted color so it was never an issue. With the dark mode, it stands out a lot imho. Thanks for considering.

docReady(function(){
	
	var userSelection = document.getElementsByClassName('js-navigation-item');
	
	for(let i = 0; i < userSelection.length; i++) {		
		userSelection[i].addEventListener('mouseleave', function() {
			this.classList.remove('navigation-focus');
		})
	}
});

function docReady(fn) {
    if (document.readyState === 'complete' || document.readyState === 'interactive') {
        setTimeout(fn, 1);
    } else {
        document.addEventListener('DOMContentLoaded', fn);
    }
}

devhl-labs avatar Feb 17 '20 01:02 devhl-labs

I see now if you navigate via page buttons then the event listeners are not added.

devhl-labs avatar Feb 17 '20 05:02 devhl-labs