Skip to content

Commit 52277e0

Browse files
LukasWallrichclaudericharddushime
authored
Add dismiss button to JUST-OS chatbot widget (#746)
The jellyfish mascot widget can obscure page content. This adds a small close button (visible on hover) that hides the widget for the current browser session via sessionStorage. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Richard Dushime <45734838+richarddushime@users.noreply.github.com>
1 parent 3625001 commit 52277e0

2 files changed

Lines changed: 50 additions & 1 deletion

File tree

layouts/partials/chatbot.html

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,35 @@
2323
z-index: 2;
2424
}
2525

26+
#just-os-dismiss {
27+
position: absolute;
28+
top: -6px;
29+
right: -6px;
30+
width: 20px;
31+
height: 20px;
32+
border-radius: 50%;
33+
border: 1px solid #ccc;
34+
background: white;
35+
color: #999;
36+
font-size: 14px;
37+
line-height: 18px;
38+
text-align: center;
39+
cursor: pointer;
40+
z-index: 3;
41+
opacity: 0;
42+
transition: opacity 0.2s ease;
43+
padding: 0;
44+
}
45+
46+
#just-os-widget:hover #just-os-dismiss {
47+
opacity: 1;
48+
}
49+
50+
#just-os-dismiss:hover {
51+
background: #eee;
52+
color: #333;
53+
}
54+
2655
#just-os-btn:hover {
2756
transform: scale(1.05);
2857
}
@@ -388,6 +417,9 @@
388417
{{ if ne .RelPermalink "/just_os_chatbot/" }}
389418
<div id="just-os-widget">
390419

420+
<!-- Dismiss Button -->
421+
<button id="just-os-dismiss" onclick="dismissJustOS()" aria-label="Dismiss chatbot" title="Dismiss">&times;</button>
422+
391423
<!-- Toggle Button -->
392424
<button id="just-os-btn" onclick="toggleJustOS()" aria-label="Open Chatbot">
393425
<img id="just-os-img" src="/img/just_os_icon.webp" alt="Chat with us">

static/js/just-os-chat.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,12 @@
450450

451451
window.newJustOSChat = newChat;
452452

453+
window.dismissJustOS = function () {
454+
var widget = document.getElementById('just-os-widget');
455+
if (widget) widget.style.display = 'none';
456+
sessionStorage.setItem('just-os-dismissed', '1');
457+
};
458+
453459
/* -------------------------------------------------- */
454460
/* Custom drag-resize (bottom-left handle) */
455461
/* -------------------------------------------------- */
@@ -509,6 +515,13 @@
509515
/* -------------------------------------------------- */
510516

511517
function init() {
518+
// Hide widget if dismissed this session
519+
if (sessionStorage.getItem('just-os-dismissed')) {
520+
var widget = document.getElementById('just-os-widget');
521+
if (widget) widget.style.display = 'none';
522+
return;
523+
}
524+
512525
const container = getContainer();
513526
if (!container) return;
514527

@@ -529,7 +542,11 @@
529542
window.addEventListener('beforeunload', saveState);
530543

531544
// Auto-toggle helper bubble every 10 seconds (widget only)
532-
setInterval(function () {
545+
var bubbleInterval = setInterval(function () {
546+
if (sessionStorage.getItem('just-os-dismissed')) {
547+
clearInterval(bubbleInterval);
548+
return;
549+
}
533550
const bubble = document.getElementById('just-os-bubble');
534551
const win = document.getElementById('just-os-window');
535552
if (bubble && win && win.style.display !== 'flex') {

0 commit comments

Comments
 (0)