Skip to content

Commit

Permalink
Merge pull request #76 from maroux/allow_multiple_excludes
Browse files Browse the repository at this point in the history
Allow multiple exclude files in EXCLUDE_FILE option - thanks to @maroux.
  • Loading branch information
rufuspollock authored Mar 31, 2018
2 parents 00e5b5c + 1cbb284 commit 3d0774e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Valid options:

### `EXCLUDE_FILE` variable

This variable is optional. It allows you to exclude a file (e.g. index.html) from the file listings.
This variable is optional. It allows you to exclude a file (e.g. index.html) or a list of files from the file listings.


### `AUTO_TITLE` variable
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
<body>
<div id="navigation"></div>
<div id="listing"></div>

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script type="text/javascript">
// var S3BL_IGNORE_PATH = true;
// var BUCKET_NAME = 'BUCKET';
// var BUCKET_URL = 'https://BUCKET.s3.amazonaws.com';
// var S3B_ROOT_DIR = 'SUBDIR_L1/SUBDIR_L2/';
// var S3B_SORT = 'DEFAULT';
// var EXCLUDE_FILE = 'index.html';
// var EXCLUDE_FILE = 'index.html'; // change to array to exclude multiple files
// var AUTO_TITLE = true;
// var S3_REGION = 's3'; // for us-east-1
</script>
Expand Down
8 changes: 7 additions & 1 deletion list.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ if (typeof S3B_SORT == 'undefined') {
var S3B_SORT = 'DEFAULT';
}

if (typeof EXCLUDE_FILE == 'undefined') {
var EXCLUDE_FILE = [];
} else if (typeof EXCLUDE_FILE == 'string') {
var EXCLUDE_FILE = [EXCLUDE_FILE];
}

jQuery(function($) { getS3Data(); });

// This will sort your file listing by most recently modified.
Expand Down Expand Up @@ -235,7 +241,7 @@ function prepareTable(info) {
item.href = item.href.replace(/%2F/g, '/');
}
var row = renderRow(item, cols);
if (typeof EXCLUDE_FILE == 'undefined' || EXCLUDE_FILE != item.Key)
if (!EXCLUDE_FILE.includes(item.Key))
content.push(row + '\n');
});

Expand Down

0 comments on commit 3d0774e

Please sign in to comment.