-
Notifications
You must be signed in to change notification settings - Fork 21
/
demo.html
183 lines (137 loc) · 4.11 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
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
<title>polymer-filters Demo</title>
<script src="../platform/platform.js"></script>
<link rel="import" href="polymer-filters.html">
</head>
<body unresolved>
<h1>Polymer Filters</h1>
<h2>A collection of Polymer filters for formatting values of expressions.</h2>
<template id="view" is="auto-binding">
<h3>uppercase</h3>
<p>{{greeting | uppercase}}</p>
<h3>lowercase</h3>
<p>{{greeting | lowercase}}</p>
<h3>reverse</h3>
{{'Hello World' | reverse}}
<h3>replace('World','Peeps')</h3>
{{'Hello World' | replace('World','Peeps')}}
<h3>truncate(8, true)</h3>
{{'Lorem Catsum Itsum' | truncate(8, true) }}
<h3>titlecase</h3>
{{'this is a sentence that was not using title case.' | titlecase}}
<h3>startsWith(T)</h3>
<template repeat="{{friend in friends | startsWith('T')}}">
{{ friend.name }}
</template>
<h3>date('yyyy-MM-dd HH:mm:ss Z')</h3>
{{1288323623006 | date('yyyy-MM-dd HH:mm:ss Z')}}
<h3>orderBy('age')</h3>
<ul class="phones">
<template repeat="{{phones | orderBy(orderProp)}}">
<li>
<span><strong>{{name}}</strong> - {{snippet}}</span>
</li>
</template>
</ul>
<h3>limitTo(2)</h3>
<ul class="phones">
<template repeat="{{phones | limitTo(2)}}">
<li>
<span><strong>{{name}}</strong> - {{snippet}}</span>
</li>
</template>
</ul>
<h3>limitFrom(1,2)</h3>
<ul class="phones">
<template repeat="{{phones | limitFrom(1,2)}}">
<li>
<span><strong>{{name}}</strong> - {{snippet}}</span>
</li>
</template>
</ul>
<h3>wordcount</h3>
{{'Hello World' | wordcount}}
<h3>round</h3>
{{ 45.35 | round }}
<h3>round(1, 'floor')</h3>
{{ 45.35 | round(1, 'floor') }}
<h3>first</h3>
{{ colors | first }}
<h3>last</h3>
{{ colors | last }}
<h3>random</h3>
{{ colors | random }}
<h3>length</h3>
{{'Hello World' | length}}
<h3>ltrim</h3>
{{' I was a string with leading whitespace' | ltrim}}
<h3>rtrim</h3>
{{'I was a string with trailing whitespace ' | rtrim}}
<h3>trim</h3>
{{' I was a string with leading and trailing whitespace ' | trim}}
<h3>list</h3>
{{colors | list}}
<h3>list(" ")</h3>
{{colors | list(" ")}}
<h3>capitalize</h3>
{{greeting | capitalize}}
<h3>underscore</h3>
{{'UserName' | underscore}}
<h3>objectKeys</h3>
{{{x: 1, y: 2} | objectKeys}}
<h3>Currency</h3>
<h4>Default</h4>
{{ 169535.216 | currency }}
<h4>Custom Currency</h4>
{{ 169535.216 | currency('USD$') }}
<h4>Custom Decimal point</h4>
{{ 169535.216 | currency('USD$', 4) }}
<h3>typeof</h3>
<h4>String</h4>
{{ 'STRING' | typeof }}
<h4>Number</h4>
{{ 192.168 | typeof }}
<h4>Object</h4>
{{ {} | typeof }}
<h4>Array</h4>
{{ [] | typeof }}
<h4>Error</h4>
{{ error | typeof }}
<h4>RegExp</h4>
{{ regexp | typeof }}
<h4>Undefined</h4>
{{ undefined | typeof }}
<h4>Null</h4>
{{ null | typeof }}
</template>
<script>
var template = document.getElementById('view');
var phones = [{'name':'Nexus S','snippet':'Fast just got faster with Nexus S.','age':1},{'name':'Motorola XOOM with Wi-Fi','snippet':'The Next, Next Generation tablet.','age':2},{'name':'MOTOROLA XOOM','snippet':'The Next, Next Generation tablet.','age':3}];
template.phones = phones;
template.orderProp = 'age';
template.colors = ['red','green','blue','yellow'];
template.greeting = 'Hello World';
template.friends = [{
name: 'Matt',
dinner: 'pizza'
}, {
name: 'Paul',
dinner: 'sushi'
}, {
name: 'Eric',
dinner: 'hummus'
}, {
name: 'Rob',
dinner: 'burger'
}, {
name: 'Timothy',
dinner: 'pasta'
}];
template.regexp = new RegExp(/a-z/);
template.error = new Error();
</script>
</body>
</html>