re-divorce entry active state from trigger strategy
| @@ -5298,12 +5298,15 @@ | ||
| 5298 | 5298 | <div class="world_entry"> |
| 5299 | 5299 | <form class="world_entry_form wi-card-entry"> |
| 5300 | 5300 | <div class="inline-drawer wide100p"> |
| 5301 | 5301 | <div class="inline-drawer-toggle inline-drawer-header gap5px padding0"> |
| 5302 | 5302 | <span class="drag-handle">☰</span> |
| 5303 | 5303 | <div class="gap5px world_entry_thin_controls wide100p alignitemscenter"> |
| 5304 | 5304 | <div class="inline-drawer-toggle fa-fw fa-solid fa-circle-chevron-down inline-drawer-icon down"></div> |
| 5305 | + <div class="fa-solid fa-toggle-on" name="entryKillSwitch"></div> | |
| 5305 | 5306 | <div class="flex-container alignitemscenter wide100p"> |
| 5307 | + | |
| 5306 | 5308 | <div class="WIEntryTitleAndStatus flex-container flex1 alignitemscenter"> |
| 5309 | + | |
| 5307 | 5310 | <div class="flex-container flex1"> |
| 5308 | 5311 | <textarea class="text_pole" rows="1" name="comment" maxlength="5000" data-i18n="[placeholder]Entry Title/Memo" placeholder="Entry Title/Memo"></textarea> |
| 5309 | 5312 | </div> |
| @@ -5312,7 +5315,7 @@ | ||
| 5312 | 5315 | <option value="constant" title="Constant" data-i18n="[title]WI_Entry_Status_Constant">🔵</option> |
| 5313 | 5316 | <option value="normal" title="Normal" data-i18n="[title]WI_Entry_Status_Normal">🟢</option> |
| 5314 | 5317 | <option value="vectorized" title="Vectorized" data-i18n="[title]WI_Entry_Status_Vectorized">🔗</option> |
| 5315 | 5318 | <!--<option value="disabled" title="Disabled" data-i18n="[title]WI_Entry_Status_Disabled">❌</option>--> |
| 5316 | 5319 | </select> |
| 5317 | 5320 | </div> |
| 5318 | 5321 | <div class="WIEnteryHeaderControls flex-container"> |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | <div id="WIEntryHeaderTitlesPC" class="flex-container wide100p spaceBetween justifyCenter textAlignCenter" style="padding:0 4.5em;"> |
| 2 | 2 | <small class="flex1" data-i18n="Title/Memo">Title/Memo</small> |
| 3 | 3 | <small style="width: calc(3.5em + 15px)" data-i18n="StatusStrategy">StatusStrategy</small> |
| 4 | 4 | <small style="width: calc(3.5em + 30px)" data-i18n="Position">Position</small> |
| 5 | 5 | <small style="width: calc(3.5em + 20px)" data-i18n="Depth">Depth</small> |
| 6 | 6 | <small style="width: calc(3.5em + 20px)" data-i18n="Order">Order</small> |
| @@ -2859,21 +2859,7 @@ async function getWorldEntry(name, data, entry) { | ||
| 2859 | 2859 | //add UID above content box (less important doesn't need to be always visible) |
| 2860 | 2860 | template.find('.world_entry_form_uid_value').text(`(UID: ${entry.uid})`); |
| 2861 | 2861 | |
| 2862 | - // disable | |
| 2862 | + //new tri-state selector for constant/normal/vectorized | |
| 2863 | - /* | |
| 2864 | - const disableInput = template.find('input[name="disable"]'); | |
| 2865 | - disableInput.data("uid", entry.uid); | |
| 2866 | - disableInput.on("input", async function () { | |
| 2867 | - const uid = $(this).data("uid"); | |
| 2868 | - const value = $(this).prop("checked"); | |
| 2869 | - data.entries[uid].disable = value; | |
| 2870 | - setOriginalDataValue(data, uid, "enabled", !data.entries[uid].disable); | |
| 2871 | - await saveWorldInfo(name, data); | |
| 2872 | - }); | |
| 2873 | - disableInput.prop("checked", entry.disable).trigger("input"); | |
| 2874 | - */ | |
| 2875 | - | |
| 2876 | - //new tri-state selector for constant/normal/disabled | |
| 2877 | 2863 | const entryStateSelector = template.find('select[name="entryStateSelector"]'); |
| 2878 | 2864 | entryStateSelector.data('uid', entry.uid); |
| 2879 | 2865 | entryStateSelector.on('click', function (event) { |
| @@ -2886,31 +2872,32 @@ async function getWorldEntry(name, data, entry) { | ||
| 2886 | 2872 | switch (value) { |
| 2887 | 2873 | case 'constant': |
| 2888 | 2874 | data.entries[uid].constant = true; |
| 2889 | 2875 | //data.entries[uid].disable = false; |
| 2890 | 2876 | data.entries[uid].vectorized = false; |
| 2891 | 2877 | setWIOriginalDataValue(data, uid, 'enabled', true); |
| 2892 | 2878 | setWIOriginalDataValue(data, uid, 'constant', true); |
| 2893 | 2879 | setWIOriginalDataValue(data, uid, 'extensions.vectorized', false); |
| 2894 | 2880 | //template.removeClass('disabledWIEntry'); |
| 2895 | 2881 | break; |
| 2896 | 2882 | case 'normal': |
| 2897 | 2883 | data.entries[uid].constant = false; |
| 2898 | 2884 | //data.entries[uid].disable = false; |
| 2899 | 2885 | data.entries[uid].vectorized = false; |
| 2900 | 2886 | setWIOriginalDataValue(data, uid, 'enabled', true); |
| 2901 | 2887 | setWIOriginalDataValue(data, uid, 'constant', false); |
| 2902 | 2888 | setWIOriginalDataValue(data, uid, 'extensions.vectorized', false); |
| 2903 | 2889 | //template.removeClass('disabledWIEntry'); |
| 2904 | 2890 | break; |
| 2905 | 2891 | case 'vectorized': |
| 2906 | 2892 | data.entries[uid].constant = false; |
| 2907 | 2893 | //data.entries[uid].disable = false; |
| 2908 | 2894 | data.entries[uid].vectorized = true; |
| 2909 | 2895 | setWIOriginalDataValue(data, uid, 'enabled', true); |
| 2910 | 2896 | setWIOriginalDataValue(data, uid, 'constant', false); |
| 2911 | 2897 | setWIOriginalDataValue(data, uid, 'extensions.vectorized', true); |
| 2912 | 2898 | //template.removeClass('disabledWIEntry'); |
| 2913 | 2899 | break; |
| 2900 | + /* | |
| 2914 | 2901 | case 'disabled': |
| 2915 | 2902 | data.entries[uid].constant = false; |
| 2916 | 2903 | data.entries[uid].disable = true; |
| @@ -2920,15 +2907,38 @@ async function getWorldEntry(name, data, entry) { | ||
| 2920 | 2907 | setWIOriginalDataValue(data, uid, 'extensions.vectorized', false); |
| 2921 | 2908 | template.addClass('disabledWIEntry'); |
| 2922 | 2909 | break; |
| 2910 | + */ | |
| 2911 | + } | |
| 2912 | + await saveWorldInfo(name, data); | |
| 2913 | + | |
| 2914 | + }); | |
| 2915 | + | |
| 2916 | + const entryKillSwitch = template.find('div[name="entryKillSwitch"]'); | |
| 2917 | + entryKillSwitch.data('uid', entry.uid); | |
| 2918 | + entryKillSwitch.on('click', async function (event) { | |
| 2919 | + event.stopPropagation(); | |
| 2920 | + const uid = entry.uid; | |
| 2921 | + data.entries[uid].disable = !data.entries[uid].disable; | |
| 2922 | + let isActive = data.entries[uid].disable; | |
| 2923 | + setWIOriginalDataValue(data, uid, 'enabled', isActive); | |
| 2924 | + if (isActive) { | |
| 2925 | + template.removeClass('disabledWIEntry'); | |
| 2926 | + entryKillSwitch.removeClass('fa-toggle-off'); | |
| 2927 | + entryKillSwitch.addClass('fa-toggle-on'); | |
| 2928 | + } else { | |
| 2929 | + template.addClass('disabledWIEntry'); | |
| 2930 | + entryKillSwitch.addClass('fa-toggle-off'); | |
| 2931 | + entryKillSwitch.removeClass('fa-toggle-on'); | |
| 2923 | 2932 | } |
| 2924 | 2933 | await saveWorldInfo(name, data); |
| 2925 | 2934 | |
| 2926 | 2935 | }); |
| 2927 | 2936 | |
| 2928 | 2937 | const entryState = function () { |
| 2929 | 2938 | /* if (entry.disable === true) { |
| 2930 | 2939 | return 'disabled'; |
| 2931 | - } else if (entry.constant === true) { | |
| 2940 | + } else */ | |
| 2941 | + if (entry.constant === true) { | |
| 2932 | 2942 | return 'constant'; |
| 2933 | 2943 | } else if (entry.vectorized === true) { |
| 2934 | 2944 | return 'vectorized'; |
| @@ -2936,6 +2946,20 @@ async function getWorldEntry(name, data, entry) { | ||
| 2936 | 2946 | return 'normal'; |
| 2937 | 2947 | } |
| 2938 | 2948 | }; |
| 2949 | + | |
| 2950 | + const isActive = !entry.disable; | |
| 2951 | + if (isActive) { | |
| 2952 | + console.warn(`${entry.uid} is active`); | |
| 2953 | + template.removeClass('disabledWIEntry'); | |
| 2954 | + entryKillSwitch.removeClass('fa-toggle-off'); | |
| 2955 | + entryKillSwitch.addClass('fa-toggle-on'); | |
| 2956 | + } else { | |
| 2957 | + console.warn(`${entry.uid} is not active`); | |
| 2958 | + template.addClass('disabledWIEntry'); | |
| 2959 | + entryKillSwitch.addClass('fa-toggle-off'); | |
| 2960 | + entryKillSwitch.removeClass('fa-toggle-on'); | |
| 2961 | + } | |
| 2962 | + | |
| 2939 | 2963 | template |
| 2940 | 2964 | .find(`select[name="entryStateSelector"] option[value=${entryState()}]`) |
| 2941 | 2965 | .prop('selected', true) |