Compose-Examples/docs/index.html

174 lines
7.0 KiB
HTML
Raw Normal View History

2024-03-09 19:58:53 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Haxxnet Compose Viewer</title>
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" integrity="sha512-t4GWSVZO1eC8BM339Xd7Uphw5s17a86tIZIj8qRxhnKub6WoyhnrxeCIMeAqBPgdZGlCcG2PrZjMc+Wr78+5Xg==" crossorigin="anonymous">
<!-- Dark Mode CSS -->
<style>
body {
background-color: #333;
color: #fff;
min-height: 100vh;
display: flex;
flex-direction: column;
}
.container {
flex: 1;
}
.project-tile {
border: 1px solid #555;
border-radius: 10px;
padding: 10px;
margin: 10px;
text-align: center;
background-color: #444;
cursor: pointer;
}
.project-tile img {
max-width: 50px;
max-height: 50px;
margin-bottom: 10px;
}
#searchBar {
width: 310px;
margin: 10px auto;
padding: 10px;
border-radius: 5px;
border: none;
background-color: transparent;
color: #fff;
box-sizing: border-box;
}
#repoContent .project-tile {
width: 20%; /* Set width to 20% for 5 tiles in a row by default */
}
/* Responsive adjustment for small screens */
@media (max-width: 576px) {
#repoContent .project-tile {
width: 40%; /* Set width to 45% for 2 tiles in a row on small screens */
}
}
</style>
</head>
<body class="container mt-5">
<div class="container">
<a target="_blank" href="https://github.com/Haxxnet/Compose-Examples" class="d-flex justify-content-center">
<img width="80px" src="https://avatars.githubusercontent.com/u/98923398?s=200&v=4" alt="Haxxnet Avatar">
</a><br>
<div align="center" width="100%">
<h1>Awesome Docker Compose Examples</h1>
<p>Various Docker Compose examples of selfhosted FOSS and proprietary projects.</p>
<img src="https://img.shields.io/github/stars/Haxxnet/Compose-Examples.svg?style=social&label=Star" /> |
<img src="https://img.shields.io/github/forks/Haxxnet/Compose-Examples.svg?style=social&label=Fork" /> |
<img src="https://img.shields.io/github/watchers/Haxxnet/Compose-Examples.svg?style=social&label=Watch" /><p>
<img src="https://img.shields.io/github/directory-file-count/Haxxnet/Compose-Examples/examples?label=Compose%20Examples&style=for-the-badge.svg&color=blue" />
<img src="https://img.shields.io/badge/maintainer-LRVT-red" /><p>
2024-03-09 23:23:49 +00:00
</div>
<div class="text-center mt-3">
<button class="btn btn-primary" onclick="randomProject()">Random Project</button>
<button class="btn btn-danger" onclick="clearAndReload()">Clear Search</button>
2024-03-09 19:58:53 +00:00
</div>
<div id="searchBar" class="text-center">
<input type="text" id="searchInput" class="form-control" placeholder="Search by project name...">
</div>
<div id="repoContent" class="row justify-content-center"></div>
2024-03-09 23:23:49 +00:00
2024-03-09 19:58:53 +00:00
</div>
<!-- jQuery and Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.6.4.min.js" integrity="sha512-pumBsjNRGGqkPzKHndZMaAG+bir374sORyzM3uulLV14lN5LyykqNk8eEeUlUkB3U0M4FApyaHraT65ihJhDpQ==" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js" integrity="sha512-VK2zcvntEufaimc+efOYi622VN5ZacdnufnmX7zIhCPmjhKnOi9ZDMtg1/ug5l183f19gG1/cBstPO4D8N/Img==" crossorigin="anonymous"></script>
<!-- Custom JavaScript -->
<script>
var apiUrl = 'https://api.github.com/repos/Haxxnet/Compose-Examples/contents/examples';
2024-03-09 23:23:49 +00:00
var data; // Define the data variable globally
var dockericon = 'https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons/png/docker.png';
2024-03-09 23:23:49 +00:00
function clearAndReload() {
// Clear the search input field
document.getElementById('searchInput').value = '';
// Reload all tiles (assuming loadProjects() is your initial load function)
loadProjects();
}
2024-03-09 19:58:53 +00:00
function loadProjects() {
$.get(apiUrl, function (data) {
2024-03-09 19:58:53 +00:00
data.forEach(function (project) {
if (project.type === 'dir') {
var projectName = project.name;
var imageUrl = `https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons/png/${projectName}.png`;
2024-03-09 19:58:53 +00:00
var projectTile = $('<div class="col-md-2 project-tile">' +
'<img src="' + imageUrl + '" onerror="this.src=\'' + dockericon + '\'" alt="Icon">' +
2024-03-09 19:58:53 +00:00
'<h5>' + project.name + '</h5>' +
2024-03-09 23:23:49 +00:00
'</div>');
2024-03-09 19:58:53 +00:00
projectTile.on('click', function () {
window.open(project.html_url, '_blank');
});
2024-03-09 19:58:53 +00:00
$('#repoContent').append(projectTile);
}
});
});
}
// Initial load
$.get(apiUrl, function (responseData) {
data = responseData;
loadProjects(); // Call the function to load projects after data is available
});
// Search functionality
$('#searchInput').on('input', function () {
var searchTerm = $(this).val().toLowerCase();
// Clear existing content
$('#repoContent').empty();
// Reload projects based on the search term
data.forEach(function (project) {
if (project.type === 'dir' && project.name.toLowerCase().includes(searchTerm)) {
var projectName = project.name;
var imageUrl = `https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons/png/${projectName}.png`;
var projectTile = $('<div class="col-md-2 project-tile">' +
'<img src="' + imageUrl + '" onerror="this.src=\'' + dockericon + '\'" alt="Icon">' +
'<h5>' + project.name + '</h5>' +
'</div>');
projectTile.on('click', function () {
window.open(project.html_url, '_blank');
});
$('#repoContent').append(projectTile);
}
2024-03-09 19:58:53 +00:00
});
});
2024-03-09 23:23:49 +00:00
// Function to select a random project name and fill the search input
function randomProject() {
// Get a random project index
var randomIndex = Math.floor(Math.random() * data.length);
var randomProject = data[randomIndex];
// Fill the search input with the random project name
$('#searchInput').val(randomProject.name);
2024-03-09 23:23:49 +00:00
// Trigger the input event to initiate the search
$('#searchInput').trigger('input');
}
2024-03-09 19:58:53 +00:00
</script>
</body>
</html>