Skip to content

Commit 7d82ecb

Browse files
authored
Land #20435, adds survey banner to the docs site
Adds survey banner to the docs site
2 parents 480a81d + 53e2d13 commit 7d82ecb

File tree

3 files changed

+139
-0
lines changed

3 files changed

+139
-0
lines changed

docs/_includes/header_custom.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,11 @@
11
<link rel="stylesheet" href="{% link assets/css/main.css %}">
22

3+
<!-- User Engagement Survey Banner -->
4+
<div id="survey-banner">
5+
<p>
6+
Click <a href="https://docs.google.com/forms/d/e/1FAIpQLSd9fgpXmyHOYViSaS6jK_6f1Y1nVSU_eA4UH-fWKYeO5HLvww/viewform"
7+
target="_blank">here</a>
8+
to participate in our user engagement survey! Your feedback will help us improve Metasploit and inform our roadmap. It should take about 5 minutes to complete, and your email will not be collected. Thank you!
9+
</p>
10+
<button id="close-banner" aria-label="Close banner">&times;</button>
11+
</div>

docs/_includes/js/custom.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,37 @@ jtd.onReady(function(ready) {
5858
}
5959
}
6060
});
61+
62+
/*
63+
* Survey Banner Close Functionality
64+
*
65+
* This section handles the interactive behavior for the user engagement survey banner.
66+
*/
67+
(function() {
68+
function initSurveyBanner() {
69+
const banner = document.getElementById('survey-banner');
70+
const closeButton = document.getElementById('close-banner');
71+
const body = document.body;
72+
73+
if (!banner || !closeButton) {
74+
return;
75+
}
76+
77+
if (localStorage.getItem('surveyBannerClosed') === 'true') {
78+
banner.style.display = 'none';
79+
body.classList.add('banner-closed');
80+
}
81+
82+
closeButton.addEventListener('click', function() {
83+
banner.style.display = 'none';
84+
body.classList.add('banner-closed');
85+
localStorage.setItem('surveyBannerClosed', 'true');
86+
});
87+
}
88+
89+
if (document.readyState === 'loading') {
90+
document.addEventListener('DOMContentLoaded', initSurveyBanner);
91+
} else {
92+
initSurveyBanner();
93+
}
94+
})();

docs/assets/css/main.css

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,102 @@
11
---
22
---
33

4+
/*
5+
* Survey Banner Styles
6+
*
7+
* This stylesheet contains all styling for the user engagement survey banner
8+
* that appears at the top of all pages.
9+
*/
10+
body {
11+
padding-top: 60px !important;
12+
}
13+
14+
body.banner-closed {
15+
padding-top: 0 !important;
16+
}
17+
18+
#survey-banner {
19+
background-color: #2c3e50;
20+
color: white;
21+
padding: 12px 20px;
22+
text-align: center;
23+
font-size: 14px;
24+
position: fixed;
25+
top: 0;
26+
left: 0;
27+
width: 100%;
28+
z-index: 1000;
29+
box-sizing: border-box;
30+
border-bottom: 2px solid #34495e;
31+
display: flex;
32+
align-items: center;
33+
justify-content: center;
34+
gap: 20px;
35+
}
36+
37+
#survey-banner p {
38+
margin: 0;
39+
line-height: 1.4;
40+
flex: 1;
41+
}
42+
43+
#survey-banner a {
44+
color: #3498db;
45+
text-decoration: underline;
46+
}
47+
48+
#survey-banner a:hover {
49+
color: #5dade2;
50+
}
51+
52+
#close-banner {
53+
background: none;
54+
border: none;
55+
color: white;
56+
font-size: 20px;
57+
cursor: pointer;
58+
padding: 0;
59+
width: 24px;
60+
height: 24px;
61+
display: flex;
62+
align-items: center;
63+
justify-content: center;
64+
border-radius: 50%;
65+
transition: background-color 0.2s ease;
66+
flex-shrink: 0;
67+
}
68+
69+
#close-banner:hover {
70+
background-color: rgba(255, 255, 255, 0.1);
71+
}
72+
73+
#close-banner:focus {
74+
outline: 2px solid #3498db;
75+
outline-offset: 2px;
76+
}
77+
78+
@media (max-width: 768px) {
79+
#survey-banner {
80+
padding: 10px 15px;
81+
font-size: 13px;
82+
gap: 15px;
83+
}
84+
85+
body {
86+
padding-top: 70px !important;
87+
}
88+
89+
body.banner-closed {
90+
padding-top: 0 !important;
91+
}
92+
93+
#close-banner {
94+
font-size: 18px;
95+
width: 22px;
96+
height: 22px;
97+
}
98+
}
99+
4100
#main-content p {
5101
text-align: justify;
6102
}

0 commit comments

Comments
 (0)