Replace alert boxes with overlay info boxes (#1742)

* consolidate test-ip definition, added missing Access-Control-Allow-Origin

* replace alert boxes with overlay info boxes

* .

* .

* .

* .

* .

* .

* .

* .

* .

* .

* .

Co-authored-by: CaCO3 <caco@ruinelli.ch>
This commit is contained in:
CaCO3
2023-01-03 08:05:28 +01:00
committed by GitHub
parent 4d823b354f
commit 6b84eb0290
24 changed files with 287 additions and 101 deletions

View File

@@ -666,8 +666,42 @@ esp_err_t handler_reboot(httpd_req_t *req)
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "handler_reboot");
ESP_LOGI(TAG, "!!! System will restart within 5 sec!!!");
const char* resp_str = "<body style='font-family: arial'> <h3 id=t></h3></body><script>var h='Rebooting!<br>The page will automatically reload in around 25..60s<br>(in case of a firmware update it can take up to 180s).<br>'; document.getElementById('t').innerHTML=h; setInterval(function (){h +='.'; document.getElementById('t').innerHTML=h; fetch('reboot_page.html',{mode: 'no-cors'}).then(r=>{parent.location.href=('index.html');})}, 1000);</script>";
httpd_resp_send(req, resp_str, strlen(resp_str));
char _query[200];
char _valuechar[30];
std::string _task;
std::string response =
"<html><head><script>"
"function m(h) {"
"document.getElementById('t').innerHTML=h;"
"setInterval(function (){h +='.'; document.getElementById('t').innerHTML=h;"
"fetch('reboot_page.html',{mode: 'no-cors'}).then(r=>{parent.location.href=('index.html');})}, 1000);"
"}</script></head></html><body style='font-family: arial'><h3 id=t></h3>";
if (httpd_req_get_url_query_str(req, _query, 200) == ESP_OK)
{
ESP_LOGD(TAG, "Query: %s", _query);
if (httpd_query_key_value(_query, "task", _valuechar, 30) == ESP_OK)
{
ESP_LOGD(TAG, "task is found: %s", _valuechar);
_task = std::string(_valuechar);
}
}
httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");
if (_task.compare("OTA") == 0) { // Reboot after OTA upload
response.append("<script>m('The upload completed successfully.<br>Rebooting and installing it now...<br><br>"
"The page will automatically reload after the update completed.<br>"
"This can take several minutes!<br><br>');</script>");
}
else { // Normal reboot
response.append("<script>m('Rebooting!<br>The page will automatically reload in around 25..60s.<br><br>');</script>");
}
response.append("</body></html>");
httpd_resp_send(req, response.c_str(), strlen(response.c_str()));
doReboot();

View File

@@ -42,7 +42,7 @@
#define FILE_PATH_MAX (255) //Max length a file path can have on storage
//server_file +(ota_page.html + upload_script.html)
#define MAX_FILE_SIZE (8000*1024) // 8 MB Max size of an individual file. Make sure this value is same as that set in upload_script.html
#define MAX_FILE_SIZE (8000*1024) // 8 MB Max size of an individual file. Make sure this value is same as that set in upload_script.html and ota_page.html!
#define MAX_FILE_SIZE_STR "8MB"
#define LOGFILE_LAST_PART_BYTES SERVER_FILER_SCRATCH_BUFSIZE * 20 // 80 kBytes // Size of partial log file to return

BIN
images/close.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

View File

