This commit is contained in:
Igor I
2024-01-25 17:01:31 +06:00
5 changed files with 263 additions and 126 deletions

View File

@ -1,18 +1,23 @@
/*jshint esversion: 6 */
"use strict";
//var g_translations = {'':''};
//Массив g_translations подгружается отдельно
function trt(key)
{
if(key==null || key===undefined) return '';
let val=g_translations[key];
if(val==null || val===undefined)
{
for(let item in g_translations) {
if(item.toLowerCase()==(''+key).toLowerCase())
{
val=g_translations[item];
break;
let val=null;
if(g_translations !== undefined){
val=g_translations[key];
if(val==null || val===undefined)
{
for(let item in g_translations) {
if(item.toLowerCase()==(''+key).toLowerCase())
{
val=g_translations[item];
break;
}
}
}
}
@ -268,6 +273,10 @@ function alert2(title,smallText,fullText,okFunc=null)
smallText=fullText;
fullText='';
}
let pos1=smallText.indexOf('[[');
let pos2=smallText.indexOf(']]');
if(pos1>=0 && pos2>=0 && pos1<pos2) smallText=smallText.substring(pos1+2, pos2);
let win=new TWin(true);
win.BuildGUI(10,10);
win.setCaption(document.createTextNode(title));
@ -1192,6 +1201,7 @@ class TRequest
{
if(typeof(xmlHttpRequest.status)=='undefined' || xmlHttpRequest.status == 200)
{
//console.log()
if(xmlHttpRequest.responseXML!=null) {
//if(typeof(xmlHttpRequest.responseXML)=='undefined' && xmlHttpRequest.contentType.match(/\/xml/)) //For IE XDomainRequest
// xmlHttpRequest.responseXML=CreateXMLDOC(xmlHttpRequest.responseText);
@ -1211,9 +1221,10 @@ class TRequest
}
}
}else{
let obj = JSON.parse(xmlHttpRequest.responseText);
let obj=null;
try { obj = JSON.parse(xmlHttpRequest.responseText); } catch (e) {}
if(obj==null) {
alert2(trt('Alert'), trt('Wrong_JSON_document') + "!\nJSON=(" + xmlHttpRequest.responseText + ')');
alert2(trt('Alert'), trt('Wrong_JSON_document') + "!\nJSON=(" + xmlHttpRequest.responseText + ') ',xmlHttpRequest.responseURL);
return;
}
if(this.winObj!=null)