Synchronize with Etiquette.
This commit is contained in:
parent
ff5fcca548
commit
b9019095e2
2 changed files with 24 additions and 3 deletions
|
@ -82,6 +82,7 @@ pre
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
|
||||||
|
height: 18px;
|
||||||
margin: 8px;
|
margin: 8px;
|
||||||
background-color: var(--color_transparency);
|
background-color: var(--color_transparency);
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,14 +85,19 @@ function _request(method, url, callback)
|
||||||
*/
|
*/
|
||||||
const request = new XMLHttpRequest();
|
const request = new XMLHttpRequest();
|
||||||
const response = {
|
const response = {
|
||||||
"meta": {"completed": false, "status": 0},
|
"meta": {
|
||||||
|
"completed": false,
|
||||||
|
"status": 0,
|
||||||
|
"json_ok": false,
|
||||||
|
"request_url": url,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
request.onreadystatechange = function()
|
request.onreadystatechange = function()
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
readystate values:
|
readystate values:
|
||||||
0 UNSENT
|
0 UNSENT / ABORTED
|
||||||
1 OPENED
|
1 OPENED
|
||||||
2 HEADERS_RECEIVED
|
2 HEADERS_RECEIVED
|
||||||
3 LOADING
|
3 LOADING
|
||||||
|
@ -105,7 +110,6 @@ function _request(method, url, callback)
|
||||||
{return;}
|
{return;}
|
||||||
|
|
||||||
response.meta.status = request.status;
|
response.meta.status = request.status;
|
||||||
response.meta.request_url = url;
|
|
||||||
|
|
||||||
if (request.status != 0)
|
if (request.status != 0)
|
||||||
{
|
{
|
||||||
|
@ -132,6 +136,7 @@ function get(url, callback)
|
||||||
{
|
{
|
||||||
request = common._request("GET", url, callback);
|
request = common._request("GET", url, callback);
|
||||||
request.send();
|
request.send();
|
||||||
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
common.post =
|
common.post =
|
||||||
|
@ -142,6 +147,21 @@ function post(url, data, callback)
|
||||||
*/
|
*/
|
||||||
request = common._request("POST", url, callback);
|
request = common._request("POST", url, callback);
|
||||||
request.send(data);
|
request.send(data);
|
||||||
|
return request;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// STRING TOOLS ////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
common.join_and_trail =
|
||||||
|
function join_and_trail(l, s)
|
||||||
|
{
|
||||||
|
if (l.length === 0)
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return l.join(s) + s
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Reference in a new issue