Props on change update stats

This commit is contained in:
color.diff=auto 2021-05-07 10:03:52 -06:00
parent 776e9d31c6
commit e3365ed343
3 changed files with 228 additions and 17 deletions

View File

@ -193,6 +193,206 @@ $(document).ready(function () {
});
/*
* Properties/par/min/max onchange function, updated item string stats
*
*
**/
$('.par1, .min1, .max1').change(function () {
prop = "Prop1";
par = $('.par1').val();
if (par == '')
par = 0;
min = $('.min1').val();
max = $('.max1').val();
val = escape($("*[name='prop1'").val());
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
console.log(data);
$(`.item_stats ul .${prop}`).html(data);
});
});
$('.par2, .min2, .max2').change(function () {
prop = "Prop2";
par = $('.par2').val();
if (par == '')
par = 0;
min = $('.min2').val();
max = $('.max2').val();
val = escape($("*[name='prop2'").val());
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
console.log(data);
$(`.item_stats ul .${prop}`).html(data);
});
});
$('.par3, .min3, .max3').change(function () {
prop = "Prop3";
par = $('.par3').val();
if (par == '')
par = 0;
min = $('.min3').val();
max = $('.max3').val();
val = escape($("*[name='prop3'").val());
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
console.log(data);
$(`.item_stats ul .${prop}`).html(data);
});
});
$('.par4, .min4, .max4').change(function () {
prop = "Prop4";
par = $('.par4').val();
if (par == '')
par = 0;
min = $('.min4').val();
max = $('.max4').val();
val = escape($("*[name='prop4'").val());
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
console.log(data);
$(`.item_stats ul .${prop}`).html(data);
});
});
$('.par5, .min5, .max5').change(function () {
prop = "Prop5";
par = $('.par5').val();
if (par == '') par = 0;
min = $('.min5').val();
max = $('.max5').val();
val = escape($("*[name='prop5'").val());
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
console.log(data);
$(`.item_stats ul .${prop}`).html(data);
});
});
$('.par6, .min6, .max6').change(function () {
prop = "Prop6";
par = $('.par6').val();
if (par == '') par = 0;
min = $('.min6').val();
max = $('.max6').val();
val = escape($("*[name='prop6'").val());
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
console.log(data);
$(`.item_stats ul .${prop}`).html(data);
});
});
$('.par7, .min7, .max7').change(function () {
prop = "Prop7";
par = $('.par7').val();
if (par == '') par = 0;
min = $('.min7').val();
max = $('.max7').val();
val = escape($("*[name='prop7'").val());
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
console.log(data);
$(`.item_stats ul .${prop}`).html(data);
});
});
$('.par8, .min8, .max8').change(function () {
prop = "Prop8";
par = $('.par8').val();
if (par == '') par = 0;
min = $('.min8').val();
max = $('.max8').val();
val = escape($("*[name='prop8'").val());
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
console.log(data);
$(`.item_stats ul .${prop}`).html(data);
});
});
$('.par9, .min9, .max9').change(function () {
prop = "Prop9";
par = $('.par9').val();
if (par == '') par = 0;
min = $('.min9').val();
max = $('.max9').val();
val = escape($("*[name='prop9'").val());
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
console.log(data);
$(`.item_stats ul .${prop}`).html(data);
});
});
$('.par10, .min10, .max10').change(function () {
prop = "Prop10";
par = $('.par10').val();
if (par == '') par = 0;
min = $('.min10').val();
max = $('.max10').val();
val = escape($("*[name='prop10'").val());
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
console.log(data);
$(`.item_stats ul .${prop}`).html(data);
});
});
$('.par11, .min11, .max11').change(function () {
prop = "Prop11";
par = $('.par11').val();
if (par == '') par = 0;
min = $('.min11').val();
max = $('.max11').val();
val = escape($("*[name='prop11'").val());
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
console.log(data);
$(`.item_stats ul .${prop}`).html(data);
});
});
$('.par12, .min12, .max12').change(function () {
prop = "Prop12";
par = $('.par12').val();
if (par == '') par = 0;
min = $('.min12').val();
max = $('.max12').val();
val = escape($("*[name='prop12'").val());
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
console.log(data);
$(`.item_stats ul .${prop}`).html(data);
});
});
// cmd = getUniqueItem
$('.uniqueitems-select').change(function () {
@ -239,13 +439,13 @@ $(document).ready(function () {
/*
* THIS LINE BREAKS hidden fields and set them to blank.
*
*/
*/
//$('.props select, .props input').val('');
$('.item_stats ul .blue').each(function(i,v){
$('.item_stats ul .blue').each(function (i, v) {
$(v).html("");
});
@ -266,13 +466,12 @@ $(document).ready(function () {
// }
//$('.item_stats div').show();
//console.log(data['lvl req']);
$.each(data, function (i, v) {
$('*[name="' + i.replace(/\s/g, '') + '"]').val(v);
$('*[name="' + i + '"]').val(v);
if (i == 'code') {
$('select[name="code[]"]').val(v);
$('select[name="code[]"]').prop('required', '');

View File

@ -148,12 +148,21 @@ select {
font-size: 18px;
border: 1px solid #CCC;
height: 34px;
text-align: center;
}
/* CAUTION: Internet Explorer hackery ahead */
input{
background: url(/img/button.png) !important;
background-size: cover;
font-weight: bold;
text-align: center !important;
}
#search {
background: none !important;
}
select::-ms-expand {
display: none; /* Remove default arrow in Internet Explorer 10 and 11 */
}
@ -169,6 +178,7 @@ select::-ms-expand {
option {
-webkit-appearance: none;
-moz-appearance: none;
}
.props input {
@ -212,7 +222,9 @@ option {
}
.item_stats li {
height: 20px;
}
ul, li, ul li {

View File

@ -85,8 +85,8 @@
</div>
<div class="row">
<div class="col-4">
<button style="margin: 20px;" class="btn btn-outline-warning btnDebug">Debug Info</button>
<button style="margin: 20px;" class="btn btn-outline-info btnDocs">Generate Docs Info</button>
<button style="margin: 20px;" class="btn btn-warning btnDebug">Debug Info</button>
<button style="margin: 20px;" class="btn btn-info btnDocs">Generate Docs Info</button>
<pre class="debug_preview" style="display:none; background: #eee; height: 420px;width: 1123px;"></pre>
</div>
</div>