forked from openedx/edx-platform
-
Notifications
You must be signed in to change notification settings - Fork 15
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 #1409 from appsembler/vladyslav/hide-html-elements…
…-in-iframe Hide site elements if render in iframe
- Loading branch information
Showing
3 changed files
with
19 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// List of the classes to hide while rendered in an iframe | ||
const classesToHide = ['.global-header', '.wrapper-course-material', '.a--footer']; | ||
|
||
document.addEventListener('DOMContentLoaded', function () { | ||
// Check if rendered in iframe | ||
if (window.self !== window.top) { | ||
classesToHide.forEach(function (className) { | ||
document.querySelectorAll(className).forEach(function (element) { | ||
element.classList.add('hidden-in-iframe'); | ||
}); | ||
}); | ||
} | ||
}); |
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 |
---|---|---|
|
@@ -24,3 +24,8 @@ | |
@extend .sr-only; | ||
} | ||
|
||
// Hide element when rendered in iFrame | ||
.hidden-in-iframe { | ||
display: none !important; | ||
} | ||
|
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