This repository has been archived by the owner on Dec 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from wswebcreation/fix/allow-element-array
fix: this fixes issue12
- Loading branch information
Showing
5 changed files
with
176 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,29 @@ | ||
/** | ||
* Hide or remove elements on the page | ||
*/ | ||
export default function hideRemoveElements(hideRemoveElements: { hide: HTMLElement[], remove: HTMLElement[] }, hideRemove: boolean): void { | ||
hideRemoveElements.hide.forEach(element => element.style.visibility = hideRemove ? 'hidden' : ''); | ||
hideRemoveElements.remove.forEach(element => element.style.display = hideRemove ? 'none' : ''); | ||
export default function hideRemoveElements( | ||
hideRemoveElements: | ||
{ | ||
hide: (HTMLElement | HTMLElement[])[], | ||
remove: (HTMLElement | HTMLElement[])[], | ||
}, | ||
hideRemove: boolean): void { | ||
|
||
hideRemoveElements.hide.forEach(element => { | ||
if (Array.isArray(element)) { | ||
return element.forEach(singleElement => { | ||
singleElement.style.visibility = hideRemove ? 'hidden' : ''; | ||
}); | ||
} | ||
|
||
return element.style.visibility = hideRemove ? 'hidden' : ''; | ||
}); | ||
|
||
hideRemoveElements.remove.forEach(element => { | ||
if (Array.isArray(element)) { | ||
return element.forEach(singleElement => singleElement.style.display = hideRemove ? 'none' : ''); | ||
} | ||
|
||
return element.style.display = hideRemove ? 'none' : ''; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters