Skip to content

Commit 970ed9a

Browse files
author
maggiewachs
committed
Merge branch 'master' of github.com:jquery/jquery-ui
2 parents 4ffe074 + d1033cc commit 970ed9a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+2156
-1052
lines changed

build/build.xml

Lines changed: 86 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,26 @@
2222
<property name="release.filename" value="jquery-ui-${release.version}" />
2323

2424
<property name="dist.dir" value="dist/${release.filename}/" />
25+
<property name="cdndist.dir" value="dist/${release.filename}-googlecdn" />
2526
<property name="build.dir" value="build" />
2627
<property name="ui.dir" value="../" />
2728
<property name="src.dir" value="${ui.dir}/ui/" />
2829
<property name="theme.dir" value="${ui.dir}/themes/base/" />
2930
<property name="docs.dir" value="${ui.dir}/docs/" />
3031

31-
<property name="min.folder" value="${dist.dir}/ui/minified" />
32+
<property name="min.dir" value="${dist.dir}/ui/minified" />
3233

3334
<property name="concatenated" value="jquery-ui" />
3435
<property name="concatenated.i18n" value="jquery-ui-i18n" />
3536

3637
<property name="core.files" value="jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.effects.core.js" />
38+
<property name="core.files.min" value="jquery.ui.core.min.js, jquery.ui.widget.min.js, jquery.ui.mouse.min.js, jquery.ui.draggable.min.js, jquery.ui.droppable.min.js, jquery.ui.resizable.min.js, jquery.ui.selectable.min.js, jquery.ui.sortable.min.js, jquery.effects.core.min.js" />
3739

3840
<property description="Google Closure" name="closure-jar" value="${build.dir}/google-compiler-20091218.jar" />
3941

40-
<target name="deploy-release" depends="docs-download, concatenate, minify, copy, replace-version, prepend-header, zip" description="Release builder">
42+
<target name="deploy-release" depends="clean, docs-download, concatenate, minify, copy, replace-version, prepend-header, zip, googlecdn" description="Release builder">
4143
</target>
42-
44+
4345
<target name="replace-version">
4446
<replaceregexp match="@VERSION" replace="${release.version}" flags="g" byline="true">
4547
<fileset dir="${dist.dir}/ui/" includes="*.js"/>
@@ -49,15 +51,14 @@
4951
</target>
5052

5153
<target name="prepend-header">
52-
<!-- TODO: refactor this ugly mess -->
5354
<copy todir="${dist.dir}/headers/">
5455
<fileset dir="${dist.dir}/ui/" includes="*.js" />
5556
</copy>
5657
<replaceregexp match="^(\/\*.*?\*\/\s).+" replace="\1" flags="s">
5758
<fileset dir="${dist.dir}/headers/" includes="*.js"/>
5859
</replaceregexp>
5960
<for param="file">
60-
<path><fileset dir="${dist.dir}/ui/minified/" includes="*.js" /></path>
61+
<path><fileset dir="${min.dir}/" includes="*.js" /></path>
6162
<sequential>
6263
<propertyregex override="yes" property="target" input="@{file}" regexp=".*[\\/](.+)\.min\.js$" replace="\1"/>
6364
<concat destfile="${dist.dir}/ui-headered/${target}.min.js">
@@ -66,9 +67,33 @@
6667
</concat>
6768
</sequential>
6869
</for>
69-
<copy todir="${dist.dir}/ui/minified">
70+
<copy todir="${min.dir}">
7071
<fileset dir="${dist.dir}/ui-headered/" includes="*.js" />
7172
</copy>
73+
74+
<!-- once more for the i18n files -->
75+
<!-- need to clean up headers in those files first
76+
<copy todir="${dist.dir}/headers/i18n/">
77+
<fileset dir="${dist.dir}/ui/i18n/" includes="*.js" />
78+
</copy>
79+
<replaceregexp match="^(\/\*.*?\*\/\s).+" replace="\1" flags="s">
80+
<fileset dir="${dist.dir}/headers/i18n/" includes="*.js"/>
81+
</replaceregexp>
82+
<for param="file">
83+
<path><fileset dir="${min.dir}/i18n/" includes="*.js" /></path>
84+
<sequential>
85+
<propertyregex override="yes" property="target" input="@{file}" regexp=".*[\\/](.+)\.min\.js$" replace="\1"/>
86+
<concat destfile="${dist.dir}/ui-headered/i18n/${target}.min.js">
87+
<header file="${dist.dir}/headers/i18n/${target}.js" />
88+
<fileset file="@{file}" />
89+
</concat>
90+
</sequential>
91+
</for>
92+
<copy todir="${min.dir}/i18n/">
93+
<fileset dir="${dist.dir}/ui-headered/i18n/" includes="*.js" />
94+
</copy>
95+
-->
96+
7297
<delete dir="${dist.dir}/headers/" />
7398
<delete dir="${dist.dir}/ui-headered/" />
7499
</target>
@@ -108,45 +133,44 @@
108133

