github.com/argoproj/argo-cd@v1.8.7/docs/assets/versions.js (about)

     1  setTimeout(function() {
     2    const callbackName = 'callback_' + new Date().getTime();
     3    window[callbackName] = function (response) {
     4    const div = document.createElement('div');
     5    div.innerHTML = response.html;
     6    document.querySelector(".md-header__inner > .md-header__title").appendChild(div);
     7    const container = div.querySelector('.rst-versions');
     8    var caret = document.createElement('div');
     9    caret.innerHTML = "<i class='fa fa-caret-down dropdown-caret'></i>"
    10    caret.classList.add('dropdown-caret')
    11    div.querySelector('.rst-current-version').appendChild(caret);
    12    div.querySelector('.rst-current-version').addEventListener('click', function() {
    13        const classes = container.className.split(' ');
    14        const index = classes.indexOf('shift-up');
    15        if (index === -1) {
    16            classes.push('shift-up');
    17        } else {
    18            classes.splice(index, 1);
    19        }
    20        container.className = classes.join(' ');
    21    });
    22    }
    23  
    24    var CSSLink = document.createElement('link');
    25    CSSLink.rel='stylesheet';
    26    CSSLink.href = '/assets/versions.css';
    27    document.getElementsByTagName('head')[0].appendChild(CSSLink);
    28  
    29    var script = document.createElement('script');
    30    script.src = 'https://argo-cd.readthedocs.io/_/api/v2/footer_html/?'+
    31        'callback=' + callbackName + '&project=argo-cd&page=&theme=mkdocs&format=jsonp&docroot=docs&source_suffix=.md&version=' + (window['READTHEDOCS_DATA'] || { version: 'latest' }).version;
    32    document.getElementsByTagName('head')[0].appendChild(script);
    33  }, 0);
    34  
    35  // VERSION WARNINGS
    36  window.addEventListener("DOMContentLoaded", function() {
    37    if ((window['READTHEDOCS_DATA']).version === "latest") {
    38      document.querySelector("div[data-md-component=announce]").innerHTML = "<div id='announce-msg'>You are viewing the docs for an unreleased version of Argo CD, <a href='https://argo-cd.readthedocs.io/en/stable/'>click here to go to the latest stable version.</a></div>"
    39    }
    40    else if ((window['READTHEDOCS_DATA']).version !== "stable") {
    41      document.querySelector("div[data-md-component=announce]").innerHTML = "<div id='announce-msg'>You are viewing the docs for a previous version of Argo CD, <a href='https://argo-cd.readthedocs.io/en/stable/'>click here to go to the latest stable version.</a></div>"
    42    }
    43  });