From 4d882e6d16036c99055cfb8df0bf8c25bcbb8d8c Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Sun, 14 May 2017 22:21:25 +0000
Subject: [PATCH] Change alert view and add top menu

---
 map.js |   37 ++++++++++++-------------------------
 1 files changed, 12 insertions(+), 25 deletions(-)

diff --git a/map.js b/map.js
index 0cbdf09..5a8c6bf 100644
--- a/map.js
+++ b/map.js
@@ -27,7 +27,7 @@
 var ignore_hashchange = false;
 
 var Panel = {
-	element: document.getElementById('popup'),
+	element: document.getElementById('panel'),
 	closeCallback: undefined,
 	
 	callCloseCallback: function() {
@@ -63,22 +63,16 @@
 };
 
 var Alert = {
-	element: document.getElementById('fail'),
-	action: undefined,
+	element: document.getElementById('alert'),
 	
-	fail: function(message, action) {
-		if(this.action) {
-			this.element.removeEventListener('click', this.action);
-			this.action = undefined;
-		}
-		
+	show: function(message) {
 		setText(this.element, message);
-		this.element.style.top = '0.5em';
-		
-		if(action) {
-			this.action = action;
-			this.element.addEventListener('click', action);
-		}
+		this.element.className = '';
+	},
+	
+	fail: function(message) {
+		this.show(message);
+		this.element.className = 'error';
 	},
 };
 
@@ -602,7 +596,7 @@
 
 function init() {
 	if(!window.jQuery) {
-		Alert.fail(lang.jquery_not_loaded);
+		Alert.show(lang.jquery_not_loaded);
 		return;
 	}
 	
@@ -667,14 +661,7 @@
 			attributionOptions: ({
 				collapsible: false,
 			})
-		}).extend([
-			new ol.control.Control({
-				element: document.getElementById('title'),
-			}),
-			new ol.control.Control({
-				element: Alert.element,
-			})
-		]),
+		}),
 		loadTilesWhileAnimating: true,
 	});
 	map_sphere = new ol.Sphere(6378137);
@@ -771,7 +758,7 @@
 		if(vehicles_xhr) vehicles_xhr.abort();
 		if(vehicles_timer) clearTimeout(vehicles_timer);
 		  
-		Alert.fail(lang.error_refresh);
+		Alert.show(lang.error_refresh);
 	}, 1800000);
 }
 

--
Gitblit v1.9.1