Commit 85fd9fcb authored by Tomas Pettersson's avatar Tomas Pettersson 🏸
Browse files

structure add

parent bf60d1cf
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "tsc",
"isShellCommand": true,
"args": ["-p", "."],
"showOutput": "silent",
"problemMatcher": "$tsc"
}
\ No newline at end of file
......@@ -44,15 +44,9 @@ module.exports = function(grunt) {
"uikit": {
"main" : ["js/uikit.js", "js/components/notify.min.js", "css/uikit.almost-flat.min.css", "css/components/notify.almost-flat.min.css"]
},
"jquery-file-upload": {
"main" : ["js/vendor/jquery.ui.widget.js", "js/jquery.iframe-transport.js", "js/jquery.fileupload.js" ]
},
"DataTables" : {
"main" : ["media/js/jquery.dataTables.min.js", "media/js/dataTables.uikit.min.js", "media/css/jquery.dataTables.min.css", "media/css/dataTables.uikit.min.css"]
},
"jquery.inputmask" : {
"main" : "dist/jquery.inputmask.bundle.js"
}
"jquery": {
"main" : "dist/jquery.js"
}
}
}
}
......
......@@ -45,7 +45,7 @@ Open browser on http://localhost:8080/demo
"proxy" : 'proxy',
"url" : '/demo'
});
map.addControl(coordinatesControl);
map.addControl(navControl);
### Options
......
......@@ -15,6 +15,7 @@
"url": "git@git.smhi.se:stw/leaflet-navigation-control.git"
},
"dependencies": {
"leaflet": "https://github.com/Leaflet/Leaflet.git#v1.0.0-rc.1",
"jquery": "latest",
"uikit": "latest"
},
......
......@@ -9,15 +9,10 @@
<meta name='copyright' content='STW'>
<meta name='owner' content='STW'>
<!-- bower:css -->
<link rel="stylesheet" href="../bower_components/DataTables/media/css/jquery.dataTables.min.css" />
<link rel="stylesheet" href="../bower_components/DataTables/media/css/dataTables.uikit.min.css" />
<link rel="stylesheet" href="../bower_components/datatables.net-select-dt/css/select.dataTables.css" />
<link rel="stylesheet" href="../bower_components/leaflet/dist/leaflet.css" />
<link rel="stylesheet" href="../bower_components/leaflet.draw/dist/leaflet.draw.css" />
<link rel="stylesheet" href="../bower_components/uikit/css/uikit.almost-flat.min.css" />
<link rel="stylesheet" href="../bower_components/uikit/css/components/notify.almost-flat.min.css" />
<link rel="stylesheet" href="../bower_components/leaflet-container-control/src/leaflet-container-control.css" />
<link rel="stylesheet" href="../dist/leaflet-coordinates-control.css" />
<link rel="stylesheet" href="../dist/leaflet-navigation-control.css" />
<!-- endbower -->
......@@ -27,21 +22,11 @@
<div id="map" style="position:absolute; top:0; bottom:0; left:0;right:0"></div>
<!-- bower:js -->
<script src="../bower_components/jquery/dist/jquery.js"></script>
<script src="../bower_components/jquery.inputmask/dist/jquery.inputmask.bundle.js"></script>
<script src="../bower_components/jquery-file-upload/js/vendor/jquery.ui.widget.js"></script>
<script src="../bower_components/jquery-file-upload/js/jquery.iframe-transport.js"></script>
<script src="../bower_components/jquery-file-upload/js/jquery.fileupload.js"></script>
<script src="../bower_components/DataTables/media/js/jquery.dataTables.min.js"></script>
<script src="../bower_components/DataTables/media/js/dataTables.uikit.min.js"></script>
<script src="../bower_components/datatables.net/js/jquery.dataTables.js"></script>
<script src="../bower_components/datatables.net-select/js/dataTables.select.js"></script>
<script src="../bower_components/leaflet/dist/leaflet-src.js"></script>
<script src="../bower_components/leaflet.draw/dist/leaflet.draw-src.js"></script>
<script src="../bower_components/jquery/dist/jquery.js"></script>
<script src="../bower_components/uikit/js/uikit.js"></script>
<script src="../bower_components/uikit/js/components/notify.min.js"></script>
<script src="../bower_components/leaflet-container-control/src/leaflet-container-control.js"></script>
<script src="../dist/leaflet-coordinates-control.js"></script>
<script src="../dist/leaflet-navigation-control.js"></script>
<!-- endbower -->
<script>
......@@ -53,74 +38,19 @@
}).addTo(map);
var language = 'en';
var containerControl = new L.Control.Container({
position: 'topright'
});
map.addControl(containerControl);
var coordinatesLangData = {
"tMarkerstart": "Click map to place point.",
"tPolygonstart": "Hold left mouse button to draw polygon on map. Press escape to abort.",
"tPolygoncont": "Hold left mouse button to draw polygon on map. Release button to finnish drawing. Press escape to abort.",
"tPolygonend": "Release button to finnish drawing.",
"tPolylinestart": "Hold left mouse button to draw line on map. Press escape to abort.",
"tPolylinecont": "Hold left mouse button to draw line on map. Release button to finnish drawing. Press escape to abort.",
"tPolylineend": "Release button to finnish drawing.",
"tDraw": "Draw outlet on map. Use LEFT mouse button while drawing.",
"tEdit": "Edit outlet shape",
"tManual": "Enter coordinates manually",
"tImport": "Import outlet as geojson file",
"tClear": "Clear drawn shapes from map",
"bManual": "Enter coordinates manually",
"bDraw": "Free hand draw on map",
"bEdit": "Edit polygon in map",
"bImport": "Import GeoJson file",
"bClear": "Clear map",
"btClear": "Clear",
"sAreaPoint": "Point",
"sAreaPolyline": "Polyline",
"sAreaPolygon": "Polygon",
"sAreaMultiPoint": "MultiPoint",
"sAreaMultiPolyline": "MultiPolyline",
"sAreaMultiPolygon": "MultiPolygon",
"tArea": "Select outlet type",
"sAreaPoint": "Point",
"tLatitude": "Latitude",
"tLatituderange": "range [-90 to 90]",
"tLongitude": "Longitude",
"tLongituderange": "range [-180 to 180]",
"rDDM": "Degrees Decimal Minutes ",
"rDD": "Decimal Degrees",
"bAdd": "Add",
"bDel": "Del",
"bCreate": "Create",
"bEdit": "Edit",
"bCancel": "Cancel",
"cCoordinates": "Coordinates"
var navLangData = {
"tNavigation": "Navigation"
};
var coordinatesControl1 = new L.Control.Coordinates({
var navControl = new L.Control.Navigation({
"lang" : language,
"langdata" : coordinatesLangData,
"langdata" : navLangData,
"proxy" : 'proxy',
"url" : '/demo',
"id" : "leaflet-coordinates-modal1",
"inline" : true
"url" : '/demo'
});
map.addControl(navControl);
var coordinatesControl2 = new L.Control.Coordinates({
"lang" : language,
"langdata" : coordinatesLangData,
"proxy" : 'proxy',
"url" : '/demo',
"id" : "leaflet-coordinates-modal2"
});
containerControl.addComponent("Coordinates1", coordinatesControl1);
containerControl.addComponent("Coordinates2", coordinatesControl2);
</script>
</body>
</html>
.navigation {
background-color: #f8f8f8;
border-color: #e7e7e7;
}
.navigation-fixed-top {
top: 0;
border-width: 0 0 1px;
}
.navigationbar-fixed-top, .navigationbar-fixed-bottom {
position: fixed;
right: 0;
left: 0;
z-index: 999;
-webkit-transform: translate3d(0,0,0);
-o-transform: translate3d(0,0,0);
transform: translate3d(0,0,0);
}
.navigationbar {
position: relative;
min-height: 50px;
border: 1px solid transparent;
}
.navigation-links > li > div > .languageImg {
width: 16px;
position: relative;
top: -2px;
}
.navigation-links > li > span > .userImg {
position: relative;
top: -2px;
}
.navigationcontainer {
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
}
.navigationcontainer>.navigationbar-header, .navigationcontainer>.navigationbarbar-collapse {
margin-right: -15px;
margin-left: -15px;
}
.navigationcontainer a {
background: 0 0;
text-decoration: none;
color: #777;
}
.navigationcontainer div {
background: 0 0;
text-decoration: none;
color: #777;
}
.navigationbar-header {
height: 50px;
}
.navigation-links {
padding-left: 0;
margin-bottom: 0;
list-style: none;
margin-top: 0px;
}
.navigation-links > li > a {
padding-top: 10px;
padding-left: 15px;
padding-bottom: 10px;
padding-right: 15px;
line-height: 20px;
display: block;
}
.navigation-links > li > div {
padding-top: 10px;
padding-left: 15px;
padding-bottom: 10px;
padding-right: 15px;
line-height: 20px;
display: block;
}
.navigation-links > li > a:hover {
color: #555;
background-color: #e7e7e7;
}
.navigation-links > li > div:hover {
color: #555;
background-color: #e7e7e7;
}
.dropdown-menu > li > a:hover {
color: #555;
background-color: #e7e7e7;
}
.dropdown-menu > li > div:hover {
color: #555;
background-color: #e7e7e7;
}
.navigationbar-collapse {
max-height: 340px;
display: none;
}
.navigationbar-collapse .in {
display: block;
}
.navigationbar-title {
float: left;
padding-top: 14px;
padding-left: 40px;
padding-bottom: 14px;
font-size: x-large;
line-height: 20px;
}
.navigationbar-img {
position: relative;
top: 0px;
right: 35px;
border:none;
outline:none
}
.caret {
display: inline-block;
width: 0;
height: 0;
margin-left: 2px;
vertical-align: middle;
border-top: 4px dashed;
border-top: 4px solid \9;
border-right: 4px solid transparent;
border-left: 4px solid transparent;
}
.open > .dropdown-menu {
display: block;
}
.dropdown {
position: relative;
}
.dropdown-menu {
margin-top: 0;
border-top-left-radius: 0;
border-top-right-radius: 0;
position: absolute;
left: 0;
z-index: 1000;
display: none;
float: left;
min-width: 160px;
padding: 5px 0;
margin: 2px 0 0;
font-size: 14px;
text-align: left;
list-style: none;
background-color: #fff;
-webkit-background-clip: padding-box;
background-clip: padding-box;
border: 1px solid #ccc;
border: 1px solid rgba(0,0,0,.15);
border-radius: 4px;
-webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175);
box-shadow: 0 6px 12px rgba(0,0,0,.175);
}
.dropdown-menu > li > a {
display: block;
padding: 3px 20px;
clear: both;
font-weight: 400;
line-height: 1.42857143;
color: #333;
white-space: nowrap;
}
.dropdown-menu > li > div {
display: block;
padding: 3px 20px;
clear: both;
font-weight: 400;
line-height: 1.42857143;
color: #333;
white-space: nowrap;
}
.navigationbar-toggle {
position: relative;
float: right;
padding: 9px 10px;
margin-top: 8px;
margin-right: 15px;
margin-bottom: 8px;
background-color: transparent;
background-image: none;
border: 1px solid transparent;
border-radius: 4px;
border-color: #ddd;
}
.navigationbar-toggle .navigationbar-icon {
display: block;
width: 22px;
height: 2px;
border-radius: 1px;
background-color: #888;
margin-top: 3px;
}
@media (min-width: 600px) {
.navigationbar-header {
float: left;
}
.navigation-links > li > a {
padding-top: 15px;
padding-left: 15px;
padding-bottom: 15px;
display: inline-block;
}
.navigation-links > li > div {
padding-top: 15px;
padding-left: 15px;
padding-bottom: 15px;
display: inline-block;
}
.navigation-links > li {
display: inline;
}
.navigationbar-links {
float: left;
margin: 0;
}
.navigationbar-toggle {
display: none;
}
.navigationbar-collapse {
display: block!important;
float: right;
margin-left: 15px
}
}
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var L;
(function (L) {
var Control;
(function (Control) {
var Navigation = (function (_super) {
__extends(Navigation, _super);
function Navigation(title, parentElementId, navDivId, options) {
_super.call(this, options);
if (options.playerLink) {
this.playerLink = options.playerLink;
}
;
if (options.playerLinkFn) {
this.playerLinkFn = options.playerLinkFn;
}
;
if (options.inputLink) {
this.inputLink = options.inputLink;
}
;
if (options.inputLinkFn) {
this.inputLinkFn = options.inputLinkFn;
}
;
if (options.aisLink) {
this.aisLink = options.aisLink;
}
;
if (options.aisLinkFn) {
this.aisLinkFn = options.aisLinkFn;
}
;
if (options.graphLink) {
this.graphLink = options.graphLink;
}
;
if (options.graphLinkFn) {
this.graphLinkFn = options.graphLinkFn;
}
;
if (options.simulationLink) {
this.simulationLink = options.simulationLink;
}
;
if (options.simulationLinkFn) {
this.simulationLinkFn = options.simulationLinkFn;
}
;
if (options.userLink) {
this.userLink = options.userLink;
}
;
if (options.languageLink) {
this.languageLink = options.languageLink;
}
;
if (options.generalLinkArray) {
this.generalLinkArray = options.generalLinkArray;
}
;
this.lang = "en";
if (options.lang) {
this.lang = options.lang.replace(/#/g, '');
}
if (options.langdata) {
this.langData = options.langdata;
}
if (options.doneFn) {
this.doneFn = options.doneFn;
}
;
var self = this;
if (self.langData) {
self.setup(title, parentElementId, navDivId);
}
else {
reqwest({
url: "lang/navigation." + self.lang + ".json",
method: 'get',
type: 'json',
success: function (lang) {
self.langData = lang;
self.setup(title, parentElementId, navDivId);
}
});
}
}
Navigation.prototype.setup = function (title, parentElementId, navDivId) {
var self = this;
self.container = document.getElementById(parentElementId);
self.navDiv = document.createElement('div');
self.navDiv.id = navDivId;
self.navDiv.className = 'navigationbar navigationbar-fixed-top navigation';
self.container.appendChild(self.navDiv);
self.addNavigation(title);
if (self.doneFn)
self.doneFn();
};
Navigation.prototype.addUser = function (container, text, id) {
var li = document.createElement('li');
var span = document.createElement('span');
span.id = id;
span.appendChild(document.createTextNode(text));
span.style.position = 'relative';
var img = document.createElement('img');
img.src = 'images/user.png';
img.className = 'userImg';
span.appendChild(img);
li.appendChild(span);
container.appendChild(li);
};
Navigation.prototype.addLink = function (container, text, id, url) {
var self = this;
var li = document.createElement('li');
var a = document.createElement('a');
a.href = url;
a.id = id;
a.onclick = function () {
self.showNavContent = false;
self.navCollapse.className = "navigationbar-collapse";
self.navCollapse.style.display = "none";
};
a.appendChild(document.createTextNode(text));
li.appendChild(a);
container.appendChild(li);
};
Navigation.prototype.test = function () {
console.log('hej');
};
Navigation.prototype.addLinkDiv = function (container, text, id, url) {
var self = this;
var li = document.createElement('li');
var div = document.createElement('div');
div.id = id;
div.onclick = function () {
self.showNavContent = false;
self.navCollapse.className = "navigationbar-collapse";
self.navCollapse.style.display = "none";
};
div.appendChild(document.createTextNode(text));
li.appendChild(div);
container.appendChild(li);
};
Navigation.prototype.addLinkFn = function (container, text, id, fn) {
var self = this;
var li = document.createElement('li');
var div = document.createElement('div');
div.id = id;
div.onclick = function () {
self.showNavContent = false;
self.navCollapse.className = "navigationbar-collapse";
self.navCollapse.style.display = "none";
fn(id);
};
div.appendChild(document.createTextNode(text));
li.appendChild(div);
container.appendChild(li);
};