---
layout: null
---
/* Only run this if we are online*/
if (window.navigator.onLine) {
var suppressButterBar = false;
/* This JSON file contains a current list of all docs versions of Docker */
$.getJSON("/js/archives.json", function (result) {
var outerDivStart =
'
";
var buttonCode = null;
var listItems = new Array();
$.each(result, function (i, field) {
if (field.name == dockerVersion && field.current) {
// We are the current version so we don't need a butterbar
suppressButterBar = true;
} else {
var prettyName = "Docker " + field.name.replace("v", "");
// If this archive has current = true, and we don't already have a button
if (field.current && buttonCode == null) {
// Get the button code
buttonCode =
'';
// The link is different for the current release
listItems.push(
'' +
prettyName +
""
);
} else {
listItems.push(
'' +
prettyName +
""
);
}
}
});
// only append the butterbar if we are NOT the current version
// Also set the isArchive variable to true if it's an archive. It defaults
// to true, set in _layouts/docs.html. We default to true because it looks
// better in CSS to show stuff than to hide stuff onLoad.
if (suppressButterBar == false) {
$("body").prepend(
outerDivStart +
buttonCode +
listStart +
listItems.join("") +
listEnd +
outerDivEnd
);
$("body").addClass("archive");
// If the butterbar exists, deal with positioning it
// Depends on some logic in _layout/docs.html
$(document).scroll(function () {
if ($("nav").hasClass("affix")) {
$("#archive-butterbar").addClass("fixed").removeClass("top");
} else {
$("#archive-butterbar").addClass("top").removeClass("fixed");
}
});
} else {
$("body").addClass("not-archive");
}
});
}