From ffb539edeb8fcbb2ada51b9aeb4ee1902f14d7f9 Mon Sep 17 00:00:00 2001 From: corkyw10 Date: Mon, 10 May 2021 16:31:12 +0200 Subject: [PATCH] Added banner to warn users about the latest version of docs only referring to development branch --- Docs/extra.css | 15 +++++++++++++++ Docs/extra.js | 10 ++++++++++ mkdocs.yml | 1 + 3 files changed, 26 insertions(+) create mode 100644 Docs/extra.js diff --git a/Docs/extra.css b/Docs/extra.css index d64c890d3..2413a64d9 100644 --- a/Docs/extra.css +++ b/Docs/extra.css @@ -244,3 +244,18 @@ table tbody td{ top: 70px; left: 1100px; } + +/************************* LATEST WARNING BANNER **************************/ + +.dev-version-warning { + padding-top: 15px; + padding-bottom: 15px; + padding-left: 15px; + padding-right: 15px; + margin-bottom: 8px; + color: #404040; + font-weight: bold; + background-color: #f55c47; + text-align: center; + border-radius: 5px; +} diff --git a/Docs/extra.js b/Docs/extra.js new file mode 100644 index 000000000..1ca979e95 --- /dev/null +++ b/Docs/extra.js @@ -0,0 +1,10 @@ +$(document).ready(function () { + if(window.location.href.indexOf("latest") != -1) { + var banner = document.createElement("div"); + banner.className = "dev-version-warning"; + banner.innerHTML = "You are currently reading documentation for the \"dev\" branch of CARLA. This documentation refers to features currently in development and may result in unexpected behaviour. To read documentation for previous releases, select the desired version in the bottom, right-hand corner of the screen."; + var x = document.getElementsByClassName("section"); + console.log(x) + x[0].insertBefore(banner,x[0].childNodes[0]); + } +}); \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index 53a8a567c..694d0dcbf 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -4,6 +4,7 @@ docs_dir: Docs edit_uri: 'edit/master/Docs/' theme: readthedocs extra_css: [extra.css] +extra_javascript: [extra.js] nav: - Home: 'index.md'