From fde984d02ba707e7db44194c406dbb5b094a4647 Mon Sep 17 00:00:00 2001 From: chylex <info@chylex.com> Date: Tue, 27 Sep 2016 03:48:14 +0200 Subject: [PATCH] Add a hover class to Notification body element and only display skip button when over --- Core/Handling/TweetNotification.cs | 2 +- Resources/Scripts/notification.js | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Core/Handling/TweetNotification.cs b/Core/Handling/TweetNotification.cs index 117396b3..f8d70612 100644 --- a/Core/Handling/TweetNotification.cs +++ b/Core/Handling/TweetNotification.cs @@ -20,7 +20,7 @@ private static string DefaultHeadTag{ private static string CustomCSS{ get{ - return @".scroll-styled-v::-webkit-scrollbar{width:8px}.scroll-styled-v::-webkit-scrollbar-thumb{border-radius:0}a[data-full-url]{word-break:break-all}#td-skip{opacity:0.75;cursor:pointer}#td-skip:hover{opacity:1}"; + return @".scroll-styled-v::-webkit-scrollbar{width:8px}.scroll-styled-v::-webkit-scrollbar-thumb{border-radius:0}a[data-full-url]{word-break:break-all}#td-skip{opacity:0;cursor:pointer;transition:opacity 0.15s ease}.td-hover #td-skip{opacity:0.75}#td-skip:hover{opacity:1}"; } } diff --git a/Resources/Scripts/notification.js b/Resources/Scripts/notification.js index 259f49cc..0d40df17 100644 --- a/Resources/Scripts/notification.js +++ b/Resources/Scripts/notification.js @@ -136,6 +136,17 @@ }); })(); + // + // Block: Setup a hover class on body. + // + document.body.addEventListener("mouseenter", function(){ + document.body.classList.add("td-hover"); + }); + + document.body.addEventListener("mouseleave", function(){ + document.body.classList.remove("td-hover"); + }); + // // Block: Page fully loaded. //