From 974ea39608f7a51d9fe94a4545c1661fb2b506b5 Mon Sep 17 00:00:00 2001 From: Alina Derkach Date: Thu, 7 Mar 2024 18:01:42 +0200 Subject: [PATCH] DOCS-106 Implement Osano Cookie consent in docs.percona.com + remove scarf (#137) modified: _resource/overrides/main.html modified: _resource/overrides/partials/copyright.html new file: docs/css/osano.css new file: docs/features/consent.js new file: docs/js/consent.js modified: mkdocs-base.yml --- _resource/overrides/main.html | 6 +- _resource/overrides/partials/copyright.html | 3 +- docs/css/osano.css | 206 ++++++++++++++++++++ docs/features/consent.js | 6 + docs/js/consent.js | 6 + mkdocs-base.yml | 12 +- 6 files changed, 227 insertions(+), 12 deletions(-) create mode 100644 docs/css/osano.css create mode 100644 docs/features/consent.js create mode 100644 docs/js/consent.js diff --git a/_resource/overrides/main.html b/_resource/overrides/main.html index 4771e00a..e0c8cef1 100644 --- a/_resource/overrides/main.html +++ b/_resource/overrides/main.html @@ -6,6 +6,11 @@ {# Import the theme's layout. #} {% extends "base.html" %} +{% block scripts %} + +{{ super() }} +{% endblock %} + {%- macro relbar2 () %}
@@ -14,7 +19,6 @@

Contact us

For free technical help, visit the Percona Community Forum.

To report bugs or submit feature requests, open a JIRA ticket.

For paid support and managed or consulting services , contact Percona Sales.

-
diff --git a/_resource/overrides/partials/copyright.html b/_resource/overrides/partials/copyright.html index 4dc9e364..2df65639 100644 --- a/_resource/overrides/partials/copyright.html +++ b/_resource/overrides/partials/copyright.html @@ -4,7 +4,8 @@ {% if not config.extra.generator == false %} Made with diff --git a/docs/css/osano.css b/docs/css/osano.css new file mode 100644 index 00000000..79565a16 --- /dev/null +++ b/docs/css/osano.css @@ -0,0 +1,206 @@ +/* General styling */ + +.osano-cm-window { + font-family: "Roboto", Arial, Helvetica, sans-serif; + font-size: 20px; +} +.osano-cm-dialog--type_bar { + justify-content: center; + color: #000; + background: #fff; + box-shadow: 0 0 0 100vmax rgba(0,0,0,0.66) +} + +.osano-cm-dialog { + font-size: 0.75em; + padding: 2em 1em; + color: var(--md-typeset-color); + background: var(--md-footer-bg-color--dark); +} +.osano-cm-header, +.osano-cm-info-dialog-header { + background: var(--md-default-bg-color); +} +.osano-cm-link, +.osano-cm-disclosure__toggle, +.osano-cm-expansion-panel__toggle { + color: var(--md-typeset-a-color); +} +.osano-cm-link:hover, +.osano-cm-link:active, +.osano-cm-disclosure__toggle:hover, +.osano-cm-disclosure__toggle:active, +.osano-cm-disclosure__toggle:focus, +.osano-cm-expansion-panel__toggle:hover, +.osano-cm-expansion-panel__toggle:active, +.osano-cm-expansion-panel__toggle:focus { + color: var(--md-accent-fg-color); +} +.osano-cm-drawer-links { + display: inline-block; +} +.osano-cm-link.osano-cm-storage-policy { + margin-right: 0.5em; +} +.osano-cm-description { + font-weight: 400; +} +.osano-cm-info { + color: var(--md-typeset-color); + background: var(--md-default-bg-color); + box-shadow: unset; +} +.osano-cm-dialog--hidden, +.osano-cm-info-dialog--hidden { + transition-delay: 0ms, 0ms; +} +.osano-cm-disclosure { + padding-top: 0; +} +.osano-cm-disclosure--collapse { + border-color: var(--md-default-fg-color--lightest); +} + +/* Closing button */ + +.osano-cm-dialog__close, +.osano-cm-dialog__close:hover, +.osano-cm-dialog__close:focus, +.osano-cm-dialog__close:focus:hover { + color: var(--md-typeset-color); + stroke: var(--md-typeset-color); + border-color: transparent; + outline: initial; +} +.osano-cm-dialog__close:focus { + background-color: var(--md-default-fg-color--lightest); +} +.osano-cm-close { + padding: 0.25em; + margin: 0.5em; + stroke-width: 2px; + border-width: 2px; + opacity: 0.4; +} +.osano-cm-close:focus, +.osano-cm-close:hover { + stroke-width: 2px; + opacity: 1; +} +.osano-cm-info-dialog-header__close:focus { + background-color: var(--md-typeset-color); +} + +/* Switch buttons */ + +.osano-cm-toggle__switch { + background-color: var(--md-default-fg-color--lightest); + transition: all 0.1s ease-out; +} +.osano-cm-toggle__input:hover + .osano-cm-toggle__switch { + background-color: var(--md-default-fg-color--light); + border-color: transparent; +} +.osano-cm-toggle__input:focus + .osano-cm-toggle__switch { + background-color: var(--md-default-fg-color--lightest); + border-color: transparent; +} +.osano-cm-toggle__input:focus + .osano-cm-toggle__switch::before { + border-color: var(--md-accent-fg-color); +} +.osano-cm-toggle__input:focus:hover + .osano-cm-toggle__switch { + background-color: var(--md-default-fg-color--light); + border-color: transparent; +} +.osano-cm-toggle__input:checked + .osano-cm-toggle__switch, +.osano-cm-toggle__input:disabled:checked + .osano-cm-toggle__switch { + background-color: var(--md-primary-fg-color); + border-color: var(--md-primary-fg-color); +} +.osano-cm-toggle__input:checked:hover + .osano-cm-toggle__switch, +.osano-cm-toggle__input:disabled:checked:hover + .osano-cm-toggle__switch { + background-color: var(--md-accent-fg-color); + border-color: var(--md-accent-fg-color); +} +.osano-cm-toggle__input:checked:focus + .osano-cm-toggle__switch, +.osano-cm-toggle__input:disabled:checked:focus + .osano-cm-toggle__switch { + background-color: var(--md-primary-fg-color); + border-color: var(--md-primary-fg-color); +} +.osano-cm-toggle__input:checked:focus + .osano-cm-toggle__switch::before { + border-color: var(--md-accent-fg-color); +} +.osano-cm-toggle__input:checked:focus:hover + .osano-cm-toggle__switch { + background-color: var(--md-accent-fg-color); + border-color: var(--md-accent-fg-color); +} +.osano-cm-toggle__input:disabled:checked + .osano-cm-toggle__switch, +.osano-cm-toggle__input:disabled:checked:focus + .osano-cm-toggle__switch, +.osano-cm-toggle__input:disabled:checked:hover + .osano-cm-toggle__switch { + opacity: 0.3; + cursor: not-allowed; +} +.osano-cm-toggle__input + .osano-cm-toggle__switch::after { + background-color: var(--md-default-bg-color) !important; +} +.osano-cm-toggle__input:checked + .osano-cm-toggle__switch::before { + border-color: transparent; +} +.osano-cm-list { + gap: 0.75em; +} + +/* CTA Buttons */ + +.osano-cm-dialog__buttons { + display: flex; + justify-content: flex-start; + flex-wrap: wrap; + gap: 0.5em 0.75em; +} +.osano-cm-button { + font-family: var(--fHeading); + flex: 1 1 20em; + color: var(--md-primary-fg-color); + background-color: transparent; + border-width: 2px; + border-color: var(--md-primary-fg-color); + border-radius: 20em; +} +.osano-cm-button:hover { + color: var(--md-accent-fg-color); + background-color: transparent; + border-color: var(--md-accent-fg-color); +} + +/* Widget */ + +.osano-cm-widget { + display: none; + opacity: 0.5; + border-radius: 10em; + bottom: 3em; +} +.osano-cm-widget:focus { + outline-offset: 0.125em; + outline-color: var(--md-default-fg-color--lighter); + outline-width: 0.1875em; +} +.osano-cm-widget__outline { + fill: transparent; + stroke: var(--md-typeset-color); +} +.osano-cm-widget__dot { + fill: var(--md-typeset-color); +} + +/* Media conditions */ + +@media screen and (min-width: 768px) { + .osano-cm-dialog--type_bar .osano-cm-dialog__content { + max-width: 50em; + } + .osano-cm-dialog--type_bar .osano-cm-dialog__buttons { + max-width: 20em; + } +} diff --git a/docs/features/consent.js b/docs/features/consent.js new file mode 100644 index 00000000..4ff680d8 --- /dev/null +++ b/docs/features/consent.js @@ -0,0 +1,6 @@ +var consent = __md_get("__consent") +if (consent && consent.custom) { + /* The user accepted the cookie */ +} else { + /* The user rejected the cookie */ +} diff --git a/docs/js/consent.js b/docs/js/consent.js new file mode 100644 index 00000000..4ff680d8 --- /dev/null +++ b/docs/js/consent.js @@ -0,0 +1,6 @@ +var consent = __md_get("__consent") +if (consent && consent.custom) { + /* The user accepted the cookie */ +} else { + /* The user rejected the cookie */ +} diff --git a/mkdocs-base.yml b/mkdocs-base.yml index 516512ca..07b93e17 100644 --- a/mkdocs-base.yml +++ b/mkdocs-base.yml @@ -46,7 +46,8 @@ extra_css: - https://unicons.iconscout.com/release/v3.0.3/css/line.css - https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css - css/percona.css - - css/nocopy.css\ + - css/nocopy.css + - css/osano.css - css/extra.css #Copyright @@ -121,15 +122,6 @@ extra: provider: mike homepage: https://docs.percona.com - consent: - title: Cookie consent - description: >- - We use cookies to recognize your repeated visits and preferences, as well - as to measure the effectiveness of our documentation and whether users - find what they're searching for. With your consent, you're helping us to - make our documentation better. Read more about Percona Cookie Policy. - edit_page_text: ' Edit this page' - updated_text: ' Page updated' nav: - Home: index.md