Flat Link List

This commit is contained in:
Marius
2021-08-11 19:11:37 +02:00
parent db03f3b8a2
commit b12a5e5c85

View File

@@ -58,9 +58,8 @@ $force_download = true;
// IGNORE EMPTY FOLDERS // IGNORE EMPTY FOLDERS
$ignore_empty_folders = true; $ignore_empty_folders = true;
// DISPLAY LINKS TO INDEX FILES ON FOLDERS // DISPLAY LINKS TO HTML FILES IN A FLAT LIST
$index_files = array(); $flat_link_list = array();
$index_ext_list = array("html");
// SET TITLE BASED ON FOLDER NAME, IF NOT SET ABOVE // SET TITLE BASED ON FOLDER NAME, IF NOT SET ABOVE
@@ -140,8 +139,8 @@ $icon_url = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA+gAAAAyCAYAAADP7vEwA
bottom: 0; bottom: 0;
left: 0; left: 0;
position: fixed; position: fixed;
height: 100%; height: 1rem;
width: 1rem; width: 100%;
background: DodgerBlue; background: DodgerBlue;
} }
@@ -152,6 +151,7 @@ $icon_url = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA+gAAAAyCAYAAADP7vEwA
bottom: 0; bottom: 0;
width: 100%; width: 100%;
background: white; background: white;
transition: all .2s;
} }
.drawer-handle { .drawer-handle {
@@ -274,13 +274,13 @@ function get_directory_size($path)
} }
// Display sidebar with all index.html files // Display sidebar with all index.html files
function display_index_files() { function display_flat_link_list() {
global $index_files; global $flat_link_list;
$h = "<div class=\"drawer\">"; $h = "<div class=\"drawer\">";
$h .= "<label class=\"drawer-handle\" for=\"drawer-handle\">---</label>"; $h .= "<label class=\"drawer-handle\" for=\"drawer-handle\">---</label>";
$h .= "<input type=\"checkbox\" id=\"drawer-handle\">"; $h .= "<input type=\"checkbox\" id=\"drawer-handle\">";
$h .= "<div class=\"index-links\">"; $h .= "<div class=\"index-links\">";
foreach($index_files as $index_file) { foreach($flat_link_list as $index_file) {
$h .= "<div><a href=\"./" . $index_file . "\">" . $index_file . "</a></div>"; $h .= "<div><a href=\"./" . $index_file . "\">" . $index_file . "</a></div>";
} }
$h .= "</div>"; $h .= "</div>";
@@ -299,7 +299,7 @@ function display_frame() {
} }
// SHOW THE MEDIA BLOCK // SHOW THE MEDIA BLOCK
function display_block( $file, $index_files_array ) function display_block( $file, $flat_link_list_array )
{ {
global $ignore_file_list, $ignore_ext_list, $force_download; global $ignore_file_list, $ignore_ext_list, $force_download;
@@ -340,7 +340,7 @@ function display_block( $file, $index_files_array )
// RECURSIVE FUNCTION TO BUILD THE BLOCKS // RECURSIVE FUNCTION TO BUILD THE BLOCKS
function build_blocks( $items, $folder ) function build_blocks( $items, $folder )
{ {
global $ignore_file_list, $ignore_ext_list, $sort_by, $toggle_sub_folders, $ignore_empty_folders, $index_files, $index_ext_list; global $ignore_file_list, $ignore_ext_list, $sort_by, $toggle_sub_folders, $ignore_empty_folders, $flat_link_list;
$objects = array(); $objects = array();
$objects['directories'] = array(); $objects['directories'] = array();
@@ -383,9 +383,9 @@ function build_blocks( $items, $folder )
} }
// INDEX FILES // INDEX FILES
if(in_array($file_ext, $index_ext_list)) if($file_ext == 'html')
{ {
array_push($index_files, $item); array_push($flat_link_list, $item);
} }
} }
@@ -414,11 +414,11 @@ function build_blocks( $items, $folder )
break; break;
} }
if( $has_sub_items ) echo display_block( $file, $index_files ); if( $has_sub_items ) echo display_block( $file, $flat_link_list );
} }
else else
{ {
echo display_block( $file, $index_files ); echo display_block( $file, $flat_link_list );
} }
if( $toggle_sub_folders ) if( $toggle_sub_folders )
@@ -443,13 +443,13 @@ function build_blocks( $items, $folder )
$fileExt = ext($file); $fileExt = ext($file);
if(in_array($file, $ignore_file_list)) { continue; } if(in_array($file, $ignore_file_list)) { continue; }
if(in_array($fileExt, $ignore_ext_list)) { continue; } if(in_array($fileExt, $ignore_ext_list)) { continue; }
echo display_block( $file, $index_files ); echo display_block( $file, $flat_link_list );
} }
// If in root folder, display window with list of index.html files // If in root folder, display window with list of index.html files
if (!$folder) { if (!$folder) {
echo display_index_files(); echo display_flat_link_list();
} }