Skip to content
This repository has been archived by the owner on Jun 20, 2022. It is now read-only.

Commit

Permalink
config for skip_hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
maykar authored Aug 3, 2020
1 parent d71af18 commit 82c77df
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions swipe-navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 82c77df

Please sign in to comment.