mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-30 15:01:32 +00:00
Performance, respect EnableHud from ESX
This commit is contained in:
+28
-26
@@ -1,15 +1,15 @@
|
||||
(function(){
|
||||
(function () {
|
||||
let status = [];
|
||||
|
||||
let status = []
|
||||
|
||||
let renderStatus = function(){
|
||||
let renderStatus = function () {
|
||||
|
||||
$('#status_list').html('');
|
||||
|
||||
for(let i=0; i<status.length; i++){
|
||||
for (let i = 0; i < status.length; i++) {
|
||||
|
||||
if(!status[i].visible)
|
||||
if (!status[i].visible) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let statusDiv = $(
|
||||
'<div class="status">' +
|
||||
@@ -17,41 +17,43 @@
|
||||
'<div class="status_val"></div>' +
|
||||
'</div>' +
|
||||
'</div>');
|
||||
|
||||
|
||||
statusDiv.find('.status_inner')
|
||||
.css({'border' : '1px solid ' + status[i].color})
|
||||
;
|
||||
.css({ 'border': '1px solid ' + status[i].color })
|
||||
;
|
||||
|
||||
statusDiv.find('.status_val')
|
||||
.css({
|
||||
'background-color' : status[i].color,
|
||||
'width' : (status[i].val / 10000) + '%'
|
||||
'background-color': status[i].color,
|
||||
'width': (status[i].val / 10000) + '%'
|
||||
})
|
||||
;
|
||||
;
|
||||
|
||||
$('#status_list').append(statusDiv)
|
||||
$('#status_list').append(statusDiv);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
window.onData = function(data){
|
||||
|
||||
if(data.update){
|
||||
|
||||
window.onData = function (data) {
|
||||
if (data.update) {
|
||||
status.length = 0;
|
||||
|
||||
for(let i=0; i<data.status.length; i++)
|
||||
status.push(data.status[i])
|
||||
for (let i = 0; i < data.status.length; i++) {
|
||||
status.push(data.status[i]);
|
||||
}
|
||||
|
||||
renderStatus();
|
||||
}
|
||||
|
||||
if(data.setDisplay){
|
||||
$('#status_list').css({'opacity' : data.display})
|
||||
if (data.setDisplay) {
|
||||
$('#status_list').css({ 'opacity': data.display });
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
window.onload = function (e) {
|
||||
window.addEventListener('message', function (event) {
|
||||
onData(event.data);
|
||||
});
|
||||
};
|
||||
|
||||
window.onload = function(e){ window.addEventListener('message', function(event){ onData(event.data) }); }
|
||||
|
||||
})()
|
||||
})();
|
||||
Reference in New Issue
Block a user