- popup_content.innerHTML = '<p>You clicked</p>';
- popup_overlay.setPosition(coordinates);
- }
- });
-
- /*
- // add features
- // if this would be done before the layer is added to the map, the features are not added
- layer_path.addFeatures(features_path);
- layer_point.addFeatures(features_point);
-
- // disable mouse wheel zoom
- var navigation_control = map.getControlsByClass('OpenLayers.Control.Navigation')[0];
- navigation_control.disableZoomWheel();
-
- // layer switcher
- // map.addControl(new OpenLayers.Control.LayerSwitcher());
-
- // print sledrun name when mouse moves over it
- map.addControl(new OpenLayers.Control.SelectFeature(layer_point, {
- hover: true,
- highlightOnly: true,
- autoActivate: true,
- renderIntent: "highlight"
- }));
-
- // show popup when user clicks on a sledrun icon
- map.addControl(new OpenLayers.Control.SelectFeature(layer_point, {
- autoActivate: true,
- toggle: true,
- onSelect: function(feature) {
- var attr = feature.attributes;
- var popup_div = createElement('div');
-
- // name
- if (attr.name !== undefined && (attr.wiki !== undefined || attr.thumb_url !== undefined)) {
- var h2 = appendElement(popup_div, 'h2');
- if (attr.wiki === undefined) h2.text(attr.name);
- else appendElement(h2, 'a', {href: attr.wiki}).text(attr.name);
- }
-
- // sledrun information
- if (attr.type == 'sledrun') {
- var p = appendElement(popup_div, 'p').text('Rodelbahnzustand').append(createElement('br'));
- if (attr.condition !== undefined) {
- var condition_text = {1: 'Sehr gut', 2: 'Gut', 3: 'Mittelmäßig', 4: 'Schlecht', 5: 'Geht nicht'};
- var year_month_day = attr.date_report.split('-');
- p.append(createElement('a', {href: attr.wiki + '#Eintr.C3.A4ge'}).text(condition_text[attr.condition]), ' ');
- p.append(createElement('small').text(year_month_day[2] + '.' + year_month_day[1] + '.'), ' ');
- p.append(createElement('em').append(createElement('a', {href: attr.wiki + '#Eintragen'}).text('Neu')));
- } else {
- p.append(createElement('em').append(createElement('a', {href: attr.wiki + '#Eintragen'}).text('Bitte eintragen')));
- }
- }
-
- // wiki link
- if (attr.wiki !== undefined) {
- var a = appendElement(appendElement(popup_div, 'p'), 'a', {href: attr.wiki});
- var detail_text = 'Details';
- if (attr.type == 'sledrun') detail_text += ' zur Rodelbahn';
- if (attr.type == 'gasthaus') detail_text += ' zum Gasthaus';
- if (attr.thumb_url === undefined) a.text(detail_text);
- else a.append(createElement('img', {src: attr.thumb_url, alt: detail_text, title: detail_text}));