forked from Wh014M/Pakistan-Card-Pattern
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
21 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |