add 'show hidden files' checkbox in fileman

This commit is contained in:
Barbudor 2021-10-03 20:11:14 +02:00
parent f3c1da6a55
commit 0e777193fc
31 changed files with 79 additions and 35 deletions

View File

@ -2,7 +2,7 @@
// compressed by tools/unishox/compress-html-uncompressed.py
/////////////////////////////////////////////////////////////////////
const size_t HTTP_HEAD_LAST_SCRIPT_SIZE = 226;
const size_t HTTP_HEAD_LAST_SCRIPT_SIZE = 355;
const char HTTP_HEAD_LAST_SCRIPT_COMPRESSED[] PROGMEM = "\x30\x2F\x83\xAD\xCE\x46\xB1\x0E\xE9\xDE\x3D\xA6\x77\xF5\x47\xC3\x8C\xEA\x2D\x3E"
"\x09\x81\x8B\x1A\xFA\x8E\x86\xA1\x6F\xE6\x45\xE6\x13\x0E\xB3\xE5\x61\x04\x77\x4F"
"\xBD\xE1\x82\xE8\xEA\x1C\x2E\xAB\x38\xEA\xA6\x6C\xAB\xFB\xB3\xAB\xCC\x26\x1D\x1F"
@ -11,6 +11,9 @@ const char HTTP_HEAD_LAST_SCRIPT_COMPRESSED[] PROGMEM = "\x30\x2F\x83\xAD\xCE\x4
"\xCF\x87\x77\x4F\x7A\x8F\x7C\xE8\x2A\x2B\xFC\x57\x55\xFD\x1C\x2E\x99\xDD\x3E\xF4"
"\x43\xEC\xEF\x1F\xA3\xF4\x77\x4F\xE0\x27\x57\xEB\x1A\xCF\xB3\xBC\x77\x8E\xF1\xDA"
"\x04\x1C\x87\x44\x3E\xCF\x7C\xF3\x04\x7C\xB0\xF0\x7B\xA8\xED\x9D\xB3\xC1\xEE\x3D"
"\xC3\xE1\x1D\xD3\x58\x87\x78\xF0\x7A\x1D\x9E\x0F\xFA\x32\x8F\xC3";
"\xC0\x89\xC1\x77\x8C\x1D\xDF\x03\x02\xE0\xBC\xE8\x28\xC0\x2F\x70\x2C\x74\xF5\x19"
"\x04\xCE\x82\x6F\x86\x05\x66\x47\xCF\x1D\xA3\xEC\x70\x58\x19\xA1\xF6\x79\x9F\x7D"
"\x9C\xCF\xB0\x43\xD7\x47\xC2\x3B\xA6\xB1\x0E\xF1\xE0\xF4\x3B\x3C\x1F\xF4\x65\x1F"
"\x86";
#define HTTP_HEAD_LAST_SCRIPT Decompress(HTTP_HEAD_LAST_SCRIPT_COMPRESSED,HTTP_HEAD_LAST_SCRIPT_SIZE).c_str()

View File

