Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

Rev Author Line No. Line
6 kaklik 1
helpstat = false;
2
stprompt = false;
3
basic = true;
4
 
5
function thelp(swtch){
6
        if (swtch == 1){
7
                basic = false;
8
                stprompt = false;
9
                helpstat = true;
10
        }
11
        else if (swtch == 0) {
12
                helpstat = false;
13
                stprompt = false;
14
                basic = true;
15
        }
16
        else if (swtch == 2) {
17
                helpstat = false;
18
                basic = false;
19
                stprompt = true;
20
        }
21
}
22
 
23
function treset(){
24
        if (helpstat){
25
                alert("Clears the current editor.");
26
        }
27
        else {
28
        clear = prompt("Are you sure? (yes/no)",'');
29
        clear = clear.toLowerCase();
30
        if(clear == 'yes') {
31
                document.editor.reset();
32
                document.editor.value = "";
33
        }
34
        }
35
}       
36
 
37
function start(){
38
        if (helpstat){
39
                alert("Elements that appear at the beginning of the document, including TITLE.");
40
        }
41
        else if (basic) {
42
        document.editor.info.value = document.editor.info.value + "<html>\n<head>\n<title></title>\n</head>\n<body>\n";
43
        }
44
        else if (stprompt) {
45
                for(;;){
46
                        twrite = prompt("Title?",'');
47
                        if (twrite != "" && twrite != null){
48
                                break;
49
                        }
50
                        else {
51
                                prompt("You must enter a title.",'Ok, sorry.');
52
                        }
53
                }
54
                document.editor.info.value = document.editor.info.value + "<html>\n<head>\n<title>" + twrite + "</title>\n</head>\n<body ";
55
 
56
                twrite = prompt("Background color? (blank if none)",'');        
57
                if (twrite != "" && twrite != null){
58
                        twrite = '"' + twrite + '"';
59
                        document.editor.info.value = document.editor.info.value + "bgcolor=" + twrite + " ";
60
                }
61
 
62
                twrite = prompt("Background image? (blank if none)",'');                
63
                if (twrite != "" && twrite != null){
64
                        twrite = '"' + twrite + '"';
65
                        document.editor.info.value = document.editor.info.value + "background=" + twrite + " ";
66
                }
67
 
68
                twrite = prompt("Text color? (blank if none)",'');
69
                if (twrite != "" && twrite != null){
70
                        twrite = '"' + twrite + '"';
71
                        document.editor.info.value = document.editor.info.value + "text=" + twrite + " ";
72
                }
73
 
74
                twrite = prompt("Link color? (blank if none)",'');              
75
                if (twrite != "" && twrite != null){
76
                        twrite = '"' + twrite + '"';
77
                        document.editor.info.value = document.editor.info.value + "link=" + twrite + " ";
78
                }
79
 
80
                twrite = prompt("Visited link color? (blank if none)",'');              
81
                if (twrite != "" && twrite != null){
82
                        twrite = '"' + twrite + '"';            
83
                        document.editor.info.value = document.editor.info.value + "vlink=" + twrite + " ";
84
                }
85
 
86
                document.editor.info.value = document.editor.info.value + ">\n";
87
        }
88
}
89
 
90
function end(){
91
        if (helpstat){
92
                alert("Adds the the final elements to a document.");
93
        }
94
        else {
95
        document.editor.info.value = document.editor.info.value + "\n</body>\n</html>\n";  
96
        }
97
}
98
 
99
function preview(){
100
        if (helpstat) {
101
                alert("Preview/save the document.");
102
        }
103
        else {
104
                temp = document.editor.info.value;
105
                preWindow= open("", "preWindow","status=no,toolbar=no,menubar=yes");
106
                preWindow.document.open();
107
                preWindow.document.write(temp);
108
                preWindow.document.close();
109
        }
110
}
111
 
112
function strike() {
113
        if (helpstat) {
114
                alert("Bold text.");
115
        }
116
        else if (basic) {
117
                document.editor.info.value = document.editor.info.value + "[s][/s]";
118
        }
119
        else if (stprompt) {
120
                twrite = prompt("Text?",'');
121
                if (twrite != null && twrite != ""){
122
                document.editor.info.value = document.editor.info.value + "[s]" + twrite + "[/s]";
123
                }
124
        }
125
}
126
 
