correção de xss e mais uma porrada coisas '-'

This commit is contained in:
2025-06-22 05:24:22 -03:00
parent 5c9de60169
commit fd452dd177
10 changed files with 302 additions and 67 deletions

View File

@@ -31,3 +31,16 @@ body {
}
}
}
@media only screen and (max-width: 1080px) {
#login_form {
width: 80%;
ul {
padding-top: 0;
justify-content: center;
li {
margin-top: 3vw;
}
}
}
}

View File

@@ -40,3 +40,16 @@ body {
}
}
}
@media only screen and (max-width: 1080px) {
#register_form {
width: 80%;
ul {
padding-top: 0;
justify-content: center;
li {
margin-top: 3vw;
}
}
}
}

View File

@@ -351,7 +351,12 @@
#text_lore {
ul {
position: relative;
#btn {
width: 100%;
min-height: 20dvw;
display: flex;
align-items: center;
flex-direction: column;
a {
position: absolute;
top: 1dvh;
right: 1dvh;
@@ -369,6 +374,35 @@
font-size: 1.5em;
padding: 1vw;
white-space: pre-wrap;
width: 100%;
min-height: 45dvw;
}
textarea {
width: 100%;
min-height: 45dvw;
resize: none;
border: none;
background-color: transparent;
font-family: arial;
font-size: 1.5em;
padding: 1vw;
white-space: pre-wrap;
color: #ffffff;
}
.lore_edit {
border: none;
margin: 1dvw 0 1dvw 0;
padding: 0.5dvh;
width: 99%;
background-color: var(--btncolor);
font-family: Arial, Helvetica, sans-serif;
font-size: 2em;
border-radius: 1dvw;
cursor: pointer;
transition: 0.3s;
}
.lore_edit:hover {
background-color: var(--lines);
}
}
}
@@ -435,4 +469,15 @@
width: 30%;
transform: translateY(50px) translateX(-50px);
}
#box_2 {
#text_lore {
a {
height: 200dvw;
}
textarea {
height: 200dvw;
}
}
}
}

View File

@@ -333,17 +333,7 @@
</div>
<div id="inv">
<h1>Inventario</h1>
<ul>
<li>
<label>item_name</label>
<label>quantidade</label>
<a id="DelBTN">
<span class="material-symbols-outlined">
close
</span>
</a>
</li>
</ul>
<ul></ul>
<hgroup>
<input type="text" placeholder="item name" />
<select name="durabilite">
@@ -355,7 +345,7 @@
<input type="number" placeholder="quantidade" max="100" />
<a id="btn">add</a>
<label>
<p>0</p>
<p id="invPA">0</p>
/
<p id="mip">0</p>
<a id="btn" class="editbtn inventario">
@@ -377,12 +367,20 @@
<h1>Texto do Player</h1>
<div id="text_lore">
<ul>
<a id="btn">
<a id="btn" class="lore">
<span class="material-symbols-outlined btn-right">
edit
</span>
</a>
<p id="lore"></p>
<textarea id="lore_edit" style="display: none"></textarea>
<input
type="submit"
id="btn"
class="lore_edit"
style="display: none"
value="atualizar"
/>
</ul>
</div>
</div>

View File