@ -2,7 +2,7 @@
// compressed by tools/unishox/compress-html-uncompressed.py
/////////////////////////////////////////////////////////////////////
const size_t HTTP_HEAD_STYLE2_SIZE = 478;
const size_t HTTP_HEAD_STYLE2_SIZE = 496;
const char HTTP_HEAD_STYLE2_COMPRESSED[] PROGMEM = "\x1C\x2E\xAB\x38\xF6\x8E\xCF\x88\xFE\x79\x9C\x67\x82\x04\x18\xA7\x5F\xEC\x4D\x17"
"\xE3\xCC\xE3\x3A\x59\x7D\x8D\x3C\x0E\xB0\xCD\x07\xBF\x82\xF8\x43\xCC\xF2\x3E\x8E"
"\x3E\x23\x61\xE0\x3C\x0B\x3E\x08\x52\x02\xDE\x67\x58\xA7\xA3\xC2\xA8\xF3\x39\x47"
@ -15,6 +15,7 @@ const char HTTP_HEAD_STYLE2_COMPRESSED[] PROGMEM = "\x1C\x2E\xAB\x38\xF6\x8E\xCF
"\x61\xED\x30\x16\x5D\x1E\x61\x33\x14\x08\x38\x05\x85\xA3\xDC\x08\x33\x0F\x71\xD0"
"\xD4\x08\x56\xFF\xA3\xC2\x81\x22\xE0\x20\xCD\x3D\xC7\x4F\x82\x17\x20\x60\x8D\xC7"
"\xD3\x1A\x78\x19\x62\x09\xBC\x3C\x79\x9C\xA2\x18\x6C\x3C\x0D\xBF\x8F\x6F\x1E\x67"
"\x38\x86\x1B\x11\xCA\x21\x86\xC3\xC1\xEE";
"\x38\x86\x1B\x11\xCA\x21\x86\xC3\xC1\xEE\x3A\x0A\x30\x7B\x44\xDF\x0C\x0A\xCC\x81"
"\x0B\x61";
#define HTTP_HEAD_STYLE2 Decompress(HTTP_HEAD_STYLE2_COMPRESSED,HTTP_HEAD_STYLE2_SIZE).c_str()

View File

@ -8,5 +8,14 @@ const char HTTP_HEAD_LAST_SCRIPT[] PROGMEM =
"t++;"
"}"
"}"
"function sf(s){"
"var t=0,i=document.querySelectorAll('.hf');"
"while(i.length>=t){"
"if(i[t]){"
"i[t].style.display=s?'block':'none';"
"}"
"t++;"
"}"
"}"
"wl(jd);" // Add name='' to any id='' in input,button,textarea,select
"</script>";

View File

@ -8,4 +8,5 @@ const char HTTP_HEAD_STYLE2[] PROGMEM =
"a{color:#%06x;text-decoration:none;}" // COLOR_BUTTON
".p{float:left;text-align:left;}"
".q{float:right;text-align:right;}"
".r{border-radius:0.3em;padding:2px;margin:6px 2px;}";
".r{border-radius:0.3em;padding:2px;margin:6px 2px;}"
".hf{display:none;}";

View File

@ -950,6 +950,7 @@
#define D_CREATE_NEW_FILE "Create and edit new file"
#define D_EDIT_FILE "Edit File"
#define D_CONFIRM_FILE_DEL "Confirm file deletion"
#define D_SHOW_HIDDEN_FILES "Show hidden files"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "versterking:"

View File

@ -949,6 +949,7 @@
#define D_CREATE_NEW_FILE "Create and edit new file"
#define D_EDIT_FILE "Edit File"
#define D_CONFIRM_FILE_DEL "Confirm file deletion"
#define D_SHOW_HIDDEN_FILES "Show hidden files"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "усилване:"

View File

@ -950,6 +950,7 @@
#define D_CREATE_NEW_FILE "Create and edit new file"
#define D_EDIT_FILE "Edit File"
#define D_CONFIRM_FILE_DEL "Confirm file deletion"
#define D_SHOW_HIDDEN_FILES "Show hidden files"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"

View File

@ -950,6 +950,7 @@
#define D_CREATE_NEW_FILE "Datei erstellen und bearbeiten"
#define D_EDIT_FILE "Datei bearbeiten"
#define D_CONFIRM_FILE_DEL "Datei löschen bestätigen"
#define D_SHOW_HIDDEN_FILES "Show hidden files"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "Umgebung:"

View File

@ -950,6 +950,7 @@
#define D_CREATE_NEW_FILE "Create and edit new file"
#define D_EDIT_FILE "Edit File"
#define D_CONFIRM_FILE_DEL "Confirm file deletion"
#define D_SHOW_HIDDEN_FILES "Show hidden files"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"

View File

@ -950,6 +950,7 @@
#define D_CREATE_NEW_FILE "Create and edit new file"
#define D_EDIT_FILE "Edit File"
#define D_CONFIRM_FILE_DEL "Confirm file deletion"
#define D_SHOW_HIDDEN_FILES "Show hidden files"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"

View File