127
 
128
function sub() {
129
        if (helpstat) {
130
                alert("Bold text.");
131
        }
132
        else if (basic) {
133
                document.editor.info.value = document.editor.info.value + "[sub][/sub]";
134
        }
135
        else if (stprompt) {
136
                twrite = prompt("Text?",'');
137
                if (twrite != null && twrite != ""){
138
                document.editor.info.value = document.editor.info.value + "[sub]" + twrite + "[/sub]";
139
                }
140
        }
141
}
142
 
143
function sup() {
144
        if (helpstat) {
145
                alert("Bold text.");
146
        }
147
        else if (basic) {
148
                document.editor.info.value = document.editor.info.value + "[sup][/sup]";
149
        }
150
        else if (stprompt) {
151
                twrite = prompt("Text?",'');
152
                if (twrite != null && twrite != ""){
153
                document.editor.info.value = document.editor.info.value + "[sup]" + twrite + "[/sup]";
154
                }
155
        }
156
}
157
 
158
 
159
 
160
function bold() {
161
        if (helpstat) {
162
                alert("Bold text.");
163
        }
164
        else if (basic) {
165
                document.editor.info.value = document.editor.info.value + "[b][/b]";
166
        }
167
        else if (stprompt) {
168
                twrite = prompt("Text?",'');
169
                if (twrite != null && twrite != ""){
170
                document.editor.info.value = document.editor.info.value + "[b]" + twrite + "[/b]";
171
                }
172
        }
173
}
174
 
175
function italic() {
176
        if (helpstat) {
177
                alert("Italicizes text.");
178
        }
179
        else if (basic) {
180
                document.editor.info.value = document.editor.info.value + "[i][/i]";
181
        }
182
        else if (stprompt) {
183
                twrite = prompt("Text?",'');
184
                if (twrite != null && twrite != ""){
185
                document.editor.info.value = document.editor.info.value + "[i]" + twrite + "[/i]";
186
                }
187
        }
188
}
189
 
190
function underline(){
191
        if (helpstat) {
192
                alert("Underlines text.");
193
        }
194
        else if (basic) {
195
                document.editor.info.value = document.editor.info.value + "[u][/u]";
196
        }
197
        else if (stprompt) {
198
                twrite = prompt("Text?",'');
199
                if (twrite != null && twrite != ""){
200
                document.editor.info.value = document.editor.info.value + "[u]" + twrite + "[/u]";
201
                }
202
        }
203
}
204
 
205
function pre(){
206
        if (helpstat) {
207
                alert("Sets text as preformatted.");
208
        }
209
        else if (basic) {
210
                document.editor.info.value = document.editor.info.value + "<pre></pre>";
211
        }
212
        else if (stprompt) {
213
                twrite = prompt("Text?",'');
214
                if (twrite != null && twrite != ""){
215
                document.editor.info.value = document.editor.info.value + "<pre>" + twrite + "</pre>";
216
                }
217
        }
218
}
219
 
220
function center(){
221
        if (helpstat) {
222
                alert("Centers text.");
223
        }
224
        else if (basic) {
225
                document.editor.info.value = document.editor.info.value + "<center></center>";
226
        }
227
        else if (stprompt) {
228
                twrite = prompt("Text?",'');
229
                if (twrite != null && twrite != ""){
230
                document.editor.info.value = document.editor.info.value + "<center>" + twrite + "</center>";
231
                }
232
        }
233
}
234
 
235
function hbar(){
236
        if (helpstat) {
237
                alert("Creates a horizontal bar.");
238
        }
239
        else {
240
                document.editor.info.value = document.editor.info.value + "[hr]\n";
241
        }
242
}
243
 
244
function lbreak(){
245
        if (helpstat) {
246
                alert("Makes a new line, the equivalent of return or enter.");
247
        }
248
        else {
249
                document.editor.info.value = document.editor.info.value + "<br>\n";
250
        }
251
}
252
 
253
function pbreak(){
254
        if (helpstat) {
255
                alert("Makes two new lines, the equivalent of two returns or enters.");
256
        }
257
        else {
258
                document.editor.info.value = document.editor.info.value + "<p>\n";
259
        }
260
}
261
 
