* Update the content of a module on screen. * @param {Module} module The module to check. * @param {string} newHeader The new header that is generated. * @param {HTMLElement} newContent The new content that is generated.
(module, newHeader, newContent)
| 216 | * @param {HTMLElement} newContent The new content that is generated. |
| 217 | */ |
| 218 | function updateModuleContent (module, newHeader, newContent) { |
| 219 | const moduleWrapper = document.getElementById(module.identifier); |
| 220 | if (moduleWrapper === null) { |
| 221 | return; |
| 222 | } |
| 223 | const headerWrapper = moduleWrapper.getElementsByClassName("module-header"); |
| 224 | const contentWrapper = moduleWrapper.getElementsByClassName("module-content"); |
| 225 | |
| 226 | contentWrapper[0].innerHTML = ""; |
| 227 | contentWrapper[0].appendChild(newContent); |
| 228 | |
| 229 | headerWrapper[0].innerHTML = newHeader; |
| 230 | if (headerWrapper.length > 0 && newHeader) { |
| 231 | headerWrapper[0].style.display = "block"; |
| 232 | } else { |
| 233 | headerWrapper[0].style.display = "none"; |
| 234 | } |
| 235 | } |
| 236 | |
| 237 | /** |
| 238 | * Hide the module. |
no outgoing calls
no test coverage detected