]>
Commit | Line | Data |
---|---|---|
f64942e4 | 1 | $(function() { |
9f95a23c | 2 | var releases_url = DOCUMENTATION_OPTIONS.URL_ROOT + 'releases.json'; |
f64942e4 AA |
3 | |
4 | function show_edit(branch, data) { | |
5 | if (branch) { | |
6 | if (branch === "master") { | |
7 | $("#dev-warning").show(); | |
8 | return true; | |
9 | } | |
10 | if (data && data.releases && branch in data.releases) { | |
11 | var eol = ("actual_eol" in data.releases[branch]); | |
12 | if (eol) { | |
13 | $("#eol-warning").show(); | |
14 | } | |
15 | return !eol; | |
16 | } | |
17 | } | |
18 | $("#dev-warning").show(); | |
19 | return false; | |
20 | } | |
21 | ||
22 | function get_branch() { | |
23 | var url = window.location.href; | |
24 | var res = url.match(/docs.ceph.com\/docs\/([a-z]+)\/?/i) | |
25 | if (res) { | |
26 | return res[1] | |
27 | } | |
28 | return null; | |
29 | } | |
30 | ||
31 | $.getJSON(releases_url, function(data) { | |
32 | var branch = get_branch(); | |
33 | if (show_edit(branch, data)) { | |
34 | // patch the edit-on-github URL for correct branch | |
35 | var url = $("#edit-on-github").attr("href"); | |
9f95a23c TL |
36 | if (url) { |
37 | url = url.replace("master", branch); | |
38 | $("#edit-on-github").attr("href", url); | |
39 | } | |
f64942e4 AA |
40 | $("#docubetter").show(); |
41 | } | |
42 | }); | |
43 | }); |