262
function image(){
263
        if (helpstat) {
264
                alert("Inserts an image.");
265
        }
266
        else if (basic) {
267
                document.editor.info.value = document.editor.info.value + '<img src="">\n';
268
        }
269
        else if (stprompt) {
270
                twrite = prompt("Image location?",'');
271
                if (twrite != null && twrite != ""){
272
                twrite = '"' + twrite + '"';
273
                document.editor.info.value = document.editor.info.value + '<img src=' + twrite + '>\n';
274
                }
275
        }
276
}
277
 
278
function aleft(){
279
        if (helpstat) {
280
                alert("Inserts an image with align left.");
281
        }
282
        else if (basic) {
283
                document.editor.info.value = document.editor.info.value + '<img src="" align=left>\n';
284
        }
285
        else if (stprompt){
286
                twrite = prompt("Image location?",'');
287
                if (twrite != null && twrite != ""){
288
                twrite = '"' + twrite + '"';
289
                document.editor.info.value = document.editor.info.value + '<img src=' + twrite + ' align=left>\n';
290
                }
291
        }
292
}
293
 
294
function aright(){
295
        if (helpstat) {
296
                alert("Inserts an image with align right.");
297
        }
298
        else if (basic) {
299
                document.editor.info.value = document.editor.info.value + '<img src="" align=right>\n';
300
        }
301
        else if (stprompt) {
302
                twrite = prompt("Image location?",'');
303
                if (twrite != null && twrite != ""){
304
                twrite = '"' + twrite + '"';
305
                document.editor.info.value = document.editor.info.value + '<img src=' + twrite + ' align=right>\n';
306
                }
307
        }
308
}
309
 
310
function atop(){
311
        if (helpstat) {
312
                alert("Inserts an image with align top.");
313
        }
314
        else if (basic) {
315
                document.editor.info.value = document.editor.info.value + '<img src=""align=top>\n';
316
        }
317
        else if (stprompt) {
318
                twrite = prompt("Image location?",'');
319
                if (twrite != null && twrite != ""){
320
                twrite = '"' + twrite + '"';
321
                document.editor.info.value = document.editor.info.value + '<img src=' + twrite + ' align=top>\n';
322
                }
323
        }
324
}
325
 
326
function amid(){
327
        if (helpstat) {
328
                alert("Inserts an image with align middle.");
329
        }
330
        else if (basic) {
331
                document.editor.info.value = document.editor.info.value + '<img src="" align=middle>\n';
332
        }
333
        else if (stprompt) {
334
                twrite = prompt("Image location?",'');
335
                if (twrite != null && twrite != ""){
336
                twrite = '"' + twrite + '"';
337
                document.editor.info.value = document.editor.info.value + '<img src=' + twrite + ' align=middle>\n';
338
                }
339
        }
340
}
341
 
342
function abottom(){
343
        if (helpstat) {
344
                alert("Inserts an image with align bottom.");
345
        }
346
        else if (basic) {
347
                document.editor.info.value = document.editor.info.value + '<img src="" align=bottom>\n';
348
        }
349
        else if (stprompt) {
350
                twrite = prompt("Image location?",'');
351
                if (twrite != null && twrite != ""){
352
                twrite = '"' + twrite + '"';
353
                document.editor.info.value = document.editor.info.value + '<img src=' + twrite + ' align=bottom>\n';
354
                }
355
        }
356
}
357
 
358
function head1(){
359
        if (helpstat) {
360
                alert("Creates a header, size 1 (largest size).");
361
        }
362
        else if (basic) {
363
                document.editor.info.value = document.editor.info.value + "<h1></h1>\n";
364
        }
365
        else if (stprompt) {
366
                twrite = prompt("Text?",'');
367
                if (twrite != null && twrite != ""){
368
                document.editor.info.value = document.editor.info.value + "<h1>" + twrite + "</h1>\n";
369
                }
370
        }
371
}
372
 
