Skip to content

Commit 5b0a100

Browse files
authored
Update unity-forum-fixer.js
Notifications panel: hide panel on mouseexit, Move Dismiss button at top
1 parent d05f6b9 commit 5b0a100

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

unity-forum-fixer.js

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// ==UserScript==
22
// @name UnityForumFixer
33
// @namespace https://unitycoder.com/
4-
// @version 0.84 (27.04.2025)
4+
// @version 0.85 (27.04.2025)
55
// @description Fixes For Unity Forums - https://github.com/unitycoder/UnityForumFixer
66
// @author unitycoder.com
77
// @match https://discussions.unity.com/latest
@@ -164,8 +164,15 @@ function AppendCustomCSS()
164164
165165
code.lang-auto, code.language-csharp { font-family: 'Fira Code', monospace; }
166166
.select-kit .select-kit-row {padding: 0px 0px 0px 6px !important;} /* project area dropdown */
167-
167+
/* notification dismiss button */
168168
169+
.quick-access-panel .panel-body-bottom {position:absolute;top:0;left:0;right:0;margin:8px 0;display:flex;justify-content:flex-end;padding:0 8px;background:transparent;border:none;box-shadow:none;}
170+
.quick-access-panel .btn.no-text.btn-default.show-all { height:20px; }
171+
.quick-access-panel .notifications-dismiss {font-size:0.8em;padding:4px 8px;height:20px; min-width:50%;}
172+
.panel-body-contents {margin-top:30px !important;}
173+
174+
img.avatar[title] { pointer-events: none; }
175+
169176
`;
170177
document.head.appendChild(style);
171178
}
@@ -660,24 +667,33 @@ function replaceNotificationIcons() {
660667

661668
function AddOnHoverOpenNotificationPanel() {
662669
const currentUserButton = document.getElementById('toggle-current-user');
670+
const headerArea = document.getElementById('main-outlet');
671+
const dropdown = document.querySelector('.user-menu.revamped.menu-panel.drop-down');
663672

664-
if (currentUserButton) {
665-
// Add mouseover event to trigger the button's click
673+
if (currentUserButton && headerArea) {
674+
// Open the panel on hover over the user button
666675
currentUserButton.addEventListener('mouseenter', () => {
667-
// Check if the dropdown is already open
668-
const dropdown = document.querySelector('.user-menu.revamped.menu-panel.drop-down');
669-
if (dropdown==null) {
670-
currentUserButton.click(); // Simulate a click to open the dropdown
676+
if (!dropdown) {
677+
currentUserButton.click();
678+
}
679+
});
680+
681+
// Close the panel when mouse moves over the header area
682+
headerArea.addEventListener('mouseenter', () => {
683+
if (dropdown) {
684+
currentUserButton.click(); // Simulate click outside to close
671685
}
672686
});
687+
673688
} else {
674-
console.warn('Current user button not found.');
689+
console.warn('Current user button or header area not found.');
675690
}
676691
}
677692

678693

679694

680695

696+
681697
// HELPER METHODS
682698

683699
function formatDate(date)

0 commit comments

Comments
 (0)