Remove jQuery use from IGC example

This commit is contained in:
Tim Schaub
2015-04-15 09:21:40 -06:00
parent c385a1b7dd
commit f712123e93

View File

@@ -51,9 +51,18 @@ var igcUrls = [
'data/igc/Ulrich-Prinz.igc'
];
function get(url, callback) {
var client = new XMLHttpRequest();
client.open('GET', url);
client.onload = function() {
callback(client.responseText);
};
client.send();
}
var igcFormat = new ol.format.IGC();
for (var i = 0; i < igcUrls.length; ++i) {
$.ajax(igcUrls[i]).then(function(data) {
get(igcUrls[i], function(data) {
var features = igcFormat.readFeatures(data,
{featureProjection: 'EPSG:3857'});
vectorSource.addFeatures(features);
@@ -184,8 +193,8 @@ var featureOverlay = new ol.FeatureOverlay({
})
});
$('#time').on('input', function(event) {
var value = parseInt($(this).val(), 10) / 100;
document.getElementById('time').addEventListener('input', function() {
var value = parseInt(this.value, 10) / 100;
var m = time.start + (time.duration * value);
vectorSource.forEachFeature(function(feature) {
var geometry = /** @type {ol.geom.LineString} */ (feature.getGeometry());