Skip to content

Commit

Permalink
Update cnic.html
Browse files Browse the repository at this point in the history
  • Loading branch information
graysuit committed Feb 28, 2022
1 parent 813f75c commit c24949e
Showing 1 changed file with 21 additions and 63 deletions.
84 changes: 21 additions & 63 deletions cnic.html
Original file line number Diff line number Diff line change
@@ -1,63 +1,21 @@
<meta charset="UTF8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CNIC Location Tracker</title>
<script src="cnic.js"></script>
<script>
function error(msg)
{
document.getElementById("error").innerHTML = msg;
}

function warn(msg)
{
document.getElementById("warn").innerHTML = msg;
}

function setLetterCase(characters)
{
var refined = "";
var comma = characters.split(',');
for(var c = 0; c < comma.length; c++)
{
var space = comma[c].split(' ');
if(space[0].length > 0)
{
for(var s = 0; s < space.length; s++) refined += " " + space[s].charAt(0).toUpperCase() + space[s].substring(1).toLowerCase();
refined += ",";
}
}
return refined;
}

function trackLocation()
{
var cnic = document.getElementById("cnic");
var val = cnic.value.trim();
if(val.length != 15)
{
warn("Example: 12345-6789012-3");
return error("CNIC should be 15 digit long including dashes");
}
error("");
warn("");
var Location = document.getElementById("Location");
var Gender = document.getElementById("Gender");
Gender.innerHTML = "Gender: " + gender(val);
Location.innerHTML = "Residence: " + setLetterCase(locate(val));
}
</script>
<center>
<input
id="cnic"
oninput="trackLocation()"
placeholder="Enter CNIC with dashes like 15602-7730609-7"
style="width:330"
pattern="[0-9]"
/><br/>
<p id="error" style="color:red"></p>
<p id="warn" style="color:yellow"></p>
<p id="Location"></p>
<p id="Gender"></p><br/>
<a href="http://github.com/graysuit/cnic/discussions/new">Discussion</a> | <a href="http://github.com/graysuit/cnic/issues/new">Issues</a>
<p>or mail me on <b>[email protected]</b></p>
</center>
<meta charset="UTF8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CNIC Location Tracker</title>
<script src="cnic.js"></script>
<script src="helper.js"></script>
<script>
<center>
<input
id="cnic"
oninput="trackLocation()"
placeholder="Enter CNIC with dashes like 15602-7730609-7"
style="width:330"
pattern="[0-9]"
/><br/>
<p id="error" style="color:red"></p>
<p id="warn" style="color:yellow"></p>
<p id="Location"></p>
<p id="Gender"></p><br/>
<a href="http://github.com/graysuit/cnic/discussions/new">Discussion</a> | <a href="http://github.com/graysuit/cnic/issues/new">Issues</a>
<p>or mail me on <b>[email protected]</b></p>
</center>

0 comments on commit c24949e

Please sign in to comment.