diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 04a4ae736..1ba21bbb3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -527,6 +527,7 @@ The shortcode has the following parameters: - **next:** path of the next document _(optional)_ - **prevText:** override the button text linking to the previous document _(optional)_ - **nextText:** override the button text linking to the next document _(optional)_ +- **keepTab:** include the currently selected tab in the button link _(optional)_ The shortcode generates buttons that link to both the previous and next documents. By default, the shortcode uses either the `list_title` or the `title` of the linked @@ -539,6 +540,10 @@ document, but you can use `prevText` and `nextText` to override button text. {{ page-nav prev="/path/to/prev/" prevText="Previous" next="/path/to/next" nextText="Next" >}} + +{{ page-nav prev="/path/to/prev/" next="/path/to/next" keepTab=true>}} +``` + ### Keybinds Use the `{{< keybind >}}` shortcode to include OS-specific keybindings/hotkeys. The following parameters are available: diff --git a/assets/js/content-interactions.js b/assets/js/content-interactions.js index d7e6b4647..48a76dcb4 100644 --- a/assets/js/content-interactions.js +++ b/assets/js/content-interactions.js @@ -27,7 +27,6 @@ headingElements.each(function() { var elementWhiteList = [ ".tabs p a", ".code-tabs p a", - ".truncate-toggle", ".children-links a", ".list-links a", "a.url-trigger", @@ -75,91 +74,21 @@ $('#contents-toggle-btn').click(function(e) { $('#nav-tree').toggleClass('open'); }) -//////////////////////////////// Tabbed Content //////////////////////////////// - -function tabbedContent(container, tab, content) { - - // Add the active class to the first tab in each tab group, - // in case it wasn't already set in the markup. - $(container).each(function () { - $(tab, this).removeClass('is-active'); - $(tab + ':first', this).addClass('is-active'); - }); - - $(tab).on('click', function(e) { - e.preventDefault(); - - // Make sure the tab being clicked is marked as active, and make the rest inactive. - $(this).addClass('is-active').siblings().removeClass('is-active'); - - // Render the correct tab content based on the position of the tab being clicked. - const activeIndex = $(tab).index(this); - $(content).each(function(i) { - if (i === activeIndex) { - $(this).show(); - $(this).siblings(content).hide(); - } - }); - }); -} - -tabbedContent('.code-tabs-wrapper', '.code-tabs p a', '.code-tab-content'); -tabbedContent('.tabs-wrapper', '.tabs p a', '.tab-content'); - -// Retrieve the user's programming language (client library) preference. -function getApiLibPreference() { - return Cookies.get('influx-docs-api-lib') || ''; -} - -function getTabQueryParam() { - const queryParams = new URLSearchParams(window.location.search); - return $('