From 82c77dfa96722177624efcc9445b7502cdbf4b96 Mon Sep 17 00:00:00 2001 From: Ryan Meek <25127328+maykar@users.noreply.github.com> Date: Mon, 3 Aug 2020 13:20:52 -0400 Subject: [PATCH] config for skip_hidden --- swipe-navigation.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/swipe-navigation.js b/swipe-navigation.js index f799b77..d4d4834 100644 --- a/swipe-navigation.js +++ b/swipe-navigation.js @@ -33,6 +33,8 @@ function swipeNavigaiton() { config.swipe_amount !== undefined ? config.swipe_amount / Math.pow(10, 2) : 0.15; + let skip_hidden = + config.skip_hidden !== undefinded ? config.skip_hidden : true; let skip_tabs = config.skip_tabs !== undefined ? String(config.skip_tabs) @@ -109,12 +111,18 @@ function swipeNavigaiton() { } function filterTabs() { - tabs = tabs.filter(element => { - return ( - !skip_tabs.includes(tabs.indexOf(element)) && - getComputedStyle(element, null).display != "none" - ); - }); + if (skip_hidden) { + tabs = tabs.filter(element => { + return ( + !skip_tabs.includes(tabs.indexOf(element)) && + getComputedStyle(element, null).display != "none" + ); + }); + } else { + tabs = tabs.filter(element => { + return !skip_tabs.includes(tabs.indexOf(element)); + }); + } firstTab = wrap ? 0 : null; lastTab = wrap ? tabs.length - 1 : null; }