source: trunk/termtv/termtv.js@ 18066

Last change on this file since 18066 was 17407, checked in by tbretz, 11 years ago
First version.
File size: 2.3 KB
Line 
1// =====================================================================
2
3function overlayTerminal(link)
4{
5 var args = link ? link.split('&') : location.search.substr(1).split('&');
6 if (args.length==0)
7 return;
8
9 var options = { };
10 for (var i=0; i<args.length; i++)
11 {
12 var pos = args[i].indexOf('=');
13 if (pos<0)
14 options[args[i]] = 1;
15 if (pos>0)
16 options[args[i].substring(0,pos)] = args[i].substring(pos+1);
17 }
18
19 if (!options['name']) options['name'] = args[0];
20 if (!options['title']) options['title'] = args[0].length ? null : '';
21 if (!options['autostart']) options['autostart'] = 1000;
22 if (!options['warp']) options['warp'] = 1;
23 if (!options['scan']) options['scan'] = false;
24 if (!options['noskip']) options['noskip'] = false;
25
26 if (args[0].length)
27 {
28 if (!options['font'] && !options['fontsize'])
29 options['fontsize'] = 13;
30
31 if (!options['fontfamily'] && !options['font'])
32 {
33 options['font'] = 'fixed-8x13';
34 options['boldfont'] = 'fixed-8x13B';
35 }
36
37 if (options['fontsize']==0)
38 options['fontsize'] = null;
39 }
40 else
41 {
42 // This is my special case for the default stream
43 if (!options['fontfamily'] && !options['font'])
44 {
45 options['font'] = 'c64';
46 options['fontfamily'] = 'c64';
47 }
48 }
49
50 options['controls'] = options['controls'] ? parseInt(options['controls'], 10) : args[0].length;
51
52 new TTVOverlay(options);
53
54 return false;
55}
56
57// ======================================================================
58
59function startDemo()
60{
61 var opts = {
62 'debug': false,
63 'scan': false,
64 'autostart': 1000,
65 'warp': 1,
66 'font': 'c64',
67 'title': '',
68 'loop': 1000,
69 'controls': 0,
70 'onclose': function() { opts.loop=0; }
71 };
72
73 var frame = document.getElementById("frame");
74
75 var display = new TTVDisplay(opts);
76 frame.appendChild(display);
77
78 return false;
79}
80
81// This is a hack to avoid that the closure compiler will rename
82// these functions
83window['overlayTerminal'] = overlayTerminal;
84window['startDemo'] = startDemo;
Note: See TracBrowser for help on using the repository browser.