diff --git a/_scss/_archive.scss b/_scss/_archive.scss
new file mode 100644
index 0000000000..4e70ee4585
--- /dev/null
+++ b/_scss/_archive.scss
@@ -0,0 +1,15 @@
+#ratings-div,
+.ctrl-right .btn-group,
+.feedback-links li:first-of-type,
+.search-form {
+ visibility: hidden;
+}
+
+.not-archive {
+ #ratings-div,
+ .ctrl-right .btn-group,
+ .feedback-links li:first-of-type,
+ .search-form {
+ visibility: visible;
+ }
+}
diff --git a/css/style.scss b/css/style.scss
index 79f34e5e83..78c41e3b12 100644
--- a/css/style.scss
+++ b/css/style.scss
@@ -2,6 +2,7 @@
# Docker Documentation Theme
---
+@import "archive";
@import "breakpoint";
@import "variables";
@import "night-mode";
diff --git a/js/archive.js b/js/archive.js
index f73bf58fcb..b942d783de 100644
--- a/js/archive.js
+++ b/js/archive.js
@@ -6,28 +6,45 @@ layout: null
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 = '
';
+ $.getJSON("/js/archives.json", function (result) {
+ var outerDivStart =
+ '
This is archived documentation for Docker ' +
+ dockerVersion +
+ '. Go to the latest docs or a different version: ' +
+ '
';
+ var listStart =
+ '";
+ var outerDivEnd = " ";
var buttonCode = null;
var listItems = new Array();
- $.each(result, function(i, field){
- if ( field.name == dockerVersion && field.current ) {
+ $.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", "");
+ 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 ) {
+ if (field.current && buttonCode == null) {
// Get the button code
- buttonCode = '';
+ buttonCode =
+ '';
// The link is different for the current release
- listItems.push('
' + prettyName + '');
+ listItems.push(
+ '
' +
+ prettyName +
+ ""
+ );
} else {
- listItems.push('
' + prettyName + '');
+ listItems.push(
+ '
' +
+ prettyName +
+ ""
+ );
}
}
});
@@ -36,19 +53,27 @@ if (window.navigator.onLine) {
// 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);
- isArchive = true;
+ 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');
+ $(document).scroll(function () {
+ if ($("nav").hasClass("affix")) {
+ $("#archive-butterbar").addClass("fixed").removeClass("top");
} else {
- $('#archive-butterbar').addClass('top').removeClass('fixed');
+ $("#archive-butterbar").addClass("top").removeClass("fixed");
}
});
} else {
- isArchive = false;
- } });
+ $("body").addClass("not-archive");
+ }
+ });
}
diff --git a/js/docs.js b/js/docs.js
index 0d11521ee5..b22b63b533 100644
--- a/js/docs.js
+++ b/js/docs.js
@@ -337,17 +337,4 @@ window.onload = function () {
var group = $(this).attr("data-group");
$('.nav-tabs > li > a[data-group="' + group + '"]').tab("show");
});
-
- // isArchive is set by logic in archive.js
- if (isArchive === false) {
- // Hide elements that are not appropriate for archives
- // PollDaddy
- $("#ratings-div").css("visibility", "visible");
- // Archive drop-down
- $(".ctrl-right .btn-group").css("visibility", "visible");
- // Search
- $(".search-form").css("visibility", "visible");
- // Page edit link
- $(".feedback-links li").first().css("visibility", "visible");
- }
};