-
Notifications
You must be signed in to change notification settings - Fork 11
/
tilda-demo.html
127 lines (119 loc) · 4.13 KB
/
tilda-demo.html
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
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="utf-8" />
<title>Quake like teminal - JQuery Terminal Emulator Demo</title>
<meta name="Description" content="This is demonstration of JQuery Terminal Emulator Plugin. To run terminal type tilda on you keyboard."/>
<script src="https://code.jquery.com/jquery-1.7.2.min.js"></script>
<script src="https://unpkg.com/jquery.terminal/js/jquery.mousewheel-min.js"></script>
<script src="https://unpkg.com/jquery.terminal/js/jquery.terminal.min.js"></script>
<script src="https://unpkg.com/js-polyfills/keyboard.js"></script>
<link href="https://unpkg.com/jquery.terminal/css/jquery.terminal.min.css" rel="stylesheet"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!--[if IE]>
<style>
body {
margin: 0;
padding: 0;
}
.tilda {
position: absolute;
}
</style>
<script>
jQuery(document).ready(function($) {
$(window).scroll(function() {
$('.tilda').each(function() {
$(this).css({top: $('body').prop('scrollTop')});
});
});
});
</script>
<![endif]-->
<script>
String.prototype.strip = function(char) {
return this.replace(new RegExp("^" + char + "*"), '').
replace(new RegExp(char + "*$"), '');
}
$.extend_if_has = function(desc, source, array) {
for (var i=array.length;i--;) {
if (typeof source[array[i]] != 'undefined') {
desc[array[i]] = source[array[i]];
}
}
return desc;
};
(function($) {
$.fn.tilda = function(eval, options) {
if ($('body').data('tilda')) {
return $('body').data('tilda').terminal;
}
this.addClass('tilda');
options = options || {};
eval = eval || function(command, term) {
term.echo("you don't set eval for tilda");
};
var settings = {
prompt: 'tilda> ',
name: 'tilda',
height: 100,
enabled: false,
greetings: 'Quake like console',
keypress: function(e) {
if (e.which == 96) {
return false;
}
}
};
if (options) {
$.extend(settings, options);
}
this.append('<div class="td"></div>');
var self = this;
self.terminal = this.find('.td').terminal(eval, settings);
var focus = false;
$(document.documentElement).keypress(function(e) {
if (e.which == 96) {
self.slideToggle('fast');
self.terminal.focus(focus = !focus);
self.terminal.attr({
scrollTop: self.terminal.attr("scrollHeight")
});
}
});
$('body').data('tilda', this);
this.hide();
return self;
};
})(jQuery);
//--------------------------------------------------------------------------
jQuery(document).ready(function($) {
$('#tilda').tilda(function(command, terminal) {
terminal.echo('you type command "' + command + '"');
});
});
</script>
</head>
<body>
<div id="tilda"></div>
<h1>This is demo of JQuery Terminal Emulator, type tilda to open terminal</h1>
<!-- Start Open Web Analytics Tracker -->
<script type="text/javascript">
//<![CDATA[
var owa_baseUrl = 'https://stats.jcubic.pl/';
var owa_cmds = owa_cmds || [];
owa_cmds.push(['setSiteId', '9b6210e220f27093109ddf895e626f1a']);
owa_cmds.push(['trackPageView']);
owa_cmds.push(['trackClicks']);
(function() {
var _owa = document.createElement('script'); _owa.type = 'text/javascript'; _owa.async = true;
owa_baseUrl = ('https:' == document.location.protocol ? window.owa_baseSecUrl || owa_baseUrl.replace(/http:/, 'https:') : owa_baseUrl );
_owa.src = owa_baseUrl + 'modules/base/js/owa.tracker-combined-min.js';
var _owa_s = document.getElementsByTagName('script')[0]; _owa_s.parentNode.insertBefore(_owa, _owa_s);
}());
//]]>
</script>
<!-- End Open Web Analytics Code -->
<script defer src="https://cloud.umami.is/script.js" data-website-id="55bf99f6-75ef-441d-95b1-27bcc3b7b332"></script>
</body>
</html>