@ -950,6 +950,7 @@
#define D_CREATE_NEW_FILE "Crear y editar un archivo nuevo"
#define D_EDIT_FILE "Editar Archivo"
#define D_CONFIRM_FILE_DEL "Confirmar la eliminación del archivo"
#define D_SHOW_HIDDEN_FILES "Show hidden files"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "Ganancia:"

View File

@ -949,6 +949,7 @@
#define D_CREATE_NEW_FILE "Créer and modifier un nouveau fichier"
#define D_EDIT_FILE "Modification de fichier"
#define D_CONFIRM_FILE_DEL "Confirmez la suppression du fichier"
#define D_SHOW_HIDDEN_FILES "Affichez les fichiers cachés"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"

View File

@ -950,6 +950,7 @@
#define D_CREATE_NEW_FILE "Create and edit new file"
#define D_EDIT_FILE "Edit File"
#define D_CONFIRM_FILE_DEL "Confirm file deletion"
#define D_SHOW_HIDDEN_FILES "Show hidden files"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"

View File

@ -950,6 +950,7 @@
#define D_CREATE_NEW_FILE "Create and edit new file"
#define D_EDIT_FILE "Edit File"
#define D_CONFIRM_FILE_DEL "Confirm file deletion"
#define D_SHOW_HIDDEN_FILES "Show hidden files"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"

View File

@ -950,6 +950,7 @@
#define D_CREATE_NEW_FILE "Create and edit new file"
#define D_EDIT_FILE "Edit File"
#define D_CONFIRM_FILE_DEL "Confirm file deletion"
#define D_SHOW_HIDDEN_FILES "Show hidden files"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "nyereség:"

View File

@ -950,6 +950,7 @@
#define D_CREATE_NEW_FILE "Crea e modifica nuovo file"
#define D_EDIT_FILE "Modifica file"
#define D_CONFIRM_FILE_DEL "Conferma eliminazione file"
#define D_SHOW_HIDDEN_FILES "Show hidden files"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "guadagno:"

View File

@ -950,6 +950,7 @@
#define D_CREATE_NEW_FILE "Create and edit new file"
#define D_EDIT_FILE "Edit File"
#define D_CONFIRM_FILE_DEL "Confirm file deletion"
#define D_SHOW_HIDDEN_FILES "Show hidden files"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"

View File

@ -950,6 +950,7 @@
#define D_CREATE_NEW_FILE "Create and edit new file"
#define D_EDIT_FILE "Edit File"
#define D_CONFIRM_FILE_DEL "Confirm file deletion"
#define D_SHOW_HIDDEN_FILES "Show hidden files"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"

View File

@ -950,6 +950,7 @@
#define D_CREATE_NEW_FILE "Utwórz i edytuj nowy plik"
#define D_EDIT_FILE "Edytuj Plik"
#define D_CONFIRM_FILE_DEL "Confirm file deletion"
#define D_SHOW_HIDDEN_FILES "Show hidden files"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "wejście:"

View File

@ -950,6 +950,7 @@
#define D_CREATE_NEW_FILE "Criar e editar um novo arquivo"
#define D_EDIT_FILE "Editar arquivo"
#define D_CONFIRM_FILE_DEL "Confirmar remoção do arquivo"
#define D_SHOW_HIDDEN_FILES "Show hidden files"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "ganho:"

View File

@ -950,6 +950,7 @@
#define D_CREATE_NEW_FILE "Create and edit new file"
#define D_EDIT_FILE "Edit File"
#define D_CONFIRM_FILE_DEL "Confirm file deletion"
#define D_SHOW_HIDDEN_FILES "Show hidden files"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"

View File

@ -950,6 +950,7 @@
#define D_CREATE_NEW_FILE "Create and edit new file"
#define D_EDIT_FILE "Edit File"
#define D_CONFIRM_FILE_DEL "Confirm file deletion"
#define D_SHOW_HIDDEN_FILES "Show hidden files"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"

View File