@@ -40,9 +40,9 @@ input[type=number] {
</body>
<script src="common.js"></script>
<script src="jszip.min.js"></script>
<script src="FileSaver.min.js"></script>
<script type="text/javascript" src="common.js"></script>
<script type="text/javascript" src="jszip.min.js"></script>
<script type="text/javascript" src="FileSaver.min.js"></script>
<script>
function startBackup() {

BIN
sd-card/html/close.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@@ -145,6 +145,8 @@ function compareVersions() {
console.log("FW Hash: " + fWGitHash + ", Web UI Hash: " + webUiHash);
if (fWGitHash != webUiHash) {
alert("The Version of the Web Interface (" + webUiHash + ") does not match the Firmware Version (" + fWGitHash + ")! It is suggested to keep them on the same version!");
firework.launch("The Version of the Web Interface (" + webUiHash +
") does not match the Firmware Version (" +
fWGitHash + ")! It is suggested to keep them on the same version!", 'warning', 30000);
}
}

View File

@@ -41,7 +41,9 @@ select {
font-size: 16px;
}
</style>
<link href="firework.css" rel="stylesheet">
<script type="text/javascript" src="jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="firework.js"></script>
</head>
<body style="font-family: arial; padding: 0px 10px;">
@@ -129,7 +131,7 @@ function SaveToConfig(){
WriteConfigININew();
UpdateConfigReference(domainname)
SaveConfigToServer(domainname);
alert("Config.ini is updated!");
firework.launch('Configuration got updated. Please reboot to activate changes!', 'success', 5000);
}
function EnhanceContrast(){

View File

@@ -60,7 +60,9 @@ th, td {
opacity: 0.4;
}
</style>
<link href="firework.css" rel="stylesheet">
<script type="text/javascript" src="jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="firework.js"></script>
</head>
<body style="font-family: arial; padding: 0px 10px;">
@@ -227,7 +229,7 @@ function newROI(){
erg = CreateROI(_number, "analog", sel.selectedIndex, _roinew, 1, 1, 30, 30, false);
if (erg != "")
alert(erg);
firework.launch(erg, 'danger', 30000);
else
UpdateROIs(_roinew);
}
@@ -281,7 +283,7 @@ function SaveToConfig(){
_zwcat["Analog"]["enabled"] = document.getElementById("Category_Analog_enabled").checked;
WriteConfigININew();
SaveConfigToServer(domainname);
alert("Config.ini is updated!");
firework.launch('Configuration got updated. Please reboot to activate changes!', 'success', 5000);
}
@@ -296,13 +298,13 @@ function UpdateROIs(_sel){
if (_catzw["Analog"]["enabled"] == false)
{
document.getElementById("Category_Analog_enabled").checked = false;
EnDisableDigits();
alert("Analog ROIs are disabled - please enable (Check box top left).\n");
EnDisableAnalog();
firework.launch('Analog ROIs are disabled - please enable first (Check box top left)', 'warning', 10000);
return;
}
if (ROIInfo.length == 0){
alert("There are no ROIs defined.\nPlease first create a new ROI (\"New ROIs ...\").\n");
firework.launch('There are no ROIs defined. Please first create a new ROI ("New ROIs ...")', 'danger', 10000);
document.getElementById("newROI").disabled = false;
document.getElementById("deleteROI").disabled = true;
document.getElementById("index").disabled = true;
@@ -454,7 +456,7 @@ function renameNumber(){
erg = RenameNUMBER(_delte, _numbernew);
if (erg != "")
alert(erg);
firework.launch(erg, 'danger', 30000);
else
UpdateNUMBERS(_numbernew);
}
@@ -464,7 +466,7 @@ function newNumber(){
erg = CreateNUMBER(_numbernew);
if (erg != "")
alert(erg);
firework.launch(erg, 'danger', 30000);
else
UpdateNUMBERS(_numbernew);
}
@@ -476,7 +478,7 @@ function removeNumber(){
var _delte= sel.options[sel.selectedIndex].text;
erg = DeleteNUMBER(_delte);
if (erg != "")
alert(erg);
firework.launch(erg, 'danger', 30000);
UpdateNUMBERS();
}
}
@@ -683,7 +685,7 @@ function drawTextBG(context, txt, x, y, padding) {
erg = RenameROI(_number, "analog", _roialt, _roinew);
if (erg != "")
alert(erg);
firework.launch(erg, 'danger', 30000);
else
UpdateROIs(_roinew);
}

View File

@@ -21,7 +21,9 @@ textarea {
font-size: 14px;
}
</style>
<link href="firework.css" rel="stylesheet">
<script type="text/javascript" src="jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="firework.js"></script>
</head>
<body style="font-family: arial; padding: 0px 10px;">
@@ -61,7 +63,7 @@ function saveTextAsFile()
FileDeleteOnServer("/config/config.ini", domainname);
var textToSave = document.getElementById("inputTextToSave").value;
FileSendContent(textToSave, "/config/config.ini", domainname);
alert("Config.ini is updated!")
firework.launch('Configuration got updated. Please reboot to activate changes!', 'success', 5000);
}
}

View File

@@ -72,7 +72,9 @@ textarea {
}
</style>
<link href="firework.css" rel="stylesheet">
<script type="text/javascript" src="jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="firework.js"></script>
</head>
<body style="font-family: arial; padding: 0px 10px;">
@@ -1450,7 +1452,7 @@ function LoadConfigNeu() {
domainname = getDomainname();
if (!loadConfig(domainname)) {
alert("Config.ini could not be loaded!\nPlease reload the page.");
firework.launch('Configuration could not be loaded! Please reload the page!', 'danger', 30000);
return;
}
ParseConfig();
@@ -1528,8 +1530,8 @@ function WriteParameter(_param, _category, _cat, _name, _optional, _number = -1)
if (!_isFound)
{
_zw_txt = "In the selected field the value '" + textToFind + "' in the parameter '";
_zw_txt = _zw_txt + _cat + "' in the field '" + _name + "' is invalid.\nPLEASE CHECK BEFORE SAVING!";
alert(_zw_txt);
_zw_txt = _zw_txt + _cat + "' in the field '" + _name + "' is invalid. PLEASE CHECK BEFORE SAVING!";
firework.launch(_zw_txt, 'warning', 10000);
}
}
else if ((element.getAttribute("type") != null) && (element.getAttribute("type").toLowerCase() == "checkbox")) {
@@ -1569,8 +1571,8 @@ function WriteParameter(_param, _category, _cat, _name, _optional, _number = -1)
if (!_isFound)
{
_zw_txt = "In the selected field the value '" + textToFind + "' in the section '";
_zw_txt = _zw_txt + _cat + "' in the field '" + _name + "' is invalid.\nPLEASE CHECK BEFORE SAVING!";
alert(_zw_txt);
_zw_txt = _zw_txt + _cat + "' in the field '" + _name + "' is invalid. PLEASE CHECK BEFORE SAVING!";
firework.launch(_zw_txt, 'warning', 10000);
}
}
@@ -2057,7 +2059,7 @@ function saveTextAsFile()
{
ReadParameterAll();
if (document.getElementsByClassName("invalid-input").length > 0) {
alert("Settings cannot be saved. Please check your entries.");
firework.launch("Settings cannot be saved. Please check your entries!", 'danger', 30000);
return;
}
@@ -2065,7 +2067,7 @@ function saveTextAsFile()
ReadParameterAll();
WriteConfigININew();
SaveConfigToServer(domainname);
alert("Config.ini is updated!")
firework.launch('Configuration got updated. Please reboot to activate changes!', 'success', 5000);
}
}

View File

@@ -51,7 +51,9 @@ th, td {
padding: 5px 5px 5px 0px;
}
</style>
<link href="firework.css" rel="stylesheet">
<script type="text/javascript" src="jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="firework.js"></script>
</head>
<body style="font-family: arial; padding: 0px 10px;">
@@ -228,7 +230,7 @@ function newROI() {
erg = CreateROI(_number, "digit", sel.selectedIndex, _roinew, 1, 1, 30, 51, 0);
if (erg != "")
alert(erg);
firework.launch(erg, 'danger', 30000);
else {
UpdateROIs(_roinew);
// Shift all ROIs on right side to the right
@@ -265,7 +267,7 @@ function changelockSizes(){
lockSizes = document.getElementById("lockSizes").checked;
if (!lockSizes) {
alert("For best results it is (in most cases) advised to keep the y, Δx and Δy identical!");
firework.launch("For best results it is in most cases advised to keep the y, Δx and Δy identical!", 'warning', 10000);
}
}
@@ -284,7 +286,7 @@ function SaveToConfig(){
_zwcat["Digits"]["enabled"] = document.getElementById("Category_Digits_enabled").checked;
WriteConfigININew();
SaveConfigToServer(domainname);
alert("Config.ini is updated!");
firework.launch('Configuration got updated. Please reboot to activate changes!', 'success', 5000);
}
@@ -300,12 +302,12 @@ function UpdateROIs(_sel){
{
document.getElementById("Category_Digits_enabled").checked = false;
EnDisableDigits();
alert("Digital ROIs are disabled - please enable (Check box top left).\n");
firework.launch('Digital ROIs are disabled - please enable first (Check box top left)', 'warning', 10000);
return;
}
if (ROIInfo.length == 0){
alert("There are no ROIs defined.\nPlease first create a new ROI (\"New ROIs ...\").\n");
firework.launch('There are no ROIs defined. Please first create a new ROI ("New ROIs ...")', 'danger', 10000);
document.getElementById("newROI").disabled = false;
document.getElementById("deleteROI").disabled = true;
document.getElementById("index").disabled = true;
@@ -460,7 +462,7 @@ function renameNumber(){
erg = RenameNUMBER(_delte, _numbernew);
if (erg != "")
alert(erg);
firework.launch(erg, 'danger', 30000);
else
UpdateNUMBERS(_numbernew);
}
@@ -470,7 +472,7 @@ function newNumber(){
erg = CreateNUMBER(_numbernew);
if (erg != "")
alert(erg);
firework.launch(erg, 'danger', 30000);
else
UpdateNUMBERS(_numbernew);
}
@@ -482,7 +484,7 @@ function removeNumber(){
var _delte= sel.options[sel.selectedIndex].text;
erg = DeleteNUMBER(_delte);
if (erg != "")
alert(erg);
firework.launch(erg, 'danger', 30000);
UpdateNUMBERS();
}
}
@@ -747,7 +749,7 @@ function draw() {
erg = RenameROI(_number, "digit", _roialt, _roinew);
if (erg != "")
alert(erg);
firework.launch(erg, 'danger', 30000);
else
UpdateROIs(_roinew);
}

View File

@@ -21,6 +21,9 @@ p {font-size: 1em;}
</style>
<link href="firework.css" rel="stylesheet">
<script type="text/javascript" src="jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="firework.js"></script>
</head>
<body style="font-family: arial">
@@ -51,10 +54,10 @@ p {font-size: 1em;}
aktstatu = 0;
function reboot() {
if (confirm("Do you want to leave the configuration mode and restart the ESP32?\n\nPlease reload the page in about 30s.")) {
if (confirm("Do you want to leave the configuration mode and restart the ESP32?")) {
domainname = getDomainname();
if (!loadConfig(domainname)) {
alert("Setup Modus could not be deactivated!\Please retry.");
firework.launch('Setup Modus could not be deactivated! Please try again!', 'danger', 30000);
return;
}
ParseConfig();

View File

@@ -30,7 +30,9 @@ table {
padding: 5px;
}
</style>
<link href="firework.css" rel="stylesheet">
<script type="text/javascript" src="jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="firework.js"></script>
</head>
<body style="font-family: arial; padding: 0px 10px;">
@@ -268,7 +270,7 @@ table {
SaveCanvasToImage(canvas, "/config/reference.jpg", true, getDomainname());
showReference(param);
UpdatePage();
alert("Reference is updated!");
firework.launch('Reference got updated. Please reboot to activate changes!', 'success', 5000);
}
}

38
sd-card/html/firework.css Normal file
View File

@@ -0,0 +1,38 @@
/* Firework JS */
.firework {
background-color: #888;
border-color: #888;
border-radius: 6px;
color: #fff;
left: 200px;
padding: 5px;
position: fixed;
opacity: 0;
text-align: center;
top: 0px;
width: 600px;
z-index: 99;
font-size:120%;
}
.firework a {
color: rgba(255, 255, 255, 0.9);
cursor: pointer;
float: right;
margin: 0 -5px 0 0;
padding: 0 5px;
}
.firework.success {
background-color: #669936f0;
border-color: #669936;
color: #fff
}
.firework.danger {
background-color: #E65A27f0;
border-color: #E65A27;
color: #fff
}
.firework.warning {
color: #5F612C;
background-color: #dbd567f0;
border-color: #DBD667;
}

68
sd-card/html/firework.js Normal file
View File

@@ -0,0 +1,68 @@
/**
* Firework displays short notifications at top of page,
* then fades out a few seconds later (no user interaction)
* Source: https://www.jqueryscript.net/other/Simple-Top-Notification-Plugin-with-jQuery-firework-js.html
* https://github.com/smalldogs/fireworkjs
* @param m string message
* @param t string (optional) message type ('success', 'danger')
* @param l number (optional) length of time to display message in milliseconds
*/
;(function ($, window) {
"use strict";
window.firework = {
launch: function(m, t, l) {
if (typeof m != 'string') {
console.error('Error: Call to firework() without a message');
return false
}
var c = 'firework' // css class(es)
, p = 10 // pixels from top or page to display
, d = new Date()
, s = d.getTime() // used to create unique element ids
, fid = "firework-"+ s; // firework id
if (typeof t !== 'undefined') c += ' '+ t; // add any user defined classes
$('.firework').each(function(){ // account for existing fireworks and move new one below
p += parseInt($(this).height()) + 30
});
$('<div id="'+ fid +'" class="'+ c +'">'+ m +'<a onclick="firework.remove(\'#'+ fid +'\')"><img src=close.png></a></div>')
.appendTo('body')
.animate({
opacity: 1,
top: p +'px'
});
setTimeout(function(){ firework.remove("#"+ fid) }, typeof l == "number" ? l : 1500);
},
remove : function(t) {
$(t)
.animate({
opacity: 0
})
.promise()
.done(function(){
$(t).remove()
})
},
sticky : function(m, t, l) {
$.cookie("firework", '{ "message" : "'+ m +'", "type" : "'+ t +'", "display" : "'+ l +'" }', { path: '/' })
}
};
// checks for firework cookie on dom ready
$(function() {
if (typeof $.cookie == "function") {
if ($.cookie("firework")) {
var ex = $.parseJSON($.cookie("firework"))
setTimeout(function(){ firework.launch(ex.message, ex.type, parseInt(ex.display) > 0 ? parseInt(ex.display) : null) }, 1000)
$.cookie("firework", null, { path: '/'})
}
}
});
})(jQuery, window);

View File

@@ -1,6 +1,6 @@
<html>
<head>
<script src='https://cdn.plot.ly/plotly-2.14.0.min.js'></script>
<script type="text/javascript" src='https://cdn.plot.ly/plotly-2.14.0.min.js'></script>
<script type="text/javascript" src="common.js"></script>
<script type="text/javascript" src="readconfigcommon.js"></script>
@@ -18,7 +18,9 @@
el && eval(el.value);
}
</script>
<link href="firework.css" rel="stylesheet">
<script type="text/javascript" src="jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="firework.js"></script>
</head>
<body>
<div id='chart'></div>
@@ -46,7 +48,7 @@ fetch(_domainname + '/fileserver/log/data/' + datefile)
.then(response => {
// handle the response
if (response.status == 404) {
alert("no log data available for "+dateString);
firework.launch('No log data available for " + dateString, 'warning', 10000);
}
response.text()
.then( result => {
@@ -79,7 +81,6 @@ fetch(_domainname + '/fileserver/log/data/' + datefile)
}).catch((error) => {
// handle the error
console.log(error);
alert("test");
});
</textarea><br />
<button onclick="run();">run</button>

View File

@@ -7,7 +7,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css" type="text/css" >
<script type="text/javascript" src="common.js"></script>
<script type="text/javascript" src="common.js"></script>
<script type="text/javascript" src="readconfigcommon.js"></script>
<script type="text/javascript" src="readconfigparam.js"></script>

View File

@@ -26,7 +26,9 @@ input[type=number] {
font-size: 16px;
}
</style>
<link href="firework.css" rel="stylesheet">
<script type="text/javascript" src="jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="firework.js"></script>
</head>
<body style="font-family: arial; padding: 0px 10px;">
@@ -89,13 +91,13 @@ function init(){
function doRebootAfterUpdate() {
if (confirm("Upload completed!\nThe device will reboot now and complete the update.\nThis will take up to 180s!")) {
var stringota = "/reboot";
/* if (confirm("Upload completed!\nThe device will reboot now and complete the update.\nThis will take up to 180s!")) {*/
var stringota = "/reboot?task=OTA";
window.location = stringota;
window.location.href = stringota;
window.location.assign(stringota);
window.location.replace(stringota);
}
/* }*/
}
@@ -112,23 +114,28 @@ function prepareOnServer() {
var nameneu = document.getElementById("newfile").value;
filePath = nameneu.split(/[\\\/]/).pop();
/* Max size of an individual file. Make sure this
* value is same as that set in file_server.c */
var MAX_FILE_SIZE = 8000*1024;
var MAX_FILE_SIZE_STR = "8000KB";
if (fileInput.length == 0) {
alert("No file selected!");
firework.launch('No file selected!', 'danger', 30000);
return;
} else if (filePath.length == 0) {
alert("File path on server is not set!");
firework.launch('File path on server is not set!', 'danger', 30000);
return;
} else if (filePath.length > 100) {
alert("Filename is to long! Max 100 characters.");
firework.launch('Filename is to long! Max 100 characters.', 'danger', 30000);
return;
} else if (filePath.indexOf(' ') >= 0) {
alert("File path on server cannot have spaces!");
firework.launch('File path on server cannot have spaces!', 'danger', 30000);
return;
} else if (filePath[filePath.length-1] == '/') {
alert("File name not specified after path!");
firework.launch('File name not specified after path!', 'danger', 30000);
return;
} else if (fileInput[0].size > MAX_FILE_SIZE) {
alert("File size must be less than " + MAX_FILE_SIZE_STR + "!");
firework.launch("File size must be less than " + MAX_FILE_SIZE_STR + "!", 'danger', 30000);
return;
}
@@ -148,10 +155,10 @@ function prepareOnServer() {
/* keine Reaktion, damit sich das Dokument nicht ändert */
upload();
} else if (xhttp.status == 0) {
alert("Server closed the connection abruptly!");
firework.launch('Server closed the connection abruptly!', 'danger', 30000);
document.getElementById("doUpdate").disabled = false;
} else {
alert(xhttp.status + " Error!\n" + xhttp.responseText);
firework.launch('An error occured: ' + xhttp.responseText, 'danger', 30000);
document.getElementById("doUpdate").disabled = false;
}
}
@@ -173,14 +180,12 @@ function upload() {
if (xhttp.readyState == 4) {
stopProgressTimer();
if (xhttp.status == 200) {
// alert("Upload successfull!")
// document.reload();
extract();
} else if (xhttp.status == 0) {
alert("Server closed the connection abruptly!");
firework.launch('Server closed the connection abruptly!', 'danger', 30000);
document.getElementById("doUpdate").disabled = false;
} else {
alert(xhttp.status + " Error!\n" + xhttp.responseText);
firework.launch('An error occured: ' + xhttp.responseText, 'danger', 30000);
document.getElementById("doUpdate").disabled = false;
}
}
@@ -218,13 +223,13 @@ function extract() {
}
else
{
alert("Processing done!\n\n" + xhttp.responseText);
firework.launch('Processing done', 'success', 5000);
}
} else if (xhttp.status == 0) {
alert("Server closed the connection abruptly!");
firework.launch('Server closed the connection abruptly!', 'danger', 30000);
UpdatePage();
} else {
alert(xhttp.status + " Error!\n" + xhttp.responseText);
firework.launch('An error occured: ' + xhttp.responseText, 'danger', 30000);
UpdatePage();
}
}

View File

@@ -68,7 +68,7 @@
</table>
<script src="jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="common.js"></script>
<script type="text/javascript" src="readconfigcommon.js"></script>
<script type="text/javascript">

View File

@@ -68,6 +68,9 @@ input[type=number] {
</body></html>
<link href="firework.css" rel="stylesheet">
<script type="text/javascript" src="jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="firework.js"></script>
<script type="text/javascript" src="common.js"></script>
<script type="text/javascript" src="readconfigcommon.js"></script>
@@ -92,7 +95,7 @@ function setprevalue() {
}
catch (error)
{
alert("Failed to get data from device!");
firework.launch('Failed to get data from device!', 'danger', 30000);
}
}
@@ -111,7 +114,7 @@ function loadPrevalue(_domainname) {
}
catch (error)
{
alert("Failed to get data from device!");
firework.launch('Failed to get data from device!', 'danger', 30000);
}
// Get current RAW Value
@@ -138,7 +141,7 @@ function loadPrevalue(_domainname) {
}
catch (error)
{
alert("Failed to get data from device!");
firework.launch('Failed to get data from device!', 'danger', 30000);
}
}

View File

@@ -31,7 +31,7 @@ function createReader(file) {
image.onload = function(evt) {
var width = this.width;
var height = this.height;
alert (width); // will produce something like 198
//alert (width); // will produce something like 198
};
image.src = evt.target.result;
};
@@ -141,7 +141,7 @@ function loadConfig(_domainname) {
}
catch (error)
{
// alert("Deleting Config.ini failed");
// firework.launch('Deleting Config.ini failed!', 'danger', 30000);
}
return true;
}
@@ -166,7 +166,7 @@ function FileCopyOnServer(_source, _target, _domainname = ""){
xhttp.send(); }
catch (error)
{
// alert("Deleting Config.ini failed");
// firework.launch('Deleting Config.ini failed!', 'danger', 30000);
}
}
@@ -179,10 +179,10 @@ function FileDeleteOnServer(_filename, _domainname = ""){
if (xhttp.status == 200) {
okay = true;
} else if (xhttp.status == 0) {
// alert("Server closed the connection on delete abruptly!");
// firework.launch('Server closed the connection abruptly!', 'danger', 30000);
// location.reload()
} else {
// alert(xhttp.status + " Error!\n" + xhttp.responseText);
// firework.launch('An error occured: ' + xhttp.responseText, 'danger', 30000);
// location.reload()
}
}
@@ -194,7 +194,7 @@ function FileDeleteOnServer(_filename, _domainname = ""){
}
catch (error)
{
// alert("Deleting Config.ini failed");
// firework.launch('Deleting Config.ini failed!', 'danger', 30000);
}
return okay;
@@ -209,9 +209,9 @@ function FileSendContent(_content, _filename, _domainname = ""){
if (xhttp.status == 200) {
okay = true;
} else if (xhttp.status == 0) {
alert("Server closed the connection abruptly!");
firework.launch('Server closed the connection abruptly!', 'danger', 30000);
} else {
alert(xhttp.status + " Error!\n" + xhttp.responseText);
firework.launch('An error occured: ' + xhttp.responseText, 'danger', 30000);
}
}
};
@@ -223,7 +223,7 @@ function FileSendContent(_content, _filename, _domainname = ""){
}
catch (error)
{
// alert("Deleting Config.ini failed");
// firework.launch('Deleting Config.ini failed!', 'danger', 30000);
}
return okay;
}
@@ -254,7 +254,7 @@ function MakeContrastImageZW(zw, _enhance, _domainname){
xhttp.send(); }
catch (error)
{
// alert("Deleting Config.ini failed");
// firework.launch('Deleting Config.ini failed!', 'danger', 30000);
}
}
@@ -270,7 +270,7 @@ function MakeRefZW(zw, _domainname){
xhttp.send(); }
catch (error)
{
// alert("Deleting Config.ini failed");
// firework.launch('Deleting Config.ini failed!', 'danger', 30000);
}
_filetarget2 = zw["name"].replace("/config/", "/img_tmp/");
// _filetarget2 = _filetarget2.replace(".jpg", "_org.jpg");

View File

@@ -28,7 +28,7 @@ function getNUMBERSList() {
}
catch (error)
{
alert("Loading Hostname failed");
// alert("Loading Hostname failed");
}
datalist = datalist.split("\t");

View File

@@ -1,3 +1,10 @@
<html>
<head>
<link href="firework.css" rel="stylesheet">
<script type="text/javascript" src="jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="firework.js"></script>
</head>
</body>
<table class="fixed" border="0" style="font-family: arial">
<col width="300px" /><col width="200px" />
<tr><td>
@@ -63,19 +70,21 @@ function upload() {
/* Max size of an individual file. Make sure this
* value is same as that set in file_server.c */
var MAX_FILE_SIZE = 2000*1024;
var MAX_FILE_SIZE_STR = "2000KB";
var MAX_FILE_SIZE = 8000*1024;
var MAX_FILE_SIZE_STR = "8000KB";
if (fileInput.length == 0) {
alert("No file selected!");
firework.launch('No file selected!', 'danger', 30000);
} else if (filePath.length == 0) {
alert("File path on server is not set!");
firework.launch('File path on server is not set!', 'danger', 30000);
} else if (filePath.length > 100) {
firework.launch('Filename is to long! Max 100 characters.', 'danger', 30000);
} else if (filePath.indexOf(' ') >= 0) {
alert("File path on server cannot have spaces!");
firework.launch('File path on server cannot have spaces!', 'danger', 30000);
} else if (filePath[filePath.length-1] == '/') {
alert("File name not specified after path!");
} else if (fileInput[0].size > 2000*1024) {
alert("File size must be less than 2000KB!");
firework.launch('File name not specified after path!', 'danger', 30000);
} else if (fileInput[0].size > MAX_FILE_SIZE) {
firework.launch("File size must be less than " + MAX_FILE_SIZE_STR + "!", 'danger', 30000);
} else {
document.getElementById("newfile").disabled = true;
document.getElementById("filepath").disabled = true;
@@ -90,10 +99,10 @@ function upload() {
document.write(xhttp.responseText);
document.close();
} else if (xhttp.status == 0) {
alert("Server closed the connection abruptly!");
firework.launch('Server closed the connection abruptly!', 'danger', 30000);
UpdatePage(false);
} else {
alert(xhttp.status + " Error!\n" + xhttp.responseText);
firework.launch('An error occured: ' + xhttp.responseText, 'danger', 30000);
UpdatePage(false);
}
}
@@ -103,3 +112,6 @@ function upload() {
}
}
</script>
</body>
</html>

View File

@@ -1,4 +1,11 @@
<table>
<html>
<head>
<link href="firework.css" rel="stylesheet">
<script type="text/javascript" src="jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="firework.js"></script>
</head>
<body>
<table>
<tr><td>WLAN-SSID</td><td><input type="text" name="ssid" id="ssid"></td><td>SSID of the WLAN</td></tr>
<tr><td>WLAN-Password</td><td><input type="text" name="password" id="password"></td><td>ATTENTION: the password will not be encrypted during the sending.</td>
</tr><tr><td> Hostname</td><td><input type="text" name="hostname" id="hostname"></td><td></td>
@@ -20,10 +27,10 @@
// var xhttp = new XMLHttpRequest();
// xhttp.onreadystatechange = function() {if (xhttp.readyState == 4) {if (xhttp.status == 200) {document.reload();}}};
if (!file.name.includes("remote-setup")){if (!confirm("The zip file name should contain \"...remote-setup...\". Are you sure that you have downloaded the correct file?"))return;}
if (!file.name.includes("remote-setup")){if (!confirm("The zip file name should contain \"...remote-setup...\". Are you sure that you have downloaded the correct file?"))return;}
if (!file.name.includes("remote-setup")){
if (!confirm("The zip file name should contain \"...remote-setup...\". Are you sure that you have downloaded the correct file?"))
return;
}
function upload() {
var xhttp = new XMLHttpRequest();
@@ -60,13 +67,13 @@ if (!file.name.includes("remote-setup")){if (!confirm("The zip file name should
}
else
{
alert("Processing done!\n\n" + xhttp.responseText);
firework.launch('Processing done! (' + xhttp.responseText + ')', 'success', 5000);
}
} else if (xhttp.status == 0) {
alert("Server closed the connection abruptly!");
firework.launch('Server closed the connection abruptly!', 'danger', 30000);
UpdatePage();
} else {
alert(xhttp.status + " Error!\n" + xhttp.responseText);
firework.launch('An error occured: ' + xhttp.responseText, 'danger', 30000);
UpdatePage();
}
}
@@ -103,3 +110,5 @@ if (!file.name.includes("remote-setup")){if (!confirm("The zip file name should
</script>
</html>
</body>