mirror of
https://github.com/ceph/ceph
synced 2024-12-30 15:33:31 +00:00
bb887b78f8
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
42 lines
1.0 KiB
JavaScript
42 lines
1.0 KiB
JavaScript
$(function() {
|
|
var releases_url = "http://docs.ceph.com/docs/master/releases.json";
|
|
|
|
function show_edit(branch, data) {
|
|
if (branch) {
|
|
if (branch === "master") {
|
|
$("#dev-warning").show();
|
|
return true;
|
|
}
|
|
if (data && data.releases && branch in data.releases) {
|
|
var eol = ("actual_eol" in data.releases[branch]);
|
|
if (eol) {
|
|
$("#eol-warning").show();
|
|
}
|
|
return !eol;
|
|
}
|
|
}
|
|
$("#dev-warning").show();
|
|
return false;
|
|
}
|
|
|
|
function get_branch() {
|
|
var url = window.location.href;
|
|
var res = url.match(/docs.ceph.com\/docs\/([a-z]+)\/?/i)
|
|
if (res) {
|
|
return res[1]
|
|
}
|
|
return null;
|
|
}
|
|
|
|
$.getJSON(releases_url, function(data) {
|
|
var branch = get_branch();
|
|
if (show_edit(branch, data)) {
|
|
// patch the edit-on-github URL for correct branch
|
|
var url = $("#edit-on-github").attr("href");
|
|
url = url.replace("master", branch);
|
|
$("#edit-on-github").attr("href", url);
|
|
$("#docubetter").show();
|
|
}
|
|
});
|
|
});
|