Updated javascript to trigger warning banner if the URL contains /latest/

This commit is contained in:
corkyw10 2021-05-13 11:05:42 +02:00 committed by bernat
parent ffb539edeb
commit a6c31d5387
1 changed files with 3 additions and 4 deletions

View File

@ -1,10 +1,9 @@
$(document).ready(function () {
if(window.location.href.indexOf("latest") != -1) {
if(window.location.href.indexOf("/latest/") != -1) {
var banner = document.createElement("div");
var section = document.getElementsByClassName("section");
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]);
section[0].insertBefore(banner,section[0].childNodes[0]);
}
});