Skip to content

Commit 84459be

Browse files
added option for selecting a period to display
1 parent 2f8e765 commit 84459be

File tree

4 files changed

+186
-20
lines changed

4 files changed

+186
-20
lines changed

index.html

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,6 @@ <h2>Contribute</h2>
105105
<div class="slimContainer">
106106
<h2><i class="icon-settings rfloat"></i>Settings</h2>
107107
<hr/>
108-
<div class="row option" id="latestonly" style="display:none">
109-
<p><a href="?latestonly=0&">Click here</a> to view the entire flights</p>
110-
<hr/>
111-
</div>
112108
<div class="row option">
113109
<span><b>Imperial units</b></span>
114110
<div class="switch off" id="sw_imperial">

js/app.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ var wvar = {
2020
vlist: true,
2121
graph: true,
2222
graph_exapnded: false,
23-
latestonly: is_mobile,
2423
focus: "",
25-
docid: ""
24+
docid: "",
25+
mode: (is_mobile) ? modeDefaultMobile : modeDefault,
2626
};
2727

2828
var params = window.location.search.substring(1).split('&');
@@ -38,14 +38,11 @@ for(var idx in params) {
3838
case "expandgraph": if(line[1] == "1") wvar.graph_expanded = true; break;
3939
case "filter": vfilter = decodeURIComponent(line[1]); break;
4040
case "nyan": nyan_mode = true; break;
41-
case "latestonly": wvar.latestonly = (parseInt(line[1]) == 1) ? true : false; break;
4241
case "focus": wvar.focus = decodeURIComponent(line[1]); break;
4342
case "docid": wvar.docid = line[1]; break;
4443
}
4544
}
4645

47-
if(wvar.latestonly) $("#latestonly").show();
48-
4946
if(wvar.enabled) {
5047
//analytics
5148
if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'Functionality', 'Embed Opts', window.location.search]);

js/gmaps_extentions.js

