Use CSS.supports to determine auto-fit validity
| @@ -10577,9 +10577,6 @@ jQuery(async function () { | ||
| 10577 | 10577 | stopScriptExecution(); |
| 10578 | 10578 | }); |
| 10579 | 10579 | |
| 10580 | - const chromeUaIdx = navigator.userAgent.lastIndexOf('Chrome/'); | |
| 10581 | - const chromeVersion = navigator.userAgent.substring(chromeUaIdx + 7, navigator.userAgent.indexOf('.', chromeUaIdx)); | |
| 10582 | - | |
| 10583 | 10580 | $('.drawer-toggle').on('click', function () { |
| 10584 | 10581 | var icon = $(this).find('.drawer-icon'); |
| 10585 | 10582 | var drawer = $(this).parent().find('.drawer-content'); |
| @@ -10619,8 +10616,7 @@ jQuery(async function () { | ||
| 10619 | 10616 | } |
| 10620 | 10617 | |
| 10621 | 10618 | // Set the height of "autoSetHeight" textareas within the drawer to their scroll height |
| 10622 | - | |
| 10619 | + if (!CSS.supports('field-sizing', 'content')) { | |
| 10623 | - if (chromeUaIdx == -1 || Number(chromeVersion) < 123) { | |
| 10624 | 10620 | $(this).closest('.drawer').find('.drawer-content textarea.autoSetHeight').each(async function () { |
| 10625 | 10621 | await resetScrollHeight($(this)); |
| 10626 | 10622 | return; |
| @@ -10697,7 +10693,7 @@ jQuery(async function () { | ||
| 10697 | 10693 | $(this).closest('.inline-drawer').find('.inline-drawer-content').stop().slideToggle(); |
| 10698 | 10694 | |
| 10699 | 10695 | // Set the height of "autoSetHeight" textareas within the inline-drawer to their scroll height |
| 10700 | - if (chromeUaIdx == -1 || Number(chromeVersion) < 123) { | |
| 10696 | + if (!CSS.supports('field-sizing', 'content')) { | |
| 10701 | 10697 | $(this).closest('.inline-drawer').find('.inline-drawer-content textarea.autoSetHeight').each(async function () { |
| 10702 | 10698 | await resetScrollHeight($(this)); |
| 10703 | 10699 | return; |
| @@ -1491,9 +1491,11 @@ function select_group_chats(groupId, skipAnimation) { | ||
| 1491 | 1491 | } |
| 1492 | 1492 | |
| 1493 | 1493 | // Toggle textbox sizes, as input events have not fired here |
| 1494 | - $('#rm_group_chats_block .autoSetHeight').each(element => { | |
| 1494 | + if (!CSS.supports('field-sizing', 'content')) { | |
| 1495 | - resetScrollHeight(element); | |
| 1495 | + $('#rm_group_chats_block .autoSetHeight').each(element => { | |
| 1496 | - }); | |
| 1496 | + resetScrollHeight(element); | |
| 1497 | + }); | |
| 1498 | + } | |
| 1497 | 1499 | |
| 1498 | 1500 | eventSource.emit('groupSelected', { detail: { id: openGroupId, group: group } }); |
| 1499 | 1501 | } |
| @@ -1965,7 +1967,9 @@ function doCurMemberListPopout() { | ||
| 1965 | 1967 | |
| 1966 | 1968 | jQuery(() => { |
| 1967 | 1969 | $(document).on('input', '#rm_group_chats_block .autoSetHeight', function () { |
| 1968 | - resetScrollHeight($(this)); | |
| 1970 | + if (!CSS.supports('field-sizing', 'content')) { | |
| 1971 | + resetScrollHeight($(this)); | |
| 1972 | + } | |
| 1969 | 1973 | }); |
| 1970 | 1974 | |
| 1971 | 1975 | $(document).on('click', '.group_select', function () { |
| @@ -42,9 +42,6 @@ const controls = [ | ||
| 42 | 42 | { id: 'instruct_system_same_as_user', property: 'system_same_as_user', isCheckbox: true, trigger: true }, |
| 43 | 43 | ]; |
| 44 | 44 | |
| 45 | -const chromeUaIdx = navigator.userAgent.lastIndexOf('Chrome/'); | |
| 46 | -const chromeVersion = navigator.userAgent.substring(chromeUaIdx + 7, navigator.userAgent.indexOf('.', chromeUaIdx)); | |
| 47 | - | |
| 48 | 45 | /** |
| 49 | 46 | * Migrates instruct mode settings into the evergreen format. |
| 50 | 47 | * @param {object} settings Instruct mode settings. |
| @@ -103,7 +100,7 @@ export async function loadInstructMode(data) { | ||
| 103 | 100 | |
| 104 | 101 | $element.on('input', async function () { |
| 105 | 102 | power_user.instruct[control.property] = control.isCheckbox ? !!$(this).prop('checked') : $(this).val; |
| 106 | - if (chromeUaIdx == -1 || Number(chromeVersion) < 123) { | |
| 103 | + if (!CSS.supports('field-sizing', 'content')) { | |
| 107 | 104 | await resetScrollHeight($(this)); |
| 108 | 105 | } |
| 109 | 106 | saveSettingsDebounced(); |
| @@ -5281,9 +5281,11 @@ $(document).ready(async function () { | ||
| 5281 | 5281 | saveSettingsDebounced(); |
| 5282 | 5282 | }); |
| 5283 | 5283 | |
| 5284 | 5284 | $if (document)!CSS.onsupports('inputfield-sizing', '#openai_settings .autoSetHeightcontent', function ()) { |
| 5285 | - resetScrollHeight($(this)); | |
| 5285 | + $(document).on('input', '#openai_settings .autoSetHeight', function () { | |
| 5286 | - }); | |
| 5286 | + resetScrollHeight($(this)); | |
| 5287 | + }); | |
| 5288 | + } | |
| 5287 | 5289 | |
| 5288 | 5290 | if (!isMobile()) { |
| 5289 | 5291 | $('#model_openrouter_select').select2({ |
| @@ -105,9 +105,6 @@ export const persona_description_positions = { | ||
| 105 | 105 | NONE: 9, |
| 106 | 106 | }; |
| 107 | 107 | |
| 108 | -const chromeUaIdx = navigator.userAgent.lastIndexOf('Chrome/'); | |
| 109 | -const chromeVersion = navigator.userAgent.substring(chromeUaIdx + 7, navigator.userAgent.indexOf('.', chromeUaIdx)); | |
| 110 | - | |
| 111 | 108 | let power_user = { |
| 112 | 109 | tokenizer: tokenizers.BEST_MATCH, |
| 113 | 110 | token_padding: 64, |
| @@ -1757,7 +1754,7 @@ async function loadContextSettings() { | ||
| 1757 | 1754 | power_user.context[control.property] = value; |
| 1758 | 1755 | } |
| 1759 | 1756 | console.log(`Setting ${$element.prop('id')} to ${value}`); |
| 1760 | - if (chromeUaIdx == -1 || Number(chromeVersion) < 123) { | |
| 1757 | + if (!CSS.supports('field-sizing', 'content')) { | |
| 1761 | 1758 | await resetScrollHeight($(this)); |
| 1762 | 1759 | } |
| 1763 | 1760 | saveSettingsDebounced(); |
| @@ -2027,11 +2027,8 @@ export function toggleDrawer(drawer, expand = true) { | ||
| 2027 | 2027 | content.style.display = 'none'; |
| 2028 | 2028 | } |
| 2029 | 2029 | |
| 2030 | - const chromeUaIdx = navigator.userAgent.lastIndexOf('Chrome/'); | |
| 2031 | - const chromeVersion = navigator.userAgent.substring(chromeUaIdx + 7, navigator.userAgent.indexOf('.', chromeUaIdx)); | |
| 2032 | - | |
| 2033 | 2030 | // Set the height of "autoSetHeight" textareas within the inline-drawer to their scroll height |
| 2034 | - if (chromeUaIdx == -1 || Number(chromeVersion) < 123) { | |
| 2031 | + if (!CSS.supports('field-sizing', 'content')) { | |
| 2035 | 2032 | content.querySelectorAll('textarea.autoSetHeight').forEach(resetScrollHeight); |
| 2036 | 2033 | } |
| 2037 | 2034 | } |