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");
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) {
var currentLocation = window.location;
var linkUrl = currentLocation.protocol + '//' + currentLocation.host + currentLocation.pathname + url;
@ -43,7 +54,7 @@ function generateCopyButton(url) {
function populateGuides(guides) {
$(guides).find('.section').each(function(i){
$(guides).find('.section').each(function (i) {
var index = i + 1;
var el = $(this).find('.reference');
var href = $(el).attr('href');
@ -53,27 +64,27 @@ function populateGuides(guides) {
});
var columns = $('#guides .col-sm-3');
for(var i = 0; i < columns.length; i+=4) {
columns.slice(i, i+4).wrapAll("<div class='row'></div>");
for (var i = 0; i < columns.length; i += 4) {
columns.slice(i, i + 4).wrapAll("<div class='row'></div>");
}
}
function populatePdfs(pdfs){
$(pdfs).each(function(){
function populatePdfs(pdfs) {
$(pdfs).each(function () {
var href = $(this).attr('href');
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>');
});
var columns = $('#pdfs .col-lg-6');
for(var i = 0; i < columns.length; i+=2) {
columns.slice(i, i+2).wrapAll("<div class='row'></div>");
for (var i = 0; i < columns.length; i += 2) {
columns.slice(i, i + 2).wrapAll("<div class='row'></div>");
}
}
function populateDownload(download){
function populateDownload(download) {
var el = $(download).find('h1 > .reference');
var href = $(el).attr('href');
var link = $(el).text();
@ -89,9 +100,9 @@ $(document).ready(function () {
$('ul.nav.navbar-nav li.dropdown').not('.globaltoc-container').hide();
$.get( "index_content.html", function( data ) {
var homeTitle = $(data).find('.home-title').html();
var home = $(data).find('.what-is-mirantis-openstack').html();
$.get("index_content.html", function (data) {
var homeTitle = $(data).find('.home-title').html();
var home = $(data).find('.what-is-mirantis-openstack').html();
var guides = $(data).find('#guides');
populateGuides(guides);
var pdfs = $(data).find('#pdf .reference');
@ -103,14 +114,14 @@ $(document).ready(function () {
$('#main').html(homeTitle);
});
$.get("eula.html", function(data) {
$.get("eula.html", function (data) {
var fuel_license = $(data).find('#fuel-license').html();
$('#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");
$(third_party).each(function(i,v){
$(third_party).each(function (i, v) {
var el = $(v).find('.reference');
var href = $(el).attr('href');
var heading = $(el).text();
@ -143,7 +154,7 @@ $(document).ready(function () {
$('.headerlink').each(function () {
$(this).replaceWith(generateLinks($(this).attr('href'), $(this).parent().children('.toc-backref').text()));
});
$('[data-toggle="tooltip"]').tooltip();
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;
}
h3.no-margin { margin-top: 0; }
h3.no-margin {
margin-top: 0;
}
a.toc-backref {
color: #41454D;
@ -426,8 +428,8 @@ a:hover .panel .panel-body {
}
div#home {
min-height: 392px;
position: relative;
min-height: 392px;
position: relative;
}
ul#menuNav {
@ -435,84 +437,94 @@ ul#menuNav {
}
a.list-group-item:focus, a.list-group-item:hover {
color: #FFF;
text-decoration: none;
background-color: #D3301A;
color: #FFF;
text-decoration: none;
background-color: #D3301A;
}
#preview-area {
width: 60px;
height: 60px;
position: absolute;
top: 0;
left: 0;
bottom: 60px;
right: 0;
margin: auto auto;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
width: 60px;
height: 60px;
position: absolute;
top: 0;
left: 0;
bottom: 60px;
right: 0;
margin: auto auto;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.btn-default.red {
margin-bottom: 15px;
text-align: left;
margin-bottom: 15px;
text-align: left;
}
.btn-default.red.active, .btn-default.red.focus, .btn-default.red:active, .btn-default.red:focus, .btn-default.red:hover {
color: #fff;
background-color: #D3301A;
border-color: #AD2816;
color: #fff;
background-color: #D3301A;
border-color: #AD2816;
}
i.fa-file-pdf-o {
color: #D3301A;
color: #D3301A;
}
.btn-default.red:hover i.fa-file-pdf-o {
color: #fff;
color: #fff;
}
.btn-danger {
background-color: #D3301A;
border-color: #AD2816;
margin-bottom: 15px;
background-color: #D3301A;
border-color: #AD2816;
margin-bottom: 15px;
}
#pdfs h3 {
margin-top: 0;
margin-top: 0;
}
.spinner {
width: 30px;
height: 30px;
background-color: #D3301A;
margin: 0 auto;
-webkit-animation: rotateplane 1.2s infinite ease-in-out;
animation: rotateplane 1.2s infinite ease-in-out;
width: 30px;
height: 30px;
background-color: #D3301A;
margin: 0 auto;
-webkit-animation: rotateplane 1.2s infinite ease-in-out;
animation: rotateplane 1.2s infinite ease-in-out;
}
@-webkit-keyframes rotateplane {
0% { -webkit-transform: perspective(120px) }
50% { -webkit-transform: perspective(120px) rotateY(180deg) }
100% { -webkit-transform: perspective(120px) rotateY(180deg) rotateX(180deg) }
0% {
-webkit-transform: perspective(120px)
}
50% {
-webkit-transform: perspective(120px) rotateY(180deg)
}
100% {
-webkit-transform: perspective(120px) rotateY(180deg) rotateX(180deg)
}
}
@keyframes rotateplane {
0% {
transform: perspective(120px) rotateX(0deg) rotateY(0deg);
-webkit-transform: perspective(120px) rotateX(0deg) rotateY(0deg)
} 50% {
transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg);
-webkit-transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg)
} 100% {
transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg);
-webkit-transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg);
}
0% {
transform: perspective(120px) rotateX(0deg) rotateY(0deg);
-webkit-transform: perspective(120px) rotateX(0deg) rotateY(0deg)
}
50% {
transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg);
-webkit-transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg)
}
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) {
.navbar-default .navbar-text {