forked from nervetattoo/jquery-autosave
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
377 lines (337 loc) · 13.2 KB
/
index.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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.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 Autosave</title>
<link rel="stylesheet" href="style.css" type="text/css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="jquery.autosave.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js" type="text/javascript"></script>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/smoothness/jquery-ui.css" type="text/css" media="all" />
<link type="text/css" href="css/ui.multiselect.css" rel="stylesheet" />
<script type="text/javascript" src="page.js"></script>
</head>
<body>
<a href="http://github.com/nervetattoo/jquery-autosave">
<img style="position: absolute; top: 0; right: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png" alt="Fork me on GitHub" />
</a>
<div id="wrapper">
<div id="header">
<h1>jQuery Autosave</h1>
<p>A flexible autosave plugin for jQuery</p>
<ul id="nav">
<li><a href="http://github.com/nervetattoo/jquery-autosave">Source</a></li>
<li><a href="http://github.com/nervetattoo/jquery-autosave/issues">Bugs</a></li>
</ul>
<div id="version"></div>
</div>
<div id="content">
<p>It depends on <a href="http://jquery.com/">jQuery 1.3</a> and is available under a <a id="license-MIT" href="#license">MIT license</a>.</p>
<h2>Demo #1 Full form autosave</h2>
<div>
<form action="tojson.php" style="border: none;" id="demo" method="get">
<label>Name:
<select id="name" name="name">
<option value="Andrew">Andrew</option>
<option value="Brian">Brian</option>
<option value="Claire">Claire</option>
<option value="Heather">Heather</option>
<option value="Hugh">Hugh</option>
<option value="James">James</option>
<option value="Mark">Mark</option>
</select>
</label>
<label>Text:
<input type="input" name="text" />
</label>
<label>Textarea:
<textarea name="textarea"></textarea>
</label>
<label>Checkbox:
<input type="checkbox" name="checkbox" />
</label>
<label>Val1:
<input type="radio" name="radio" value="1" />
</label>
<label>Val2
<input type="radio" name="radio" value="2" />
</label>
</form>
<p id="demodebug"></p>
</div>
<h2>Features</h2>
<ul>
<li>Send entire form when one element changes</li>
<li>Send just the changed element</li>
<li>Form buttons and input:submit is not sent unless clicked</li>
<li>Override action/method parameter of form or fallback</li>
<li>Send elements from multiple forms in one request</li>
<li>Callbacks on sending, success and error</li>
</ul>
<h2>Known bugs</h2>
<ul>
<li>When grouped:true radio buttons breaks</li>
<li><a href="http://github.com/nervetattoo/jquery-autosave/issues">...more?</a></li>
</ul>
<h2 id="todo">Todo</h2>
<p>Here's a list of features that may or may not be implemented in future releases (no specific versions).</p>
<ul>
<li>Timer based saving of textarea input</li>
<li><a href="http://github.com/nervetattoo/jquery-autosave/issues">...more?</a></li>
</ul>
<h2>Contributors</h2>
<ul>
<li><a href="http://github.com/nervetattoo/jquery-autosave/">Raymond Julin</a></li>
<li>Mads Forberg</li>
</ul>
<h2>Misc</h2>
<p>There are no limitations. Do whatever you want with this plugin.
If you did some nice modifications, just let us know (via Github). We'd be happy to review them, and perhaps include them.</p>
</div>
<!-- Options -->
<div id="optionTabs" class="UIAPIPlugin">
<ul>
<li><a href="#optionTabs-1">Options</a></li>
<li><a href="#optionTabs-2">Methods</a></li>
<li><a href="#optionTabs-3">Events</a></li>
</ul>
<div id="optionTabs-1">
<ul class="options-list">
<!-- option - animated -->
<li class="option" id="option-url">
<div class="option-header">
<h3 class="option-name"><a href="#option-url">url</a></h3>
<dl>
<dt class="option-type-label">Type:</dt>
<dd class="option-type">String, null</dd>
<dt class="option-default-label">Default:</dt>
<dd class="option-default">form.action</dd>
</dl>
</div>
<div class="option-description">
<p>When <i>url</i> is specified, the forms action attribute will be overriden by the supplied url.</p>
</div>
<div class="option-examples">
<h4>Code examples</h4>
<dl class="option-examples-list">
<dt>
Initialize an autosave with user specified url.
</dt>
<dd>
<pre><code>$('input').autosave({ url: '/myurl' });</code></pre>
</dd>
</dl>
</div>
</li>
<li class="option" id="option-method">
<div class="option-header">
<h3 class="option-name"><a href="#option-method">method</a></h3>
<dl>
<dt class="option-type-label">Type:</dt>
<dd class="option-type">String, null</dd>
<dt class="option-default-label">Default:</dt>
<dd class="option-default">form.method</dd>
</dl>
</div>
<div class="option-description">
<p>Override forms default action (post/get)</p>
</div>
<div class="option-examples">
<h4>Code examples</h4>
<dl class="option-examples-list">
<dt>
Override default action
</dt>
<dd>
<pre><code>$('input').autosave({method:'get'});</code></pre>
</dd>
</dl>
</div>
</li>
<li class="option" id="option-grouped">
<div class="option-header">
<h3 class="option-name"><a href="#option-grouped">grouped</a></h3>
<dl>
<dt class="option-type-label">Type:</dt>
<dd class="option-type">boolean</dd>
<dt class="option-default-label">Default:</dt>
<dd class="option-default">false</dd>
</dl>
</div>
<div class="option-description">
<p>When grouped is set to false autosave will not group all elements matching <em>selector</em> but instead only send the one single node it was triggered upon (onchange/onclick).</p>
<p>If set to <i>true</i> it will group every element matched by <em>selector</em> and send each value as data when the request is sent to the server</p>
</div>
</li>
<li class="option" id="option-dataType">
<div class="option-header">
<h3 class="option-name"><a href="#option-dataType">dataType</a></h3>
<dl>
<dt class="option-type-label">Type:</dt>
<dd class="option-type">String</dd>
<dt class="option-default-label">Default:</dt>
<dd class="option-default">'json'</dd>
</dl>
</div>
<div class="option-description">
<p>Define what content type to expect to be returned by the url used for autosave.</p>
<p>Can be any jQuery content type.</p>
</div>
</li>
<li class="option" id="option-send">
<div class="option-header">
<h3 class="option-name"><a href="#option-send">send</a></h3>
<dl>
<dt class="option-type-label">Type:</dt>
<dd class="option-type">Function, null</dd>
<dt class="option-default-label">Default:</dt>
<dd class="option-default">false</dd>
</dl>
</div>
<div class="option-description">
<p>Supply a callback method to be used while sending ajax request.</p>
</div>
<div class="option-examples">
<h4>Code examples</h4>
<dl class="option-examples-list">
<dt>
Specify a custom handler while sending data.
</dt>
<dd>
<pre><code>$('input').autosave({
send: function(changedNode) {
// Do some pretty spinner visualization here
}
});</code></pre>
</dd>
</dl>
</div>
</li>
<li class="option" id="option-success">
<div class="option-header">
<h3 class="option-name"><a href="#option-success">success</a></h3>
<dl>
<dt class="option-type-label">Type:</dt>
<dd class="option-type">Function, null</dd>
<dt class="option-default-label">Default:</dt>
<dd class="option-default">null</dd>
</dl>
</div>
<div class="option-description">
<p>Callback on success from ajax request.</p>
</div>
<div class="option-examples">
<h4>Code examples</h4>
<dl class="option-examples-list">
<dt>
Specify a custom handler to run when success is received.
</dt>
<dd>
<pre><code>$('input').autosave({
success: function(data) {
// Show some confirmation to user
}
});</code></pre>
</dd>
</dl>
</div>
</li>
<li class="option" id="option-error">
<div class="option-header">
<h3 class="option-name"><a href="#option-error">error</a></h3>
<dl>
<dt class="option-type-label">Type:</dt>
<dd class="option-type">Function, null</dd>
<dt class="option-default-label">Default:</dt>
<dd class="option-default">null</dd>
</dl>
</div>
<div class="option-description">
<p>Callback on error from ajax request.</p>
</div>
<div class="option-examples">
<h4>Code examples</h4>
<dl class="option-examples-list">
<dt>
Specify a custom handler to run when error is received.
</dt>
<dd>
<pre><code>$('input').autosave({
error: function(data) {
// Show a warning that something failed
}
});</code></pre>
</dd>
</dl>
</div>
</li>
</ul>
</div>
<div id="optionTabs-2">
<p>Autosave currently supports no methods</p>
<ul class="methods-list">
<!-- Kept as template
<li class="method" id="method-cancel">
<div class="method-header">
<h3 class="method-name"><a href="#method-cancel">cancel</a></h3>
<dl>
<dt class="method-signature-label">Signature:</dt>
<dd class="method-signature">.multiselect( 'enabled', <span class="optional">[</span>state<span class="optional">]</span>, <span class="optional">[</span>msg<span class="optional">]</span> )</dd>
</dl>
</div>
<div class="method-description">
<p>Get or set the state of the enabled multiselect. If no state is specified, will act as a getter. If state is set to <code>false</code>, the <code>msg</code> argument will display the specified string as custom disabled message inside the multiseelct.</p>
</div>
</li>
-->
</ul>
</div>
<div id="optionTabs-3">
<p>
Autosave currently doesnt implement events that can be added after initialization time
</p>
<ul class="events-list">
<!-- event - deselected -->
<!-- Kept for template
<li class="event" id="event-deselected">
<div class="event-header">
<h3 class="event-name"><a href="#event-deselected">deselected</a></h3>
<dl>
<dt class="event-type-label">Type:</dt>
<dd class="event-type">multiselectdeselected</dd>
</dl>
</div>
<div class="event-description">
<p>This event is triggered whenever the an option has been deselected. The event <code>deselected</code> is triggered for every option deselected.</p>
</div>
<div class="event-examples">
<h4>Code examples</h4>
<dl class="option-examples-list">
<dt>
Supply a feedback function to handle the <code>deselected</code> events as an init option.
</dt>
<dd>
<pre><code>$('.selector').multiselect({ deselected: function(event, ui) { alert($(ui.option).val() + " has been deselected"); } });</code></pre>
</dd>
<dt>
Bind to the <code>deselected</code> event of type <code>multiselectdeselected</code>.
</dt>
<dd>
<pre><code>$('.selector').bind('multiselectdeselected', function(event, ui) {
... // ui.option is the DOMOption node of ui.sender
});</code></pre>
</dd>
</dl>
</div>
</li>
-->
</ul>
</div>
</div>
<div id="footer">
<p class="right">Template/design adopted from <a href="http://yanickrochon.uuuq.com/multiselect/">yanickrochon.uuuq.com</a></p>
<br class="clear"/>
</div>
</div>
</body>
</html>