-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
47 lines (44 loc) · 1.29 KB
/
index.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
<!doctype html>
<html lang="en">
<head><meta charset="utf-8">
<title>jq-shell example</title>
<link rel="stylesheet" type="text/css" href="$hell.css">
<style>
/* demo styles */
html, body { position: relative; min-height: 100%; height: 100%; background: #fff; color: #000 }
figure { background: #eee; padding: 5px } figcaption { font-style: italic } pre { background: #f8f8f8 }
</style>
</head>
<body>
<h1>Demo jq-shell <a href="https://github.com/devoidfury/jq-shell">(on github)</a></h1>
<figure>
<pre></pre>
<figcaption>Source javascript code for this example.</figcaption>
</figure>
<button>Click Me</button>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="$hell.js"></script>
<!-- this just an example, see https://github.com/devoidfury/jq-shell -->
<script id="source">
$('body').$hell({
commands: {
greet: function(shell, args, cb) {
cb(0, "Hello world!")
},
lipsum: function(shell, args, cb) {
$.get('http://dinoipsum.herokuapp.com/api/?format=text¶graphs=1', function(text) {
cb(0, text)
})
.fail(function() {
cb(1, "segfault")
})
}
}
})
$('button').on('click', function() {
$('.shell').addClass('show').trigger('click')
})
$('pre').text($('#source').text())
</script>
</body>
</html>