Skip to content

Instantly share code, notes, and snippets.

@yitsushi
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yitsushi/265022b5f116cf9f0415 to your computer and use it in GitHub Desktop.
Save yitsushi/265022b5f116cf9f0415 to your computer and use it in GitHub Desktop.
Front page for my nginx-static-and-php docker image (https://hub.docker.com/u/yitsushi/nginx-static-and-php/)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Experiments</title>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<h1>Experiments <small>list of available items</small></h1>
<div class="input-group input-group-lg" style="margin-bottom: 1em;">
<span class="input-group-addon"><i class="glyphicon glyphicon-search"></i></span>
<input type="search" class="form-control" placeholder="Filter...">
</div>
<?php $dir = opendir('.'); ?>
<?php while($item = readdir($dir)): ?>
<?php if (in_array($item, array('Makefile', 'index.php')) || substr($item, 0, 1) == ".") { continue; } ?>
<a href='/<?php echo $item; ?><?php echo (is_dir($item) ? "/" : ""); ?>' style='display: inline-block; margin-right: 1em;' class='item'><?php echo $item; ?></a>
<?php endwhile; ?>
<div style='margin-top: 2em;'><small>by Yitsushi</small></div>
</div>
<script>
document.querySelector('input[type="search"]').addEventListener('keyup', function() {
var regexp = new RegExp(this.value, 'i');
[].map.call(document.querySelectorAll('.item'), function(item) { item.className ="item"; return item; })
.filter(function(item) { return !regexp.test(item.innerHTML); })
.forEach(function(item) { item.className ="item hidden"; })
;
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment