mirror of
				https://github.com/SillyTavern/SillyTavern.git
				synced 2025-06-05 21:59:27 +02:00 
			
		
		
		
	Set container block height on load
This commit is contained in:
		| @@ -812,6 +812,7 @@ function printCharacters() { | |||||||
|     printGroups(); |     printGroups(); | ||||||
|     sortCharactersList(); |     sortCharactersList(); | ||||||
|     favsToHotswap(); |     favsToHotswap(); | ||||||
|  |     setCharacterBlockHeight(); | ||||||
|     setCharListVisible(); |     setCharListVisible(); | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -3918,6 +3919,18 @@ async function saveSettings(type) { | |||||||
|     }); |     }); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | function setCharacterBlockHeight() { | ||||||
|  |     const $children = $("#rm_print_characters_block").children(); | ||||||
|  |     const originalHeight = $children.length * $children.find(':visible').first().outerHeight(); | ||||||
|  |     $("#rm_print_characters_block").css('height', originalHeight); | ||||||
|  |     //show and hide charlist divs on pageload (causes load lag) | ||||||
|  |     //$children.each(function () { setCharListVisible($(this)) }); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     //delay timer to allow for charlist to populate, | ||||||
|  |     //should be set to an onload for rm_print_characters or windows? | ||||||
|  | } | ||||||
|  |  | ||||||
| function messageEditAuto(div) { | function messageEditAuto(div) { | ||||||
|     let mesBlock = div.closest(".mes_block"); |     let mesBlock = div.closest(".mes_block"); | ||||||
|     var text = mesBlock.find(".edit_textarea").val().trim(); |     var text = mesBlock.find(".edit_textarea").val().trim(); | ||||||
| @@ -6205,23 +6218,13 @@ $(document).ready(function () { | |||||||
|         showSwipeButtons(); |         showSwipeButtons(); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     setTimeout(function () { |     $("#rm_print_characters_block").on('scroll', debounce(function () { | ||||||
|         const $children = $("#rm_print_characters_block").children(); |         setCharacterBlockHeight(); | ||||||
|         const originalHeight = $children.length * $children.first().outerHeight(); |         //const containerHeight = $children.length * $children.find(':visible').first().outerHeight(); | ||||||
|         $("#rm_print_characters_block").css('height', originalHeight); |         //$("#rm_print_characters_block").css('height', containerHeight); | ||||||
|         //show and hide charlist divs on pageload (causes load lag) |         //show and hide on scroll | ||||||
|         //$children.each(function () { setCharListVisible($(this)) }); |         setCharListVisible(); | ||||||
|  |     }, 1)); | ||||||
|         $("#rm_print_characters_block").on('scroll', debounce(function () { |  | ||||||
|             const containerHeight = $children.length * $children.find(':visible').first().outerHeight(); |  | ||||||
|             $("#rm_print_characters_block").css('height', containerHeight); |  | ||||||
|             //show and hide on scroll |  | ||||||
|             setCharListVisible(); |  | ||||||
|         }, 1)); |  | ||||||
|         //delay timer to allow for charlist to populate, |  | ||||||
|         //should be set to an onload for rm_print_characters or windows? |  | ||||||
|     }, 1000); |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     $(document).on("click", ".mes_edit_delete", function () { |     $(document).on("click", ".mes_edit_delete", function () { | ||||||
|         if (!confirm("Are you sure you want to delete this message?")) { |         if (!confirm("Are you sure you want to delete this message?")) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user