-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
151 lines (126 loc) · 5.04 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<!doctype html>
<html xmlns="http://www.w3.org/1999/html">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- css -->
<link href="//cdn.muicss.com/mui-latest/css/mui.min.css" rel="stylesheet" type="text/css" />
<link href="css/mui-style.css" rel="stylesheet" type="text/css" />
<link href="css/Mask.css" rel="stylesheet" type="text/css" />
<!-- js -->
<script src="//cdn.muicss.com/mui-latest/js/mui.min.js"></script>
<script src="//code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="js/mui-scripts.js"></script>
<script src="js/appbar.js"></script>
<script src="js/sidebar.js"></script>
<!-- For the MaskSubmit.html -->
<script src="js/MaskSubmit.js"></script>
<script src="js/MaskInfo.js"></script>
<!-- For loading the content into the same page -->
<script type="module" src="js/MaskHome.js"></script>
<!-- Used to display the mask plots -->
<script src="js/MaskPlot.js"></script>
</head>
<body>
<!-- add the sidebar links -->
<div id="sidedrawer"></div>
<!-- TODO button doesn't work with thi-->
<!-- Header / MUI AppBar generated by js/appbar.js and appbar.html-->
<!-- <div id="shared-header"></div>-->
<script>
// add the common header
window.addEventListener('DOMContentLoaded', loadHeader);
</script>
<div id="shared-header">
<header id="header">
<div class="mui-appbar mui--appbar-line-height">
<div class="mui-container-fluid">
<table width="100%">
<tr style="vertical-align:middle;">
<!-- LEFT -->
<td class="mui--appbar-height">
<a class="sidedrawer-toggle mui--hidden-xs mui--hidden-sm js-hide-sidedrawer">☰</a>
W.M. Keck Observatory
</td>
<!-- RIGHT -->
<td class="mui--appbar-height" align="right">
<div id="infoDropdownContainer" class="info-dropdown-container">
<div id="infoDropdown" class="mui--text-subhead"></div>
</div>
</td>
</span>
</tr>
</table>
</div>
</div>
</header>
</div>
<!-- Main content dynamically added by MaskTable.js / MaskPlot.js / MaskHome.js-->
<div id="content-wrapper">
<div class="mui--appbar-height"></div>
<div class="mui-container-fluid">
<br>
<div class="content" id="content">
</div>
</div>
</div>
<!-- add basic footer -->
<footer id="footer">
<div class="mui-container-fluid mui--align-bottom">
<div class="mui-container-fluid mui--text-center">
<br>
<a href="https://www.keckobservatory.org/" style="font-weight: bold; color: #638ba7;">Keck Observatory</a><br>
Contact: [email protected]
</div>
</div>
</footer>
<script>
function loadContent(url) {
fetch(url)
.then(response => response.text())
.then(data => {
const mainContent = document.getElementById('content');
mainContent.innerHTML = data;
// Find and execute module scripts within the loaded content
let moduleScripts = mainContent.querySelectorAll('script[type="module"]');
moduleScripts.forEach(script => {
const newScript = document.createElement('script');
newScript.type = 'module';
newScript.textContent = script.textContent;
document.body.appendChild(newScript);
});
// Find and execute non-module scripts within the loaded content
let nonModuleScripts = mainContent.querySelectorAll('script:not([type="module"])');
nonModuleScripts.forEach(script => {
const newScript = document.createElement('script');
newScript.textContent = script.textContent;
document.body.appendChild(newScript);
});
})
.catch(error => console.error('Error loading content:', error));
}
// Function to extract URL parameters
function getUrlParameter(name) {
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(window.location.href);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
// Function to load content from URL parameter or default URL
function loadInitialContent() {
const urlParam = getUrlParameter('url');
const initialUrl = urlParam ? urlParam : 'MaskHome.html';
loadContent(initialUrl);
}
// Call loadInitialContent on window load
window.onload = loadInitialContent;
</script>
<script type="module">
import { addAdminButton } from './js/MaskHome.js';
addAdminButton();
</script>
</body>
</html>