From e4654a71eb7f7376ecf5bec8e54b13ee5340f441 Mon Sep 17 00:00:00 2001 From: Jonah Aragon Date: Fri, 29 Apr 2022 09:17:23 -0500 Subject: [PATCH] Enable feedback widget (#1146) --- docs/browsers.en.md | 3 +++ docs/index.en.md | 1 + docs/javascripts/feedback.js | 13 +++++++++++++ mkdocs.yml | 12 ++++++++++++ .../partials/integrations/analytics/plausible.html | 1 + 5 files changed, 30 insertions(+) create mode 100644 docs/javascripts/feedback.js diff --git a/docs/browsers.en.md b/docs/browsers.en.md index 9bc14c3470..9cf0ee52ea 100644 --- a/docs/browsers.en.md +++ b/docs/browsers.en.md @@ -1,6 +1,9 @@ --- title: "Web Browsers" icon: octicons/browser-16 +tags: + - HTML5 + - JavaScript --- These are our current web browser recommendations and settings. We recommend keeping extensions to a minimum: they have privileged access within your browser, require you to trust the developer, can make you [stand out](https://en.wikipedia.org/wiki/Device_fingerprint#Browser_fingerprint), and [weaken](https://groups.google.com/a/chromium.org/g/chromium-extensions/c/0ei-UCHNm34/m/lDaXwQhzBAAJ) site isolation. diff --git a/docs/index.en.md b/docs/index.en.md index 6727a997a0..c9e9a48034 100644 --- a/docs/index.en.md +++ b/docs/index.en.md @@ -3,6 +3,7 @@ template: overrides/home.en.html hide: - navigation - toc + - feedback ---
diff --git a/docs/javascripts/feedback.js b/docs/javascripts/feedback.js new file mode 100644 index 0000000000..814f6037cc --- /dev/null +++ b/docs/javascripts/feedback.js @@ -0,0 +1,13 @@ +var feedback = document.forms.feedback +feedback.removeAttribute("hidden"); +feedback.addEventListener("submit", function(ev) { + ev.preventDefault() + + /* Retrieve page and feedback value */ + var page = document.location.pathname + var data = ev.submitter.getAttribute("data-md-value") + + /* Send feedback value */ + console.log(page, data) + plausible(data) +}) diff --git a/mkdocs.yml b/mkdocs.yml index c539f77c69..6b3df9773e 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -15,6 +15,17 @@ extra: analytics: provider: plausible property: privacyguides.org + feedback: + title: Was this page helpful? + ratings: + - icon: material/emoticon-happy-outline + name: This page was helpful + data: Helpful + note: Thanks for your feedback! + - icon: material/emoticon-sad-outline + name: This page could be improved + data: Needs Improvement + note: Thanks for your feedback! Help us improve this page by opening a discusson on GitHub. social: - icon: pg/matrix link: https://matrix.to/#/#privacyguides:matrix.org @@ -120,6 +131,7 @@ markdown_extensions: extra_javascript: - javascripts/mathjax.js + - javascripts/feedback.js nav: - Home: 'index.md' diff --git a/theme/partials/integrations/analytics/plausible.html b/theme/partials/integrations/analytics/plausible.html index 858085b01f..5ec35c8880 100644 --- a/theme/partials/integrations/analytics/plausible.html +++ b/theme/partials/integrations/analytics/plausible.html @@ -1 +1,2 @@ +