aboutsummaryrefslogtreecommitdiffstats
path: root/demos/autocomplete/folding.html
blob: c4fff1487e3f8787b2721e9edcf334805de76a5f (plain)
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
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>jQuery UI Autocomplete - Accent folding</title>
	<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
	<script src="../../jquery-1.7.js"></script>
	<script src="../../ui/jquery.ui.core.js"></script>
	<script src="../../ui/jquery.ui.widget.js"></script>
	<script src="../../ui/jquery.ui.position.js"></script>
	<script src="../../ui/jquery.ui.menu.js"></script>
	<script src="../../ui/jquery.ui.autocomplete.js"></script>
	<link rel="stylesheet" href="../demos.css">
	<script>
	$(function() {
		var names = [ "Jörn Zaefferer", "Scott González", "John Resig" ];

		var accentMap = {
			"á": "a",
			"ö": "o"
		};
		var normalize = function( term ) {
			var ret = "";
			for ( var i = 0; i < term.length; i++ ) {
				ret += accentMap[ term.charAt(i) ] || term.charAt(i);
			}
			return ret;
		};

		$( "#developer" ).autocomplete({
			source: function( request, response ) {
				var matcher = new RegExp( $.ui.autocomplete.escapeRegex( request.term ), "i" );
				response( $.grep( names, function( value ) {
					value = value.label || value.value || value;
					return matcher.test( value ) || matcher.test( normalize( value ) );
				}) );
			}
		});
	});
	</script>
</head>
<body>

<div class="demo">

<div class="ui-widget">
	<form>
	<label for="developer">Developer: </label>
	<input id="developer">
	</form>
</div>

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



<div class="demo-description">
<p>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.</p>
<p>Try typing "Jo" to see "John" and "Jörn", then type "Jö" to see only "Jörn".</p>
</div><!-- End demo-description -->

</body>
</html>
= "margl"; public final static String MARGIN_RIGHT = "margr"; public final static String[] PAGE_ATTR = new String[]{ PAGE_WIDTH, PAGE_HEIGHT, MARGIN_TOP, MARGIN_BOTTOM, MARGIN_LEFT, MARGIN_RIGHT }; /** RtfPage creates new page attributes with the parent container, the writer and the attributes*/ RtfPage(RtfPageArea parent, Writer w, RtfAttributes attrs) throws IOException { super((RtfContainer)parent,w); m_attrib = attrs; } /** RtfPage writes the attributes the attributes contained in the string PAGE_ATTR, if not null */ protected void writeRtfContent() throws IOException { writeAttributes(m_attrib, PAGE_ATTR); if (m_attrib != null) { Object widthRaw = m_attrib.getValue( PAGE_WIDTH ); Object heightRaw = m_attrib.getValue( PAGE_HEIGHT ); if ((widthRaw instanceof Integer) && (heightRaw instanceof Integer) && ((Integer) widthRaw).intValue() > ((Integer) heightRaw).intValue()) { writeControlWord( "landscape" ); } } } /** RtfPage - attributes accessor */ public RtfAttributes getAttributes(){ return m_attrib; } /** RtfPage - is overwritten here because page attributes have no content only attributes. RtfContainer is defined not to write when empty. Therefore must make this true to print.*/ protected boolean okToWriteRtf() { return true; } }