Add option to toggle password fields

Change-Id: I07a16697d2cbf9215176995b1d65ecfcc1094141
diff --git a/dev/js/src/util.js b/dev/js/src/util.js
index 0fea33f..b8be33b 100644
--- a/dev/js/src/util.js
+++ b/dev/js/src/util.js
@@ -86,6 +86,30 @@
 };
 
 
+/**
+ * Add option to show passwords.
+ */
+function initTogglePwdVisibility () {
+    const el = document.querySelectorAll("input[type=password].show-pwd");
+    for (let x = 0; x < el.length; x++) {     
+        const pwd = el[x];
+
+        const a = document.createElement('a');
+        a.classList.add('showPWD');         
+        a.addEventListener('click', function () {
+            if (pwd.getAttribute("type") === "password") {
+                pwd.setAttribute("type", "text");
+                a.classList.add('hide');
+                return;
+            };
+            pwd.setAttribute("type", "password");
+            a.classList.remove('hide');
+        });
+        pwd.parentNode.insertBefore(a, pwd.nextSibling);
+    };
+};
+
+
 define(function () {
   // Todo: That's double now!
   KorAP.API = KorAP.API || {};