-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.html
executable file
·254 lines (239 loc) · 9.78 KB
/
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>jQuery MultipleLiveSearch v1.0 Demo</title>
<script type="text/javascript" src="js/shCore.js"></script>
<script type="text/javascript" src="js/shBrushBash.js"></script>
<script type="text/javascript" src="js/shBrushCpp.js"></script>
<script type="text/javascript" src="js/shBrushCSharp.js"></script>
<script type="text/javascript" src="js/shBrushCss.js"></script>
<script type="text/javascript" src="js/shBrushDelphi.js"></script>
<script type="text/javascript" src="js/shBrushDiff.js"></script>
<script type="text/javascript" src="js/shBrushGroovy.js"></script>
<script type="text/javascript" src="js/shBrushJava.js"></script>
<script type="text/javascript" src="js/shBrushJScript.js"></script>
<script type="text/javascript" src="js/shBrushPerl.js"></script>
<script type="text/javascript" src="js/shBrushPhp.js"></script>
<script type="text/javascript" src="js/shBrushPlain.js"></script>
<script type="text/javascript" src="js/shBrushPython.js"></script>
<script type="text/javascript" src="js/shBrushRuby.js"></script>
<script type="text/javascript" src="js/shBrushScala.js"></script>
<script type="text/javascript" src="js/shBrushSql.js"></script>
<script type="text/javascript" src="js/shBrushVb.js"></script>
<script type="text/javascript" src="js/shBrushXml.js"></script>
<link type="text/css" rel="stylesheet" href="css/shCore.css"/>
<link type="text/css" rel="Stylesheet" href="css/shThemeDefault.css" id="theme" />
<link type="text/css" rel="stylesheet" href="css/common.css" charset="utf-8" media="screen" />
<!-- Everything above this line is used for showing the demo page syntax and list boxes -->
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.7.2.custom.min.js"></script>
<script type="text/javascript" src="js/quicksilver.js" charset="utf-8"></script>
<script type="text/javascript" src="js/jquery.multiplelivesearch.js" charset="utf-8"></script>
<script type="text/javascript">
$(document).ready(function(){
droplist(".clients",".clients",'.live_clients_list');
droplist(".employees",".employees",'.live_empls_list');
$('.live_search').focus(function() {
var live_class = $(this).attr("id");
$(this).liveUpdate("."+live_class,$(this),$('.live_search_clear'));
});
});
</script>
</head>
<body>
<div class="wrapper">
<h1>MultipleLiveSearch (v1.0): jQuery LiveSearch modified for Multiple Instances and Escape/Delete Image</h1>
<div class="left">
<p>
This plugin takes <a href="http://ejohn.org/blog/jquery-livesearch/" target="_blank">John Resig's</a> version of
<a href="http://orderedlist.com/articles/live-search-with-quicksilver-style-for-jquery" target="_blank">John Nunemaker</a>
jquery.livesearch and adds the following features:
<ul>
<li>Multiple Instances</li>
<li>Sort/Dragable Lists</li>
<li>Reset search by:</li>
<ul>
<li>Escape key</li>
<li>Delete button</li>
</ul>
</ul>
</p>
</div>
<div class="right">
<h4>jquery.livesearch.js versions:</h4>
<ul>
<li>
v1.0 - <a href="http://orderedlist.com/demos/quicksilverjs/javascripts/jquery.livesearch.js" target="_blanks">jquery.livesearch.js</a><br/>
(author: <a href="http://orderedlist.com/articles/live-search-with-quicksilver-style-for-jquery" target="_blank">John Nunemaker</a>) [<a href="http://orderedlist.com/demos/quicksilverjs/jquery.html" target="_blank">demo</a>]
</li>
<li>
v2.0 - <a href="http://ejohn.org/apps/livesearch/jquery.livesearch.js" target="_blanks">jquery.livesearch.js</a><br/>
(author: <a href="http://ejohn.org/blog/jquery-livesearch/" target="_blank">John Resig</a>)
</li>
</ul>
<a href="http://github.com/styledev/jquery.multiplelivesearch.js" class="download">Check for Updates</a></div>
</div>
</div>
<div class="example">
<div class="wrapper">
<h4 class="mintop">Example of MultipleLiveSearch:</h4>
<div class="target-selection">
<div class="left_box">
<div class="filter-list">
<label>clients</label>
<input type="text" value="" name="live_search" id="clients" class="live_search"/>
<img src="images/delete.png" width="16" height="14" alt="Delete" class="live_search_clear">
</div>
<div class="list">
<ul class="live_clients_list clients">
<li>Apolit</li>
<li>Inksaint</li>
<li>OverridePro</li>
<li>Styledev</li>
<li>Vlytics</li>
</ul>
</div>
</div>
<div class="right_box">
<label>assign to project</label>
<div class="list">
<ul class="connectedSortable sort live_clients_list clients"></ul>
</div>
</div>
</div>
<div class="target-selection">
<div class="left_box">
<div class="filter-list">
<label>employees</label>
<input type="text" value="" name="live_search" id="employees" class="live_search"/>
<img src="images/delete.png" width="16" height="14" alt="Delete" class="live_search_clear">
</div>
<div class="list">
<ul class="live_empls_list employees">
<li>Bushaw, Dewey</li>
<li>Hasbard, Rich</li>
<li>Hathorne, Justin</li>
<li>Hunter, Scott</li>
<li>Jones, Mat</li>
</ul>
</div>
</div>
<div class="right_box">
<label>assign to project</label>
<div class="list">
<ul class="sort live_empls_list employees"></ul>
</div>
</div>
</div>
<div class="clear"></div>
</div>
</div>
<div class="wrapper">
<h4>Link to JS / Enable LiveSearch / Create Sortable Lists:</h4>
<p>Insert this after your calls to all external JS files in the <head> area:</p>
<pre class="brush: js;">
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.7.2.custom.min.js"></script>
<script type="text/javascript" src="js/quicksilver.js" charset="utf-8"></script>
<script type="text/javascript" src="js/multiplelivesearch.js" charset="utf-8"></script>
<script type="text/javascript">
$(document).ready(function(){
droplist(".clients",".clients",'.live_clients_list');
droplist(".employees",".employees",'.live_empls_list');
$('.live_search').focus(function() {
var live_class = $(this).attr("id");
$(this).liveUpdate("."+live_class,$(this),$('.live_search_clear'));
});
});
</script>
</pre>
<h4>HTML:</h4>
<p>The input field "id" needs to be the same as the class name of the list(s) you wish to search and the "class" should is how the plugin knows what to use for the filter.</p>
<pre class="brush: xml;">
<label>clients</label>
<input type="text" value="" name="live_search" id="clients" class="live_search"/>
<img src="images/delete.png" width="16" height="14" alt="Delete" class="live_search_clear"/>
<ul class="live_clients_list clients">
<li>Apolit</li>
<li>Inksaint</li>
<li>OverridePro</li>
<li>Styledev</li>
<li>Vlytics</li>
</ul>
<label>assign to project</label>
<ul class="live_clients_list clients"></ul>
<label>employees</label>
<input type="text" value="" name="live_search" id="employees" class="live_search"/>
<img src="images/delete.png" width="16" height="14" alt="Delete" class="live_search_clear"/>
<ul class="live_empls_list employees">
<li>Apolit</li>
<li>Inksaint</li>
<li>OverridePro</li>
<li>Styledev</li>
<li>Vlytics</li>
</ul>
<label>assign to project</label>
<ul class="live_empls_list employees"></ul>
</pre>
<h4>Contents of jquery.multiplelivesearch.js:</h4>
<pre class="brush: js;">
jQuery.fn.liveUpdate = function(list,inputfield,clearbutton){
list = jQuery(list);
inputfield.keyup(function(e) {if (e.keyCode == 27) { $(this).val('') }});
clearbutton.click(function() {
$(this).siblings("input."+inputfield).val("");
$(this).siblings("input."+inputfield).focus();
})
if ( list.length ) {
var rows = list.children('li'),
cache = rows.map(function(){
return this.innerHTML.toLowerCase();
});
this
.keyup(filter).keyup()
.parents('form').submit(function(){
return false;
});
}
return this;
function filter(){
var term = jQuery.trim( jQuery(this).val().toLowerCase() ), scores = [];
if ( !term ) {
$(this).siblings("img."+clearbutton).hide();
rows.show();
} else {
$(this).siblings(clearbutton).show();
rows.hide();
cache.each(function(i){
var score = this.score(term);
if (score > 0) { scores.push([score, i]); }
});
jQuery.each(scores.sort(function(a, b){return b[0] - a[0];}), function(){
jQuery(rows[ this[1] ]).show();
});
}
}
};
function droplist(id1,id2,connect_class){
$(id1+","+id2).sortable({
connectWith: connect_class,
placeholder: 'ui-state-highlight'
}).disableSelection();
};
</pre>
</div>
<script type="text/javascript">
SyntaxHighlighter.config.clipboardSwf = 'js/clipboard.swf';
SyntaxHighlighter.config.stripBrs = true;
SyntaxHighlighter.all();
function onThemeChange(sender)
{
var parts = sender.value.split('|');
document.getElementById("theme").href = "images/" + parts[1];
document.body.style.backgroundColor = parts[0];
}
</script>
</body>
</html>