File "mistral09.html"
Full Path: /home/analogde/www/Liens/FTP/mistral09.html
File size: 3.67 KB
MIME-type: text/html
Charset: utf-8
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tree Viewer</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
<style>
ul {
list-style-type: none;
padding-left: 20px;
}
.file-icon {
margin-right: 5px;
}
.version-icon {
margin-right: 5px;
}
.context-menu {
display: none;
position: absolute;
background-color: white;
border: 1px solid #ccc;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
z-index: 1000;
}
.context-menu-item {
padding: 10px;
cursor: pointer;
}
.context-menu-item:hover {
background-color: #f0f0f0;
}
.folder-icon {
margin-right: 5px;
cursor: pointer;
}
.folder-icon.expanded {
transform: rotate(90deg);
}
</style>
</head>
<body>
<ul id="tree"></ul>
<div id="contextMenu" class="context-menu">
<div class="context-menu-item" data-action="option1">Option 1</div>
<div class="context-menu-item" data-action="option2">Option 2</div>
<div class="context-menu-item" data-action="option3">Option 3</div>
<div class="context-menu-item" data-action="option4">Option 4</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const xhr = new XMLHttpRequest();
xhr.open('GET', 'get_files.php', true);
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const data = JSON.parse(xhr.responseText);
const tree = document.getElementById('tree');
for (const [fileName, versions] of Object.entries(data)) {
const li = document.createElement('li');
const folderIcon = document.createElement('i');
folderIcon.className = 'folder-icon fas fa-chevron-right';
li.appendChild(folderIcon);
const fileIcon = document.createElement('i');
fileIcon.className = 'file-icon fas fa-file';
li.appendChild(fileIcon);
li.appendChild(document.createTextNode(fileName));
const versionsUl = document.createElement('ul');
versionsUl.style.display = 'none';
versions.forEach(version => {
const versionLi = document.createElement('li');
const versionIcon = document.createElement('i');
versionIcon.className = 'version-icon fas fa-code-branch';
versionLi.appendChild(versionIcon);
const versionLink = document.createElement('a');
versionLink.href = `version_details.php?file=${encodeURIComponent(fileName)}&version=${encodeURIComponent(version)}`;
versionLink.textContent = version;
versionLi.appendChild(versionLink);
versionsUl.appendChild(versionLi);
versionLi.addEventListener('contextmenu', function(event) {
event.preventDefault();
const contextMenu = document.getElementById('contextMenu');
contextMenu.s