-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
127 lines (125 loc) · 4.06 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
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>
<head>
<title>listy.jquery.js</title>
<link href="css/bootstrap.min.css" media="screen" rel="stylesheet" type="text/css" />
<link href="css/bootstrap-responsive.min.css" media="screen" rel="stylesheet" type="text/css" />
<link href="css/listy.css" media="screen" rel="stylesheet" type="text/css" />
<link href="css/theme.css" media="screen" rel="stylesheet" type="text/css" />
<style type="text/css">
/* Fix rainbow which use the same .close class as bootstrap */
span.close{
float: none;
color: #8DA6CE;
font-weight: normal;
font-size: 12px;
text-shadow: none;
opacity: 1;
}
#console{
height: 150px;
overflow-y: auto;
}
</style>
</head>
<body>
<div class="container">
<div class='row'>
<div class='span12'>
<h1>Listy</h1>
<br />
</div>
</div>
<div class='row'>
<div class='span4'>
<ol>
<li>Focus the following list (by using tab or clicking into it)</li>
<li>Use keyboard up/down keys to navigate</li>
<li>Press space/enter to select an item (or click it)</li>
<li>Press backspace to remove an item (or double click it)</li>
<li>Press i to mark an item as inactive</li>
</ol>
<ul tabindex='0' class='listy'>
<li class='muted'>elem 1</li>
<li>elem 2</li>
<li>elem 3</li>
<li>elem 4</li>
<li>elem 5</li>
<li>elem 6</li>
<li>elem 7</li>
<li class='muted'>elem 8</li>
<li>elem 9</li>
<li>elem 10</li>
</ul>
<br />
<br />
<div id='console' class='well well-small'>
</div>
</div>
<div class='span8'>
<pre><code data-language="html"><ul tabindex='0' class='listy'>
<li class='muted'>elem 1</li>
<li>elem 2</li>
<li>elem 3</li>
<li>elem 4</li>
<li>elem 5</li>
<li>elem 6</li>
<li>elem 7</li>
<li class='muted'>elem 8</li>
<li>elem 9</li>
<li>elem 10</li>
</ul></code></pre>
<br />
<pre><code data-language="javascript">$('.listy').listy({
actions: {
select: {
keys: [13, 32],
events: 'click',
method: function(elem){
if (elem.hasClass('selected')){
elem.removeClass('selected');
$('#console').prepend(elem.text()+' deselected !<br />');
} else {
elem.addClass('selected');
$('#console').prepend(elem.text()+' selected !<br />');
}
}
},
remove: {
keys: [8],
events: 'dblclick',
method: function(elem){
elem.hide();
$('#console').prepend(elem.text()+' removed !<br />');
}
},
inactive: {
keys: [73],
method: function(elem){
elem.removeClass('selected listy-hover')
.addClass('muted')
.off('click dblclick');
$('#console').prepend(elem.text()+' inactived !<br />');
}
}
}
});</code></pre>
</div>
</div>
</div>
<script src="js/jquery.js"></script>
<script src="js/jquery.listy.js" type="text/javascript"></script>
<script src="js/application.js" type="text/javascript"></script>
<script src="js/rainbow.js" type="text/javascript"></script>
<script src="js/rainbow.javascript.js" type="text/javascript"></script>
<script src="js/rainbow.html.js" type="text/javascript"></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-40322158-1', 'github.io');
ga('send', 'pageview');
</script>
</body>
</html>