109134
<target name="minify" depends="concatenate" description="Remove all comments and whitespace, no compression, great in combination with GZip">
110135
<echo message="Building minified" />
111-
<delete dir="${min.folder}/" />
112-
<mkdir dir="${min.folder}" />
113-
<delete dir="${min.folder}/i18n/" />
114-
<mkdir dir="${min.folder}/i18n/" />
136+
<delete dir="${min.dir}/" />
137+
<mkdir dir="${min.dir}" />
138+
<delete dir="${min.dir}/i18n/" />
139+
<mkdir dir="${min.dir}/i18n/" />
115140

116141
<apply executable="java" parallel="false">
117142
<fileset dir="${src.dir}/" includes="jquery.ui.*.js, jquery.effects.*.js" />
118143
<arg line="-jar" />
119-
<arg path="build/google-compiler-20091218.jar" />
144+
<arg path="${closure-jar}" />
120145
<arg value="--warning_level" />
121146
<arg value="QUIET" />
122147
<arg value="--js_output_file" />
123148
<targetfile />
124149
<arg value="--js" />
125-
<mapper type="glob" from="*.js" to="${min.folder}/*.min.js" />
150+
<mapper type="glob" from="*.js" to="${min.dir}/*.min.js" />
126151
</apply>
152+
153+
<concat destfile="${min.dir}/${concatenated}.min.js">
154+
<filelist dir="${min.dir}" files="${core.files.min}" />
155+
<fileset dir="${min.dir}" includes="jquery.ui.*.js, jquery.effects.*.js" excludes="${core.files.min}" />
156+
</concat>
127157

128-
<apply executable="java" parallel="false" verbose="true" dest="${dist.dir}">
129-
<filelist dir="${dist.dir}/ui/" files="${concatenated}.js" />
158+
<apply executable="java" parallel="false">
159+
<fileset dir="${src.dir}/i18n/" includes="jquery.ui.*.js" />
130160
<arg line="-jar" />
131-
<arg path="build/google-compiler-20091218.jar" />
161+
<arg path="${closure-jar}" />
132162
<arg value="--warning_level" />
133163
<arg value="QUIET" />
134164
<arg value="--js_output_file" />
135165
<targetfile />
136166
<arg value="--js" />
137-
<mapper type="glob" from="${concatenated}.js" to="tmpmin" />
167+
<mapper type="glob" from="*.js" to="${min.dir}/i18n/*.min.js" />
138168
</apply>
139-
<concat destfile="${min.folder}/jquery-ui.min.js">
140-
<filelist files="${src.dir}/jquery.ui.core.js, ${dist.dir}/tmpmin"/>
141-
<filterchain>
142-
<headfilter lines="9"/>
143-
</filterchain>
144-
</concat>
145-
<concat destfile="${min.folder}/jquery-ui.min.js" append="yes">
146-
<filelist files="${dist.dir}/tmpmin"/>
169+
170+
<concat destfile="${min.dir}/i18n/${concatenated.i18n}.min.js">
171+
<fileset dir="${min.dir}/i18n" includes="jquery.ui.*.js" />
147172
</concat>
148-
<delete file="${dist.dir}/tmpmin"/>
149-
173+
150174
<echo message="Minified ui/ built." />
151175
</target>
152176

