-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathripterm.html
More file actions
598 lines (544 loc) · 19.6 KB
/
Copy pathripterm.html
File metadata and controls
598 lines (544 loc) · 19.6 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
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
<!DOCTYPE html>
<html>
<head>
<title id="path1"></title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!--[if lte IE 8]><script src="/ass/js/ie/html5shiv.js"></script><![endif]-->
<link rel="stylesheet" href="/ass/css/main.css" />
<link rel="stylesheet" href="/ass/css/magnific-popup.css" />
<link rel="stylesheet" href="/ass/js/highlight/styles/default.css" />
<noscript><link rel="stylesheet" href="/ass/css/noscript.css" /></noscript>
<!--[if lte IE 8]><link rel="stylesheet" href="/ass/css/ie8.css" /><![endif]-->
</head>
<body>
<!-- Wrapper-->
<div id="wrapper">
<!-- Main -->
<div id="main">
<article id="pub" class="panel">
<header>
</header>
<section>
<div class="row">
<div class="12u">
<h2>RIPtermJS</h2>
<h6>2011 (v0.1), 2018 (v0.2), 2021 (v0.3), 2026 (v0.4)</h6>
<br>
<p>
This is Version 0.4 of my .RIP file viewer and eventual terminal. The <a href="https://en.wikipedia.org/wiki/Remote_Imaging_Protocol" target="_blank" class="link"><i>Remote Imaging Protocol</i></a> was a vector graphics encoding used in BBS's during the 90's. This is an attempt to recreate the MS-DOS program RIP<i>term</i> v1.54 that ran in 640 x 350px EGA, but in an HTML canvas.
</p>
<p>
Either <b>Upload</b> a RIP file from your computer, or <b>Select a RIP file</b> from the dropdown list, then <b>Play</b> to draw it. RIP<em>scrip</em> commands are shown on the right.
<em>(Blue = Implemented. Red = Skipped.)</em>
</p>
<style>
.button, button {
font-size: 8pt;
font-weight: 400;
line-height: 1.5em;
}
.rip-body {
background-color: #000;
width: 640px;
}
.rip-body-height {
height: 350px; /* use this later to stretch: 480px */
}
.rip-frame {
margin: 4px 0 4px 0;
}
.rip-frame-width {
width: 656px;
}
.rip-frame-height {
height: 366px; /* use this later to stretch: 496px */
}
.rip-hidden {
visibility: hidden;
}
.rip-all-views {
display: none;
float: left;
}
.rip-caption-area {
height: 2em;
}
.rip-caption-left {
float: left;
}
.rip-caption-right {
float: right;
margin-right: 4px;
}
.rip-status-area {
padding: 0.5em 0 0 0;
font-size: 10pt;
}
#rip-files {
font-size: 12pt;
}
#rip-commands {
float:right;
/* border:solid 1px #999; */
margin: 4px 0;
padding: 0px 8px;
width: calc(100% - 662px); /* 136px, 144px */
/* height: 366px; */ /* was 496px */
overflow: auto;
background: #333;
font-family: monospace;
font-size: 12px;
color: #fff;
vertical-align: top;
white-space: nowrap;
}
#rip-commands::after {
/* content: "";
display: block;
clear: both; */
}
#rip-log {
height: 18em;
padding: 0px 8px;
overflow: auto;
background: #333;
font-family: monospace;
font-size: 12px;
color: #fff;
vertical-align: top;
}
.rip-select-views {
line-height: 1.5em;
}
.rip-select-views * {
padding-right: 0.5em;
}
.rip-select-left {
float: left;
}
.rip-select-right {
float: right;
}
.clear { clear: both; }
#rip-counter {
float: right;
padding-right: 8px;
/* font-size: 12pt; */
/* font-weight: bold; */
/* line-height: 30px; */
/* clear: both; */
}
.debugOptions {
padding-left: 0.5em;
font-size: 12pt;
}
.debugOptions * {
padding-right: 0.5em;
font-weight: 400;
}
/* debug log colors */
.rip-log-trm { color: #888; } /* gray */
.rip-log-fnt { color: #b8f; } /* magenta */
.rip-log-rip { color: #88f; } /* blue */
.rip-log-ans { color: #ff8; } /* yellow */
.rip-log-bgi { color: #8ff; } /* cyan */
.rip-log-svg { color: #8f8; } /* green */
.rip-log-err { color: #f88; } /* red */
/* rip command colors */
.cmd-ok { color: #88f; }
.cmd-not { color: #f88; }
.cmd-paused { color: #ff8; }
.rip-cmd:hover {
background: #666;
cursor: pointer;
}
</style>
<div>
<button onclick="ripterm.reset()">Reset</button>
<input type="file" id="rip-open-file" accept=".rip,.RIP" onchange="openRIP()" hidden />
<label for="rip-open-file" class="button">Upload...</label> or
<select id="rip-files" onchange="selectRIP()">
<option value="" selected>Select a RIP file...</option>
<option value="rips/set1/BEAR">Bear</option>
<option value="rips/set1/BILL">Bill</option>
<option value="rips/set1/BULLETIN">Bulletin</option>
<option value="rips/set1/BUTFLY">Butterfly</option>
<option value="rips/set1/CAPITOL">Capitol</option>
<option value="rips/set1/CARN">Carnivores</option>
<option value="rips/set1/DOORS">Doors</option>
<option value="rips/set1/DRAGON01">Dragon #1</option>
<option value="rips/set1/DRAGON02">Dragon #2</option>
<option value="rips/set1/FIERO">Fiero</option>
<option value="rips/set1/FILE5">File 5</option>
<option value="rips/set1/FINISHLN">Finish Line</option>
<option value="rips/set1/FLIGHT">Flight</option>
<option value="rips/set1/FS7_SHUT">FS7 Shuttle</option>
<option value="rips/set1/GARFIELD">Garfield #1</option>
<option value="rips/set1/GFIELD2">Garfield #2</option>
<option value="rips/set1/GOODBYE">Goodbye</option>
<option value="rips/set1/HELLO2">Hello 2</option>
<option value="rips/set1/JULY493">July 4, 1993</option>
<option value="rips/set1/LTHOUSE">Lighthouse</option>
<option value="rips/set1/MAIN5">Main 5</option>
<option value="rips/set1/MSG5">Msg 5</option>
<option value="rips/set1/NEWMOUNT">New mount</option>
<option value="rips/set1/PLANE">Plane</option>
<option value="rips/set1/PMID1">Pyramid 1</option>
<option value="rips/set1/POSTRIP">POSTRIP</option>
<option value="rips/set1/PRELOG">PRELOG</option>
<option value="rips/set1/QUESTION">Question</option>
<option value="rips/set1/SBBS2">SBBS2</option>
<option value="rips/set1/SURFER1">Surfer 1</option>
<option value="rips/set1/SYSOP9">Sysop 9</option>
<option value="rips/set1/TWEED_AD">Tweed</option>
<option value="rips/set1/ZIGPARTY">Zig Party</option>
<option value="rips/set1/11FV">11FV</option>
<option value="rips/set1/184">184</option>
<option value="rips/set1/ACOMA">ACOMA</option>
<option value="rips/set1/ANGEL">Angel</option>
<option value="rips/set1/BAKER">Baker</option>
<option value="rips/set1/BIMBO">Bimbo</option>
<option value="rips/set1/CAVE2">Cave 2</option>
<option value="rips/set1/FELIX">Felix</option>
<option value="rips/set1/GHOST">Ghost</option>
<option value="rips/set1/HOLLY">Holly</option>
<option value="rips/set1/HOUND">Hound</option>
<option value="rips/set1/IRIS">Iris</option>
<option value="rips/set1/JDRAW">JDraw</option>
<option value="rips/set1/LEAVES">Leaves</option>
<option value="rips/set1/MAMA">Mama</option>
<option value="rips/set1/NO-L">NO-L</option>
<option value="rips/set1/NOSHIT">No Shit</option>
<option value="rips/set1/NOUVEAU">Nouveau</option>
<option value="rips/set1/OPUS">Opus</option>
<option value="rips/set1/PAPERCUT">Papercut</option>
<option value="rips/set1/PERSEID">Perseid (original)</option>
<option value="rips/set1/PERSEID2">Perseid (updated)</option>
<option value="rips/set1/PISANKI">Pisanki</option>
<option value="rips/set1/POSADA">Posada</option>
<option value="rips/set1/PUMPKIN">Pumpkin</option>
<option value="rips/set1/RIPDELIC">RIPedelic</option>
<option value="rips/set1/SH">SH</option>
<option value="rips/set1/SKATE">Skate</option>
<option value="rips/set1/SOCCER">Soccer</option>
<option value="rips/set1/SPRING">Spring</option>
<option value="rips/set1/STEREO1">Stereo #1</option>
<option value="rips/set1/STEREO2">Stereo #2</option>
<option value="rips/set1/STPATS95">STPATS95</option>
<option value="rips/set1/UKIYOE">Ukiyoe</option>
<option value="rips/set1/VAL94">VAL94</option>
<option value="rips/set1/VOTE">Vote</option>
<option value="rips/set1/WW02">Wishing Well</option>
<option value="rips/set1/XMAS-94">XMAS-94</option>
<option value="rips/set1/CITY">City</option>
<option value="rips/set1/MOTION">Motion</option>
<option value="rips/set1/FRACTMTN">Fractal Mountain</option>
<option value="rips/test/S_FILL">Test Fill Patterns (S)(s)</option>
<option value="rips/test/F_FILL1">Test Flood Fill Leaks #1 (F)</option>
<option value="rips/test/F_FILL2">Test Flood Fill Leaks #2 (F)</option>
<option value="rips/test/L_LINE">Test Line Styles #1 (L)(=)</option>
<option value="rips/test/L_LINE2">Test Line Styles #2 (L)(=)</option>
<option value="rips/test/COVAI">Test Circ/Oval/Arc/Pie (COVAIoi)</option>
<option value="rips/test/V_ARC">Test Large Arcs (V)</option>
<option value="rips/test/C_WELL">Test Wishing Well Circles (C)</option>
<option value="rips/test/v_VIEW">Test Viewport (v)</option>
<option value="rips/test/Y_FONT">Test Fonts (Y)</option>
<option value="rips/test/BUTTONS">Test Buttons (1B)(1U)</option>
<option value="rips/test/ICONS">Test Icons (1I)</option>
<option value="rips/test/TXT_VARS">Test Text Variables + Audio</option>
<option value="rips/test/TXT_WIN">Test Text Window</option>
<option value="rips/ansi/GI-MODHE.ANS">ANSI Music (GI-MODHE.ANS)</option>
<option value="rips/ansi/TEST.ANS">ANSI Test (TEST.ANS)</option>
<option value="rips/set2/K!LIGHT">K!LIGHT.RIP</option>
<option value="rips/set2/KT-JJB">KT-JJB.RIP</option>
<option value="rips/set2/OUT-AD">OUT-AD.RIP</option>
<option value="rips/set2/OUT-BOBA">OUT-BOBA.RIP</option>
<option value="rips/set2/OUT-EXCL">OUT-EXCL.RIP</option>
<option value="rips/set2/PL-ORC">PL-ORC.RIP</option>
<option value="rips/set2/P1-DL1">P1-DL1.RIP</option>
<option value="rips/set2/LB-MIST">LB-MIST.RIP</option>
<option value="rips/set2/LO-TV1">LO-TV1.RIP</option>
<option value="rips/set2/OA-LITE2">OA-LITE2.RIP</option>
<option value="rips/set2/PX-INF">PX-INF.RIP</option>
<option value="rips/set2/WC-PF">WC-PF.RIP</option>
<option value="rips/set3/CHAPLIN">CHAPLIN.RIP</option>
<option value="rips/set3/MAINMENU">MAINMENU.RIP</option>
<option value="rips/set3/AN-ACID1">AN-ACID1.RIP</option>
<option value="rips/set3/SA-STATC">SA-STATC.RIP (267K)</option>
<option value="rips/set3/US-SUCCO">US-SUCCO.RIP</option>
<option value="rips/set3/WC-PRE1">WC-PRE1.RIP</option>
</select>
<select id="rip-speed" onchange="selectSpeed()">
<option value="0">Full Speed</option>
<option value="460800">460.8 kbps</option>
<option value="230400">230.4 kbps</option>
<option value="115200" selected>115.2 kbps</option>
<option value="56000">56 kbps</option>
<option value="33600">33.6 kbps</option>
<option value="28800">28.8 kbps</option>
<option value="14400">14.4 kbps</option>
<option value="9600">9,600 bps</option>
<option value="4800">4,800 bps</option>
<option value="2400">2,400 bps</option>
</select>
<!-- <button onclick="ripterm.clear();">Clear</button> -->
<!-- <button onclick="loadRIP()">Load RIP</button> -->
<button onclick="togglePlayPause()" id="rip-play-button">▶ Play</button>
<button onclick="doStop()">⏹ Stop</button>
<button onclick="ripterm.fullscreen();">Full Screen</button>
<div class="clear"></div>
<div class="rip-status-area">x,y (<span id="rip-coords"></span>)
<span id="rip-counter"></span>
</div>
<div class="clear"></div>
<div class="rip-frame-width">
<div id="canvas-view" class="rip-all-views" style="display: inherit">
<div class="rip-frame rip-frame-height framed">
<canvas id="rip-canvas" class="rip-body rip-body-height" width="640" height="350"></canvas>
</div>
<div class="rip-caption-area">
<div class="rip-caption-left">
<h6><b>Canvas</b> - RIP rendering in a canvas.</h6>
</div>
<div class="rip-caption-right">
<a onclick="this.setAttribute('href',getCanvasPNG());" download="canvas.png" class="noline">
<button>Save .PNG</button>
</a>
</div>
</div>
</div>
<div id="svg-view" class="rip-all-views">
<div id="rip-svg-frame" class="rip-frame rip-frame-height framed">
<svg id="rip-svg" class="rip-body rip-body-height" width="640" height="350"
viewBox="0 0 640 350" preserveAspectRatio="none" enable-background="new"
xmlns="http://www.w3.org/2000/svg">
</svg>
</div>
<div class="rip-caption-area">
<div class="rip-caption-left">
<h6><b>SVG</b> - Experimental RIP to SVG conversion.</h6>
</div>
<div class="rip-caption-right">
<a onclick="this.setAttribute('href',getSVG());" download="rip.svg" class="noline">
<button>Save .SVG</button>
</a>
</div>
</div>
</div>
<div id="ss-view" class="rip-all-views">
<div class="rip-frame rip-frame-height framed">
<canvas id="rip-ss-canvas" class="rip-body rip-body-height" width="640" height="350"></canvas>
</div>
<div class="rip-caption-area">
<div class="rip-caption-left">
<h6><b>Original</b> - Screenshot from RIPterm v1.54 running in DOSbox. (if available)</h6>
</div>
<div class="rip-caption-right">
</div>
</div>
</div>
<div id="diff-view" class="rip-all-views">
<div class="rip-frame rip-frame-height framed">
<canvas id="rip-diff-canvas" class="rip-body rip-body-height" width="640" height="350"></canvas>
</div>
<div class="rip-caption-area">
<div class="rip-caption-left">
<h6><b>Diff</b> - Highlights where pixels differ between Canvas and Original screenshot.</h6>
</div>
<div class="rip-caption-right">
<a onclick="this.setAttribute('href',getDiffPNG());" download="diff.png" class="noline">
<button>Save .PNG</button>
</a>
</div>
</div>
</div>
</div>
<div id="rip-commands" class="rip-frame-height framed">
</div>
<div>
<label>
<h6><input type="checkbox" id="hilite-opt" onchange="toggleHilite()" style="margin-left:1em">
<span style="padding-left:0.3em">Highlight RIP</span></h6>
</label>
</div>
<div class="clear"></div>
<hr>
<div class="rip-select-views">
<div class="rip-select-left">
<strong>Select View:</strong>
<input type="radio" id="canvas-opt" name="view-options" onclick="showView('#canvas-view')" checked>
<label for="canvas-opt">Canvas</label>
<input type="radio" id="ss-opt" name="view-options" onclick="showView('#ss-view')">
<label for="ss-opt">Original</label>
<input type="radio" id="svg-opt" name="view-options" onclick="showView('#svg-view')">
<label for="svg-opt">SVG</label>
<input type="radio" id="diff-opt" name="view-options" onclick="showView('#diff-view')">
<label for="diff-opt">Diff</label>
</div>
<div class="rip-select-right">
<strong>Render:</strong>
<input type="checkbox" id="render-svg-opt" onclick="toggleRenderOptions()">
<label for="render-svg-opt">SVG</label>
<input type="checkbox" id="render-diff-opt" onclick="toggleRenderOptions()" checked>
<label for="render-diff-opt">Diff</label>
</div>
</div>
<div class="clear"></div>
<hr>
<h6><b>Debug Log</b></h6>
<div id="rip-log" class="rip-frame framed">
</div>
<button onclick="clearLog()">Clear</button>
</div>
<script src="src/BGI.js"></script>
<script src="src/BGIpotrace.js"></script>
<script src="src/BGIsvg.js"></script>
<script src="src/ripterm.js"></script>
<script src="src/ansiterm.js"></script>
<script src="src/ansimusic.js"></script>
<script>
// testBGI({ canvasId: 'rip-canvas' }); // TEST
let playShown = true;
const ripterm = new RIPterm({
canvasId: 'rip-canvas',
ssId: 'rip-ss-canvas',
diffId: 'rip-diff-canvas',
svgId: 'rip-svg',
logId: 'rip-log',
commandsId: 'rip-commands',
counterId: 'rip-counter',
coordsId: 'rip-coords',
refreshInterval: 20,
fontsPath: 'fonts',
iconsPath: 'icons',
logQuiet: true
});
ripterm.initFonts();
const ansiterm = new ANSIterm({
bgi: ripterm.bgi,
log: ripterm.log
});
ripterm.initAnsiTerm(ansiterm);
function openRIP() {
const select = document.getElementById('rip-files');
const file = document.getElementById('rip-open-file').files[0];
if (file) {
select.options[0].text = file.name;
select.selectedIndex = 0;
ripterm.reset();
ripterm.clearFile();
ripterm.clearScreenshot();
ripterm.clearDiff();
ripterm.openFile(file);
}
}
function selectRIP() {
ripterm.reset();
ripterm.clearFile();
ripterm.clearScreenshot();
ripterm.clearDiff();
loadRIP();
}
function selectSpeed() {
const select = document.getElementById('rip-speed');
if (select) {
ripterm.setModemSpeed(select.value);
}
}
function loadRIP() {
let url = document.getElementById('rip-files').value;
if (url !== '') {
const urlRIP = url + '.RIP';
ripterm.readScreenshot(url + '.png');
ripterm.openURL(urlRIP);
}
}
async function doStop() {
await ripterm.stop();
if (!playShown) {
playShown = true;
const button = document.getElementById('rip-play-button');
button.innerHTML = '▶ Play';
}
}
async function togglePlayPause() {
const button = document.getElementById('rip-play-button');
if (playShown) {
playShown = false;
button.innerHTML = '⏸ Pause';
await ripterm.play();
}
else {
ripterm.pause();
}
// reset to Play after playing stops.
playShown = true;
button.innerHTML = '▶ Play';
}
function getCanvasPNG() {
return document.getElementById('rip-canvas').toDataURL("image/png").replace("image/png", "image/octet-stream");
}
function getDiffPNG() {
return document.getElementById('rip-diff-canvas').toDataURL("image/png").replace("image/png", "image/octet-stream");
}
function toBase64 (str) {
return window.btoa(unescape(encodeURIComponent(str)));
}
function getSVG() {
return 'data:text/attachment;base64,' + toBase64(document.getElementById('rip-svg-frame').innerHTML);
}
function saveSVG() {
document.location = getSVG();
}
function showView(viewId) {
$('.rip-all-views').hide();
$(viewId).show();
}
function toggleRenderOptions() {
const svgBox = document.getElementById('render-svg-opt');
const diffBox = document.getElementById('render-diff-opt');
ripterm.bgi.svgActive = svgBox.checked;
ripterm.diffActive = diffBox.checked;
}
function toggleHilite() {
const cbox = document.getElementById('hilite-opt');
ripterm.hiliteCmdFlag = cbox.checked;
}
function clearLog() {
const div = document.getElementById('rip-log');
div.innerHTML = '';
// fixes layer invalidation bug (not clearing right away)
div.style.display = "none";
div.offsetHeight;
div.style.display = "";
}
// onload
document.addEventListener('DOMContentLoaded', () => {
toggleRenderOptions();
selectSpeed();
});
</script>
<br><br>
</div>
</div>
</section>
</article>
</div><!-- END Main -->
<!-- Footer -->
<div id="footer">
<ul class="copyright">
<li>© 2025 Carl Gorringe</li>
</ul>
</div>
</div>
<!-- Scripts -->
<script src="/ass/js/jquery.min.js"></script>
<script src="/ass/js/skel.min.js"></script>
<script src="/ass/js/skel-viewport.min.js"></script>
<script src="/ass/js/util.js"></script>
<script src="/ass/js/jquery.magnific-popup.min.js"></script>
<!--[if lte IE 8]><script src="/ass/js/ie/respond.min.js"></script><![endif]-->
<script src="/ass/js/main.js"></script>
</body>
</html>