(card)
| 210 | } |
| 211 | |
| 212 | function insertCardInHeader(card) { |
| 213 | const host = getHeaderDropArea(); |
| 214 | if (!host) return; |
| 215 | |
| 216 | // Ensure hidden container exists to park real cards while icon-visible. |
| 217 | let hidden = $('hiddenCardsContainer'); |
| 218 | if (!hidden) { |
| 219 | hidden = document.createElement('div'); |
| 220 | hidden.id = 'hiddenCardsContainer'; |
| 221 | |
| 222 | // Park cards off–screen but keep them rendered so modals/layout still work |
| 223 | Object.assign(hidden.style, { |
| 224 | position: 'absolute', |
| 225 | left: '-9999px', |
| 226 | top: '0', |
| 227 | width: '0', |
| 228 | height: '0', |
| 229 | overflow: 'visible', |
| 230 | pointerEvents: 'none' |
| 231 | // **NO** display:none here |
| 232 | }); |
| 233 | |
| 234 | document.body.appendChild(hidden); |
| 235 | } |
| 236 | if (card.parentNode?.id !== 'hiddenCardsContainer') hidden.appendChild(card); |
| 237 | |
| 238 | if (card.headerIconButton && card.headerIconButton.parentNode) return; |
| 239 | |
| 240 | const iconButton = document.createElement('button'); |
| 241 | iconButton.className = 'header-card-icon'; |
| 242 | iconButton.style.border = 'none'; |
| 243 | iconButton.style.background = 'none'; |
| 244 | iconButton.style.cursor = 'pointer'; |
| 245 | iconButton.innerHTML = `<i class="material-icons" style="font-size:24px;">${ |
| 246 | card.id === 'uploadCard' ? 'cloud_upload' : |
| 247 | card.id === 'folderManagementCard' ? 'folder' : 'insert_drive_file' |
| 248 | }</i>`; |
| 249 | |
| 250 | iconButton.cardElement = card; |
| 251 | card.headerIconButton = iconButton; |
| 252 | |
| 253 | let modal = null; |
| 254 | let isLocked = false; |
| 255 | let hoverActive = false; |
| 256 | |
| 257 | function ensureModal() { |
| 258 | if (modal) return; |
| 259 | modal = document.createElement('div'); |
| 260 | modal.className = 'header-card-modal'; |
| 261 | Object.assign(modal.style, { |
| 262 | position: 'fixed', |
| 263 | top: '55px', |
| 264 | right: '80px', |
| 265 | zIndex: '11000', |
| 266 | display: 'block', |
| 267 | visibility: 'hidden', |
| 268 | opacity: '0', |
| 269 | background: 'none', |
no test coverage detected