diff --git a/docs/_includes/head.html b/docs/_includes/head.html index cef6d85375..c1e251d961 100644 --- a/docs/_includes/head.html +++ b/docs/_includes/head.html @@ -21,6 +21,7 @@ + diff --git a/docs/js/customscripts.js b/docs/js/customscripts.js index d1a0c0c4bc..35e53e155b 100644 --- a/docs/js/customscripts.js +++ b/docs/js/customscripts.js @@ -22,36 +22,3 @@ $( document ).ready(function() { anchors.add('h2,h3,h4,h5'); }); - -// needed for nav tabs on pages. See Formatting > Nav tabs for more details. -// script from http://stackoverflow.com/questions/10523433/how-do-i-keep-the-current-tab-active-with-twitter-bootstrap-after-a-page-reload -$(function() { - var json, tabsState; - $('a[data-toggle="pill"], a[data-toggle="tab"]').on('shown.bs.tab', function(e) { - var href, json, parentId, tabsState; - - tabsState = localStorage.getItem("tabs-state"); - json = JSON.parse(tabsState || "{}"); - parentId = $(e.target).parents("ul.nav.nav-pills, ul.nav.nav-tabs").attr("id"); - href = $(e.target).attr('href'); - json[parentId] = href; - - return localStorage.setItem("tabs-state", JSON.stringify(json)); - }); - - tabsState = localStorage.getItem("tabs-state"); - json = JSON.parse(tabsState || "{}"); - - $.each(json, function(containerId, href) { - if (containerId && containerId !== "undefined") { - $("#" + containerId + " a[href=" + href + "]").tab('show'); - } - }); - - $("ul.nav.nav-pills, ul.nav.nav-tabs").each(function() { - var $this = $(this); - if (!json[$this.attr("id")]) { - return $this.find("a[data-toggle=tab]:first, a[data-toggle=pill]:first").tab("show"); - } - }); -}); diff --git a/docs/js/tabstate.js b/docs/js/tabstate.js new file mode 100644 index 0000000000..529dcc5bb3 --- /dev/null +++ b/docs/js/tabstate.js @@ -0,0 +1,43 @@ +// needed for nav tabs on pages. See Formatting > Nav tabs for more details. +// script from http://stackoverflow.com/questions/10523433/how-do-i-keep-the-current-tab-active-with-twitter-bootstrap-after-a-page-reload +(function() { + var registerTabEvent = function() { + $('a[data-toggle="pill"], a[data-toggle="tab"]').on('shown.bs.tab', function(e) { + var tabId, json, parentId, tabsState; + + tabsState = localStorage.getItem("tabs-state"); + json = JSON.parse(tabsState || "{}"); + parentId = $(e.target).parents("ul.nav.nav-pills, ul.nav.nav-tabs").attr("id"); + tabId = $(e.target).attr('id'); + json[parentId] = tabId; + + return localStorage.setItem("tabs-state", JSON.stringify(json)); + }); + }; + + document.addEventListener('DOMContentLoaded', function () { + var json, tabsState; + tabsState = localStorage.getItem("tabs-state"); + json = JSON.parse(tabsState || "{}"); + + $.each(json, function(containerId, tabId) { + if (containerId && containerId !== "undefined" && tabId && tabId !== "undefined" + && tabId.indexOf('#') !== 0) { + $("#" + tabId).tab('show'); + } + }); + + $("ul.nav.nav-pills, ul.nav.nav-tabs").each(function() { + var $this = $(this); + if (!json[$this.attr("id")]) { + return $this.find("a[data-toggle=tab]:first, a[data-toggle=pill]:first").tab("show"); + } + }); + + // cleanup "undefined" entries + delete json['undefined']; + localStorage.setItem("tabs-state", JSON.stringify(json)); + + registerTabEvent(); + }); +})(); diff --git a/docs/pages/pmd/userdocs/installation.md b/docs/pages/pmd/userdocs/installation.md index 7339d1b986..049fd97564 100644 --- a/docs/pages/pmd/userdocs/installation.md +++ b/docs/pages/pmd/userdocs/installation.md @@ -71,13 +71,17 @@ Additionally, the following options, are specified most of the time even though