Post getvars + fixed colors.py valid hex
This commit is contained in:
@ -96,6 +96,20 @@ function AJAX(addr){
|
||||
});
|
||||
}
|
||||
|
||||
this.postForm = function(args){
|
||||
xhr.open("POST", addr, true);
|
||||
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
||||
xhr.send(args);
|
||||
return new Promise(function(resolve, reject){
|
||||
xhr.addEventListener('load', function(){
|
||||
if(this.status == 200){
|
||||
if (debugCommunication) console.log('A RES', JSON.parse(this.responseText));
|
||||
resolve(JSON.parse(this.responseText));
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
this.get = function(responseType = "text"){
|
||||
xhr.open("GET", addr, true);
|
||||
xhr.responseType = responseType;
|
||||
@ -831,7 +845,7 @@ let graphs = (function (){
|
||||
msRightTimestampGetVars = dateTimestampMs + timeValueMs;
|
||||
msRightTimestampGetGraph = dateTimestampMs + 24*60*60*1000;
|
||||
|
||||
AJAX("http://" + hostPort + "/getvars?time=" + msLeftTimestampGetVars/1000 + "," + msRightTimestampGetVars/1000 + "&userconfiguration=" + encodeURIComponent(JSON.stringify(getFormattedUserConfigurationFromLocalStorage())) + "&id="+ clientID).getJSON().then(function(data){
|
||||
AJAX("http://" + hostPort + "/getvars").postForm("time=" + msLeftTimestampGetVars/1000 + "," + msRightTimestampGetVars/1000 + "&userconfiguration=" + JSON.stringify(getFormattedUserConfigurationFromLocalStorage()) + "&id="+ clientID).then(function(data){
|
||||
blocks = data.blocks;
|
||||
document.getElementById("device").innerHTML = data.device
|
||||
maxTime = msRightTimestampGetGraph;
|
||||
@ -901,7 +915,7 @@ let graphs = (function (){
|
||||
let msLeftTimestamp = msRightTimestamp - 30*60*1000;
|
||||
cursorLine(null);
|
||||
|
||||
AJAX("http://" + hostPort + "/getvars?time=" + msLeftTimestamp/1000 + "," + msRightTimestamp/1000 + "&userconfiguration=" + encodeURIComponent(JSON.stringify(getFormattedUserConfigurationFromLocalStorage())) + "&id="+ clientID).getJSON().then(function(data){
|
||||
AJAX("http://" + hostPort + "/getvars").postForm("time=" + msLeftTimestamp/1000 + "," + msRightTimestamp/1000 + "&userconfiguration=" + JSON.stringify(getFormattedUserConfigurationFromLocalStorage()) + "&id="+ clientID).then(function(data){
|
||||
currentMaxTime = msRightTimestamp + 60000;
|
||||
currentMinTime = msLeftTimestamp;
|
||||
|
||||
@ -1212,7 +1226,7 @@ let graphs = (function (){
|
||||
function applySettingsCallback(userConfiguration){
|
||||
cursorLine(null);
|
||||
|
||||
AJAX("http://" + hostPort + "/getvars?time=" + currentMinTime/1000 + "," + currentMaxTime/1000 + "&userconfiguration=" + encodeURIComponent(JSON.stringify(userConfiguration)) + "&id="+ clientID).getJSON().then(function(data){
|
||||
AJAX("http://" + hostPort + "/getvars").postForm("time=" + currentMinTime/1000 + "," + currentMaxTime/1000 + "&userconfiguration=" + JSON.stringify(userConfiguration) + "&id="+ clientID).then(function(data){
|
||||
blocks = data.blocks;
|
||||
document.getElementById("device").innerHTML = data.device
|
||||
maxTime = currentMaxTime;
|
||||
|
Reference in New Issue
Block a user