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ctrls/ctrls-password.ts"],"sourcesContent":["import {Ctl} from \"../controller-binding\";\r\nimport $ from \"jquery\";\r\n\r\nCtl[\"Password\"] = (() => {\r\n\r\n\tfunction changeType(x:JQuery, type:string) {\r\n\t\tif (x.prop(\"type\") == type)\r\n\t\t\treturn x; //That was easy.\r\n\t\ttry {\r\n\t\t\treturn x.prop(\"type\", type); //Stupid IE security will not allow this\r\n\t\t} catch (e) {\r\n\t\t\t//Try re-creating the element (yep... this sucks)\r\n\t\t\t//jQuery has no html() method for the element, so we have to put into a div first\r\n\t\t\tvar html = $(\"
\").append(x.clone()).html();\r\n\t\t\tvar regex = /type=(\\\")?([^\\\"\\s]+)(\\\")?/; //matches type=text or type=\"text\"\r\n\t\t\t//If no match, we add the type attribute to the end; otherwise, we replace\r\n\t\t\tvar tmp = $(html.match(regex) == null ?\r\n\t\t\t\thtml.replace(\">\", \" type=\\\"\" + type + \"\\\">\") :\r\n\t\t\t\thtml.replace(regex, \"type=\\\"\" + type + \"\\\"\"));\r\n\t\t\t//Copy data from old element\r\n\t\t\ttmp.data(\"type\", x.data(\"type\"));\r\n\t\t\tvar events = x.data(\"events\");\r\n\t\t\tvar cb = function(events) {\r\n\t\t\t\treturn function() {\r\n\t\t\t\t\t//Bind all prior events\r\n\t\t\t\t\tfor (var i in events) {\r\n\t\t\t\t\t\tvar y = events[i];\r\n\t\t\t\t\t\tfor (var j in y)\r\n\t\t\t\t\t\t\ttmp.bind(i, y[j].handler);\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t}(events);\r\n\t\t\tx.replaceWith(tmp);\r\n\t\t\tsetTimeout(cb, 10); //Wait a bit to call function\r\n\t\t\treturn tmp;\r\n\t\t};\r\n\t}\r\n\r\n\tfunction markValid(id:string, valid:boolean) {\r\n\t\t$(id).removeClass(valid ? \"invalid\" : \"valid\")\r\n\t\t\t .addClass(valid ? \"valid\" : \"invalid\");\r\n\t}\r\n\r\n\tfunction validatePassword(pswd:any) {\r\n\t\tmarkValid(\"#length\", pswd.length >= 6);\r\n\t\tmarkValid(\"#letter\", pswd.match(/[A-z]/));\r\n\t\tmarkValid(\"#capital\", pswd.match(/[A-Z]/));\r\n\t\tmarkValid(\"#number\", pswd.match(/\\d/));\r\n\t}\r\n\r\n function init() {\r\n console.log(\"[app-init] Password Ctrl\");\r\n\r\n\t\t$(\"input:password\").focus(function() {\r\n\t\t\tchangeType($(this), \"text\");\r\n\t\t\t$(\".pwd .field-reqs\").show();\r\n\t\t}).blur(function() {\r\n\t\t\tchangeType($(this), \"password\");\r\n\t\t}).keyup(function() {\r\n\t\t\tvalidatePassword($(this).val());\r\n\t\t});\r\n\t}\r\n\r\n\treturn {\r\n\t\tinit: init\r\n\t};\r\n})();\r\n"],"names":["Ctl","changeType","x","type","prop","e","html","$","append","clone","regex","tmp","match","replace","data","cb","events","i","y","j","bind","handler","replaceWith","setTimeout","markValid","id","valid","removeClass","addClass","init","focus","this","show","blur","keyup","pswd","length","validatePassword","val"],"sourceRoot":""}