-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathJAMTutorial.html
More file actions
302 lines (178 loc) · 11.3 KB
/
Copy pathJAMTutorial.html
File metadata and controls
302 lines (178 loc) · 11.3 KB
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
<html>
<head>
<script src="coded/jqueryCoded.js"></script>
<script>
$(document).ready(function(){
$('#image').coded();
$('#div').coded();
$('#table').coded();
$('#select').coded();
$('#radioButtons').coded();
$('#checkboxes').coded();
$('#passwordField').coded();
$('#inputField').coded();
$('#button').coded();
$('#span').coded();
$('#textarea').coded();
$('#custom').coded();
$('#listview').coded();
});
</script>
</head>
<body>
<!--
<p style="font-size:20px">To create a web element with JAM, specify an element ID as the key to a JSON-formatted array(like you do when you write CSS and define an element's style. ) and as a "type" parameter of this element, specify "image". <br>In the "content" parameter, specify the image's URL. <br> In the "parent" parameter, specify which div (selected by ID (#) or class(.)) you would like this element to be a child of. If you do not specify a child element, the element will be added to the body of your document. <br>
In the "listeners" parameter, use a JSON formatted string to determine the the event listeners that should be attached to the element, with the event as the key and the javascript callback function of the event listener as the value.<br> In the "class" parameter, use a string as the value to express which class in the stylesheet to apply to the element.<br>In the "style" parameter, use a JSON formatted string to express additional CSS rules to be applied to the element as overrides to defaults.<br>In the "prependBool" parameter, express "true" if you want the element to be prepended to its parent.
</p>
-->
<h3>Simple Image</h3>
<div class="bs-docs-example" id="image">
[{"#logoImg": {"type": "image", "content": "http://media.npr.org/images/picture-show-flickr-promo.jpg", "parent":"#image", "prependBool":false, "listeners":{"click":"alert('hello')"}, "style":{width:"20%"}}}]
</div>
<pre class="prettyprint linenums">
{"#logoImg": {"type": "image", "content": "http://media.npr.org/images/picture-show-flickr-promo.jpg", "parent":"#image", "prependBool":false, "listeners":{"click":"alert('hello')"}, "style":{width:"20%"}}}
</pre>
<hr class="bs-docs-separator">
<h3>Simple Div</h3>
<div class="bs-docs-example" id="div">
[{"#helloDiv": {"type": "div", "content": "hi there", "parent":"#div", "style":{"background-color":"red", "font-size": "20px", "text-align":"center", "color":"white", "padding-top": "75px", "width":"300px", "height":"150px"}}}]
</div>
<pre class="prettyprint linenums">
{"#helloDiv": {"type": "div", "content": "hi there", "parent":"#div", "style":{"background-color":"red", "font-size": "20px", "text-align":"center", "color":"white", "padding-top": "75px", "width":"300px", "height":"150px"}}}
</pre>
<hr class="bs-docs-separator">
<h3>Simple Table</h3>
<div class="bs-docs-example" id="table">
[{"#tableId": {"type":"table", "content": [["first row, first cell", "first row, second cell"], ["second row, first cell", "second row, second cell"] ], "class":"table", "parent":"#table"}}]
</div>
<pre class="prettyprint linenums">
[{"#tableId": {"type":"table", "content": [["first row, first cell", "first row, second cell"], ["second row, first cell", "second row, second cell"] ], "class":"table", "parent":"#table"}}]
<center> <br> - or -<br></center>
{"#tableId": {"type":"table", "content": {"firstRowId":{"cellId1":"first row, first cell", "cellId2":"first row, second cell"}, "anotherRowId": {"cellId3":"second row, first cell", "cellId4":"second row, second cell"} }, "class":"table", "parent":"#table"}}
</pre>
<hr class="bs-docs-separator">
<h3>Simple Select Element</h3>
<div class="bs-docs-example" id="select">
[{"#select1": {"type":"select", "content": {"choiceId":"choice 1", "choiceId2":"choice 2"}, parent:"#select"}}]
</div>
<pre class="prettyprint linenums">
[{"#select1": {"type":"select", "content": {"choiceId":"choice 1", "choiceId2":"choice 2"}, parent:"#select"}}]
<br><center> - or - <br>
[{"#select1": {"type":"select", "content": ["choice 1", choice 2"], parent:"#select"}}]
</pre>
<hr class="bs-docs-separator">
<h3>Simple Listview</h3>
<div class="bs-docs-example" id="listview">
[{"#newList": {type:"listview", "content":[{"title":"blah", "desc":"blah blah. Yay!", "desc2":"2 mi away", "link":"http://jquerycoded.com"}, , {"title":"blah 2", "desc":"blah blah blah. Yay!", "desc2":"4 mi away"}], "parent":"#listview"}}]
</div>
<pre class="prettyprint linenums">
{"#newList": {type:"listview", "content":[{"title":"blah", "desc":"blah blah. Yay!", "desc2":"2 mi away","link":"http://jquerycoded.com"}, {"title":"blah 2", "desc":"blah blah blah. Yay!", "desc2":"4 mi away"}], "parent":"#listview"}}
</pre>
<hr class="bs-docs-separator">
<h3>Simple Checkboxes</h3>
<div class="bs-docs-example" id="checkboxes">
[{"#check": {"type":"checkBoxes", "content": {"checkId1":"choice 1", "checkId2":"choice 2"}, parent:"#checkboxes"}}]
</div>
<pre class="prettyprint linenums">
{"#check": {"type":"checkBoxes", "content": {"checkId1":"choice 1", "checkId2":"choice 2"}, parent:"#checkboxes"}}
</pre>
<hr class="bs-docs-separator">
<h3>Simple Radio Buttons</h3>
<div class="bs-docs-example" id="radioButtons">
[{"#radio": {"type":"radioButtons", "content": {"radioId1":"choice 1", "radioId2":"choice 2"}, parent:"#radioButtons"}}]
</div>
<pre class="prettyprint linenums">
{"#radio": {"type":"radioButtons", "content": {"radioId1":"choice 1", "radioId2":"choice 2"}, parent:"#radioButtons"}}</pre>
<hr class="bs-docs-separator">
<h3>Simple Input Field</h3>
<div class="bs-docs-example" id="inputField">
[{"#inputElem": {"type": "inputText", "content": "username", "parent":"#inputField"}}]
</div>
<pre class="prettyprint linenums">
{"#inputElem": {"type": "inputText", "content": "username", "parent":"#inputField"}}
</pre>
<hr class="bs-docs-separator">
<h3>Simple Password Field</h3>
<div class="bs-docs-example" id="passwordField">
[{"#passElem": {"type": "inputPassword", "content": "password", "parent":"#passwordField"}}]
</div>
<pre class="prettyprint linenums">
{"#passElem": {"type": "inputPassword", "content": "password", "parent":"#passwordField"}}
</pre>
<hr class="bs-docs-separator">
<h3>Simple Button</h3>
<div class="bs-docs-example" id="button">
[{"#buttonElem": {"type": "button", "content": "click me", "parent":"#button", listeners:{"click":"alert('You clicked me!')"}}}]
</div>
<pre class="prettyprint linenums">
{"#buttonElem": {"type": "button", "content": "click me", "parent":"#button", listeners:{"click":"alert('You clicked me!')"}}}
</pre>
<hr class="bs-docs-separator">
<h3>Stylesheets</h3>
<div class="bs-docs-example" id="stylesheets1">
To import a simple CSS stylesheets, use this code:
</div>
<pre class="prettyprint linenums">
[{"#bootstrap1": {"type":"stylesheet", "content": "css/bootstrap.css"}},
{"#bootstrap2": {"type":"stylesheet", "content": "css/bootstrap-responsive.css"}},
{"#bootstrap3": {"type":"stylesheet", "content": "css/bootstrap-docs.css"}}]
</pre>
<hr class="bs-docs-separator">
<h3>Simple Span</h3>
<div class="bs-docs-example" id="span">
[{"#helloSpan": {"type": "span", "content": "example span", "parent":"#span"}}]
</div>
<pre class="prettyprint linenums">
{"#helloSpan": {"type": "span", "content": "example span", "parent":"#span"}}</pre>
<hr class="bs-docs-separator">
<h3>Simple Textarea</h3>
<div class="bs-docs-example" id="textarea">
[{"#textareaElem": {"type": "textarea", "content": "enter some words...", "parent":"#textarea"}}]
</div>
<pre class="prettyprint linenums">
{"#textareaElem": {"type": "textarea", "content": "enter some words...", "parent":"#textarea"}}
</pre>
<h3>Swipable Content on Mobile</h3>
<div class="bs-docs-example" id="swipableContent">
If you're on a mobile device, check out this <a href="mobile.html" target="_blank"> demo</a>
</div>
<pre class="prettyprint linenums">
[{"#slider":{"type": "swipableContainer", "parent":"#mainPage"}},
{"#sliderElem1":{"type": "swipableContent", "parent":"#slider", "content":"swipable content goes here.."}},
{"#sliderElem2":{"type": "swipableContent", "parent":"#slider", "content":'more swipable content goes here', style:{"background-color":"#1C1C1C"}}}]
</pre>
<hr class="bs-docs-separator">
<h3>Your Custom Elements and HTML 5</h3>
<div class="bs-docs-example" id="custom">
[{"#customElem": {"type": "anythingYouMakeUp", "content": "hi there", "parent":"#custom"}}]
</div>
<pre class="prettyprint linenums">
{"#customElem": {"type": "anythingYouMakeUp", "content": "hi there", "parent":"#custom"}}
</pre>
<hr class="bs-docs-separator">
<div id="blah" style="display:none">
<!--
[
{"#tableBootstrap": {"type":"tableBootstrap", "content": {"wewe":{"adssd":"sdsdsd"}, "sdsdsd": {"adssd":"sdsdsd"} }}},
{"#select2": {"type":"selectBootstrap", "content": {"adssd":"sdsdsd", "adssd11":"sdsdsd11"}}},
{"#radio": {"type":"checkBoxesBootstrap", "content": {"adssd":"sdsdsd", "adssd11":"sdsdsd11"}}},
{"#logoImg": {"type": "image", "content": "http://media.npr.org/images/picture-show-flickr-promo.jpg", "parent":"body", "prependBool":false, "listeners":{"click":"alert('hello')"}, "style":{width:"20%"}}},
{"#helloDiv": {"type": "div", "content": "hi there", "parent":"#blah", "style":{"background-color":"red", "font-size": "20px", "text-align":"center", "color":"white", "padding-top": "75px", "width":"300px", "height":"150px"}}},
{"#inputElem": {"type": "inputText", "content": "username", "parent":"#blah"}},
{"#inputPassword": {"type": "inputPassword", "content": "password", "parent":"#blah"}},
{"#theSpan": {"type": "span", "content": "this is a span", "parent":"#blah"}},
{"#theTable": {"type": "table", "content": "<tr><td>dfdfd</td><td>fddfdf</td></tr>", "parent":"#blah"}},
{"#newList": {type:"listview", "content":[{"title":"blah", "image": "http://jquerymobile.com/demos/1.2.0/docs/lists/images/album-af.jpg", "desc":"blah blah. Yay!"}], "parent":"body"}},
]
-->
</div>
<div id="stylesheets">
[{"#bootstrap1": {"type":"stylesheet", "content": "css/bootstrap.css"}},
{"#bootstrap2": {"type":"stylesheet", "content": "css/bootstrap-responsive.css"}},
{"#bootstrap3": {"type":"stylesheet", "content": "css/bootstrap-docs.css"}}]
</div>
<script>
$('#stylesheets').coded();
</script>
</body>
</html>