Skip to content
This repository has been archived by the owner on Dec 24, 2023. It is now read-only.

Commit

Permalink
Merge 5c55fb0 into b3e3f46
Browse files Browse the repository at this point in the history
  • Loading branch information
wswebcreation committed Aug 25, 2019
2 parents b3e3f46 + 5c55fb0 commit c7860c6
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions lib/clientSideScripts/hideRemoveElements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@
* 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' : '');
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' : '';
});
}

0 comments on commit c7860c6

Please sign in to comment.