@@ -1,18 +1,25 @@
let img;
let update;
let invUpdate;
function delitem(id) {
alert(id);
}
function useItem(id) {
alert(id);
}
function load_ficha() {
$.ajax({
url: window.api + "player",
type: "GET",
xhrFields: {
withCredentials: true,
},
xhrFields: { withCredentials: true },
success: function (resp) {
if (img === undefined) {
img = resp.Foto;
$("#hero").attr("src", `data:image/*;base64,${resp.Foto}`);
}
$("#vdp").text(resp.Vida);
$("#nmp").text(resp.PlayerName);
$("#lvp").text(resp.Level);
@@ -26,8 +33,13 @@ function load_ficha() {
$("#cárisma").text(resp.Cárisma);
$("#mip").text(resp.Inventario);
$("#lore").text(resp.Descrição);
if ($("#lore_edit").attr("placeholder") !== resp.Descrição) {
$("#lore_edit").attr("placeholder", resp.Descrição);
$("#lore_edit").val(resp.Descrição);
}
},
error: function (resp, status, jqXHR) {
error: function () {
window.location.href = "login.html";
},
});
@@ -37,21 +49,25 @@ function roll_load() {
$.ajax({
url: window.api + "roll",
type: "GET",
xhrFields: {
withCredentials: true,
},
xhrFields: { withCredentials: true },
success: function (resp) {
switch (update) {
case undefined:
resp.Logs.forEach(function (item) {
$("#log").append(`<li> <label>${item.log}</label></li>`);
const $li = $("<li>");
const $label = $("<label>").text(item.log);
$li.append($label);
$("#log").append($li);
update = item.id;
});
break;
default:
resp.Logs.forEach(function (item) {
if (item.id > update) {
$("#log").append(`<li> <label>${item.log}</label></li>`);
const $li = $("<li>");
const $label = $("<label>").text(item.log);
$li.append($label);
$("#log").append($li);
update = item.id;
}
});
@@ -59,12 +75,6 @@ function roll_load() {
}
$("#log").scrollTop($("#log")[0].scrollHeight);
},
error: function (resp, status, jqXHR) {
/*msg(
resp.responseJSON?.Status || "Erro",
resp.responseJSON?.Message || "Algo deu errado.",
);*/
},
});
}
@@ -73,7 +83,6 @@ function roll(d) {
url: window.api + "roll",
type: "POST",
data: { roll: d },
xhrFields: { withCredentials: true },
success: function (resp) {
msg(resp.Status, resp.Message);
@@ -81,7 +90,49 @@ function roll(d) {
});
}
function invPlayer() {
$.ajax({
url: window.api + "player/inv",
type: "GET",
xhrFields: { withCredentials: true },
success: function (resp) {
const buildItem = function (item) {
const $li = $("<li>");
$li.append($("<label>").text(item.itemname));
$li.append($("<label>").text(`tem: ${item.itemquantidade}`));
$li.append($("<label>").text(`peso: ${item.itempeso}`));
const $delBtn = $("<a>")
.attr("id", "DelBTN")
.append(
$("<span>").addClass("material-symbols-outlined").text("close"),
);
$li.on("click", () => useItem(item.id));
$delBtn.on("click", (e) => {
e.stopPropagation();
delitem(item.id);
});
$li.append($delBtn);
return $li;
};
if (invUpdate === undefined || resp.invPeso !== invUpdate) {
$("#inv ul").empty();
resp.InvItems.forEach((item) => {
$("#inv ul").append(buildItem(item));
});
invUpdate = resp.invPeso;
}
$("#invPA").text(resp.invPeso);
},
});
}
load_ficha();
$(document).ready(function () {
$(".updown").click(function () {
const atb = $(this).data("atb");
@@ -90,10 +141,8 @@ $(document).ready(function () {
$.ajax({
url: `${window.api}player/${atb}/${updown}`,
type: "PATCH",
xhrFields: {
withCredentials: true,
},
error: function (resp, status, jqXHR) {
xhrFields: { withCredentials: true },
error: function (resp) {
msg(
resp.responseJSON?.Status || "Erro",
resp.responseJSON?.Message || "Algo deu errado.",
@@ -105,5 +154,6 @@ $(document).ready(function () {
setInterval(function () {
load_ficha();
roll_load();
invPlayer();
}, 500);
});

View File

@@ -1,5 +1,6 @@
var $inp;
let lore = false;
let cordX = 0;
let cordY = 0;
@@ -78,4 +79,34 @@ $(document).ready(function () {
? editInput(reqbtn[1], cordX, cordY)
: msg("Error", "erro, ainda não foi definido a classe desse botão");
});
$(".lore").on("click", function (e) {
switch (lore) {
case false:
$(".lore span").text("close");
$("#lore").hide();
$("#lore_edit").show();
$(".lore_edit").css("display", "block");
lore = true;
break;
case true:
$(".lore span").text("edit");
$("#lore").show();
$("#lore_edit").hide();
$(".lore_edit").css("display", "none");
lore = false;
break;
}
});
$(".lore_edit").on("click", function (e) {
data_update("lore", $("#lore_edit").val()).then((result) => {
if (result) {
$(".lore span").text("edit");
$("#lore").show();
$("#lore_edit").hide();
$(".lore_edit").css("display", "none");
lore = false;
}
});
});
});