Skip to content
Snippets Groups Projects
Commit b33f8b60 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Button layout fix

When search text is empty, hide result list
parent 3e60232d
Branches
Tags
No related merge requests found
......@@ -15,7 +15,8 @@
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<link href="/css/3rdparty/ol.css" rel="stylesheet" media="screen" />
<link rel="stylesheet" href="/css/3rdparty/font-awesome.min.css" media="screen" />
<link rel="stylesheet" href="/css/3rdparty/ol.css" media="screen" />
<style type="text/css">
html, body, #map {
margin: 0;
......@@ -59,11 +60,29 @@
{
top: auto;
right: 0.5em;
bottom: 8.0em;
bottom: 10.0em;
left: auto;
z-index: 1000;
}
#registerButton {
top: auto;
bottom: 12.0em;
right: 0.5em;
left: auto;
z-index: 1000;
}
#registerButton button {
width: 1.375em;
height: 1.375em;
background-size: 20px 20px;
background-repeat: no-repeat;
background-position: 2px 2px;
background-color: rgba(0,60,136,.5);
border: none;
color: white;
}
.geo-location button {
......@@ -135,6 +154,30 @@
#legend {
display: none;
}
}
@media (pointer: coarse) {
#registerButton button, .geo-location button {
width: 1.8em;
height: 1.8em;
}
#registerButton {
bottom: 13.0em;
}
.geo-location button {
bottom: 8.0em;
background-position: 6px;
}
}
@media (max-height: 500px)
{
#legend {
display: none;
}
}
ul.resultList
......@@ -180,7 +223,12 @@
<body>
<div id="map" class="map">
<div class="geo-location ol-unselectable ol-control"><button onclick="navToLocation();" title="Finn min posisjon"></button></div>
<div class="geo-location ol-unselectable ol-control">
<button onclick="navToLocation();" title="Finn min posisjon"></button>
</div>
<div id="registerButton" class="ol-unselectable ol-control">
<button type="button" onclick="toggleRegistration(this);" title="Registrering er AV"><i class="fa fa-pencil" aria-hidden="true"></i></button>
</div>
</div>
<div id="searchFieldContainer">
<div id="searchFieldInnerContainer">
......@@ -212,9 +260,9 @@
<li class="paere">Pære</li>
<li class="plante">Annet</li>
</ul>
</div>
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
......@@ -243,9 +291,15 @@
var phrase = inputField.value;
if(phrase.trim().length > 2)
{
console.log(phrase);
//console.log(phrase);
$.getJSON( "https://ws.geonorge.no/SKWS3Index/ssr/sok?navn=" + phrase + "*&maxAnt=5&tilSosiKoordSyst=4258&fylkeKommuneListe=&eksakteForst=true", renderResults);
}
else if(phrase.trim().length === 0)
{
var searchResultsEl = document.getElementById("searchResults");
searchResultsEl.innerHTML = "";
searchResultsEl.style.display="none";
}
}
var renderResults = function(data) {
......
......@@ -4,6 +4,9 @@ var map, featureOverlay, newFeatureOverlay;
// Override localization settings for this particular web page
var hardcodedLanguage = "nb";
// If false, touching map will not create a new item
var registration = false;
function initMap()
{
// OpenStreetMap background layer
......@@ -194,7 +197,7 @@ var styles = {
vectorSource.addFeature(fakeFeature);
displayFeature(feature);
}
else
else if(registration)
{
var newFeature = createFeature(map.getCoordinateFromPixel(evt.pixel));
vectorSource.addFeature(newFeature);
......@@ -204,6 +207,21 @@ var styles = {
}
function toggleRegistration(theButton)
{
if(registration)
{
theButton.title = "Registrering er AV";
theButton.style.color="white";
}
else
{
theButton.title = "Registrering er PÅ";
theButton.style.color="red";
}
registration = ! registration;
}
/**
* Creates a new feature
* @param {type} coordinate
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment