Skip to content

Commit

Permalink
Hide upcoming event notification (#138)
Browse files Browse the repository at this point in the history
Signed-off-by: mohin7 <csemohin@gmail.com>
  • Loading branch information
mohin7 authored Mar 24, 2024
1 parent 5de98b9 commit c50c31a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 18 deletions.
34 changes: 19 additions & 15 deletions layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -132,23 +132,27 @@
<div class="navbar-area header--fixed">

<!-- iframe for top notification -->
<iframe src="/notification-top/" id="notification" frameborder="0" scrolling="no" style="width: 100%; display: flex; overflow: hidden; height: 38px;"></iframe>
<iframe src="/notification-top/" id="notification" frameborder="0" scrolling="no" onload="resizeIframe()" style="height: 0px; width: 100%; display: flex; overflow: hidden;"></iframe>
<script>
window.addEventListener("message", receiveMessageFromIframe, false);

function receiveMessageFromIframe(event) {
// Check the origin of the message for security purposes
let baseURL = "{{$.Site.BaseURL}}"

if (baseURL.endsWith("/")) {
baseURL = baseURL.slice(0, -1);
}
if (event.origin !== baseURL) {
return;
}
const notification = document.querySelector("#notification");
notification.style.height = `${event.data}px`
function resizeIframe() {
var iframe = document.getElementById("notification");
iframe.style.height = iframe.contentWindow.document.body.scrollHeight + 'px';
}
// window.addEventListener("message", receiveMessageFromIframe, false);

// function receiveMessageFromIframe(event) {
// // Check the origin of the message for security purposes
// let baseURL = "{{$.Site.BaseURL}}"

// if (baseURL.endsWith("/")) {
// baseURL = baseURL.slice(0, -1);
// }
// if (event.origin !== baseURL) {
// return;
// }
// const notification = document.querySelector("#notification");
// notification.style.height = `${event.data}px`
// }
</script>
<!-- iframe for top notification -->
<div class="navbar-area navbar-fixed">
Expand Down
10 changes: 7 additions & 3 deletions layouts/_default/notification_top.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
font-family: "Roboto", sans-serif;
font-size: 14px;
}
.is-hidden {
display: none;
}
.notification-wrapper {
background: linear-gradient(-100deg, #fb00ff, #fe0 32%, #fe4d5d 70%, #ff7900);
}
Expand Down Expand Up @@ -115,11 +118,12 @@
</style>
</head>
<body>
<div class="notification-wrapper" id="notificationWrapper">
<!-- "is-hidden" class for hide element -->
<div class="notification-wrapper is-hidden" id="notificationWrapper">
<div class="navbar-appscode container">
<div class="notification-top">
<a href="https://calendly.com/appscode/kubecon-eu-2024?text_color=1c1c1c&primary_color=00a651" target="_blank" class="left-content">
<!-- https://calendly.com/appscode/kubecon-eu-2024?text_color=1c1c1c&primary_color=00a651 -->
<a href="#" target="_blank" class="left-content">
<span class="message">Connect with the AppsCode team at Kubecon EU: Reserve your personalized 1:1 chat now!</span>
<button class="button">
<span>Reserve Now</span>
Expand Down

0 comments on commit c50c31a

Please sign in to comment.