Skip to content

Commit ddcc322

Browse files
DOCS-217 Test and implement the feedback form
new file: docs/js/feedback.js modified: mkdocs-base.yml modified: mkdocs.yml
1 parent 8289ff9 commit ddcc322

File tree

3 files changed

+73
-13
lines changed

3 files changed

+73
-13
lines changed

docs/js/feedback.js

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
document.addEventListener("DOMContentLoaded", function () {
2+
const container = document.createElement("div");
3+
container.style.position = "fixed";
4+
container.style.bottom = "20px";
5+
container.style.right = "20px";
6+
container.style.background = "#fff";
7+
container.style.border = "1px solid #ddd";
8+
container.style.padding = "10px 15px";
9+
container.style.borderRadius = "8px";
10+
container.style.boxShadow = "0 2px 6px rgba(0,0,0,0.15)";
11+
container.style.zIndex = 9999;
12+
container.style.fontFamily = "sans-serif";
13+
container.style.textAlign = "center";
14+
15+
const title = document.createElement("div");
16+
title.innerText = "Do you like Percona docs?";
17+
title.style.marginBottom = "8px";
18+
title.style.fontSize = "14px"; // Make the text larger
19+
title.style.fontWeight = "bold"; // Make text bold
20+
title.style.color = "#0E5FB5"; // Set desired blue color
21+
title.style.fontFamily = '"Poppins", "Roboto", Arial, Helvetica, sans-serif';
22+
container.appendChild(title);
23+
24+
const stars = document.createElement("div");
25+
26+
for (let i = 1; i <= 5; i++) {
27+
const star = document.createElement("span");
28+
star.innerHTML = "☆";
29+
star.style.fontSize = "24px";
30+
star.style.cursor = "pointer";
31+
star.style.margin = "0 3px";
32+
33+
star.addEventListener("mouseover", () => {
34+
[...stars.children].forEach((s, index) => {
35+
s.innerHTML = index < i ? "★" : "☆";
36+
s.style.color = index < i ? "#0e5fb5" : "#000";
37+
});
38+
});
39+
40+
star.addEventListener("mouseleave", () => {
41+
[...stars.children].forEach((s) => {
42+
s.innerHTML = "☆";
43+
s.style.color = "#000"; // or reset to default
44+
});
45+
});
46+
47+
star.addEventListener("click", () => {
48+
const formURL = "https://docs.google.com/forms/d/e/1FAIpQLSfhscELpzoXB4uyh9pXNmXSeqKc10IH_DxmAoaVGID85sO0Aw/viewform";
49+
const ratingURL = `${formURL}?entry.303027158=${i}`;
50+
window.open(ratingURL, "_blank");
51+
});
52+
53+
stars.appendChild(star);
54+
}
55+
56+
container.appendChild(stars);
57+
document.body.appendChild(container);
58+
});
59+

mkdocs-base.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ extra_javascript:
7070
- js/version-select.js
7171
- js/promptremover.js
7272
- js/consent.js
73+
- js/feedback.js
7374

7475
markdown_extensions:
7576
attr_list: {}

mkdocs.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ extra:
1414
analytics:
1515
provider: google
1616
property: G-J4J70BNH0G
17-
feedback:
18-
title: Was this page helpful?
19-
ratings:
20-
- icon: material/emoticon-happy-outline
21-
name: This page was helpful
22-
data: 1
23-
note: >-
24-
Thank you for your feedback!
25-
- icon: material/emoticon-sad-outline
26-
name: This page could be improved
27-
data: 0
28-
note: >-
29-
Thanks for your feedback! Want to improve this page? Click <strong>Edit this page on GitHub</strong> above to submit a pull request.
17+
# feedback:
18+
# title: Was this page helpful?
19+
# ratings:
20+
# - icon: material/emoticon-happy-outline
21+
# name: This page was helpful
22+
# data: 1
23+
# note: >-
24+
# Thank you for your feedback!
25+
# - icon: material/emoticon-sad-outline
26+
# name: This page could be improved
27+
# data: 0
28+
# note: >-
29+
# Thanks for your feedback! Want to improve this page? Click <strong>Edit this page on GitHub</strong> above to submit a pull request.
3030

0 commit comments

Comments
 (0)