]> ToastFreeware Gitweb - philipp/winterrodeln/mediawiki_extensions/wrmap.git/blobdiff - wrmap.js
Increased the version number to 3.2.0.
[philipp/winterrodeln/mediawiki_extensions/wrmap.git] / wrmap.js
index 54d8ba4108dafe59f7e8d2ea8d0a9fa341fbafbc..51ea34d17dabb0bb284cc60942509aa5eb1d2200 100644 (file)
--- a/wrmap.js
+++ b/wrmap.js
@@ -232,30 +232,34 @@ function init_wrmap(i, jq_map) {
                        var popup_div = createElement('div');
 
                        // name
-                       if (attr.name !== undefined && (attr.wiki !== undefined || attr.thumb_url !== undefined))
-                               popup_div.append(createElement('h2').text(attr.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 ul = appendElement(popup_div, 'ul');
-                               ul.append(createElement('li').append(createElement('a', {href: attr.wiki}).text('Details zur Rodelbahn')));
-                               var li = appendElement(ul, 'li').text('Rodelbahnzustand').append(createElement('br'));
+                               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('-');
-                                       li.append(createElement('a', {href: attr.wiki + '#Eintr.C3.A4ge'}).text(condition_text[attr.condition]), ' ');
-                                       li.append(createElement('small').text(year_month_day[2] + '.' + year_month_day[1] + '.'), ' ');
-                                       li.append(createElement('em').append(createElement('a', {href: attr.wiki + '#Eintragen'}).text('Neu')));
+                                       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 {
-                                       li.append(createElement('em').append(createElement('a', {href: attr.wiki + '#Eintragen'}).text('Bitte eintragen')));
+                                       p.append(createElement('em').append(createElement('a', {href: attr.wiki + '#Eintragen'}).text('Bitte eintragen')));
                                }
                        }
 
                        // wiki link
-                       if (attr.wiki !== undefined && attr.type !== 'sledrun') {
+                       if (attr.wiki !== undefined) {
                                var a = appendElement(appendElement(popup_div, 'p'), 'a', {href: attr.wiki});
-                               if (attr.thumb_url === undefined) a.text('Details');
-                               else a.append(createElement('img', {src: attr.thumb_url, alt: 'Details'}));
+                               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}));
                        }
 
                        // no popup if we don't have anything to say