373
function head2(){
374
        if (helpstat) {
375
                alert("Creates a header, size 2 (slightly smaller than 1).");
376
        }
377
        else if (basic) {
378
                document.editor.info.value = document.editor.info.value + "<h2></h2>\n";
379
        }
380
        else if (stprompt) {
381
                twrite = prompt("Text?",'');
382
                if (twrite != null && twrite != ""){
383
                document.editor.info.value = document.editor.info.value + "<h2>" + twrite + "</h2>\n";
384
                }
385
        }
386
}
387
 
388
function head3(){
389
        if (helpstat) {
390
                alert("Creates a header, size 3 (slightly smaller than 2).");
391
        }
392
        else if (basic) {
393
                document.editor.info.value = document.editor.info.value + "<h3></h3>\n";
394
        }
395
        else if (stprompt) {
396
                twrite = prompt("Text?",'');
397
                if (twrite != null && twrite != ""){
398
                document.editor.info.value = document.editor.info.value + "<h3>" + twrite + "</h3>\n";
399
                }
400
        }
401
}
402
 
403
function head4(){
404
        if (helpstat) {
405
                alert("Creates a header, size 4 (slightly smaller than 3).");
406
        }
407
        else if (basic) {
408
                document.editor.info.value = document.editor.info.value + "<h4></h4>\n";
409
        }
410
        else if (stprompt) {
411
                twrite = prompt("Text?",'');
412
                if (twrite != null && twrite != ""){
413
                document.editor.info.value = document.editor.info.value + "<h4>" + twrite + "</h4>\n";
414
                }
415
        }
416
}
417
 
418
function head5(){
419
        if (helpstat) {
420
                alert("Creates a header, size 5 (slightly smaller than 4).");
421
        }
422
        else if (basic) {
423
                document.editor.info.value = document.editor.info.value + "<h5></h5>\n";
424
        }
425
        else if (stprompt) {
426
                twrite = prompt("Text?",'');
427
                if (twrite != null && twrite != ""){
428
                document.editor.info.value = document.editor.info.value + "<h5>" + twrite + "</h5>\n";
429
                }
430
        }
431
}
432
 
433
function head6(){
434
        if (helpstat) {
435
                alert("Creates a header, size 6 (smallest size).");
436
        }
437
        else if (basic) {
438
                document.editor.info.value = document.editor.info.value + "<h6></h6>\n";
439
        }
440
        else if (stprompt) {
441
                twrite = prompt("Text?",'');
442
                if (twrite != null && twrite != ""){
443
                document.editor.info.value = document.editor.info.value + "<h6>" + twrite + "</h6>\n";
444
                }
445
        }
446
}
447
 
448
function maillink(){
449
        if (helpstat) {
450
                alert("Begins a link.");
451
        }
452
        else if (basic) {
453
                document.editor.info.value = document.editor.info.value + '[mail][/mail]';
454
        }
455
        else if (stprompt) {
456
                twrite = prompt("File location?",'');
457
                if (twrite != null && twrite != ""){
458
                twrite = '"' + twrite + '"';
459
                document.editor.info.value = document.editor.info.value + '[mail]' + twrite + '[/mail]';
460
                for(;;){
461
                        twrite = prompt("Text?",'');
462
                        if (twrite != "" && twrite != null){
463
                                break;
464
                        }
465
                        else {
466
                                prompt("You must enter the link text.",'Ok, sorry.');
467
                        }
468
                        }
469
                document.editor.info.value = document.editor.info.value + twrite + '[/mail]\n';
470
                        }
471
        }
472
}
473
 
474
function linkopen(){
475
        if (helpstat) {
476
                alert("Begins a link.");
477
        }
478
        else if (basic) {
479
                document.editor.info.value = document.editor.info.value + '[url][/url]';
480
        }
481
        else if (stprompt) {
482
                twrite = prompt("File location?",'');
483
                if (twrite != null && twrite != ""){
484
                twrite = '"' + twrite + '"';
485
                document.editor.info.value = document.editor.info.value + '[url]' + twrite + '[/url]';
486
                for(;;){
487
                        twrite = prompt("Text?",'');
488
                        if (twrite != "" && twrite != null){
489
                                break;
490
                        }
491
                        else {
492
                                prompt("You must enter the link text.",'Ok, sorry.');
493
                        }
494
                        }
495
                document.editor.info.value = document.editor.info.value + twrite + '[/url]\n';
496
                        }
497
        }
498
}
499
 
