Skip to content

Commit cfa185d

Browse files
committed
Merge commit '1.8.1' into tooltip
2 parents 19b76a1 + 469d0c5 commit cfa185d

33 files changed

+646
-119
lines changed

demos/autocomplete/custom-data.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,13 @@
6464

6565
return false;
6666
}
67-
});
67+
})
68+
.data( "autocomplete" )._renderItem = function( ul, item ) {
69+
return $( "<li></li>" )
70+
.data( "item.autocomplete", item )
71+
.append( "<a>" + item.label + "<br>" + item.desc + "</a>" )
72+
.appendTo( ul );
73+
};
6874
});
6975
</script>
7076
</head>

demos/autocomplete/folding.html

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<title>jQuery UI Autocomplete Accent Folding Demo</title>
6+
<link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
7+
<script type="text/javascript" src="../../jquery-1.4.2.js"></script>
8+
<script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
9+
<script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
10+
<script type="text/javascript" src="../../ui/jquery.ui.position.js"></script>
11+
<script type="text/javascript" src="../../ui/jquery.ui.autocomplete.js"></script>
12+
<link type="text/css" href="../demos.css" rel="stylesheet" />
13+
<script type="text/javascript">
14+
$(function() {
15+
var names = [ "Jörn Zaefferer", "Scott González", "John Resig" ];
16+
17+
var accentMap = {
18+
'á':'a',
19+
'ö':'o'
20+
};
21+
var normalize = function( term ) {
22+
var ret = '';
23+
for ( var i = 0; i < term.length; i++ ) {
24+
ret += accentMap[ term.charAt(i) ] || term.charAt(i);
25+
}
26+
return ret;
27+
};
28+
29+
$( "#developer" ).autocomplete({
30+
source: function( request, response ) {
31+
var matcher = new RegExp( $.ui.autocomplete.escapeRegex( request.term ), "i" );
32+
response( $.grep( names, function( value ) {
33+
value = value.label || value.value || value;
34+
return matcher.test( value ) || matcher.test( normalize( value ) );
35+
}) );
36+
}
37+
});
38+
});
39+
</script>
40+
</head>
41+
<body>
42+
43+
<div class="demo">
44+
45+
<div class="ui-widget">
46+
<form>
47+
<label for="developer">Developer: </label>
48+
<input id="developer" />
49+
</form>
50+
</div>
51+
52+
</div><!-- End demo -->
53+
54+
<div class="demo-description">
55+
<p>
56+
The autocomplete field uses a custom source option which will match results that have accented characters even when the text field doesn't contain accented characters. However if the you type in accented characters in the text field it is smart enough not to show results that aren't accented.
57+
</p>
58+
<p>
59+
Try typing "Jo" to see "John" and "Jörn", then type "Jö" to see only "Jörn".
60+
</p>
61+
</div><!-- End demo-description -->
62+
63+
</body>
64+
</html>

demos/autocomplete/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ <h4>Examples</h4>
1717
<li><a href="custom-data.html">Custom data and display</a></li>
1818
<li><a href="xml.html">XML data parsed once</a></li>
1919
<li><a href="categories.html">Categories</a></li>
20+
<li><a href="multiple.html">Multiple values</a></li>
21+
<li><a href="multiple-remote.html">Multiple, remote</a></li>
2022
</ul>
2123
</div>
2224
</body>
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<title>jQuery UI Autocomplete multiple demo</title>
6+
<link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
7+
<script type="text/javascript" src="../../jquery-1.4.2.js"></script>
8+
<script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
9+
<script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
10+
<script type="text/javascript" src="../../ui/jquery.ui.position.js"></script>
11+
<script type="text/javascript" src="../../ui/jquery.ui.autocomplete.js"></script>
12+
<link type="text/css" href="../demos.css" rel="stylesheet" />
13+
<script type="text/javascript">
14+
$(function() {
15+
function split(val) {
16+
return val.split(/,\s*/);
17+
}
18+
function extractLast(term) {
19+
return split(term).pop();
20+
}
21+
22+
$("#birds").autocomplete({
23+
source: function(request, response) {
24+
$.getJSON("search.php", {
25+
term: extractLast(request.term)
26+
}, response);
27+
},
28+
search: function() {
29+
// custom minLength
30+
var term = extractLast(this.value);
31+
if (term.length < 2) {
32+
return false;
33+
}
34+
},
35+
focus: function() {
36+
// prevent value inserted on focus
37+
return false;
38+
},
39+
select: function(event, ui) {
40+
var terms = split( this.value );
41+
// remove the current input
42+
terms.pop();
43+
// add the selected item
44+
terms.push( ui.item.value );
45+
// add placeholder to get the comma-and-space at the end
46+
terms.push("");
47+
this.value = terms.join(", ");
48+
return false;
49+
}
50+
});
51+
});
52+
</script>
53+
</head>
54+
<body>
55+
56+
<div class="demo">
57+
58+
<div class="ui-widget">
59+
<label for="birds">Birds: </label>
60+
<input id="birds" size="50" />
61+
</div>
62+
63+
</div><!-- End demo -->
64+
65+
<div class="demo-description">
66+
<p>
67+
Usage: Enter at least two characters to get bird name suggestions. Select a value to continue adding more names.
68+
</p>
69+
<p>
70+
This is an example showing how to use the source-option along with some events to enable autocompleting multiple values into a single field.
71+
</p>
72+
</div><!-- End demo-description -->
73+
74+
</body>
75+
</html>

