first in this branch

This commit is contained in:
Hash Borgir
2023-06-12 01:07:57 -06:00
parent e68dde2f23
commit 46a7bbd378
3 changed files with 147 additions and 13 deletions

View File

@@ -340,7 +340,7 @@ $(document).ready(function () {
var parentFormId = $(this).closest("form").attr("id");
var parentFormClass = $(this).closest("form").attr("class");
var filePath = $(`#${parentFormId} input[name='filePath']`).val();
// Construct the URL for the GET request
@@ -367,7 +367,7 @@ $(document).ready(function () {
var parentFormId = $(this).closest("form").attr("id");
var parentFormClass = $(this).closest("form").attr("class");
var filePath = $(`#${parentFormId} input[name='filePath']`).val();
@@ -400,14 +400,14 @@ $(document).ready(function () {
return "/saveCharacter.php?cmd=" + cmd + "&name=" + name + "&value=" + value + "&filePath=" + filePath;
}
$(".charform input[name='Difficulty'], .charform .skill, #CharacterName, #CharacterClass, #CharacterLevel, #CharacterClass, .stats input, .form-check-input, #statsdiv input").change(function () {
$(".charform input[name='Difficulty'], .charform .skill, #CharacterName, #CharacterClass, #CharacterLevel, #CharacterClass, .stats input, .form-check-input, #statsdiv input,#setallskills,.wp_all,.q_all").change(function () {
var name = $(this).attr("name");
var newValue = $(this).val();
var cmd = $(this).attr("cmd") || $(this).attr("id") || name;
var parentFormId = $(this).closest("form").attr("id");
var parentFormClass = $(this).closest("form").attr("class");
var filePath = $(`#${parentFormId} input[name='filePath']`).val();
var url = constructURL(cmd, name, newValue, filePath);
@@ -423,13 +423,54 @@ $(document).ready(function () {
});
});
// colorize the acts
var acts = ['Act 1', 'Act 2', 'Act 3', 'Act 4', 'Act 5'];
$('.q_all, .wp_all').click(function () {
var parentFormId = $(this).closest("form").attr("id");
var targetClass = $(this).attr('class') === 'q_all' ? `#${parentFormId} .qcheck` : `#${parentFormId} .wpcheck`;
var isChecked = $(this).prop('checked');
$(targetClass).prop('checked', isChecked);
});
$('.qcheck').change(function () {
var parentFormId = $(this).closest("form").attr("id");
var qallChecked = $(`#${parentFormId} .qcheck:checked`).length === $(`#${parentFormId} .qcheck`).length;
if (qallChecked == true) {
var qchecked = 'checked';
var val = 1;
} else {
qchecked = '';
var val = 0;
}
$(`#${parentFormId} .q_all`).prop('checked', qchecked).val(val);
});
$('.wpcheck').change(function () {
var parentFormId = $(this).closest("form").attr("id");
var wpallChecked = $(`#${parentFormId} .wpcheck:checked`).length === $(`#${parentFormId} .wpcheck`).length;
if (wpallChecked == true) {
var wpchecked = 'checked';
var val = 1;
} else {
wpchecked = '';
var val = 0;
}
$(`#${parentFormId} .wp_all`).prop('checked', wpchecked).val(val);
});
$('#setallskills').change(function () {
var value = $(this).val();
var parentFormId = $(this).closest("form").attr("id");
$(`#${parentFormId} .skill`).attr('value', value);
});
// colorize the acts
var acts = ['Act 1', 'Act 2', 'Act 3', 'Act 4', 'Act 5'];
for (var i = 0; i < acts.length; i++) {
var act = acts[i];
var className = 'act' + (i + 1);
// Find the checkbox with a label containing the act
$('input[type="checkbox"] + label:contains("' + act + '")').each(function () {
// Add a class to the parent div
@@ -437,5 +478,4 @@ $(document).ready(function () {
});
}
});// end document.ready