From 3d4e61b9bf577b1af1edb87721f8d6a3ce39ac35 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Thu, 12 Mar 2015 15:23:08 +0000 Subject: Combine the full information and title for popups This saves vital vertical space on devices with smaller screens. --- src/leaflet-soton.css | 14 +++++++++----- src/leaflet-soton.js | 25 ++++++++++++------------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/leaflet-soton.css b/src/leaflet-soton.css index f529f60..1baa2f4 100644 --- a/src/leaflet-soton.css +++ b/src/leaflet-soton.css @@ -5,6 +5,15 @@ .ls-popup-title { font: 25px/16px Arial, Helvetica, sans-serif; } + +.ls-popup-title-name { + text-decoration: none; +} + +.ls-popup-title-name:hover { + text-decoration: underline; +} + .ls-popup-title-ref { background-color: black; color: white; @@ -12,11 +21,6 @@ border-radius: 3px; } -.ls-popup-uri { - text-align: right; - text-decoration: none; -} - .ls-levelselector { line-height: 18px; color: #555; diff --git a/src/leaflet-soton.js b/src/leaflet-soton.js index 6116704..238a921 100644 --- a/src/leaflet-soton.js +++ b/src/leaflet-soton.js @@ -1638,23 +1638,22 @@ SELECT * WHERE {\ } if ('name' in properties) { - var span = document.createElement( "span" ); - span.classList.add("ls-popup-title-name"); - span.textContent = properties.name; - title.appendChild( span ); - } + if ('uri' in properties) { + var link = document.createElement('a'); + link.setAttribute('href', properties.uri); + link.className = 'ls-popup-title-name'; - if ('uri' in properties) { - var link = document.createElement('a'); - link.setAttribute('href', properties.uri); - link.setAttribute('target', '_blank'); - link.className = 'ls-popup-uri'; - link.textContent = "(Full Information)"; + link.textContent = properties.name; - documentFragment.appendChild(link); + title.appendChild(link); + } else { + var span = document.createElement( "span" ); + span.classList.add("ls-popup-title-name"); + span.textContent = properties.name; + title.appendChild( span ); + } } - var div_inner = document.createElement("div"); div_inner.classList.add("ls-popup-content"); contentFunction(div_inner); -- cgit v1.2.3