-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathindex.html
More file actions
346 lines (319 loc) · 18.4 KB
/
index.html
File metadata and controls
346 lines (319 loc) · 18.4 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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>catprinter</title>
<meta name="description" content="Webapp for the MXW01 model of thermal printer.">
<meta name="keywords" content="MXW01, catprinter, cat printer, thermal printer, receipt printer, bluetooth printer, MXW01 printer, portable printer, aliexpress printer, thermal receipt printer, mini printer, pocket printer, wireless printer, cute printer, small printer">
<meta name="author" content="MXW01 Tools">
<meta name="google-site-verification" content="48f-bTXCryRqg-w3Hjgpl13aBiEh2J2LXBfF4gv8xp4" />
<!-- Open Graph / Facebook -->
<meta property="og:type" content="website">
<meta property="og:url" content="https://catprinter.vercel.app/">
<meta property="og:title" content="catprinter">
<meta property="og:description" content="Webapp for the MXW01 model of thermal printer.">
<!-- Twitter -->
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:url" content="https://catprinter.vercel.app/">
<meta property="twitter:title" content="catprinter">
<meta property="twitter:description" content="Webapp for the MXW01 model of thermal printer.">
<link rel="icon" type="image/png" href="/img/favicon/favicon-96x96.png" sizes="96x96" />
<link rel="icon" type="image/svg+xml" href="/img/favicon/favicon.svg" />
<link rel="shortcut icon" href="/img/favicon/favicon.ico" />
<link rel="apple-touch-icon" sizes="180x180" href="/img/favicon/apple-touch-icon.png" />
<meta name="apple-mobile-web-app-title" content="catprinter" />
<link rel="manifest" href="/img/favicon/site.webmanifest" />
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<header>
<h1>catprinter</h1>
<p>Webapp for the MXW01 model of thermal printer.</p>
<!-- Mode Toggle -->
<div class="mode-toggle">
<button id="receiptModeBtn" class="mode-btn mode-receipt active">Receipt Mode</button>
<button id="imageModeBtn" class="mode-btn mode-image">Image Mode</button>
</div>
</header>
<main>
<div class="panels">
<!-- Receipt Mode Content -->
<div id="receiptModeContent" class="mode-content active">
<!-- Left Panel: Configuration -->
<section class="config-panel">
<div class="config-section">
<h3>Business Information</h3>
<div class="input-group">
<label for="businessName">Name</label>
<input type="text" id="businessName" value="MY RESTAURANT">
</div>
<div class="input-group">
<label for="businessAddress">Address</label>
<textarea id="businessAddress" rows="2">123 MAIN STREET
CITY, STATE 12345</textarea>
</div>
<div class="input-group">
<label for="businessPhone">Phone</label>
<input type="text" id="businessPhone" value="(555) 123-4567">
</div>
</div>
<div class="config-section">
<h3>Transaction</h3>
<div class="flex-row">
<div class="input-group">
<label for="tableNumber">Table</label>
<input type="text" id="tableNumber" value="12">
</div>
<div class="input-group">
<label for="serverName">Server</label>
<input type="text" id="serverName" value="ALICE">
</div>
<div class="input-group">
<label for="transactionNumber">#</label>
<input type="text" id="transactionNumber" value="1234">
</div>
</div>
<div class="flex-row">
<div class="input-group">
<label for="taxRate">Tax %</label>
<input type="number" id="taxRate" value="8.25" step="0.01">
</div>
<div class="input-group">
<label>Date/Time</label>
<div class="read-only-field" id="dateTimeField"></div>
</div>
</div>
</div>
<div class="config-section">
<h3>Items</h3>
<div id="itemsList"></div>
<div class="item-entry">
<div class="flex-row">
<div class="input-group">
<input type="text" id="newItemName" placeholder="Item name">
</div>
<div class="input-group input-group-small">
<input type="number" id="newItemPrice" placeholder="0.00" step="0.01">
</div>
<button id="addItemBtn" class="btn-primary">Add</button>
</div>
</div>
</div>
<div class="config-section">
<h3>Payment</h3>
<div class="flex-row">
<div class="input-group">
<label for="tipAmount">Tip</label>
<input type="number" id="tipAmount" value="0.00" step="0.01">
</div>
<div class="input-group">
<label for="paymentMethod">Method</label>
<select id="paymentMethod">
<option value="CASH">Cash</option>
<option value="CREDIT" selected>Credit Card</option>
<option value="DEBIT">Debit</option>
<option value="MOBILE">Mobile Pay</option>
</select>
</div>
</div>
<div class="flex-row">
<div class="input-group">
<label for="amountPaid">Paid</label>
<input type="number" id="amountPaid" value="0.00" step="0.01">
</div>
<div class="input-group">
<label>Change</label>
<div class="read-only-field" id="changeAmount">$0.00</div>
</div>
</div>
</div>
<div class="config-section">
<h3>Footer</h3>
<div class="input-group">
<textarea id="footerMessage" rows="3">THANK YOU FOR DINING WITH US
PLEASE COME AGAIN
WWW.MYRESTAURANT.COM</textarea>
</div>
</div>
<div class="action-buttons">
<button id="resetBtn" class="btn-secondary">Reset</button>
<button id="connectReceiptBtn" class="btn btn-primary connect-btn">Connect Printer</button>
<button id="printReceiptBtn" class="btn-primary" disabled>Print</button>
</div>
</section>
<!-- Right Panel: Receipt Preview -->
<section class="preview-panel">
<div class="preview-header">
<h2>Print Preview</h2>
</div>
<div class="receipt-wrapper">
<div class="receipt-container" id="receiptContainer">
<div class="receipt" id="receiptPreview">
<!-- Receipt will be rendered here -->
</div>
</div>
<div class="receipt-summary" id="receiptSummary">
<!-- Summary info will be placed here -->
</div>
</div>
</section>
</div>
<!-- Image Mode Content -->
<div id="imageModeContent" class="mode-content">
<!-- Left Panel: Image Configuration -->
<section class="config-panel image-config-panel">
<div class="config-section">
<h3>Image Source</h3>
<div class="input-group">
<label for="imageUpload">Upload Image</label>
<div class="file-upload-container">
<input type="file" id="imageUpload" accept="image/*">
</div>
</div>
<div class="input-group">
<label>Rotation</label>
<div class="rotation-controls">
<button id="rotateLeftBtn" class="btn-icon" title="Rotate Left (90° Counter-Clockwise)">
<span class="rotation-icon">↺</span>
</button>
<span id="rotationDisplay">0°</span>
<button id="rotateRightBtn" class="btn-icon" title="Rotate Right (90° Clockwise)">
<span class="rotation-icon">↻</span>
</button>
</div>
</div>
</div>
<div class="config-section">
<h3>Image Processing</h3>
<div class="input-group">
<label for="ditherMethod">Dithering Method</label>
<select id="ditherMethod">
<option value="threshold">Threshold</option>
<option value="floydSteinberg" selected>Floyd-Steinberg</option>
<option value="atkinson">Atkinson</option>
<option value="halftone">Halftone</option>
<option value="none">None</option>
</select>
</div>
<div class="input-group">
<label for="thresholdValue">Threshold</label>
<input type="range" id="thresholdValue" min="0" max="255" value="128">
<span id="thresholdDisplay">128</span>
</div>
<div class="input-group">
<label for="imageInvert">Invert Image</label>
<input type="checkbox" id="imageInvert">
</div>
</div>
<div class="config-section">
<h3>Size & Positioning</h3>
<div class="input-group">
<label for="imageWidth">Width (px)</label>
<input type="number" id="imageWidth" value="384" min="1" max="384" step="1">
</div>
<div class="input-group">
<label for="autoscaleImage">Auto Scale to Width</label>
<input type="checkbox" id="autoscaleImage" checked>
</div>
<div class="input-group">
<label for="imagePadding">Padding (px)</label>
<input type="number" id="imagePadding" value="10" min="0" max="100" step="1">
</div>
</div>
<div class="action-buttons">
<button id="resetImageBtn" class="btn-secondary">Reset</button>
<button id="connectImageBtn" class="btn btn-primary connect-btn">Connect Printer</button>
<button id="printImageBtn" class="btn-primary" disabled>Print</button>
</div>
</section>
<!-- Right Panel: Image Preview -->
<section class="preview-panel image-preview-panel">
<div class="preview-header">
<h2>Print Preview</h2>
</div>
<div class="image-wrapper" id="dropZone">
<div class="image-container" id="imageContainer">
<canvas id="imagePreview"></canvas>
<div id="imagePreviewMessage">Drop image here or click the upload button</div>
</div>
<div class="image-summary" id="imageSummary">
<!-- Image info will be placed here -->
</div>
</div>
</section>
</div>
<!-- Printer Log Panel (shared between modes) -->
<section class="log-panel">
<div class="log-controls">
<h2>Printer Log</h2>
<button id="clearLogBtn">Clear Log</button>
</div>
<div class="log-wrapper" id="logWrapper">
<!-- Log entries will be added here -->
</div>
<div class="progress-container" id="printProgress">
<div class="progress-bar" id="printProgressBar"></div>
</div>
</section>
</div>
</main>
<footer>
<p><a href="https://github.com/dropalltables/catprinter" target="_blank">catprinter</a></p>
<div class="battery-indicator" id="batteryIndicator">
<span class="battery-icon">🔋</span>
<span class="battery-level" id="batteryLevel">--</span>
</div>
</footer>
<script type="module" src="js/main.js"></script>
<!-- PostHog -->
<script>
!function(t,e){var o,n,p,r;e.__SV||(window.posthog && window.posthog.__loaded)||(window.posthog=e,e._i=[],e.init=function(i,s,a){function g(t,e){var o=e.split(".");2==o.length&&(t=t[o[0]],e=o[1]),t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}}(p=t.createElement("script")).type="text/javascript",p.crossOrigin="anonymous",p.async=!0,p.src=s.api_host.replace(".i.posthog.com","-assets.i.posthog.com")+"/static/array.js",(r=t.getElementsByTagName("script")[0]).parentNode.insertBefore(p,r);var u=e;for(void 0!==a?u=e[a]=[]:a="posthog",u.people=u.people||[],u.toString=function(t){var e="posthog";return"posthog"!==a&&(e+="."+a),t||(e+=" (stub)"),e},u.people.toString=function(){return u.toString(1)+".people (stub)"},o="init rs ls wi ns us ts ss capture calculateEventProperties vs register register_once register_for_session unregister unregister_for_session gs getFeatureFlag getFeatureFlagPayload getFeatureFlagResult isFeatureEnabled reloadFeatureFlags updateFlags updateEarlyAccessFeatureEnrollment getEarlyAccessFeatures on onFeatureFlags onSurveysLoaded onSessionId getSurveys getActiveMatchingSurveys renderSurvey displaySurvey cancelPendingSurvey canRenderSurvey canRenderSurveyAsync identify setPersonProperties group resetGroups setPersonPropertiesForFlags resetPersonPropertiesForFlags setGroupPropertiesForFlags resetGroupPropertiesForFlags reset get_distinct_id getGroups get_session_id get_session_replay_url alias set_config startSessionRecording stopSessionRecording sessionRecordingStarted captureException startExceptionAutocapture stopExceptionAutocapture loadToolbar get_property getSessionProperty fs ds createPersonProfile setInternalOrTestUser ps Qr opt_in_capturing opt_out_capturing has_opted_in_capturing has_opted_out_capturing get_explicit_consent_status is_capturing clear_opt_in_out_capturing hs debug M cs getPageViewId captureTraceFeedback captureTraceMetric Kr".split(" "),n=0;n<o.length;n++)g(u,o[n]);e._i.push([i,s,a])},e.__SV=1)}(document,window.posthog||[]);
posthog.init('phc_7ZW6lV0EVazJLrKba1lKwNG4qBt0Vs5tqLMaGxUOwgR', {
api_host: 'https://us.i.posthog.com',
defaults: '2026-01-30',
person_profiles: 'identified_only',
session_recording: {
recordCrossOriginIframes: true,
recordConsole: true,
},
});
window.__catprinter_debug = false;
document.addEventListener('keydown', function(e) {
if (e.ctrlKey && e.shiftKey && e.key === 'D') {
window.__catprinter_debug = !window.__catprinter_debug;
posthog.register({ debug: window.__catprinter_debug });
posthog.capture('debug_mode_toggled', { debug: window.__catprinter_debug });
console.log('[catprinter] debug mode:', window.__catprinter_debug);
}
});
</script>
<!-- Structured Data -->
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "SoftwareApplication",
"name": "MXW01 CatPrinter Tools",
"description": "Webapp for the MXW01 model of thermal printer.",
"url": "https://catprinter.vercel.app/",
"applicationCategory": "UtilityApplication",
"operatingSystem": "Web Browser",
"offers": {
"@type": "Offer",
"price": "0",
"priceCurrency": "USD"
},
"keywords": "MXW01, catprinter, cat printer, thermal printer, receipt printer, bluetooth printer, portable printer",
"author": {
"@type": "Organization",
"name": "MXW01 Tools"
},
"compatibleWith": [
"MXW01 Thermal Printer",
"CatPrinter",
"Bluetooth Thermal Printer"
]
}
</script>
</body>
</html>