|
| 1 | + |
| 2 | +<!-- OUTDATED LAB --> |
| 3 | + |
| 4 | +<style> |
| 5 | +/* The Modal (background) */ |
| 6 | +.modal { |
| 7 | + display: none; /* Hidden by default */ |
| 8 | + position: fixed; /* Stay in place */ |
| 9 | + z-index: 1; /* Sit on top */ |
| 10 | + padding-top: 100px; /* Location of the box */ |
| 11 | + left: 0; |
| 12 | + top: 0; |
| 13 | + width: 100%; /* Full width */ |
| 14 | + height: 100%; /* Full height */ |
| 15 | + overflow: auto; /* Enable scroll if needed */ |
| 16 | + background-color: rgb(0,0,0); /* Fallback color */ |
| 17 | + background-color: rgba(0,0,0,0); /* Black w/ opacity */ |
| 18 | +} |
| 19 | + |
| 20 | +/* Modal Content */ |
| 21 | +.modal-content { |
| 22 | + position: relative; |
| 23 | + background-color: #fefefe; |
| 24 | + margin: auto; |
| 25 | + padding: 10; |
| 26 | + top: 10%; |
| 27 | + left: 1%; |
| 28 | + border: 1px solid #888; |
| 29 | + width: 80%; |
| 30 | + box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19); |
| 31 | + -webkit-animation-name: animatetop; |
| 32 | + -webkit-animation-duration: 0.4s; |
| 33 | + animation-name: animatetop; |
| 34 | + animation-duration: 0.4s |
| 35 | +} |
| 36 | + |
| 37 | +/* Add Animation */ |
| 38 | +@-webkit-keyframes animatetop { |
| 39 | + from {top:-300px; opacity:0} |
| 40 | + to {top:10%; opacity:1} |
| 41 | +} |
| 42 | + |
| 43 | +@keyframes animatetop { |
| 44 | + from {top:-300px; opacity:0} |
| 45 | + to {top:10%; opacity:1} |
| 46 | +} |
| 47 | + |
| 48 | +/* The Close Button */ |
| 49 | +.close { |
| 50 | + color: white; |
| 51 | + float: right; |
| 52 | + font-size: 28px; |
| 53 | + font-weight: bold; |
| 54 | +} |
| 55 | + |
| 56 | +.close:hover, |
| 57 | +.close:focus { |
| 58 | + color: #000; |
| 59 | + text-decoration: none; |
| 60 | + cursor: pointer; |
| 61 | +} |
| 62 | + |
| 63 | +.modal-header { |
| 64 | + padding: 2px 16px; |
| 65 | + background-color: #FF0000; |
| 66 | + color: white; |
| 67 | +} |
| 68 | + |
| 69 | +.modal-body {padding: 2px 16px;} |
| 70 | +</style> |
| 71 | + |
| 72 | +<!-- The Modal --> |
| 73 | +<div id="outdatedlab-modal" class="modal"> |
| 74 | + |
| 75 | + <!-- Modal content --> |
| 76 | + <div class="modal-content"> |
| 77 | + <div class="modal-header"> |
| 78 | + <span class="close">×</span> |
| 79 | + <h2>Outdated Lab</h2> |
| 80 | + </div> |
| 81 | + <div class="modal-body"> |
| 82 | + <p>You're searching and old version of the lab.</p> |
| 83 | + <p><a id="newlaburl" href="https://github.com/RHsyseng/5g-ran-deployments-on-ocp-lab/">Go to latest</a></p> |
| 84 | + </div> |
| 85 | + </div> |
| 86 | + |
| 87 | +</div> |
| 88 | + |
| 89 | +<script> |
| 90 | +// Get the modal |
| 91 | +var modal = document.getElementById("outdatedlab-modal"); |
| 92 | + |
| 93 | +// Get the <span> element that closes the modal |
| 94 | +var span = document.getElementsByClassName("close")[0]; |
| 95 | + |
| 96 | +// When the user clicks on <span> (x), close the modal |
| 97 | +span.onclick = function() { |
| 98 | + modal.style.display = "none"; |
| 99 | +} |
| 100 | + |
| 101 | +function getLatestLabURL(){ |
| 102 | + const repoUrl = 'https://api.github.com/repos/RHsyseng/5g-ran-deployments-on-ocp-lab'; |
| 103 | + return fetch(repoUrl) |
| 104 | + .then(response => response.json()) |
| 105 | + .then(data => { |
| 106 | + const defaultBranch = data.default_branch; |
| 107 | + return defaultBranch; |
| 108 | + }) |
| 109 | + .catch(error => { |
| 110 | + return "notFound"; |
| 111 | + }); |
| 112 | +} |
| 113 | + |
| 114 | +document.addEventListener('DOMContentLoaded', function () { |
| 115 | + const latestLabURLPromise = getLatestLabURL(); |
| 116 | + latestLabURLPromise.then(latestLabURL => { |
| 117 | + if(latestLabURL != "notFound") { |
| 118 | + var newLabUrl = document.getElementById("newlaburl"); |
| 119 | + newLabUrl.href = "https://labs.sysdeseng.com/5g-ran-deployments-on-ocp-lab/"+latestLabURL.replace("lab-","")+"/index.html" |
| 120 | + } |
| 121 | + }); |
| 122 | + modal.style.display = 'block'; |
| 123 | + }); |
| 124 | + |
| 125 | + |
| 126 | +// When the user clicks anywhere outside of the modal, close it |
| 127 | +window.onclick = function(event) { |
| 128 | + if (event.target == modal) { |
| 129 | + modal.style.display = "none"; |
| 130 | + } |
| 131 | +} |
| 132 | +</script> |
| 133 | + |
| 134 | +<!-- ORIGINAL FOOTER --> |
| 135 | + |
| 136 | +<footer class="footer"> |
| 137 | + <a class="rhd-logo" href="https://redhat.com" target="_blank"></div> |
| 138 | +</footer> |
0 commit comments