Skip to content

Commit 39f5e08

Browse files
reworked page switching logic
1 parent 54480ec commit 39f5e08

File tree

3 files changed

+21
-58
lines changed

3 files changed

+21
-58
lines changed

css/main.css

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ body {
2828
}
2929

3030
.scrollStyleV {
31-
z-index: 100;
31+
z-index: 49;
3232
width: 5px;
3333
bottom: 6px;
3434
top: 6px;
@@ -43,7 +43,7 @@ body {
4343
border-radius: 3px 3px 3px 3px;
4444
position: absolute;
4545
width: 100%;
46-
z-index: 100;
46+
z-index: 49;
4747
}
4848

4949
#mapscreen {
@@ -188,7 +188,7 @@ header > div {
188188
padding-left: 5px;
189189
border-bottom: 1px solid #33b5e5;
190190
position: relative;
191-
z-index: 4;
191+
z-index: 51;
192192
cursor: pointer;
193193
background-color: #fff;
194194
border-left: 5px solid #fff;
@@ -336,7 +336,7 @@ header > div {
336336
overflow: auto;
337337
position: absolute;
338338
width: 100%;
339-
z-index: 4;
339+
z-index: 50;
340340
background: #fff;
341341
}
342342

@@ -414,7 +414,7 @@ header > div {
414414
height: 26px;
415415
position: relative;
416416
top: 0;
417-
z-index: 3;
417+
z-index: 51;
418418
border: solid 1px #919191;
419419
border-radius: 28px;
420420
box-shadow: inset 0 2px 1px white, inset 0 -2px 1px white;

index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,15 @@ <h2>Chase car mode</h2>
206206
</div>
207207
</div>
208208
</div>
209+
<div id="homebox" style="width:0px;height:0px"></div>
209210
<div id="mapscreen">
210-
<div id="map" style="dispaly: none" class="main_screen"></div>
211+
<div id="map"></div>
211212
<div id="telemetry_graph" style="display: none">
212213
<div class="graph_label">Telemetry Graph</div>
213214
<div class="holder" style="height: 200px;width: 50px"></div>
214215
</div>
215216
</div>
216-
<div id="main" style="dispaly: none" class="main_screen">
217+
<div id="main" style="dispaly: none">
217218
<div class="scrollwrapper">
218219
<div class="portrait">
219220
<div class="row vehicle0"><div class="header empty"><span>No vehicles :(</span></div></div>

js/app.js

Lines changed: 13 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,15 @@ function trackerInit() {
6666
if(map) return;
6767

6868
$('#loading,#settingsbox,#aboutbox,#chasebox').hide(); // welcome screen
69-
$('header,#main,#map').show(); // interface elements
69+
$('header,#main').show(); // interface elements
7070

7171
if(is_mobile || embed.enabled) $(".nav .embed").hide();
7272

7373
if(!is_mobile) {
7474
if(!embed.enabled) $.getScript("js/ssdv.js");
7575

7676
$.getScript("js/init_plot.js", function() { checkSize(); if(!map) load(); });
77-
if(embed.graph) $('#telemetry_graph').addClass("main_screen").attr('style','');
77+
if(embed.graph) $('#telemetry_graph').attr('style','');
7878
return;
7979
}
8080
checkSize();
@@ -354,65 +354,27 @@ $(window).ready(function() {
354354

355355
// menu interface options
356356
$('.nav')
357-
.on('click', '.home', function() {
357+
.on('click', 'li', function() {
358358
var e = $(this);
359-
var box = $('.main_screen');
360-
if(box.is(':hidden')) {
361-
$('#chasecarbox,#aboutbox,#settingsbox,#embedbox').hide();
362-
box.show();
359+
var name = e.attr('class').replace(" last","");
360+
var box = $("#"+name+"box");
363361

364-
// analytics
365-
if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'UI Menubar', 'Open Page', 'Map']);
366-
}
367-
checkSize();
368-
})
369-
.on('click', '.chasecar', function() {
370-
var e = $(this);
371-
var box = $('#chasecarbox');
372362
if(box.is(':hidden')) {
373-
$('.main_screen,#aboutbox,#settingsbox,#embedbox').hide();
363+
$('.flatpage').hide();
374364
box.show().scrollTop(0);
375365

376366
// analytics
377-
if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'UI Menubar', 'Open Page', 'Chase Car']);
378-
}
379-
checkSize();
380-
})
381-
.on('click', '.about', function() {
382-
var e = $(this);
383-
var box = $('#aboutbox');
384-
if(box.is(':hidden')) {
385-
$('.main_screen,#chasecarbox,#settingsbox,#embedbox').hide();
386-
box.show().scrollTop(0);
367+
var pretty_name;
368+
switch(name) {
369+
case "home": pretty_name = "Map"; break;
370+
case "chasecar": pretty_name = "Chase Car"; break;
371+
default: pretty_name = name[0].toUpperCase() + name.slice(1);
372+
}
387373

388-
// analytics
389-
if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'UI Menubar', 'Open Page', 'About']);
374+
if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'UI Menubar', 'Open Page', pretty_name]);
390375
}
391376
checkSize();
392377
})
393-
.on('click', '.settings', function() {
394-
var e = $(this);
395-
var box = $('#settingsbox');
396-
if(box.is(':hidden')) {
397-
$('.main_screen,#chasecarbox,#aboutbox,#embedbox').hide();
398-
box.show().scrollTop(0);
399-
400-
// analytics
401-
if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'UI Menubar', 'Open Page', 'Settings']);
402-
}
403-
})
404-
.on('click', '.embed', function() {
405-
var e = $(this);
406-
var box = $('#embedbox');
407-
if(box.is(':hidden')) {
408-
$('.main_screen,#chasecarbox,#aboutbox,#settingsbox').hide();
409-
box.show().scrollTop(0);
410-
411-
// analytics
412-
if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'UI Menubar', 'Open Page', 'Embed']);
413-
}
414-
checkSize();
415-
});
416378

417379
// toggle functionality for switch button
418380
$("#sw_chasecar").click(function() {

0 commit comments

Comments
 (0)