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