@ -950,6 +950,7 @@
#define D_CREATE_NEW_FILE "Create and edit new file"
#define D_EDIT_FILE "Edit File"
#define D_CONFIRM_FILE_DEL "Confirm file deletion"
#define D_SHOW_HIDDEN_FILES "Show hidden files"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"

View File

@ -950,6 +950,7 @@
#define D_CREATE_NEW_FILE "Create and edit new file"
#define D_EDIT_FILE "Edit File"
#define D_CONFIRM_FILE_DEL "Confirm file deletion"
#define D_SHOW_HIDDEN_FILES "Show hidden files"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"

View File

@ -950,6 +950,7 @@
#define D_CREATE_NEW_FILE "Create and edit new file"
#define D_EDIT_FILE "Edit File"
#define D_CONFIRM_FILE_DEL "Confirm file deletion"
#define D_SHOW_HIDDEN_FILES "Show hidden files"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"

View File

@ -950,6 +950,7 @@
#define D_CREATE_NEW_FILE "Create and edit new file"
#define D_EDIT_FILE "Edit File"
#define D_CONFIRM_FILE_DEL "Confirm file deletion"
#define D_SHOW_HIDDEN_FILES "Show hidden files"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"

View File

@ -950,6 +950,7 @@
#define D_CREATE_NEW_FILE "Create and edit new file"
#define D_EDIT_FILE "Edit File"
#define D_CONFIRM_FILE_DEL "Confirm file deletion"
#define D_SHOW_HIDDEN_FILES "Show hidden files"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"

View File

@ -950,6 +950,7 @@
#define D_CREATE_NEW_FILE "Create and edit new file"
#define D_EDIT_FILE "Edit File"
#define D_CONFIRM_FILE_DEL "Confirm file deletion"
#define D_SHOW_HIDDEN_FILES "Show hidden files"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "khuếch đại:"

View File

@ -950,6 +950,7 @@
#define D_CREATE_NEW_FILE "Create and edit new file"
#define D_EDIT_FILE "Edit File"
#define D_CONFIRM_FILE_DEL "Confirm file deletion"
#define D_SHOW_HIDDEN_FILES "Show hidden files"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"

View File

@ -950,6 +950,7 @@
#define D_CREATE_NEW_FILE "Create and edit new file"
#define D_EDIT_FILE "Edit File"
#define D_CONFIRM_FILE_DEL "Confirm file deletion"
#define D_SHOW_HIDDEN_FILES "Show hidden files"
//xsns_67_as3935.ino
#define D_AS3935_GAIN "gain:"

View File

