rapids/docs/javascripts/extra.js

15 lines
858 B
JavaScript
Raw Normal View History

2020-11-19 00:41:48 +01:00
window.addEventListener("DOMContentLoaded", function() {
var xhr = new XMLHttpRequest();
xhr.open("GET", window.location + "../versions.json");
xhr.onload = function() {
var versions = JSON.parse(this.responseText);
latest_version = ""
for(id in versions)
if(versions[id]["aliases"].length > 0 && versions[id]["aliases"].includes("latest"))
latest_version = "/" + versions[id].version + "/"
if(!window.location.pathname.includes("/latest/") && (latest_version.length > 0 && !window.location.pathname.includes(latest_version)))
2020-12-12 23:36:15 +01:00
document.querySelector("div[data-md-component=announce]").innerHTML = "<div id='announce-msg'>You are seeing the docs for a previous version of RAPIDS, <a href='http://www.rapids.science/'>click here to go to the latest</a></div>"
};
xhr.send();
2020-11-19 00:41:48 +01:00
});