summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <cb15g11@soton.ac.uk>2015-03-12 15:23:08 +0000
committerChristopher Baines <cb15g11@soton.ac.uk>2015-03-12 15:23:08 +0000
commit3d4e61b9bf577b1af1edb87721f8d6a3ce39ac35 (patch)
tree437c95d729a1a0960460fc617a8eecc3144c8e8d
parentaee7cbb090494b0c8db1219ce7f2fd072a835a2a (diff)
downloadleaflet-soton-3d4e61b9bf577b1af1edb87721f8d6a3ce39ac35.tar
leaflet-soton-3d4e61b9bf577b1af1edb87721f8d6a3ce39ac35.tar.gz
Combine the full information and title for popups
This saves vital vertical space on devices with smaller screens.
-rw-r--r--src/leaflet-soton.css14
-rw-r--r--src/leaflet-soton.js25
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);