@ -563,20 +563,25 @@ const char UFS_FORM_FILE_UPGb[] PROGMEM =
"<form method='get' action='ufse'><input type='hidden' file='" D_NEW_FILE "'>"
"<button type='submit'>" D_CREATE_NEW_FILE "</button></form>"
#endif
"<input type='checkbox' id='shf' onclick='sf(eb(\"shf\").checked);' name='shf'>" D_SHOW_HIDDEN_FILES "</input>"
"</fieldset>"
"</div>"
"<div id='f2' name='f2' style='display:none;text-align:center;'><b>" D_UPLOAD_STARTED " ...</b></div>";
const char UFS_FORM_SDC_DIR_NORMAL[] PROGMEM =
"";
const char UFS_FORM_SDC_DIR_HIDDABLE[] PROGMEM =
" class='hf'";
const char UFS_FORM_SDC_DIRd[] PROGMEM =
"<pre><a href='%s' file='%s'>%s</a></pre>";
const char UFS_FORM_SDC_DIRb[] PROGMEM =
"<pre><a href='%s' file='%s'>%s</a> %s %8d %s %s</pre>";
"<pre%s><a href='%s' file='%s'>%s</a> %s %8d %s %s</pre>";
const char UFS_FORM_SDC_HREF[] PROGMEM =
"ufsd?download=%s/%s";
#ifdef GUI_TRASH_FILE
const char UFS_FORM_SDC_HREFdel[] PROGMEM =
//"<a href=ufsd?delete=%s/%s>&#128465;</a>"; // 🗑️
"<a href=ufsd?delete=%s/%s onclick=\"return confirm('" D_CONFIRM_FILE_DEL "')\">&#128293;</a>"; // 🔥
"<a href='ufsd?delete=%s/%s' onclick=\"return confirm('" D_CONFIRM_FILE_DEL "')\">&#128293;</a>"; // 🔥
#endif // GUI_TRASH_FILE
#ifdef GUI_EDIT_FILE
@ -584,7 +589,7 @@ const char UFS_FORM_SDC_HREFdel[] PROGMEM =
#define FILE_BUFFER_SIZE 1024
const char UFS_FORM_SDC_HREFedit[] PROGMEM =
"<a href=ufse?file=%s/%s>&#x1F4DD;</a>"; // 📝
"<a href='ufse?file=%s/%s'>&#x1F4DD;</a>"; // 📝
const char HTTP_EDITOR_FORM_START[] PROGMEM =
"<fieldset><legend><b>&nbsp;" D_EDIT_FILE "&nbsp;</b></legend>"
@ -710,41 +715,40 @@ void UfsListDir(char *path, uint8_t depth) {
if (!*(pp + 1)) { pp++; }
char *cp = name;
// osx formatted disks contain a lot of stuff we dont want
if (!UfsReject((char*)ep)) {
bool hiddable = UfsReject((char*)ep);
for (uint8_t cnt = 0; cnt<depth; cnt++) {
*cp++ = '-';
for (uint8_t cnt = 0; cnt<depth; cnt++) {
*cp++ = '-';
}
sprintf(cp, format, ep);
if (entry.isDirectory()) {
ext_snprintf_P(npath, sizeof(npath), UFS_FORM_SDC_HREF, pp, ep);
WSContentSend_P(UFS_FORM_SDC_DIRd, npath, ep, name);
uint8_t plen = strlen(path);
if (plen > 1) {
strcat(path, "/");
}
sprintf(cp, format, ep);
if (entry.isDirectory()) {
ext_snprintf_P(npath, sizeof(npath), UFS_FORM_SDC_HREF, pp, ep);
WSContentSend_P(UFS_FORM_SDC_DIRd, npath, ep, name);
uint8_t plen = strlen(path);
if (plen > 1) {
strcat(path, "/");
}
strcat(path, ep);
UfsListDir(path, depth + 4);
path[plen] = 0;
} else {
strcat(path, ep);
UfsListDir(path, depth + 4);
path[plen] = 0;
} else {
#ifdef GUI_TRASH_FILE
char delpath[128];
ext_snprintf_P(delpath, sizeof(delpath), UFS_FORM_SDC_HREFdel, pp, ep);
char delpath[128];
ext_snprintf_P(delpath, sizeof(delpath), UFS_FORM_SDC_HREFdel, pp, ep);
#else
char delpath[2];
delpath[0]=0;
char delpath[2];
delpath[0]=0;
#endif // GUI_TRASH_FILE
#ifdef GUI_EDIT_FILE
char editpath[128];
ext_snprintf_P(editpath, sizeof(editpath), UFS_FORM_SDC_HREFedit, pp, ep);
char editpath[128];
ext_snprintf_P(editpath, sizeof(editpath), UFS_FORM_SDC_HREFedit, pp, ep);
#else
char editpath[2];
editpath[0]=0;
char editpath[2];
editpath[0]=0;
#endif // GUI_TRASH_FILE
ext_snprintf_P(npath, sizeof(npath), UFS_FORM_SDC_HREF, pp, ep);
WSContentSend_P(UFS_FORM_SDC_DIRb, npath, ep, name, tstr.c_str(), entry.size(), delpath, editpath);
}
ext_snprintf_P(npath, sizeof(npath), UFS_FORM_SDC_HREF, pp, ep);
WSContentSend_P(UFS_FORM_SDC_DIRb, hiddable ? UFS_FORM_SDC_DIR_HIDDABLE : UFS_FORM_SDC_DIR_NORMAL, npath, ep, name, tstr.c_str(), entry.size(), delpath, editpath);
}
entry.close();
}