enable back button for tabs

Change-Id: Ia2f40a5266a974133d32867eb699ceaea817ab71
This commit is contained in:
Jim Phillips 2015-05-26 10:09:05 -04:00
parent 60653017bd
commit 18b40a0613
2 changed files with 92 additions and 65 deletions

View File

@ -1,6 +1,17 @@
var _conv_host = (("https:" == document.location.protocol) ? "https://d9jmv9u00p0mv.cloudfront.net" : "http://cdn-1.convertexperiments.com"); var _conv_host = (("https:" == document.location.protocol) ? "https://d9jmv9u00p0mv.cloudfront.net" : "http://cdn-1.convertexperiments.com");
document.write(unescape("%3Cscript src='" + _conv_host + "/js/10012224-10012014.js' type='text/javascript'%3E%3C/script%3E")); document.write(unescape("%3Cscript src='" + _conv_host + "/js/10012224-10012014.js' type='text/javascript'%3E%3C/script%3E"));
(function () {
window.addEventListener("popstate", function (e) {
var activeTab = location.hash ? $('[href=' + location.hash + ']') : $('[href=#home]');
if (activeTab.length) {
activeTab.tab('show');
} else {
$('.nav-tabs a:first').tab('show');
}
});
})();
function generateLinks(url, title) { function generateLinks(url, title) {
var currentLocation = window.location; var currentLocation = window.location;
var linkUrl = currentLocation.protocol + '//' + currentLocation.host + currentLocation.pathname + url; var linkUrl = currentLocation.protocol + '//' + currentLocation.host + currentLocation.pathname + url;
@ -43,7 +54,7 @@ function generateCopyButton(url) {
function populateGuides(guides) { function populateGuides(guides) {
$(guides).find('.section').each(function(i){ $(guides).find('.section').each(function (i) {
var index = i + 1; var index = i + 1;
var el = $(this).find('.reference'); var el = $(this).find('.reference');
var href = $(el).attr('href'); var href = $(el).attr('href');
@ -53,27 +64,27 @@ function populateGuides(guides) {
}); });
var columns = $('#guides .col-sm-3'); var columns = $('#guides .col-sm-3');
for(var i = 0; i < columns.length; i+=4) { for (var i = 0; i < columns.length; i += 4) {
columns.slice(i, i+4).wrapAll("<div class='row'></div>"); columns.slice(i, i + 4).wrapAll("<div class='row'></div>");
} }
} }
function populatePdfs(pdfs){ function populatePdfs(pdfs) {
$(pdfs).each(function(){ $(pdfs).each(function () {
var href = $(this).attr('href'); var href = $(this).attr('href');
var link = $(this).text(); var link = $(this).text();
$('#pdfs').append('<div class="col-lg-6"><a class="btn btn-default red btn-block" href="' + href + '"><i class="fa fa-file-pdf-o"></i> ' + link + '</a></div>'); $('#pdfs').append('<div class="col-lg-6"><a class="btn btn-default red btn-block" href="' + href + '"><i class="fa fa-file-pdf-o"></i> ' + link + '</a></div>');
}); });
var columns = $('#pdfs .col-lg-6'); var columns = $('#pdfs .col-lg-6');
for(var i = 0; i < columns.length; i+=2) { for (var i = 0; i < columns.length; i += 2) {
columns.slice(i, i+2).wrapAll("<div class='row'></div>"); columns.slice(i, i + 2).wrapAll("<div class='row'></div>");
} }
} }
function populateDownload(download){ function populateDownload(download) {
var el = $(download).find('h1 > .reference'); var el = $(download).find('h1 > .reference');
var href = $(el).attr('href'); var href = $(el).attr('href');
var link = $(el).text(); var link = $(el).text();
@ -89,9 +100,9 @@ $(document).ready(function () {
$('ul.nav.navbar-nav li.dropdown').not('.globaltoc-container').hide(); $('ul.nav.navbar-nav li.dropdown').not('.globaltoc-container').hide();
$.get( "index_content.html", function( data ) { $.get("index_content.html", function (data) {
var homeTitle = $(data).find('.home-title').html(); var homeTitle = $(data).find('.home-title').html();
var home = $(data).find('.what-is-mirantis-openstack').html(); var home = $(data).find('.what-is-mirantis-openstack').html();
var guides = $(data).find('#guides'); var guides = $(data).find('#guides');
populateGuides(guides); populateGuides(guides);
var pdfs = $(data).find('#pdf .reference'); var pdfs = $(data).find('#pdf .reference');
@ -103,14 +114,14 @@ $(document).ready(function () {
$('#main').html(homeTitle); $('#main').html(homeTitle);
}); });
$.get("eula.html", function(data) { $.get("eula.html", function (data) {
var fuel_license = $(data).find('#fuel-license').html(); var fuel_license = $(data).find('#fuel-license').html();
$('#fuel-license').html($(fuel_license).find('pre')); $('#fuel-license').html($(fuel_license).find('pre'));
}); });
$.get("third-party-licenses.html", function(data){ $.get("third-party-licenses.html", function (data) {
var third_party = $(data).find(".section > .section"); var third_party = $(data).find(".section > .section");
$(third_party).each(function(i,v){ $(third_party).each(function (i, v) {
var el = $(v).find('.reference'); var el = $(v).find('.reference');
var href = $(el).attr('href'); var href = $(el).attr('href');
var heading = $(el).text(); var heading = $(el).text();
@ -143,7 +154,7 @@ $(document).ready(function () {
$('.headerlink').each(function () { $('.headerlink').each(function () {
$(this).replaceWith(generateLinks($(this).attr('href'), $(this).parent().children('.toc-backref').text())); $(this).replaceWith(generateLinks($(this).attr('href'), $(this).parent().children('.toc-backref').text()));
}); });
$('[data-toggle="tooltip"]').tooltip(); $('[data-toggle="tooltip"]').tooltip();
ZeroClipboard.config({ ZeroClipboard.config({
@ -174,4 +185,8 @@ $(document).ready(function () {
} }
); );
$('a[data-toggle="tab"]').on('click', function (e) {
history.pushState(null, null, $(this).attr('href'));
});
}); });

View File

@ -26,7 +26,9 @@ h4, h5 {
font-weight: bold; font-weight: bold;
} }
h3.no-margin { margin-top: 0; } h3.no-margin {
margin-top: 0;
}
a.toc-backref { a.toc-backref {
color: #41454D; color: #41454D;
@ -426,8 +428,8 @@ a:hover .panel .panel-body {
} }
div#home { div#home {
min-height: 392px; min-height: 392px;
position: relative; position: relative;
} }
ul#menuNav { ul#menuNav {
@ -435,84 +437,94 @@ ul#menuNav {
} }
a.list-group-item:focus, a.list-group-item:hover { a.list-group-item:focus, a.list-group-item:hover {
color: #FFF; color: #FFF;
text-decoration: none; text-decoration: none;
background-color: #D3301A; background-color: #D3301A;
} }
#preview-area { #preview-area {
width: 60px; width: 60px;
height: 60px; height: 60px;
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
bottom: 60px; bottom: 60px;
right: 0; right: 0;
margin: auto auto; margin: auto auto;
-webkit-user-select: none; -webkit-user-select: none;
-moz-user-select: none; -moz-user-select: none;
-ms-user-select: none; -ms-user-select: none;
user-select: none; user-select: none;
} }
.btn-default.red { .btn-default.red {
margin-bottom: 15px; margin-bottom: 15px;
text-align: left; text-align: left;
} }
.btn-default.red.active, .btn-default.red.focus, .btn-default.red:active, .btn-default.red:focus, .btn-default.red:hover { .btn-default.red.active, .btn-default.red.focus, .btn-default.red:active, .btn-default.red:focus, .btn-default.red:hover {
color: #fff; color: #fff;
background-color: #D3301A; background-color: #D3301A;
border-color: #AD2816; border-color: #AD2816;
} }
i.fa-file-pdf-o { i.fa-file-pdf-o {
color: #D3301A; color: #D3301A;
} }
.btn-default.red:hover i.fa-file-pdf-o { .btn-default.red:hover i.fa-file-pdf-o {
color: #fff; color: #fff;
} }
.btn-danger { .btn-danger {
background-color: #D3301A; background-color: #D3301A;
border-color: #AD2816; border-color: #AD2816;
margin-bottom: 15px; margin-bottom: 15px;
} }
#pdfs h3 { #pdfs h3 {
margin-top: 0; margin-top: 0;
} }
.spinner { .spinner {
width: 30px; width: 30px;
height: 30px; height: 30px;
background-color: #D3301A; background-color: #D3301A;
margin: 0 auto; margin: 0 auto;
-webkit-animation: rotateplane 1.2s infinite ease-in-out; -webkit-animation: rotateplane 1.2s infinite ease-in-out;
animation: rotateplane 1.2s infinite ease-in-out; animation: rotateplane 1.2s infinite ease-in-out;
} }
@-webkit-keyframes rotateplane { @-webkit-keyframes rotateplane {
0% { -webkit-transform: perspective(120px) } 0% {
50% { -webkit-transform: perspective(120px) rotateY(180deg) } -webkit-transform: perspective(120px)
100% { -webkit-transform: perspective(120px) rotateY(180deg) rotateX(180deg) } }
50% {
-webkit-transform: perspective(120px) rotateY(180deg)
}
100% {
-webkit-transform: perspective(120px) rotateY(180deg) rotateX(180deg)
}
} }
@keyframes rotateplane { @keyframes rotateplane {
0% { 0% {
transform: perspective(120px) rotateX(0deg) rotateY(0deg); transform: perspective(120px) rotateX(0deg) rotateY(0deg);
-webkit-transform: perspective(120px) rotateX(0deg) rotateY(0deg) -webkit-transform: perspective(120px) rotateX(0deg) rotateY(0deg)
} 50% { }
transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg); 50% {
-webkit-transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg) transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg);
} 100% { -webkit-transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg)
transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg); }
-webkit-transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg); 100% {
} transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg);
-webkit-transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg);
}
} }
.navbar-version { display: none; } .navbar-version {
display: none;
}
@media (max-width: 767px) and (min-width: 0px) { @media (max-width: 767px) and (min-width: 0px) {
.navbar-default .navbar-text { .navbar-default .navbar-text {