Skip to content

Commit

Permalink
Merge pull request #9 from MoskalykA/main
Browse files Browse the repository at this point in the history
refactor: remove jquery
  • Loading branch information
Gellipapa authored Aug 20, 2023
2 parents 7e3dce6 + 2e26f05 commit 4084b65
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 19 deletions.
33 changes: 15 additions & 18 deletions html/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,28 @@
let status = [];

let renderStatus = function () {
$("#status_list").html("");
document.getElementById("status_list").innerHTML = "";

for (let i = 0; i < status.length; i++) {
if (!status[i].visible) {
continue;
}

let statusDiv = $(
'<div class="status">' +
'<div class="status_inner">' +
'<div class="status_val"></div>' +
"</div>" +
"</div>"
);
const statusVal = document.createElement("div");
statusVal.style.width = status[i].percent + "%";
statusVal.style.backgroundColor = status[i].color;
statusVal.classList.add("status_val");

statusDiv
.find(".status_inner")
.css({ border: "1px solid " + status[i].color });
const statusInner = document.createElement("div");
statusInner.classList.add("status_inner");
statusInner.style.border = "1px solid " + status[i].color;
statusInner.appendChild(statusVal);

statusDiv.find(".status_val").css({
"background-color": status[i].color,
width: status[i].percent + "%",
});
const statusDiv = document.createElement("div");
statusDiv.classList.add("status");
statusDiv.appendChild(statusInner);

$("#status_list").append(statusDiv);
document.getElementById("status_list").appendChild(statusDiv);
}
};

Expand All @@ -42,11 +39,11 @@
}

if (data.setDisplay) {
$("#status_list").css({ opacity: data.display });
document.getElementById("status_list").style.opacity = data.display;
}
};

window.onload = function (e) {
window.onload = function () {
window.addEventListener("message", function (event) {
onData(event.data);
});
Expand Down
1 change: 0 additions & 1 deletion html/ui.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<body>
<div id="status_list"></div>

<script src="nui://game/ui/jquery.js" type="text/javascript"></script>
<script src="scripts/app.js"></script>
</body>
</html>

0 comments on commit 4084b65

Please sign in to comment.