diff --git a/docs/_static/css/custom.css b/docs/_static/css/custom.css index 494d6cb909..cfe25c5cd0 100644 --- a/docs/_static/css/custom.css +++ b/docs/_static/css/custom.css @@ -28,3 +28,69 @@ div.wy-side-nav-search { .wy-side-nav-search input[type=text] { border-color: #d9d9d9; /*color-grey-3*/ } + +/* Wagtail Space */ +a.wagtailspace { + background: #00676a; + color: white; + padding: 15px; + border-radius: 6px; + margin-bottom: 1.25em; + display: flex; + justify-content: space-between; + align-items: flex-start; +} + +.wagtailspace svg { + margin-right: 1em; + width: 56px; +} + +.wagtailspace div { + text-align: left; + flex-grow: 2; +} + +.wagtailspace strong { + font-size: 1.25em; +} + +.wagtailspace .close { + margin-left: 1em; + margin-bottom: 1em; + cursor: pointer; + font-weight: bold; + font-size: 1.25em; +} + +/* Bounce the UFO on hover */ +@-webkit-keyframes bounce { + 0%, 100% { + -webkit-transform: translateY(0); + } + 50% { + -webkit-transform: translateY(-5px); + } +} + +@keyframes bounce { + 0%, 100% { + transform: translateY(0); + } + 50% { + transform: translateY(-5px); + } +} + +a.wagtailspace:hover svg { + -webkit-animation-duration: .5s; + animation-duration: .5s; + -webkit-animation-fill-mode: both; + animation-fill-mode: both; + -webkit-animation-timing-function: linear; + animation-timing-function: linear; + animation-iteration-count: infinite; + -webkit-animation-iteration-count: infinite; + -webkit-animation-name: bounce; + animation-name: bounce; +} diff --git a/docs/_static/js/wagtailspace.js b/docs/_static/js/wagtailspace.js new file mode 100644 index 0000000000..fab2e868c0 --- /dev/null +++ b/docs/_static/js/wagtailspace.js @@ -0,0 +1,33 @@ +function setCookie(name, value, days) { + const date = new Date(); + date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); + document.cookie = encodeURIComponent(name) + '=' + + encodeURIComponent(value) + + '; expires=' + date.toGMTString(); +} + +function hasCookie(name, value) { + return document.cookie.split('; ').indexOf(name + '=' + value) >= 0; +} + +$(function () { + const $wagtailspace = $( + '' + + ' ' + + '
' + + ' Wagtail Space
13 – 15 March 2019 Arnhem, The Netherlands' + + '
' + + ' ×' + + '
' + ); + + if (!hasCookie('wagtailspaceClosed', 'true') + && new Date() < new Date(2019, 2, 15)) { + $('.wy-nav-content').prepend($wagtailspace); + $wagtailspace.find('.close').click(function (e) { + e.preventDefault(); + setCookie('wagtailspaceClosed', 'true', 30); + $wagtailspace.detach(); + }); + } +}); diff --git a/docs/conf.py b/docs/conf.py index 3ab0ed8ff0..2b50cbed4e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -297,3 +297,4 @@ texinfo_documents = [ def setup(app): app.add_stylesheet('css/custom.css') + app.add_javascript('js/wagtailspace.js')