generated from mintlify/starter
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcustom-scripts.js
More file actions
161 lines (147 loc) · 5.68 KB
/
custom-scripts.js
File metadata and controls
161 lines (147 loc) · 5.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
// Custom scripts for MemSync documentation
(function() {
'use strict';
// Wait for DOM to be fully loaded
function addClickHandlers() {
// Handle Dashboard link clicks
const dashboardLinks = document.querySelectorAll('a[href="javascript:void(0)"]');
dashboardLinks.forEach(link => {
if (link.textContent.trim() === 'Dashboard') {
link.addEventListener('click', function(e) {
e.preventDefault();
showComingSoonPopup('Dashboard');
});
}
});
// Handle GitHub link clicks (in global anchors)
const githubLinks = document.querySelectorAll('a[href="javascript:void(0)"]');
githubLinks.forEach(link => {
// Check if this is a GitHub link by looking for GitHub icon or text
const hasGithubIcon = link.querySelector('svg') || link.innerHTML.includes('github') || link.textContent.includes('GitHub');
if (hasGithubIcon && link.textContent.trim() === 'GitHub') {
link.addEventListener('click', function(e) {
e.preventDefault();
showComingSoonPopup('GitHub');
});
}
});
}
// Show "Coming Soon" popup
function showComingSoonPopup(feature) {
// Create popup overlay
const overlay = document.createElement('div');
overlay.style.cssText = `
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
justify-content: center;
align-items: center;
z-index: 10000;
animation: fadeIn 0.3s ease-out;
`;
// Create popup content
const popup = document.createElement('div');
popup.style.cssText = `
background: white;
border-radius: 12px;
padding: 32px;
max-width: 400px;
width: 90%;
text-align: center;
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
animation: slideIn 0.3s ease-out;
`;
// Add content
popup.innerHTML = `
<div style="margin-bottom: 20px;">
<svg width="64" height="64" fill="none" viewBox="0 0 24 24" stroke="currentColor" style="color: #0EA5E9; margin: 0 auto;">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
</div>
<h3 style="margin: 0 0 12px 0; font-size: 24px; font-weight: 600; color: #1f2937;">${feature} Coming Soon!</h3>
<p style="margin: 0 0 24px 0; color: #6b7280; font-size: 16px; line-height: 1.5;">
We're working hard to bring you the ${feature.toLowerCase()} experience. Stay tuned for updates!
</p>
<button id="close-popup" style="
background: #0EA5E9;
color: white;
border: none;
padding: 12px 24px;
border-radius: 8px;
font-size: 16px;
font-weight: 600;
cursor: pointer;
transition: background-color 0.2s;
">Got it!</button>
`;
// Add CSS animations
const style = document.createElement('style');
style.textContent = `
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
@keyframes slideIn {
from {
opacity: 0;
transform: translateY(-20px) scale(0.95);
}
to {
opacity: 1;
transform: translateY(0) scale(1);
}
}
`;
document.head.appendChild(style);
// Assemble popup
overlay.appendChild(popup);
document.body.appendChild(overlay);
// Add close functionality
const closeBtn = popup.querySelector('#close-popup');
function closePopup() {
overlay.style.animation = 'fadeIn 0.2s ease-out reverse';
setTimeout(() => {
document.body.removeChild(overlay);
document.head.removeChild(style);
}, 200);
}
closeBtn.addEventListener('click', closePopup);
overlay.addEventListener('click', function(e) {
if (e.target === overlay) {
closePopup();
}
});
// Close on Escape key
document.addEventListener('keydown', function(e) {
if (e.key === 'Escape') {
closePopup();
}
}, { once: true });
// Hover effect for button
closeBtn.addEventListener('mouseenter', function() {
this.style.backgroundColor = '#0284C7';
});
closeBtn.addEventListener('mouseleave', function() {
this.style.backgroundColor = '#0EA5E9';
});
}
// Initialize when DOM is ready
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', addClickHandlers);
} else {
addClickHandlers();
}
// Also re-initialize after navigation changes (for SPA behavior)
let lastUrl = location.href;
new MutationObserver(() => {
const url = location.href;
if (url !== lastUrl) {
lastUrl = url;
setTimeout(addClickHandlers, 100);
}
}).observe(document, { subtree: true, childList: true });
})();