From 1148eeac36048f84740004a2dbc3f1e15a39cc6b Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sat, 27 Sep 2014 15:16:12 +0100 Subject: Rework the building popups Swap round the link to URI and locate functionality. The primary purpose of the list of things in a building is to jump to that location in the building, when that is not possible, a link to the URI is provided. This also removes the very small target icons. --- src/leaflet-soton.js | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/leaflet-soton.js b/src/leaflet-soton.js index d3b0e4d..2d96f97 100644 --- a/src/leaflet-soton.js +++ b/src/leaflet-soton.js @@ -1355,14 +1355,13 @@ SELECT * WHERE {\ var content = document.createElement( 'div' ); content_ids.forEach(function(thing_id) { var info = set[thing_id]; - var div = document.createElement( 'div' ); - var html = ""+info.label+""; - div.innerHTML = html; - if( info.geo ) { - div.appendChild( document.createTextNode( ' ' ) ); - var locate_link = createLink('#', false, div); - - locate_link.onclick = function() { + var div = document.createElement('div'); + + if (info.geo) { + var link = createLink('#', false, div); + link.textContent = info.label + + link.onclick = function() { var feature = LS.getFeatureByURI(info.uri); close(); @@ -1383,11 +1382,22 @@ SELECT * WHERE {\ map.showFeaturePopup(feature, latlng, options); } }; + } else { + var span = document.createElement("span"); + span.textContent = info.label + " "; + + div.appendChild(span); + + var link = document.createElement('a'); + link.setAttribute('href', info.uri); + link.setAttribute('target', '_blank'); + link.className = 'ls-popup-uri'; + link.textContent = "(Full Information)"; - locate_link.innerHTML = ' \u2316'; + div.appendChild(link); } - content.appendChild( div ); + content.appendChild(div); }); return content; } -- cgit v1.2.3