From 35ded1fef31b69b80995c3cdf4a5df5407abc3ba Mon Sep 17 00:00:00 2001
From: ulrich@undisclosed <ulrich@ulrich-vaio>
Date: Sun, 17 May 2020 18:37:44 +0000
Subject: [PATCH] Code aufgeraeumt, Stile verfeinert

---
 web/login_form.jsp |    2 
 web/ui2/js/app.js  |   72 +++++++++++++++--------------------
 web/stile.css      |    2 +
 web/ui2/index.html |    2 
 web/ui2/stile.css  |    2 +
 5 files changed, 37 insertions(+), 43 deletions(-)

diff --git a/web/login_form.jsp b/web/login_form.jsp
index 762e085..e7d9b76 100644
--- a/web/login_form.jsp
+++ b/web/login_form.jsp
@@ -3,7 +3,7 @@
 <html lang="en">
   <head>
     <meta charset="utf-8">
-    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalabe=no">
     <meta name="description" content="">
     <meta name="author" content="">
     <link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/stile.css">    
diff --git a/web/stile.css b/web/stile.css
index 5ab527b..4413187 100644
--- a/web/stile.css
+++ b/web/stile.css
@@ -4,6 +4,7 @@
   height: 100%; /* Anmerkung 2 */
   font-size: larger;
   font-family: 'Roboto Condensed';
+	-webkit-text-size-adjust: none;
 }
 
 .form-signin {
@@ -16,6 +17,7 @@
 
 .form-signin input {
   margin: 0.5em 0 0.5em 0;
+  font-size: large;
 }
 
 .form-signin button {
diff --git a/web/ui2/index.html b/web/ui2/index.html
index 1a4f800..242fada 100644
--- a/web/ui2/index.html
+++ b/web/ui2/index.html
@@ -3,7 +3,7 @@
   <head>
     <title>Nutzerverwaltung</title>
     <meta charset="UTF-8">
-    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalabe=no">
     <meta name="apple-mobile-web-app-capable" content="yes" />
     <link rel="stylesheet" type="text/css" href="stile.css">
   </head>
diff --git a/web/ui2/js/app.js b/web/ui2/js/app.js
index d6a208d..8e08d96 100644
--- a/web/ui2/js/app.js
+++ b/web/ui2/js/app.js
@@ -1,11 +1,12 @@
 function NutzerApp() {
   var self = this;
-  var vorlagen;
+  //var vorlagen;
   var userid;
   var loc;
+  this.cache = {}; // mustache template cache
 
   this.init = function () {
-    self.vorlagen = new Vorlagen();
+    //self.vorlagen = new Vorlagen();
     var dlg = document.querySelector(".dialog");
     dlg.style.flexBasis = '0em';
     document.querySelector('#top-neu-btn').addEventListener('click', self.nutzer_neu_dialog_zeigen);
@@ -76,7 +77,7 @@
       } else {
         rollen = 'keine';
       }
-      self.vorlagen.html_erzeugen(
+      self.html_erzeugen(
         'data/tpl/nutzer-rollen-dlg.tpl',
         rollen,
         function (html) {
@@ -111,7 +112,7 @@
     var m = 'getRoleNamesGranted';
     var u = '../svc/' + m;
     self.http_get(u, function (antwort2) {
-      self.vorlagen.html_erzeugen(
+      self.html_erzeugen(
         'data/tpl/alle-rollen.tpl',
         JSON.parse(antwort2),
         function (html) {
@@ -237,7 +238,7 @@
    */
   this.dialog_zeigen = function (vurl, inhalt, renderCallback) {
     var dlg = document.querySelector(".dialog");
-    self.vorlagen.html_erzeugen(
+    self.html_erzeugen(
             vurl,
             inhalt,
             function (html) {
@@ -267,7 +268,7 @@
     var m = 'getUserNameList';
     var u = '../svc/' + m;
     self.http_get(u, function (antwort) {
-      self.vorlagen.html_erzeugen(
+      self.html_erzeugen(
         'data/tpl/inhalt.tpl',
         JSON.parse(antwort),
         function (h) {
@@ -334,29 +335,29 @@
   };
 
   /* -------- ajax helper functions ----------- */
+  
+  this.http_get = function(u, cb)  {
+    self.http_call('GET', u, null, cb);
+  };
+  
+  this.http_post = function(u, data, cb) {
+    self.http_call('POST', u, data, cb);
+  };
 
-  this.http_get = function (u, scallback) {    
-    var xmlhttp = new XMLHttpRequest();
+  this.http_call = function (method, u, data, scallback) {    
+    var xhr = new XMLHttpRequest();
     var url = u;
-    xmlhttp.onreadystatechange = function() {
+    xhr.onreadystatechange = function() {
       if (this.readyState === 4 && this.status === 200) {
         scallback(this.responseText);
       }
     };
-    xmlhttp.open("GET", url, true);
-    xmlhttp.send();
-  };
-  
-  this.http_post = function (url, data, callback) {
-    var xhr = new XMLHttpRequest();
-    xhr.onreadystatechange = function() {
-      if (this.readyState === 4 && this.status === 200) {
-        callback(this.responseText);
-      }
-    };
-    xhr.open("POST", url, true);
-    xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
-    xhr.send(data);
+    xhr.open(method, url);
+    if(method === 'GET')  {
+      xhr.send();
+    } else if(method === 'POST' || method === 'PUT') {
+      xhr.send(data);
+    }
   };
   
 /* ----- Hilfsfunktionen ----- */
@@ -377,15 +378,9 @@
     var el = document.getElementById(elementId);
     elClone = el.cloneNode(true);
     el.parentNode.replaceChild(elClone, el);
-  };
+  }; // https://stackoverflow.com/questions/19469881/remove-all-event-listeners-of-specific-type
 
-}
-
-/* ----- Vorlagen ----- */
-
-function Vorlagen() {
-  var self = this;
-  this.cache = {}; // mustache template cache
+  /* ---- Vorlagen ---- */
 
   this.html_erzeugen = function(vurl, inhalt, cb) {
     var vorlage = self.cache[vurl];
@@ -401,18 +396,13 @@
   };
 
   this.vorlage_laden_und_fuellen = function(vurl, inhalt, cb) {
-    var xmlhttp = new XMLHttpRequest();
-    xmlhttp.onreadystatechange = function() {
-      if (this.readyState == 4 && this.status == 200) {
-        self.cache[vurl] = this.responseText;
-        self.vorlage_fuellen(vurl, inhalt, cb);
-      }
-    };
-    xmlhttp.open("GET", vurl, true);
-    xmlhttp.send();
+    app.http_get(vurl, function(antwort) {
+      self.cache[vurl] = antwort;
+      self.vorlage_fuellen(vurl, inhalt, cb);
+    });
   };
-}
 
+}
 
 /* ----- Objekte ----- */
 
diff --git a/web/ui2/stile.css b/web/ui2/stile.css
index 39008ba..e85cc03 100644
--- a/web/ui2/stile.css
+++ b/web/ui2/stile.css
@@ -11,6 +11,8 @@
   height: 100%; /* Anmerkung 2 */
   font-size: larger;
   font-family: 'Roboto Condensed';
+	-webkit-text-size-adjust: none;
+	/* touch-action: manipulation;*/
 }
 body {
   min-height: 0; /* Anmerkung 1 */

--
Gitblit v1.9.3