@@ -257,5 +281,41 @@
257281
</replaceregexp>
258282
<echo message="All trailing spaces removed." />
259283
</target>
284+
285+
<target name="googlecdn">
286+
<delete dir="${cdndist.dir}" />
287+
<mkdir dir="${cdndist.dir}" />
288+
<copy todir="${cdndist.dir}">
289+
<fileset dir=".." includes="AUTHORS.txt, GPL-LICENSE.txt, MIT-LICENSE.txt, version.txt" />
290+
</copy>
291+
<copy todir="${cdndist.dir}">
292+
<fileset dir="${dist.dir}ui" includes="jquery-ui.js" />
293+
<fileset dir="${dist.dir}ui/minified" includes="jquery-ui.min.js" />
294+
</copy>
295+
<copy todir="${cdndist.dir}/i18n">
296+
<fileset dir="${dist.dir}ui/i18n" />
297+
<fileset dir="${dist.dir}ui/minified/i18n" />
298+
</copy>
299+
<copy todir="${cdndist.dir}/themes">
300+
<fileset dir="${dist.dir}themes" />
301+
</copy>
302+
<checksum>
303+
<fileset dir="${cdndist.dir}" />
304+
</checksum>
305+
<for param="file">
306+
<path><fileset dir="${cdndist.dir}" includes="**/" excludes="**/*.MD5" /></path>
307+
<sequential>
308+
<!-- @{file} is an absolute path, use that ugly regexes to make it relative -->
309+
<propertyregex override="yes" property="relativepath" input="@{file}" regexp=".+?googlecdn[\\/](.+)$" replace="\1"/>
310+
<propertyregex override="yes" property="relativepath" input="${relativepath}" regexp="\\" replace="/" global="true" />
311+
<concat destfile="${cdndist.dir}/MANIFEST" append="yes">${relativepath} </concat>
312+
<concat destfile="${cdndist.dir}/MANIFEST" append="yes"><file file="@{file}.MD5" /></concat>
313+
</sequential>
314+
</for>
315+
<delete dir="${cdndist.dir}" includes="**/*.MD5" />
316+
<zip destfile="${dist.dir}/../${release.filename}-googlecdn.zip">
317+
<zipfileset dir="${cdndist.dir}/" />
318+
</zip>
319+
</target>
260320

261321
</project>

demos/autocomplete/combobox.html

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,23 @@
3030
var matcher = new RegExp(request.term, "i");
3131
response(select.children("option").map(function() {
3232
var text = $(this).text();
33-
if (!request.term || matcher.test(text))
33+
if (this.value && (!request.term || matcher.test(text)))
3434
return {
35-
id: $(this).val(),
36-
label: text.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + request.term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>"),
35+
id: this.value,
36+
label: text.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + $.ui.autocomplete.escapeRegex(request.term) + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>"),
3737
value: text
3838
};
3939
}));
4040
},
4141
delay: 0,
42-
select: function(e, ui) {
42+
change: function(event, ui) {
4343
if (!ui.item) {
4444
// remove invalid value, as it didn't match anything
4545
$(this).val("");
4646
return false;
4747
}
48-
$(this).focus();
4948
select.val(ui.item.id);
50-
self._trigger("selected", null, {
49+
self._trigger("selected", event, {
5150
item: select.find("[value='" + ui.item.id + "']")
5251
});
5352

@@ -56,6 +55,7 @@
5655
})
5756
.addClass("ui-widget ui-widget-content ui-corner-left");
5857
$("<button>&nbsp;</button>")
58+
.attr("tabIndex", -1)
5959
.attr("title", "Show All Items")
6060
.insertAfter(input)
6161
.button({
@@ -81,7 +81,10 @@
8181
})(jQuery);
8282

8383
$(function() {
84-
$("select").combobox();
84+
$("#combobox").combobox();
85+
$("#toggle").click(function() {
86+
$("#combobox").toggle();
87+
});
8588
});
8689
</script>
8790
</head>
@@ -91,7 +94,8 @@
9194

9295
<div class="ui-widget">
9396
<label>Your preferred programming language: </label>
94-
<select>
97+
<select id="combobox">
98+
<option value="">Select one...</option>
9599
<option value="a">asp</option>
96100
<option value="c">c</option>
97101
<option value="cpp">c++</option>
@@ -107,6 +111,7 @@
107111
<option value="s">scala</option>
108112
</select>
109113
</div>
114+
<button id="toggle">Show underlying select</button>
110115

111116
</div><!-- End demo -->
112117

demos/autocomplete/index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ <h4>Examples</h4>
1616
<li><a href="combobox.html">Combobox</a></li>
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>
19+
<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>
1922
</ul>
2023
</div>
2124
</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>

0 commit comments

Comments
 (0)