Skip to content

Commit d9ef24e

Browse files
xssfoxTheSkorm
authored andcommitted
Add banner
1 parent c0e4ca9 commit d9ef24e

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

css/layout.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,4 +179,20 @@ header h1{
179179
padding: 10px;
180180
border-width: 1px;
181181
display: none;
182+
}
183+
184+
#banner {
185+
display: none
186+
}
187+
@media only screen and (min-width: 768px){
188+
#banner {
189+
line-height: 1.1;
190+
font-size: small;
191+
display: block;
192+
margin-left: 300px;
193+
text-align: center;
194+
overflow-y: auto;
195+
font-weight: bold;
196+
height: 100%;
197+
}
182198
}

index.template.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
</ol>
8585
<span id="locate-me" style="display: none"><i class="icon-target"></i></span>
8686
<span id="app_name"><b>no<br/>location</b></span>
87+
<span id="banner"></span>
8788
</div>
8889
</header>
8990

js/app.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,6 +1126,19 @@ function update_site(){
11261126
window.location.reload(true)
11271127
}
11281128

1129+
function check_banner(){
1130+
const bannerRequest = new Request("https://api.v2.sondehub.org/banner");
1131+
fetch(bannerRequest)
1132+
.then(function(response){ return response.json()})
1133+
.then(function(response){
1134+
if (response['banner']) {
1135+
document.getElementsByTagName("header")[0].style.backgroundColor = "#ff6259"
1136+
document.getElementsByTagName("header")[0].style.borderColor = "#eb3d34"
1137+
document.getElementById("banner").innerText = response['banner']
1138+
}
1139+
})
1140+
}
1141+
11291142
function update_countdown(){
11301143
var date = new Date(0);
11311144
time_remaining = (reload_end_time - new Date().getTime())/1000
@@ -1135,6 +1148,7 @@ function update_countdown(){
11351148
}
11361149

11371150
check_version()
1151+
check_banner()
11381152
update_check = setInterval(check_version, 15 * 60 * 1000)
11391153
load_hash();
11401154
startAjax();

0 commit comments

Comments
 (0)