demos/autocomplete/multiple.html

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<title>jQuery UI Autocomplete multiple demo</title>
6+
<link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
7+
<script type="text/javascript" src="../../jquery-1.4.2.js"></script>
8+
<script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
9+
<script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
10+
<script type="text/javascript" src="../../ui/jquery.ui.position.js"></script>
11+
<script type="text/javascript" src="../../ui/jquery.ui.autocomplete.js"></script>
12+
<link type="text/css" href="../demos.css" rel="stylesheet" />
13+
<script type="text/javascript">
14+
$(function() {
15+
var availableTags = ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby", "python", "c", "scala", "groovy", "haskell", "perl"];
16+
function split(val) {
17+
return val.split(/,\s*/);
18+
}
19+
function extractLast(term) {
20+
return split(term).pop();
21+
}
22+
23+
$("#tags").autocomplete({
24+
minLength: 0,
25+
source: function(request, response) {
26+
// delegate back to autocomplete, but extract the last term
27+
response($.ui.autocomplete.filter(availableTags, extractLast(request.term)));
28+
},
29+
focus: function() {
30+
// prevent value inserted on focus
31+
return false;
32+
},
33+
select: function(event, ui) {
34+
var terms = split( this.value );
35+
// remove the current input
36+
terms.pop();
37+
// add the selected item
38+
terms.push( ui.item.value );
39+
// add placeholder to get the comma-and-space at the end
40+
terms.push("");
41+
this.value = terms.join(", ");
42+
return false;
43+
}
44+
});
45+
});
46+
</script>
47+
</head>
48+
<body>
49+
50+
<div class="demo">
51+
52+
<div class="ui-widget">
53+
<label for="tags">Tag programming languages: </label>
54+
<input id="tags" size="50" />
55+
</div>
56+
57+
</div><!-- End demo -->
58+
59+
<div class="demo-description">
60+
<p>
61+
Usage: Type something, eg. "j" to see suggestions for tagging with programming languages. Select a value, then continue typing to add more.
62+
</p>
63+
<p>
64+
This is an example showing how to use the source-option along with some events to enable autocompleting multiple values into a single field.
65+
</p>
66+
</div><!-- End demo-description -->
67+
68+
</body>
69+
</html>

demos/autocomplete/remote-with-cache.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,11 @@
2222
source: function(request, response) {
2323
if (cache.term == request.term && cache.content) {
2424
response(cache.content);
25+
return;
2526
}
2627
if (new RegExp(cache.term).test(request.term) && cache.content && cache.content.length < 13) {
27-
var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i");
28-
response($.grep(cache.content, function(value) {
29-
return matcher.test(value.value)
30-
}));
28+
response($.ui.autocomplete.filter(cache.content, request.term));
29+
return;
3130
}
3231
$.ajax({
3332
url: "search.php",

demos/draggable/visual-feedback.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
return $('<div class="ui-widget-header">I\'m a custom helper</div>');
2828
}
2929
});
30-
$("#set div").draggable({ stack: { group: '#set div', min: 1 } });
30+
$("#set div").draggable({ stack: '#set div' });
3131
});
3232
</script>
3333
</head>

demos/effect/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<h4>Examples</h4>
1212
<ul>
1313
<li class="demo-config-on"><a href="default.html">Effect showcase</a></li>
14-
<li class="demo-config-on"><a href="easing.html">Easing showcase</a></li>
14+
<li><a href="easing.html">Easing showcase</a></li>
1515
<!-- WIP
1616
<li class="demo-config-on"><a href="scale.html">Scale effect</a></li>
1717
<li class="demo-config-on"><a href="size.html">Size effect</a></li>

0 commit comments

Comments
 (0)