| Current Path : /home/quelfutuu/www/lchg/lchg/ |
| Current File : /home/quelfutuu/www/lchg/lchg/lchgscript.js |
function renomme(filename, e) {
var newfilename = prompt("Renommer le fichier\n" + filename + "\nen : ", filename);
if (newfilename) {
e.preventDefault();
var theform = document.getElementById("form_renomme");
var createform = document.createElement('form');
var url = window.location.pathname;
var pagename = url.substring(url.lastIndexOf('/')+1);
createform.setAttribute("action", pagename);
createform.setAttribute("method", "post");
theform.appendChild(createform);
var inputfilename = document.createElement('input');
inputfilename.setAttribute("type", "hidden");
inputfilename.name = "fichier_a_renommer";
inputfilename.value = filename;
createform.appendChild(inputfilename);
var inputnewfilename = document.createElement('input');
inputnewfilename.setAttribute("type", "hidden");
inputnewfilename.name = "nouveau_nom";
inputnewfilename.value = newfilename;
createform.appendChild(inputnewfilename);
createform.submit();
}
}
function supprime(filename, e) {
if (confirm(filename + "\nSupprimer ce document ?")) {
e.preventDefault();
var theform = document.getElementById("form_supprime");
var createform = document.createElement('form');
var url = window.location.pathname;
var pagename = url.substring(url.lastIndexOf('/')+1);
createform.setAttribute("action", pagename);
createform.setAttribute("method", "post");
theform.appendChild(createform);
var inputelement = document.createElement('input');
inputelement.setAttribute("type", "hidden");
inputelement.name = "fichier_a_supprimer";
inputelement.value = filename;
createform.appendChild(inputelement);
createform.submit();
}
}
/* When the user clicks on the button, toggle between hiding and showing the dropdown content */
function menudisplay(filename) {
document.getElementById("Menu-"+filename).classList.toggle("show");
}
// Close the dropdown if the user clicks outside of it
window.onclick = function(event) {
if (!event.target.matches('.dropbtn')) {
var dropdowns = document.getElementsByClassName("dropdown-content");
var i;
for (i = 0; i < dropdowns.length; i++) {
var openDropdown = dropdowns[i];
if (openDropdown.classList.contains('show')) {
openDropdown.classList.remove('show');
}
}
}
}