forked from DO3SWW/Web-Aprs-Passcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
82 lines (76 loc) · 2.47 KB
/
index.html
File metadata and controls
82 lines (76 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!DOCTYPE html>
<html lang="en">
<head>
<title>APRS Passcode Generator</title>
<meta name="description" content="This is a web-based tool to generate passcodes for the APRS-IS network with your amateur radio callsign."/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.11"></script>
<script>
document.addEventListener('DOMContentLoaded', function () {
new Vue({
el: '#container',
data: {
callsign: "",
passcode: ""
},
methods: {
getPasscode(callsign) {
if((/^[a-zA-Z0-9-]+$/).test(callsign)){
callsign = callsign.toUpperCase();
let i = 0;
let tmp_code = 29666;
while(i < callsign.length){
// ^ = XOR Operation
tmp_code = tmp_code ^ callsign.charCodeAt(i) * 256;
tmp_code = tmp_code ^ callsign.charCodeAt(i+1);
i += 2;
}
tmp_code = tmp_code & 32767;
this.passcode = tmp_code;
}
else{
this.passcode = "";
alert("Invalid Callsign, Try Again!");
this.callsign = "";
}
}
}
})
})
</script>
<style type="text/css">
body {
font-family: Arial, sans-serif;
font-size: 14px;
background-color: #cfcbcb;
}
label {
width: 100%;
font-weight: bold;
}
#container {
margin: 0 auto;
width: 400px;
padding: 10px;
border: 1px solid #020202;
background-color: #ffffffdc;
}
#passcode {
font-size: 16px;
}
</style>
</head>
<body>
<div id="container">
<h2>APRS Passcode Generator</h2>
<p>Enter your amature radio callsign to get a Passocde for the APRS-IS network.</p>
<form v-on:submit.prevent="getPasscode(callsign)" >
<label for="callsign"><b>Callsign:</b></label>
<input v-model=callsign type="text" id="callsign" name="callsign">
<button v-on:click="getPasscode(callsign)" type="button">Get Passcode!</button>
<p id="passcode"><b>Your Passcode: {{ passcode }}</b></p>
</form>
<p>Source Code on <a href="https://github.com/DO3SWW/web-aprs-passcode" title="Github" target="_blank" rel="noopener">Github</a></p>
</div>
</body>
</html>