DescFunc 28,13 done, added ajax prop update, need work

This commit is contained in:
color.diff=auto
2021-05-03 00:27:13 -06:00
parent 2fcc98dddb
commit f008b24b1f
5 changed files with 97 additions and 40 deletions

View File

@@ -45,7 +45,9 @@ function search() {
});
}
function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
$(document).ready(function () {
$('.form-text').hide();
@@ -137,30 +139,55 @@ $(document).ready(function () {
$(this).fadeOut("slow");
});
$('').change(function () {
if (this.checked) {
$('option[disabled="disabled"]').hide();
} else {
$('option[disabled="disabled"]').show();
}
});
// every time we change a prop dropdown,
//
// 1 send to server,
// 2 grab string,
// 3 update item display
$('select[name^="prop"]').change(function(){
prop = capitalizeFirstLetter($(this).attr("name"));
val = escape(this.value);
$.get("/ajax/uniqueitems.php?cmd=getString&prop=" + val, function (data) {
console.log(data)
$("."+prop).html(data.string1);
});
});
// cmd = getUniqueItem
$('.uniqueitems-select').change(function () {
$(".item").attr("src", "/img/items/1.png");
$.get("/ajax/uniqueitems.php?cmd=getUniqueItem&index=" + this.value, function (data) {
props = data.props;
$('.item_desc').html("<p></p>");
$.each(props, function (i, v) {
console.log(props);
$('.item_desc').html("<p></p>");
$.each(props, function (i, v) {
if (v.par1) {
$s1 = '';
}
if(v.string){
$('.item_desc p').append(v.string[0]+"<br>");
$('.item_desc p').append('<li class="'+i+'">'+v.string[0]+"</li>");
}
});
invImg = "/img/items/" + data.invfile + ".png";
$(".item").attr("src", invImg);
@@ -175,14 +202,6 @@ $(document).ready(function () {
});
// cmd = sortBy
$('input[name="sort"]').change(function () {
$.get("/ajax/uniqueitems.php?cmd=sortBy&sort=" + this.value, function (data) {

View File

@@ -167,7 +167,7 @@ option {
.item_desc {
height: auto;
width: 420px;
width: 640px;
position: absolute;
left: 110px;
top: 23px;
@@ -180,6 +180,10 @@ option {
}
.item_desc p {
font-size: 14px;
font-size: 13px;
color: #4169E1;
}
ul, li, ul li {
list-style-type: none;
}