From bc45e83cc845cd2d834ba7cfb1f9029409fc1491 Mon Sep 17 00:00:00 2001 From: Holger Frey Date: Wed, 1 Apr 2020 18:20:08 +0200 Subject: [PATCH] added file for custom javascripts --- ordr3/static/script.js | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 ordr3/static/script.js diff --git a/ordr3/static/script.js b/ordr3/static/script.js new file mode 100644 index 0000000..222d8d7 --- /dev/null +++ b/ordr3/static/script.js @@ -0,0 +1,39 @@ +var capitalize = function(some_string) { + if (some_string) { + return some_string[0].toUpperCase() + some_string.substring(1).toLowerCase(); + } else { + return(""); + } +} + +$(function() { + // Handler for .ready() called. + + $("#deformCancel").on("click", function(event) { + window.location.href = "/"; + }) + + $(".o3-pwd-visibility").on("click", function(event) { + // handle password visibility + var target = $(event.delegateTarget) + var pwd = target.parent().children("input") + if (pwd.attr("type") == "password") { + target.removeClass("o3-pwd-dots"); + target.addClass("o3-pwd-text"); + pwd.attr("type", "text") + } else { + target.addClass("o3-pwd-dots"); + target.removeClass("o3-pwd-text"); + pwd.attr("type", "password") + } + }); + + $(".o3-reg-username-source").on("keyup", function(event){ + // automatic username creation + var first_name = $(".o3-reg-firstname").val(); + var last_name = $(".o3-reg-lastname").val(); + var user_name = capitalize(first_name) + capitalize(last_name) + $(".o3-reg-username").val(user_name); + }); + +});