Lines changed: 89 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ google.maps.Label = function(opt_options) {
1414

1515
var span = this.span_ = document.createElement('span');
1616
span.style.cssText = 'position: relative; left: -50%;' +
17-
'white-space: nowrap; color: #000;';
17+
'white-space: nowrap; color: #000;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;-khtml-user-select:none;';
1818

1919
span.style.cssText += !this.get('textOnly') ?
2020
'border: 1px solid '+this.get('strokeColor')+'; border-radius: 5px; ' +
@@ -25,7 +25,7 @@ google.maps.Label = function(opt_options) {
2525

2626
var div = this.div_ = document.createElement('div');
2727
div.appendChild(span);
28-
div.style.cssText = 'position: absolute; display: none';
28+
div.style.cssText = 'position: absolute; display: none;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;-khtml-user-select:none;';
2929
};
3030

3131
google.maps.Label.prototype = new google.maps.OverlayView();
@@ -82,3 +82,90 @@ google.maps.Label.prototype.draw = function() {
8282
div.style.zIndex = this.get('zIndex');
8383
this.span_.innerHTML = this.get('text').toString();
8484
};
85+
86+
87+
// custom dropdown menu control
88+
89+
google.maps.DropDownControl = function(options) {
90+
var ctx = this;
91+
this.options = options;
92+
93+
// generate the controls
94+
this.div_ = document.createElement('div');
95+
this.div_.className = "gmnoprint";
96+
this.div_.draggable = false;
97+
this.div_.style.cssText = "margin: 5px; margin-top: 0;z-index: 0; position: absolute; cursor: pointer; text-align: left; width: 100px; right: 0px; top: 0px;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;-khtml-user-select:none";
98+
99+
this.div_head = document.createElement('div');
100+
this.div_head.style.cssText = "direction: ltr; overflow: hidden; text-align: left; position: relative; color: rgb(0, 0, 0); font-family: Roboto,Arial,sans-serif; -moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;-khtml-user-select: none; font-size: 11px; background-color: rgb(255, 255, 255); padding: 1px 6px; border-radius: 2px; background-clip: padding-box; border: 1px solid rgba(0, 0, 0, 0.15); box-shadow: 0px 1px 4px -1px rgba(0, 0, 0, 0.3); font-weight: 500;";
101+
this.div_head.title = options.title;
102+
103+
google.maps.event.addDomListener(this.div_head, 'mouseover', function(){
104+
ctx.div_head.style.backgroundColor = "rgb(235,235,235)";
105+
});
106+
google.maps.event.addDomListener(this.div_head, 'mouseout', function(){
107+
ctx.div_head.style.backgroundColor = "rgb(255,255,255)";
108+
});
109+
110+
this.header = document.createElement('span');
111+
this.header.innerHTML = (options.headerPrefix || "") + options.list[options.listDefault || 0];
112+
var arrow = document.createElement('img');
113+
arrow.src = "http://maps.gstatic.com/mapfiles/arrow-down.png";
114+
arrow.style.cssText = "-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;-khtml-user-select: none; border: 0px none; padding: 0px; margin: -2px 0px 0px; position: absolute; right: 6px; top: 50%; width: 7px; height: 4px;";
115+
116+
this.div_head.appendChild(this.header);
117+
this.div_head.appendChild(arrow);
118+
this.div_.appendChild(this.div_head);
119+
120+
// generate list of dropdown entries
121+
this.div_list = document.createElement('div');
122+
this.div_list.style.cssText = "background-color: white; z-index: -1; padding-top: 2px; background-clip: padding-box; border-width: 0px 1px 1px; border-style: none solid solid; border-color: use-text-color rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15); border-top-colors: none; border-right-colors: none; border-bottom-colors: none; border-left-colors: none; border-image: none; box-shadow: 0px 1px 4px -1px rgba(0, 0, 0, 0.3); position: relative; text-align: left; display: none;";
123+
124+
var div_list = this.div_list;
125+
126+
options.list.forEach(function(name) {
127+
var row = document.createElement('div');
128+
row.style.cssText = "color: rgb(86, 86, 86); font-family: Roboto,Arial,sans-serif; -moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;-khtml-user-select: none; font-size: 11px; background-color: rgb(255, 255, 255); padding: 3px; padding-top: 2px; padding-bottom: 2px; line-height: 11px; font-weight: 500;";
129+
row.innerHTML = name;
130+
131+
google.maps.event.addDomListener(row, 'click', function(){
132+
if(ctx.options.callback(row.innerHTML)) {
133+
ctx.header.innerHTML = (ctx.options.headerPrefix || "") + row.innerHTML;
134+
row.style.fontWeight = "800";
135+
row.style.color = "rgb(0,0,0)";
136+
}
137+
});
138+
google.maps.event.addDomListener(row, 'mouseover', function(){
139+
if(ctx.header.innerHTML == (ctx.options.headerPrefix || "") + row.innerHTML) {
140+
row.style.fontWeight = "800";
141+
row.style.color = "rgb(0,0,0)";
142+
}
143+
row.style.backgroundColor = "rgb(235,235,235)";
144+
});
145+
google.maps.event.addDomListener(row, 'mouseout', function(){
146+
row.style.fontWeight = "500";
147+
row.style.color = "rgb(86,86,86)";
148+
row.style.backgroundColor = "rgb(255,255,255)";
149+
});
150+
151+
div_list.appendChild(row);
152+
});
153+
154+
this.div_.appendChild(this.div_list);
155+
156+
// add control
157+
options.map.controls[options.position].push(this.div_);
158+
159+
// event for expanding
160+
161+
google.maps.event.addDomListener(this.div_head, 'click', function(){
162+
clearTimeout(ctx.hideTimeout);
163+
div_list.style.display = (div_list.style.display != 'none') ? 'none' : 'block';
164+
});
165+
google.maps.event.addDomListener(this.div_, 'mouseout', function(){
166+
ctx.hideTimeout = setTimeout(function() { div_list.style.display = 'none'; }, 1000);
167+
});
168+
google.maps.event.addDomListener(this.div_, 'mouseover', function(){
169+
clearTimeout(ctx.hideTimeout);
170+
});
171+
};

0 commit comments

Comments
 (0)