500
function linktext(){
501
        if (helpstat) {
502
                alert("Inserts the text for a link.");
503
        }
504
        else if (basic) {
505
                for(;;){
506
                        twrite = prompt("Text?",'');
507
                        if (twrite != "" && twrite != null){
508
                                break;
509
                        }
510
                        else {
511
                                prompt("You must enter the link text.",'Ok, sorry.');
512
                        }
513
                }
514
                document.editor.info.value = document.editor.info.value + twrite + '\n';
515
        }
516
        else if (stprompt) {
517
                alert("Not used in prompt mode.");
518
        }
519
}
520
 
521
function linkclose(){
522
        if (helpstat) {
523
                alert("Closes a link.");
524
        }
525
        else if (basic) {
526
                document.editor.info.value = document.editor.info.value + "</a>\n";
527
        }
528
        else if (stprompt) {
529
                alert("Not used in prompt mode.");
530
        }
531
}
532
 
533
function anchor(){
534
        if (helpstat) {
535
                alert("Sets an anchor (e.g. #here).");
536
        }
537
        else if (basic) {
538
                document.editor.info.value = document.editor.info.value + '<a name="">\n';
539
        }
540
        else if (stprompt) {
541
                twrite = prompt("Anchor name?",'');
542
                if (twrite != null && twrite != ""){
543
                twrite = '"' + twrite + '"';
544
                document.editor.info.value = document.editor.info.value + '<a name=' + twrite + '>\n';
545
                }
546
        }
547
}
548
 
549
function orderopen(){
550
        if (helpstat) {
551
                alert("Starts an ordered list.");
552
        }
553
        else if (basic) {
554
                document.editor.info.value = document.editor.info.value + "<ol>\n";
555
        }
556
        else if (stprompt) {
557
                for(i=1;;i++){
558
                        twrite = prompt("Item " + i + "? (Blank entry stops.)",'');
559
                        if (twrite == "" || twrite == null){
560
                                break;
561
                        }
562
                        if (i == 1){
563
                                document.editor.info.value = document.editor.info.value + "<ol>\n";
564
                                okeydokey = 1;
565
                        }
566
                        document.editor.info.value = document.editor.info.value + "<li>" + twrite + "\n";
567
                }
568
                if (okeydokey) {
569
                document.editor.info.value = document.editor.info.value + "</ol>\n";
570
                }
571
        }
572
}
573
 
574
function li(){
575
        if (helpstat) {
576
                alert("Creates an item in a list.");
577
        }
578
        else if (basic) {
579
                document.editor.info.value = document.editor.info.value + "<li>";
580
        }
581
        else if (stprompt) {
582
                alert("Not used in prompt mode.");
583
        }
584
}
585
 
586
function orderclose(){
587
        if (helpstat) {
588
                alert("Closes an ordered list.");
589
        }
590
        else if (basic) {
591
                document.editor.info.value = document.editor.info.value + "</ol>\n";
592
        }
593
        else if (stprompt) {
594
                alert("Not used in prompt mode.");
595
        }
596
}
597
 
598
function unorderopen(){
599
        if (helpstat) {
600
                alert("Starts an unordered list.");
601
        }
602
        else if (basic) {
603
                document.editor.info.value = document.editor.info.value + "<ul>";
604
        }
605
        else if (stprompt) {
606
                for(i=1;;i++){
607
                        twrite = prompt("Item " + i + "? (Blank entry stops.)",'');
608
                        if (twrite == "" || twrite == null){
609
                                break;
610
                        }
611
                        if (i == 1){
612
                                document.editor.info.value = document.editor.info.value + "<ul>\n";
613
                                okeydokey = 1;
614
                        }
615
                        document.editor.info.value = document.editor.info.value + "<li>" + twrite + "\n";
616
                }
617
                if (okeydokey) {
618
                document.editor.info.value = document.editor.info.value + "</ul>\n";
619
                }
620
        }
621
}
622
 
623
function unorderclose(){
624
        if (helpstat) {
625
                alert("Closes an unordered list.");
626
        }
627
        else if (basic) {
628
                document.editor.info.value = document.editor.info.value + "</ul>\n";
629
        }
630
        else if (stprompt) {
631
                alert("Not used in prompt mode.");
632
        }
633
}
634
 
