diff --git a/res/app.js b/res/app.js index b6f66b7..c3526cb 100755 --- a/res/app.js +++ b/res/app.js @@ -1,29 +1,29 @@ /* - + Copyright (C) 2021 Hash Borgir - + This file is part of D2Modder - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + * This software must not be used for commercial purposes * without my consent. Any sales or commercial use are prohibited * without my express knowledge and consent. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY! - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF @@ -37,7 +37,7 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - + */ // highlight json dump for item debugger function syntaxHighlight(json) { @@ -400,11 +400,11 @@ $(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,#setallskills,.wp_all,.q_all").change(function () { + $(".charform input[name='Difficulty'], .charform .skill, .CharacterName, .CharacterClass, .CharacterLevel, .stats input, .form-check-input, .statsdiv input,.setallskills").change(function () { var name = $(this).attr("name"); var newValue = $(this).val(); - var cmd = $(this).attr("cmd") || $(this).attr("id") || name; + var cmd = $(this).attr("cmd") || name; var parentFormId = $(this).closest("form").attr("id"); var parentFormClass = $(this).closest("form").attr("class"); @@ -424,41 +424,31 @@ $(document).ready(function () { }); $('.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 parentForm = $(this).closest('form'); + var targetClass = $(this).hasClass('q_all') ? '.qcheck' : '.wpcheck'; var isChecked = $(this).prop('checked'); - - $(targetClass).prop('checked', isChecked); + + parentForm.find(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; - } + var wpchecked = wpallChecked ? 'checked' : ''; + var val = wpallChecked ? 1 : 0; $(`#${parentFormId} .wp_all`).prop('checked', wpchecked).val(val); }); - $('#setallskills').change(function () { + $('.qcheck').change(function () { + var parentFormId = $(this).closest("form").attr("id"); + var qallChecked = $(`#${parentFormId} .qcheck:checked`).length === $(`#${parentFormId} .qcheck`).length; + var qchecked = qallChecked ? 'checked' : ''; + var val = qallChecked ? 1 : 0; + $(`#${parentFormId} .q_all`).prop('checked', qchecked).val(val); + }); + + $('.setallskills').change(function () { var value = $(this).val(); var parentFormId = $(this).closest("form").attr("id"); $(`#${parentFormId} .skill`).attr('value', value); diff --git a/src/tabs/Chars.php b/src/tabs/Chars.php index a702b4c..a4fb78e 100644 --- a/src/tabs/Chars.php +++ b/src/tabs/Chars.php @@ -67,8 +67,8 @@ EOT; $checked = ($v == 1) ? 'checked' : ''; $quests .= "
"; - $quests .= ""; - $quests .= "
"; + $quests .= ""; + $quests .= "
"; $quests .= "
"; } @@ -112,8 +112,8 @@ EOT; $checked = ($v == 1 && $k != '') ? 'checked ' : ''; $wps .= "
"; - $wps .= ""; - $wps .= "
"; + $wps .= ""; + $wps .= "
"; $wps .= "
"; $wp_count++; } @@ -146,8 +146,8 @@ EOT; foreach ($difficulties as $difficulty => $id) { $checked = ($c->cData['Difficulty'][$difficulty] == 1) ? 'checked' : ''; - $radio .= ""; - $radio .= "
"; + $radio .= ""; + $radio .= "
"; } $skills = ''; @@ -221,8 +221,8 @@ EOT; $checkboxes .= <<
-
- +
+
HTML; @@ -253,10 +253,10 @@ HTML; $defaultValue = isset($c->cData['stats'][$stat]) ? $c->cData['stats'][$stat] : 0; // Create an HTML input for the stat - $stats .= '
'; + $stats .= '
cData['CharacterName']}-" . $stat . '" name="' . $stat . '" max="' . $maxValue . '" value="' . $defaultValue . '" class="' . $stat . '">'; // Create an HTML label for the stat - $stats .= '
'; + $stats .= '
'; } @@ -377,14 +377,13 @@ HTML;
- - Name: + + Name:
- $option
- Character Level: + Character Level:
Difficulty:
@@ -398,66 +397,14 @@ $checkboxes

- -
- +
$stats

Skills

- - + +
@@ -469,8 +416,8 @@ $checkboxes

Quests

- - + +
$quests @@ -479,8 +426,8 @@ $checkboxes

Waypoints

- - + +