This repository has been archived by the owner on Dec 1, 2017. It is now read-only.
/
string.html
239 lines (222 loc) · 8.48 KB
/
string.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQueryMobile - SimpleDialog Demos</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0rc2/jquery.mobile-1.0rc2.min.css" />
<link type="text/css" href="http://dev.jtsage.com/cdn/simpledialog/latest/jquery.mobile.simpledialog.min.css" rel="stylesheet" />
<link type="text/css" href="http://dev.jtsage.com/jQM-DateBox/css/demos.css" rel="stylesheet" />
<!-- NOTE: Script load order is significant! -->
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/mobile/1.0rc2/jquery.mobile-1.0rc2.min.js"></script>
<script type="text/javascript" src="http://dev.jtsage.com/jquery.mousewheel.min.js"></script>
<script type="text/javascript" src="http://dev.jtsage.com/cdn/simpledialog/latest/jquery.mobile.simpledialog.min.js"></script>
<script type="text/javascript" src="http://dev.jtsage.com/gpretty/prettify.js"></script>
<link type="text/css" href="http://dev.jtsage.com/gpretty/prettify.css" rel="stylesheet" />
<script type="text/javascript">
$('div').live('pagecreate', function() {
prettyPrint()
});
</script>
</head>
<body>
<div data-role="page" data-theme="a" id="main">
<div data-role="header">
<h1>jQueryMobile - SimpleDialog</h1>
</div>
<div data-role="content" data-theme="c">
<div class="content-secondary">
<div id="jqm-homeheader">
<h1 id="jqm-logo"><img src="/jQM-SimpleDialog/demos/jquery-logo-sd.png" alt="jQuery Mobile Framework :: SimpleDialog" /></h1>
<p>A Popup Dialog Box for jQueryMobile</p>
</div>
<p class="intro">SimpleDialog aims to be a replacement for javascript dialog(), written for jQM.</p>
<ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="f">
<li data-role="list-divider">Overview</li>
<li><a href="../">Intro & Features</a></li>
<li><a href="config.html">Full Options Matrix</a></li>
<li><a href="install.html">Download & Use</a></li>
<li><a href="bool.html">Boolean / Button Mode</a></li>
<li data-theme="a">String / Input Mode</li>
<li><a href="blank.html">Raw HTML Mode</a></li>
</ul>
</div><!--/content-primary-->
<div class="content-primary">
<h2>String Input Mode</h2>
<p>This shows the simplest form of string input.</p>
<p>You have entered: <span id="simplestringout"></span></p>
<script type="text/javascript">
$(document).delegate('#simplestring', 'click', function() {
$(this).simpledialog({
'mode' : 'string',
'prompt' : 'What do you say?',
'buttons' : {
'OK': {
click: function () {
$('#simplestringout').text($('#simplestring').attr('data-string'));
}
},
'Cancel': {
click: function () { console.log(this); },
icon: "delete",
theme: "c"
}
}
})
});
</script>
<a href="#" id="simplestring" data-role="button">Open Dialog</a>
<strong>HTML</strong><pre class="prettyprint">
<p>You have entered: <span id="dialogoutput"></span></p>
<a href="#" id="dialoglink" data-role="button">Open Dialog</a></pre>
<strong>jQuery</strong><pre class="prettyprint">
$(document).delegate('#simplestring', 'click', function() {
$(this).simpledialog({
'mode' : 'string',
'prompt' : 'What do you say?',
'buttons' : {
'OK': {
click: function () {
$('#dialogoutput').text($('#dialoglink').attr('data-string'));
}
},
'Cancel': {
click: function () { },
icon: "delete",
theme: "c"
}
}
})
})</pre>
<h2>String Password Input Mode</h2>
<p>This shows getting a password input.</p>
<p>You have entered: <span id="simplepassout"></span></p>
<script type="text/javascript">
$(document).delegate('#simplepass', 'click', function() {
$(this).simpledialog({
'mode' : 'string',
'prompt' : 'Password?',
'inputPassword': true,
'buttons' : {
'OK': {
click: function () {
$('#simplepassout').text($('#simplepass').attr('data-string'));
}
},
'Cancel': {
click: function () { console.log(this); },
icon: "delete",
theme: "c"
}
}
})
});
</script>
<a href="#" id="simplepass" data-role="button">Open Dialog</a>
<strong>HTML</strong><pre class="prettyprint">
<p>You have entered: <span id="dialogoutput"></span></p>
<a href="#" id="dialoglink" data-role="button">Open Dialog</a></pre>
<strong>jQuery</strong><pre class="prettyprint">
$(document).delegate('#simplepass', 'click', function() {
$(this).simpledialog({
'mode' : 'string',
'prompt' : 'Password?',
'inputPassword': true,
'buttons' : {
'OK': {
click: function () {
$('#dialogoutput').text($('#dialoglink').attr('data-string'));
}
},
'Cancel': {
click: function () { },
icon: "delete",
theme: "c"
}
}
})
})</pre>
<h2>Adding to a Select Box</h2>
<p>This shows how to use SimpleDialog to add to a select box.</p>
<script type="text/javascript">
$(document).delegate('#stringselect', 'change', function(e) {
var self = this;
$(self+':selected:not([data-placeholder])').each(function(){
if ( $(this).attr('data-addoption') ) {
$(self).simpledialog({
'mode' : 'string',
'prompt' : 'Add New Option',
'useDialogForceFalse' : true,
'buttons' : {
'Yes, Add' : {
click: function () {
thisopt = $(self).attr('data-string');
$('<option value="'+thisopt+'" selected="selected">'+thisopt+'</option>').appendTo($(self));
$(self).selectmenu('refresh', true);
return true; }
},
'Cancel' : {
click: function () { $(self).selectmenu('open'); },
icon: "delete"
}
}
});
}
});
});
</script>
<div data-role='fieldcontain'>
<label for='vendor'>Some Select Menu, using jQM styles</label>
<select data-native-menu="false" name='stringselect' id='stringselect' >
<option data-placeholder='true'>Choose one...</option>
<option data-addoption='true' value='0'>Add New...</option>
<option value='Example Vendor'>Example Vendor</option>
<option value='Another Example Vendor'>Another Example Vendor</option>
</select>
</div>
<strong>HTML</strong><pre class="prettyprint">
<div data-role='fieldcontain'>
<label for='vendor'>Some Select Menu, using jQM styles</label>
<select data-native-menu="false" name='stringselect' id='stringselect' >
<option data-placeholder='true'>Choose one...</option>
<option data-addoption='true' value='0'>Add New...</option>
<option value='Example Vendor'>Example Vendor</option>
<option value='Another Example Vendor'>Another Example Vendor</option>
</select>
</div></pre>
<strong>jQuery</strong><pre class="prettyprint">
$(document).delegate('#stringselect', 'change', function(e) {
var self = this;
$(self+':selected:not([data-placeholder])').each(function(){
if ( $(this).attr('data-addoption') ) {
$(self).simpledialog({
'mode' : 'string',
'prompt' : 'Add New Option',
'useDialogForceFalse' : true,
'buttons' : {
'Yes, Add' : {
click: function () {
thisopt = $(self).attr('data-string');
$('<option value="'+thisopt+'" selected="selected">'+thisopt+'</option>').appendTo($(self));
$(self).selectmenu('refresh', true);
return true; }
},
'Cancel' : {
click: function () { $(self).selectmenu('open'); },
icon: "delete"
}
}
});
}
});
});</pre>
</div>
</div>
<div data-role="footer">
<div data-role="controlgroup" data-type="horizontal">
<a data-role="button" href="https://github.com/jtsage/jquery-mobile-simpledialog">GitHub Source</a><a data-role="button" rel='external' href="http://dev.jtsage.com/blog/">Blog</a><a data-role="button" href="mailto:jtsage+datebox@gmail.com">Contact</a><a data-role="button" href="http://jquerymobile.com/">jQueryMobile Homepage</a>
</div>
</div>
</div>
</html>