@@ -56,6 +56,50 @@ if (FOLDER_VIEW_DEBUG_MODE) {
5656 console . log ( '[FV3_DEBUG] docker.js loaded. FOLDER_VIEW_DEBUG_MODE is ON.' ) ;
5757}
5858
59+ const escapeClassToken = ( value ) => {
60+ const input = String ( value ) ;
61+ if ( window . CSS && typeof window . CSS . escape === 'function' ) {
62+ return window . CSS . escape ( input ) ;
63+ }
64+ return input . replace ( / [ ^ a - z A - Z 0 - 9 _ - ] / g, '\\$&' ) ;
65+ } ;
66+
67+ const forceFolderRowVerticalCenter = ( id ) => {
68+ const escapedId = escapeClassToken ( id ) ;
69+ const rows = Array . from ( document . querySelectorAll ( `tr.folder.folder-id-${ escapedId } ` ) ) ;
70+ if ( ! rows . length ) {
71+ return ;
72+ }
73+
74+ rows . forEach ( ( row ) => {
75+ Array . from ( row . children ) . forEach ( ( td ) => {
76+ if ( td && td . tagName === 'TD' ) {
77+ td . style . setProperty ( 'vertical-align' , 'middle' , 'important' ) ;
78+ }
79+ } ) ;
80+
81+ const cell = row . querySelector ( 'td.ct-name.folder-name' ) ;
82+ if ( ! cell ) {
83+ return ;
84+ }
85+ cell . style . setProperty ( 'position' , 'relative' , 'important' ) ;
86+ cell . style . setProperty ( 'padding-top' , '0px' , 'important' ) ;
87+ cell . style . setProperty ( 'padding-bottom' , '0px' , 'important' ) ;
88+
89+ const sub = cell . querySelector ( '.folder-name-sub' ) ;
90+ if ( ! sub ) {
91+ return ;
92+ }
93+ sub . style . setProperty ( 'position' , 'absolute' , 'important' ) ;
94+ sub . style . setProperty ( 'top' , '50%' , 'important' ) ;
95+ sub . style . setProperty ( 'left' , '8px' , 'important' ) ;
96+ sub . style . setProperty ( 'right' , '8px' , 'important' ) ;
97+ sub . style . setProperty ( 'transform' , 'translateY(-50%)' , 'important' ) ;
98+ sub . style . setProperty ( 'display' , 'flex' , 'important' ) ;
99+ sub . style . setProperty ( 'align-items' , 'center' , 'important' ) ;
100+ } ) ;
101+ } ;
102+
59103/**
60104 * Handles the creation of all folders
61105 */
@@ -224,6 +268,11 @@ const createFolders = async () => {
224268 globalFolders = foldersDone ;
225269 if ( FOLDER_VIEW_DEBUG_MODE ) console . log ( '[FV3_DEBUG] createFolders: Assigned foldersDone to globalFolders:' , { ...globalFolders } ) ;
226270
271+ Object . keys ( globalFolders ) . forEach ( ( folderId ) => forceFolderRowVerticalCenter ( folderId ) ) ;
272+ setTimeout ( ( ) => {
273+ Object . keys ( globalFolders ) . forEach ( ( folderId ) => forceFolderRowVerticalCenter ( folderId ) ) ;
274+ } , 50 ) ;
275+
227276 folderDebugMode = false ; // Existing flag
228277 if ( FOLDER_VIEW_DEBUG_MODE ) console . log ( '[FV3_DEBUG] createFolders: Set folderDebugMode (existing) to false.' ) ;
229278
@@ -376,6 +425,7 @@ const createFolder = (folder, id, positionInMainOrder, liveOrderArray, container
376425 $ ( '#docker_list' ) . append ( $ ( fld ) ) ;
377426 }
378427 }
428+ forceFolderRowVerticalCenter ( id ) ;
379429
380430 // NOTE: switchButton initialization is deferred until after autostart state is known (see below).
381431 // This avoids the bug where initializing with checked:false then clicking ON could
0 commit comments