-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
208 lines (179 loc) · 7.43 KB
/
index.html
File metadata and controls
208 lines (179 loc) · 7.43 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
<!DOCTYPE html>
<html>
<head>
<title>A-Sign Builder</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<style>
p.one {
display: inline;
font-size: 200%;
letter-spacing: 5px;
border-color: gray;
border-style: solid;
border-width: 1px;
background-color: #f1f1f1;
padding: 2px;
border-radius: 5px;
}
p.one:hover {
background-color: #d8d8d8;
}
div.mainform {
width:18%;
float:left;
}
div.maincanvas {
width:600px;
float:left;
}
@media print {
/* Add your custom css rules here */
div.mainform {
width:0%;
}
input {
display: none;
}
label {
display: none;
}
button {
display: none;
}
p.one {
display: none;
}
h3 {
display: none;
}
@page
{
size: auto; /* auto is the initial value */
margin: 0mm; /* this affects the margin in the printer settings */
}
canvas
{
/* Top Right Bottom Left*/
margin: 5mm 17mm 5mm 18mm; /* margin you want for the content */
zoom: 125%;
}
}
</style>
<script src="jquery.js"></script>
<script>
// prime with empty jQuery object
window.prevFocus = $();
// Catch any bubbling focusin events (focus does not bubble)
$(document).on('focusin', ':input', function () {
// Save the previously clicked value for later
window.prevFocus = $(this);
});
function addSymbol(symbol) {
var position = window.prevFocus[0].selectionStart;
var oldString = window.prevFocus[0].value
var newString = [oldString.slice(0,position), symbol, oldString.slice(position)].join('');
window.prevFocus[0].value = newString;
window.prevFocus[0].focus();
}
function writeLetters() {
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
//ctx.textBaseline = "middle";
ctx.textAlign = "center";
var canvas_width = 490;
var x = canvas_width / 2;
var fontsize = 75;
var y = fontsize + 10;
var v_space = 20;
ctx.fillStyle = "black";
ctx.font = "75px Arial";
ctx.clearRect(0,0,490,710);
var line1 = document.getElementById("line1").value.toUpperCase().replace(/[^a-zA-Z\d\s\u2605\u2192\u2190\u2022\u00a2(&%$,.:)-]/g,'');
var line2 = document.getElementById("line2").value.toUpperCase().replace(/[^a-zA-Z\d\s\u2605\u2192\u2190\u2022\u00a2(&%$,.:)-]/g,'');
var line3 = document.getElementById("line3").value.toUpperCase().replace(/[^a-zA-Z\d\s\u2605\u2192\u2190\u2022\u00a2(&%$,.:)-]/g,'');
var line4 = document.getElementById("line4").value.toUpperCase().replace(/[^a-zA-Z\d\s\u2605\u2192\u2190\u2022\u00a2(&%$,.:)-]/g,'');
var line5 = document.getElementById("line5").value.toUpperCase().replace(/[^a-zA-Z\d\s\u2605\u2192\u2190\u2022\u00a2(&%$,.:)-]/g,'');
var line6 = document.getElementById("line6").value.toUpperCase().replace(/[^a-zA-Z\d\s\u2605\u2192\u2190\u2022\u00a2(&%$,.:)-]/g,'');
var line7 = document.getElementById("line7").value.toUpperCase().replace(/[^a-zA-Z\d\s\u2605\u2192\u2190\u2022\u00a2(&%$,.:)-]/g,'');
ctx.fillText(line1, x, y);
ctx.moveTo(0, y+v_space);
ctx.lineTo(canvas_width, y+v_space);
ctx.stroke();
y += fontsize + v_space;
ctx.fillText(line2, x, y);
ctx.moveTo(0, y+v_space);
ctx.lineTo(canvas_width, y+v_space);
ctx.stroke();
y += fontsize + v_space;
ctx.fillText(line3, x, y);
ctx.moveTo(0, y+v_space);
ctx.lineTo(canvas_width, y+v_space);
ctx.stroke();
ctx.fillRect(0,y - (fontsize / 2) - 10,10,40);
ctx.fillRect(canvas_width - 10,y - (fontsize / 2) - 10,10,40);
y += fontsize + v_space;
ctx.fillText(line4, x, y);
ctx.moveTo(0, y+v_space);
ctx.lineTo(canvas_width, y+v_space);
ctx.stroke();
y += fontsize + v_space;
ctx.fillText(line5, x, y);
ctx.moveTo(0, y+v_space);
ctx.lineTo(canvas_width, y+v_space);
ctx.stroke();
y += fontsize + v_space;
ctx.fillText(line6, x, y);
ctx.moveTo(0, y+v_space);
ctx.lineTo(canvas_width, y+v_space);
ctx.stroke();
y += fontsize + v_space;
ctx.fillText(line7, x, y);
ctx.moveTo(0, y+v_space);
ctx.lineTo(canvas_width, y+v_space);
ctx.stroke();
y += fontsize + v_space;
ctx.globalCompositeOperation = 'destination-over'
ctx.fillStyle = "white";
ctx.fillRect(0, 0, c.width, c.height);
}
</script>
<body>
<div class="mainform">
<label for="line1">Line 1:</label><br>
<input type="text" id="line1" name="line1" size="12"><br>
<label for="line2">Line 2:</label><br>
<input type="text" id="line2" name="line2" size="12"><br>
<label for="line3">Line 3:</label><br>
<input type="text" id="line3" name="line3" size="12"><br>
<label for="line4">Line 4:</label><br>
<input type="text" id="line4" name="line4" size="12"><br>
<label for="line5">Line 5:</label><br>
<input type="text" id="line5" name="line5" size="12"><br>
<label for="line6">Line 6:</label><br>
<input type="text" id="line6" name="line6" size="12"><br>
<label for="line7">Line 7:</label><br>
<input type="text" id="line7" name="line7" size="12"><br><br>
<br>
<button type="button" onclick="javascript:writeLetters()">Submit</button>
<h3>Available Characters</h3>
<p class="one" onclick="javascript:addSymbol('&')">&</p>
<p class="one" onclick="javascript:addSymbol('%')">%</p>
<p class="one" onclick="javascript:addSymbol('$')">$</p>
<p class="one" onclick="javascript:addSymbol(',')">,</p>
<p class="one" onclick="javascript:addSymbol('.')">.</p>
<p class="one" onclick="javascript:addSymbol('-')">-</p>
<p class="one" onclick="javascript:addSymbol(':')">:</p>
<br><br>
<p class="one" onclick="javascript:addSymbol('\u2605')">★</p>
<p class="one" onclick="javascript:addSymbol('\u2192')">→</p>
<p class="one" onclick="javascript:addSymbol('\u2190')">←</p>
<p class="one" onclick="javascript:addSymbol('\u2022')">•</p>
<p class="one" onclick="javascript:addSymbol('\u00a2')">¢</p>
</div>
<div class="maincanvas">
<canvas id="myCanvas" width="490" height="710" style="border:1px solid #000000;">
Your browser does not support the HTML canvas tag.</canvas>
</div>
</body>
</html>