-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathtilda-demo.html
More file actions
113 lines (106 loc) · 3.49 KB
/
tilda-demo.html
File metadata and controls
113 lines (106 loc) · 3.49 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
<!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://cdn.jsdelivr.net/npm/jquery.terminal/js/jquery.mousewheel-min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jquery.terminal/js/jquery.terminal.js"></script>
<script src="https://cdn.jsdelivr.net/npm/js-polyfills/keyboard.js"></script>
<link href="https://cdn.jsdelivr.net/npm/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) {
if (command) {
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>
<script defer src="https://umami.jcubic.pl/script.js"
data-website-id="bb1c5851-93fe-4fce-8209-944c25b8f7be"></script>
<script src="https://js-de.sentry-cdn.com/c6868ced9c228b7da5e50196c0ab2f14.min.js" crossorigin="anonymous"></script>
</body>
</html>