Skip to content

Commit 5ea8cf3

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 5ea8cf3

File tree

3 files changed

+67
-13
lines changed

3 files changed

+67
-13
lines changed

docs/js/feedback.js

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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 documentation?";
17+
title.style.marginBottom = "8px";
18+
container.appendChild(title);
19+
20+
const stars = document.createElement("div");
21+
22+
for (let i = 1; i <= 5; i++) {
23+
const star = document.createElement("span");
24+
star.innerHTML = "☆";
25+
star.style.fontSize = "24px";
26+
star.style.cursor = "pointer";
27+
star.style.margin = "0 3px";
28+
29+
star.addEventListener("mouseover", () => {
30+
[...stars.children].forEach((s, index) => {
31+
s.innerHTML = index < i ? "★" : "☆";
32+
});
33+
});
34+
35+
star.addEventListener("mouseleave", () => {
36+
[...stars.children].forEach((s) => {
37+
s.innerHTML = "☆";
38+
});
39+
});
40+
41+
star.addEventListener("click", () => {
42+
const formURL = "https://docs.google.com/forms/d/e/1FAIpQLSfhscELpzoXB4uyh9pXNmXSeqKc10IH_DxmAoaVGID85sO0Aw/viewform";
43+
const ratingURL = `${formURL}?entry.303027158=${i}`;
44+
window.open(ratingURL, "_blank");
45+
});
46+
47+
stars.appendChild(star);
48+
}
49+
50+
container.appendChild(stars);
51+
document.body.appendChild(container);
52+
});
53+

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)