Unicode ship names to string

This commit is contained in:
oSkrobuk
2021-11-01 00:52:08 +03:00
parent 027c17dbd4
commit ccfdd04bc4
3 changed files with 20 additions and 6 deletions

View File

@@ -411,7 +411,7 @@ define([
});
let localTable = table.DataTable({
pageLength: 3, // default page length, smaller then max page length (4) if map is vertical resized to min.
pageLength: 3, // default page length, smaller then max page length (4) if map is vertical resized to min.
paging: true,
pagingType: 'simple',
lengthChange: false,
@@ -484,7 +484,7 @@ define([
_: (data, type, row, meta) => {
let value = data.name;
if(type === 'display'){
value = '<div class="' + MapUtil.config.tableCellEllipsisClass + ' ' + MapUtil.config.tableCellEllipsis80Class + '">' + data.name + '</div>';
value = '<div class="' + MapUtil.config.tableCellEllipsisClass + ' ' + MapUtil.config.tableCellEllipsis80Class + '">' + Util.unicodeToString(data.name) + '</div>';
}
return value;
},
@@ -622,4 +622,4 @@ define([
});
};
});
});

View File

@@ -771,7 +771,7 @@ define([
if(data){
value = data.name;
if(type === 'display'){
value = '<div class="' + MapUtil.config.tableCellEllipsisClass + ' ' + MapUtil.config.tableCellEllipsis100Class + '">' + data.name + '</div>';
value = '<div class="' + MapUtil.config.tableCellEllipsisClass + ' ' + MapUtil.config.tableCellEllipsis100Class + '">' + Util.unicodeToString(data.name) + '</div>';
}
}
@@ -1395,4 +1395,4 @@ define([
}
};
});
});

View File

@@ -946,6 +946,19 @@ define([
return url;
};
/**
* convert unicode to string
* @param text
* @returns {String}
*/
let unicodeToString = (text) => {
let result = text.replace(/\\u[\dA-F]{4}/gi,
function (match) {
return String.fromCharCode(parseInt(match.replace(/\\u/g, ''), 16));
});
return result.substring(0, 2) == "u'" ? result.substring(2, result.length - 1) : result;
};
/**
* polyfill for "passive" events
* -> see https://github.com/zzarcon/default-passive-events
@@ -3687,6 +3700,7 @@ define([
showVersionInfo: showVersionInfo,
imgRoot: imgRoot,
eveImageUrl: eveImageUrl,
unicodeToString: unicodeToString,
initPassiveEvents: initPassiveEvents,
initDefaultBootboxConfig: initDefaultBootboxConfig,
initDefaultTooltipConfig: initDefaultTooltipConfig,
@@ -3789,4 +3803,4 @@ define([
setCookie: setCookie,
getCookie: getCookie
};
});
});