Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
docs: prevent caching version embed
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Matyushentsev authored and Alexander Matyushentsev committed Jan 2, 2021
1 parent 3397d9f commit 17ed41e
Showing 1 changed file with 25 additions and 21 deletions.
46 changes: 25 additions & 21 deletions docs/assets/versions.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
function callback(response) {
const div = document.createElement('div');
div.innerHTML = response.html;
document.body.appendChild(div);
const container = div.querySelector('.rst-versions');
div.querySelector('.rst-current-version').addEventListener('click', function() {
const classes = container.className.split(' ');
const index = classes.indexOf('shift-up');
if (index === -1) {
classes.push('shift-up');
} else {
classes.splice(index, 1);
}
container.className = classes.join(' ');
});
}
(function() {
const callbackName = 'callback_' + new Date().getTime();
window[callbackName] = function (response) {
const div = document.createElement('div');
div.innerHTML = response.html;
document.body.appendChild(div);
const container = div.querySelector('.rst-versions');
div.querySelector('.rst-current-version').addEventListener('click', function() {
const classes = container.className.split(' ');
const index = classes.indexOf('shift-up');
if (index === -1) {
classes.push('shift-up');
} else {
classes.splice(index, 1);
}
container.className = classes.join(' ');
});
}

var script = document.createElement('script');
script.src = 'https://argocd-notifications.readthedocs.io/_/api/v2/footer_html/?'+
'callback=' + callbackName + '&project=argocd-notifications&page=&theme=mkdocs&format=jsonp&docroot=docs&source_suffix=.md&version=' + (window['READTHEDOCS_DATA'] || { version: 'latest' }).version;

document.getElementsByTagName('head')[0].appendChild(script);
})();

var script = document.createElement('script');
script.src = 'https://argocd-notifications.readthedocs.io/_/api/v2/footer_html/?'+
'callback=callback&project=argocd-notifications&page=&theme=mkdocs&format=jsonp&docroot=docs&source_suffix=.md&version=' + (window['READTHEDOCS_DATA'] || { version: 'latest' }).version;

document.getElementsByTagName('head')[0].appendChild(script);

0 comments on commit 17ed41e

Please sign in to comment.