|
| 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 | + |
0 commit comments