635
function defopen(){
636
        if (helpstat) {
637
                alert("Starts a definition list.");
638
        }
639
        else if (basic) {
640
                document.editor.info.value = document.editor.info.value + "<dl>";
641
        }
642
        else if (stprompt) {
643
                for(i=1;;i++){
644
                        twrite = prompt("Term " + i + "? (Blank entry stops.)",'');
645
                        if (twrite == "" || twrite == null){
646
                                break;
647
                        }
648
                        if (i == 1) {
649
                                document.editor.info.value = document.editor.info.value + "<dl>\n";
650
                                okeydokey = 1;
651
                        }
652
                        document.editor.info.value = document.editor.info.value + "<dt>" + twrite + "</dt>\n";
653
                        twrite = prompt("Definition" + i + "? (Blank entry stops.)",'');
654
                        if (twrite == "" || twrite == null){
655
                                break;
656
                        }
657
                        document.editor.info.value = document.editor.info.value + "<dd>" + twrite + "<dd>\n";
658
                }
659
                if (okeydokey){
660
                document.editor.info.value = document.editor.info.value + "</dl>\n";
661
                }
662
        }
663
}
664
 
665
function defterm(){
666
        if (helpstat) {
667
                alert("Creates the term in a definition.");
668
        }
669
        else if (basic) {
670
                document.editor.info.value = document.editor.info.value + "<dt>";
671
        }
672
        else if (stprompt) {
673
                alert("Not used in prompt mode.");
674
        }
675
}
676
 
677
function define(){
678
        if (helpstat) {
679
                alert("Creates the definition.");
680
        }
681
        else if (basic) {
682
                document.editor.info.value = document.editor.info.value + "<dd>";
683
        }
684
        else if (stprompt) {
685
                alert("Not used in prompt mode.");
686
        }
687
}
688
 
689
function defclose(){    
690
        if (helpstat) {
691
                alert("Closes a defeinition list.");
692
        }
693
        else if (basic) {
694
                document.editor.info.value = document.editor.info.value + "</dt>";
695
        }
696
        else if (stprompt) {
697
                alert("Not used in prompt mode.");
698
        }
699
}
700
 
701
function font(){
702
        if (helpstat) {
703
                alert("Sets the font.");
704
        }
705
        else if (basic) {
706
                document.editor.info.value = document.editor.info.value + '<font face="">';
707
        }
708
        else if (stprompt) {
709
                twrite = prompt("Font?",'');
710
                if (twrite != null && twrite != "") {
711
                twrite = '"' + twrite + '"';
712
                document.editor.info.value = document.editor.info.value + '<font face=' + twrite + '>';
713
                }
714
        }
715
}
716
 
717
function fontcolor(){
718
        if (helpstat) {
719
                alert("Sets the font color.");
720
        }
721
        else if (basic) {
722
                document.editor.info.value = document.editor.info.value + '<font color="">';
723
        }
724
        else if (stprompt) {
725
                twrite = prompt("Color? (hex or name)",'');
726
                if (twrite != null && twrite != "") {
727
                twrite = '"' + twrite + '"';
728
                document.editor.info.value = document.editor.info.value + '<font color=' + twrite + '>';
729
        }
730
        }
731
}
732
 
733
 
734
function fontsize(){
735
        if (helpstat) {
736
                alert("Sets the font size (a number 1-7, or +2, -3, etc.).");
737
        }
738
        else if (basic) {
739
                document.editor.info.value = document.editor.info.value + "font size=>";
740
        }
741
        else if (stprompt) {
742
                twrite = prompt("Size? (e.g. 1, +5, -2, etc.)",'');
743
                if (twrite != null && twrite != "") {
744
                document.editor.info.value = document.editor.info.value + "<font size=" + twrite + ">";
745
        }
746
        }
747
}
748
 
749
function fontclose(){
750
        if (helpstat) {
751
                alert("Closes the font changes.");
752
        }
753
        else if (basic) {
754
                document.editor.info.value = document.editor.info.value + "</font>";
755
        }
756
        else if (stprompt) {
757
                document.editor.info.value = document.editor.info.value + "</font>";
758
        }
759
}