Debian Codegraph @

docs/_static/js/custom.js

raw
1 jQuery(function ($) {
2 // Show banner linking to /stable/ if this is a /latest/ page
3 if (!/\/latest\//.test(location.pathname)) {
4 return;
5 }
6 var stableUrl = location.pathname.replace("/latest/", "/stable/");
7 // Check it's not a 404
8 fetch(stableUrl, { method: "HEAD" }).then((response) => {
9 if (response.status == 200) {
10 var warning = $(
11 `<div class="admonition warning">
12 <p class="first admonition-title">Note</p>
13 <p class="last">
14 This documentation covers the <strong>development version</strong> of Datasette.</p>
15 <p>See <a href="${stableUrl}">this page</a> for the current stable release.
16 </p>
17 </div>`
18 );
19 warning.find("a").attr("href", stableUrl);
20 $("article[role=main]").prepend(warning);
21 }
22 });
23 });