-
Notifications
You must be signed in to change notification settings - Fork 1
/
SimpleDocs.html
508 lines (393 loc) · 24 KB
/
SimpleDocs.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
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>SimpleDocs</title>
<meta http-equiv="content-type" content="text/html;charset=UTF-8">
<style type="text/css">
body
{
font-family: verdana;
font-size: 12px;
color: #333333;
}
div.page
{
width: 960px;
margin: 0 auto;
border: 1px solid lightgray;
background-color: whitesmoke;
}
div.menu
{
float: left;
width: 260px;
padding: 10px;
}
div.content
{
float: left;
width: 660px;
padding: 10px;
}
a
{
color: #4794D6;
text-decoration: none;
}
a.menulink
{
margin-left: 5px;
margin-bottom: 3px;
}
a.menulink:before
{
content: "» ";
color: orange;
}
h1
{
font-size: 16px;
font-weight: bold;
margin-top: 0px;
margin-bottom: 15px;
}
div.description
{
/*font-style: italic;*/
margin-bottom: 15px;
}
div.members
{
border: 1px solid #4794D6;
font-weight: bold;
font-size: 14px;
padding: 5px;
margin-bottom: 15px;
}
div.functions
{
border: 1px solid #4794D6;
font-weight: bold;
font-size: 14px;
padding: 5px;
margin-bottom: 15px;
}
div.access
{
font-weight: bold;
margin-bottom: 15px;
}
div.member
{
margin-bottom: 15px;
}
div.function
{
margin-bottom: 15px;
}
span.access
{
color: red;
}
span.static
{
color: red;
}
span.virtual
{
}
span.type
{
color: green;
}
span.member
{
color: blue;
}
span.function
{
color: blue;
}
span.parameter
{
color: purple;
}
span.default
{
color: darkred;
}
span.description
{
/*font-style: italic;*/
color: #717171;
}
</style>
</head>
<body>
<script type="text/javascript">
var containers = [{ "Name" : "PSP", "Description" : "Class exposing functionality useful to Payment Service Provider Modules", "Extends" : "" }, { "Name" : "PSPCardDetails", "Description" : "Class representing credit card details", "Extends" : "" }, { "Name" : "PSPCustomerDetails", "Description" : "Class representing customer details", "Extends" : "" }, { "Name" : "PSPI", "Description" : "Interface exposing payment functionality", "Extends" : "" }, { "Name" : "PSPPaymentMetaData", "Description" : "Class representing payment metadata", "Extends" : "" }];
var members = [];
var functions = [{ "Container" : "PSP", "Name" : "CurrencyCodeToNumericValue", "Returns" : "string", "Access" : "public", "Description" : "Converts a currency code (e.g. USD) to its numeric equivalent (e.g. 840).\nValue is returned as string to preserve any leading zeros.", "Static" : true, "Virtual" : false, "Parameters" : [{ "Name" : "currencyCode", "Type" : "string", "Default" : "", "Nullable" : false, "Description" : "Alphabetical currency code as defined by ISO 4217" }] }, { "Container" : "PSP", "Name" : "GetCallbackData", "Returns" : "object[]", "Access" : "public", "Description" : "Securely obtain data sent to application callback specified in RedirectToPaymentForm(..).\nThis function takes care of ensuring data integrity - an exception is thrown\nif data has been tampered with.\nData is returned in an associative array containing the following keys:\n- TransactionId (string value): Used to capture or cancel payment - empty string if not supported.\n- OrderId (string value).\n- Amount (integer value).\n- Currency (string value): ISO 4217 (e.g. USD, GBP, or USD).\n- MetaData (instance of PSPPaymentMetaData if provided by Payment Service Provider Module, otherwise null)", "Static" : true, "Virtual" : false, "Parameters" : [] }, { "Container" : "PSP", "Name" : "GetConfig", "Returns" : "string[]", "Access" : "public", "Description" : "Used by PSPM to obtain associative configuration array\ndefined in Config.php with key/value pairs", "Static" : true, "Virtual" : false, "Parameters" : [{ "Name" : "provider", "Type" : "string", "Default" : "", "Nullable" : false, "Description" : "Name of PSPM" }] }, { "Container" : "PSP", "Name" : "GetLogMode", "Returns" : "string", "Access" : "public", "Description" : "Returns a value indicating the current logging mode (Disabled, Simple, or Full)", "Static" : true, "Virtual" : false, "Parameters" : [] }, { "Container" : "PSP", "Name" : "GetPaymentProvider", "Returns" : "PSPI", "Access" : "public", "Description" : "Get instance of Payment Service Provider Module which implements the PSPI interface", "Static" : true, "Virtual" : false, "Parameters" : [{ "Name" : "provider", "Type" : "string", "Default" : "", "Nullable" : false, "Description" : "Name of Payment Service Provider Module" }] }, { "Container" : "PSP", "Name" : "GetProviderUrl", "Returns" : "string", "Access" : "public", "Description" : "Returns external URL to folder containing PSPM", "Static" : true, "Virtual" : false, "Parameters" : [{ "Name" : "provider", "Type" : "string", "Default" : "", "Nullable" : false, "Description" : "Name of PSPM" }] }, { "Container" : "PSP", "Name" : "GetTestMode", "Returns" : "boolean", "Access" : "public", "Description" : "Returns a value indicating whether transactions should be carried\nout in test mode, meaning no money should be charged when testing.", "Static" : true, "Virtual" : false, "Parameters" : [] }, { "Container" : "PSP", "Name" : "InvokeCallback", "Returns" : "string", "Access" : "public", "Description" : "Invoke callback - used by PSPM to invoke callbacks passed to RedirectToPaymentForm(..)", "Static" : true, "Virtual" : false, "Parameters" : [{ "Name" : "callbackUrl", "Type" : "string", "Default" : "", "Nullable" : false, "Description" : "Callback URL" }, { "Name" : "transactionId", "Type" : "string", "Default" : "", "Nullable" : false, "Description" : "Transaction ID used for further processing (e.g. Capture/Cancel).\nPass empty string if further processing is not supported." }, { "Name" : "orderId", "Type" : "string", "Default" : "", "Nullable" : false, "Description" : "Order ID" }, { "Name" : "amount", "Type" : "integer", "Default" : "", "Nullable" : false, "Description" : "Order amount in smallest possible unit (e.g. Cents for USD)" }, { "Name" : "currency", "Type" : "string", "Default" : "", "Nullable" : false, "Description" : "Currency in the format defined by ISO 4217 (e.g. USD, GBP, or USD)" }, { "Name" : "metaData", "Type" : "PSPPaymentMetaData", "Default" : "null", "Nullable" : false, "Description" : "Additional meta data related to transaction (optional)" }] }, { "Container" : "PSP", "Name" : "IsLoggingEnabled", "Returns" : "boolean", "Access" : "public", "Description" : "Returns a value indicating whether logging is enabled or not", "Static" : true, "Virtual" : false, "Parameters" : [] }, { "Container" : "PSP", "Name" : "Log", "Returns" : "", "Access" : "public", "Description" : "Log message to log file - nothing will be logged if logging has been disabled", "Static" : true, "Virtual" : false, "Parameters" : [{ "Name" : "msg", "Type" : "string", "Default" : "", "Nullable" : false, "Description" : "Message to log" }] }, { "Container" : "PSP", "Name" : "NumericValueToCurrencyCode", "Returns" : "string", "Access" : "public", "Description" : "Converts a numeric concurrency representation (e.g. 840) to its alphabetical equivalent (e.g. USD)", "Static" : true, "Virtual" : false, "Parameters" : [{ "Name" : "numericCurrencyValue", "Type" : "string", "Default" : "", "Nullable" : false, "Description" : "Numeric currency representation as defined by ISO 4217" }] }, { "Container" : "PSP", "Name" : "Post", "Returns" : "string", "Access" : "public", "Description" : "Post data to given URL", "Static" : true, "Virtual" : false, "Parameters" : [{ "Name" : "url", "Type" : "string", "Default" : "", "Nullable" : false, "Description" : "Target URL" }, { "Name" : "data", "Type" : "string[]", "Default" : "null", "Nullable" : false, "Description" : "Associative array contain data as key/value pairs" }, { "Name" : "headers", "Type" : "string[]", "Default" : "null", "Nullable" : false, "Description" : "Optional associative array contain headers as key/value pairs" }] }, { "Container" : "PSP", "Name" : "RedirectToContinueUrl", "Returns" : "", "Access" : "public", "Description" : "Redirect user to Continue URL passed to RedirectToPaymentForm(..)", "Static" : true, "Virtual" : false, "Parameters" : [{ "Name" : "url", "Type" : "string", "Default" : "", "Nullable" : false, "Description" : "Continue URL" }] }, { "Container" : "PSPCardDetails", "Name" : "ExpiryMonth", "Returns" : "integer", "Access" : "public", "Description" : "Get/set month credit card expires (1 = January, 12 = December)", "Static" : false, "Virtual" : false, "Parameters" : [{ "Name" : "newValue", "Type" : "integer", "Default" : "-1", "Nullable" : false, "Description" : "Updates expiry month for credit card if provided" }] }, { "Container" : "PSPCardDetails", "Name" : "ExpiryYear", "Returns" : "integer", "Access" : "public", "Description" : "Get/set year credit card expires (e.g. 2020)", "Static" : false, "Virtual" : false, "Parameters" : [{ "Name" : "newValue", "Type" : "integer", "Default" : "-1", "Nullable" : false, "Description" : "Updates expiry year for credit card if provided" }] }, { "Container" : "PSPCardDetails", "Name" : "Identifier", "Returns" : "string", "Access" : "public", "Description" : "Get/set credit card identifier (last 4 digits)", "Static" : false, "Virtual" : false, "Parameters" : [{ "Name" : "newValue", "Type" : "string", "Default" : "null", "Nullable" : false, "Description" : "Updates credit card identifier if provided" }] }, { "Container" : "PSPCardDetails", "Name" : "Type", "Returns" : "string", "Access" : "public", "Description" : "Get/set credit card type (e.g. VISA, Mastercard, etc.)", "Static" : false, "Virtual" : false, "Parameters" : [{ "Name" : "newValue", "Type" : "string", "Default" : "null", "Nullable" : false, "Description" : "Updates credit card type if provided" }] }, { "Container" : "PSPCustomerDetails", "Name" : "Country", "Returns" : "string", "Access" : "public", "Description" : "Get/set customer's country", "Static" : false, "Virtual" : false, "Parameters" : [{ "Name" : "newValue", "Type" : "string", "Default" : "null", "Nullable" : false, "Description" : "Updates country if provided" }] }, { "Container" : "PSPCustomerDetails", "Name" : "IpAddress", "Returns" : "string", "Access" : "public", "Description" : "Get/set customer's IP address", "Static" : false, "Virtual" : false, "Parameters" : [{ "Name" : "newValue", "Type" : "string", "Default" : "null", "Nullable" : false, "Description" : "Updates IP address if provided" }] }, { "Container" : "PSPI", "Name" : "CancelPayment", "Returns" : "boolean", "Access" : "public", "Description" : "Cancel payment previously authorized using payment form - returns True on success, otherwise False", "Static" : false, "Virtual" : false, "Parameters" : [{ "Name" : "transactionId", "Type" : "string", "Default" : "", "Nullable" : false, "Description" : "Unique ID identifying transaction" }] }, { "Container" : "PSPI", "Name" : "CapturePayment", "Returns" : "boolean", "Access" : "public", "Description" : "Capture payment previously authorized using payment form - returns True on success, otherwise False", "Static" : false, "Virtual" : false, "Parameters" : [{ "Name" : "transactionId", "Type" : "string", "Default" : "", "Nullable" : false, "Description" : "Unique ID identifying transaction" }, { "Name" : "amount", "Type" : "integer", "Default" : "", "Nullable" : false, "Description" : "Amount to withdraw in smallest possible unit (e.g. Cents for USD)" }] }, { "Container" : "PSPI", "Name" : "RedirectToPaymentForm", "Returns" : "", "Access" : "public", "Description" : "Redirects user to payment form/window", "Static" : false, "Virtual" : false, "Parameters" : [{ "Name" : "orderId", "Type" : "string", "Default" : "", "Nullable" : false, "Description" : "Unique ID identifying payment" }, { "Name" : "amount", "Type" : "integer", "Default" : "", "Nullable" : false, "Description" : "Order amount in smallest possible unit (e.g. Cents for USD)" }, { "Name" : "currency", "Type" : "string", "Default" : "", "Nullable" : false, "Description" : "Currency in the format defined by ISO 4217 (e.g. USD, GBP, or USD)" }, { "Name" : "continueUrl", "Type" : "string", "Default" : "", "Nullable" : false, "Description" : "URL to which user is redirected after completing payment - e.g. a receipt" }, { "Name" : "callbackUrl", "Type" : "string", "Default" : "", "Nullable" : false, "Description" : "URL called asynchronously when payment is successfully carried through.\nUse PSP::GetCallbackData() to obtain OrderId, TransactionId, Amount, Currency, and MetaData." }] }, { "Container" : "PSPPaymentMetaData", "Name" : "GetCard", "Returns" : "PSPCardDetails", "Access" : "public", "Description" : "Get credit card information", "Static" : false, "Virtual" : false, "Parameters" : [] }, { "Container" : "PSPPaymentMetaData", "Name" : "GetCustomer", "Returns" : "PSPCustomerDetails", "Access" : "public", "Description" : "Get customer information", "Static" : false, "Virtual" : false, "Parameters" : [] }, { "Container" : "PSPPaymentMetaData", "Name" : "PSPPaymentMetaData", "Returns" : "", "Access" : "public", "Description" : "Create instance of PSPPaymentMetaData", "Static" : false, "Virtual" : false, "Parameters" : [] }];
window.onload = initialize;
function initialize()
{
if (navigator.userAgent.indexOf("MSIE 5") > -1 || navigator.userAgent.indexOf("MSIE 6") > -1 || navigator.userAgent.indexOf("MSIE 7") > -1)
{
alert("Please upgrade to a more recent version of Internet Explorer");
return;
}
buildMenu();
if (location.href.indexOf("#") > -1)
loadDocumentation(location.href.substring(location.href.indexOf("#") + 1));
else
buildFrontPage();
document.onkeypress = keyListener;
}
function keyListener(e)
{
e = (window.event ? window.event : e);
if (e.keyCode === 115) // Listen for S key
search();
}
function buildMenu()
{
// Build menu
var menu = document.getElementById("menu");
menu.appendChild(createElement("h1", "Containers"));
var search = createElement("a");
search.href = "javascript: search()";
search.innerHTML = "Search";
menu.appendChild(search);
menu.appendChild(createElement("br"));
// Create links to containers
for (var i = 0 ; i < containers.length ; i++)
{
// Skip special containers except @GlobalScope
if (containers[i].Name.indexOf("@") === 0 && containers[i].Name !== "@GlobalScope")
continue;
menu.appendChild(createElement("br"));
menu.appendChild(createMenuLink(containers[i].Name));
}
}
function buildFrontPage()
{
var content = document.getElementById("content");
content.appendChild(createElement("h1", "Documentation"));
for (var i = 0 ; i < containers.length ; i++)
{
if (containers[i].Name === "@FrontPage")
{
content.appendChild(createElement("span", containers[i].Description.replace(/\n/g, "<br>")));
return;
}
}
content.appendChild(createElement("span", "Please select a container to load documentation.<br>Press S or click the Search link to search available members and functions."));
}
function loadDocumentation(container)
{
window.scrollTo(0, 0);
var content = document.getElementById("content");
content.innerHTML = "";
// Load container details
var containerInfo = getElementByName(containers, container);
if (containerInfo === null)
return;
// Set headline and description
content.appendChild(createElement("h1", containerInfo.Name + (containerInfo.Extends !== "" ? " (extends " + containerInfo.Extends + ")" : "")));
content.appendChild(createElement("div", containerInfo.Description.replace(/\n/g, "<br>"), "description"));
// Load members
var headerPrinted = false;
var access = "";
var accessItem = null;
for (var i = 0 ; i < members.length ; i++)
{
if (members[i].Container !== container) // skip member - does not belong to this container
continue;
// Add members header
if (headerPrinted === false)
{
headerPrinted = true;
content.appendChild(createElement("div", "Members", "members"));
}
// Add access header (e.g. "public static") under which members are grouped
if (members[i].Access + (members[i].Static === true ? " static" : "") !== access)
{
access = members[i].Access + (members[i].Static === true ? " static" : "");
content.appendChild(createElement("div", access, "access"));
}
// Add member
content.appendChild(createMemberDocumentation(members[i]));
}
headerPrinted = false;
access = "";
for (var i = 0 ; i < functions.length ; i++)
{
if (functions[i].Container !== container) // skip function - does not belong to this container
continue;
// Add functions header
if (headerPrinted === false)
{
headerPrinted = true;
content.appendChild(createElement("div", "Functions", "functions"));
}
// Add access header (e.g. "public static") under which functions are grouped
if (functions[i].Access + (functions[i].Static === true ? " static" : "") !== access)
{
access = functions[i].Access + (functions[i].Static === true ? " static" : "");
content.appendChild(createElement("div", access, "access"));
}
// Add function
content.appendChild(createFunctionDocumentation(functions[i]));
}
}
function createMenuLink(container)
{
var link = createElement("a");
link.href = "#" + container;
link.innerHTML = container;
link.setAttribute("onclick", "loadDocumentation('" + container + "');");
link.setAttribute("class", "menulink");
return link;
}
function createMemberDocumentation(member, prefixContainer)
{
var format = "{[Container]} {[>]} {[Access]} {[Static]} {[Type]} {[Name]} {[=]} {[Default]}";
format = format.replace("{[Container]}", (prefixContainer !== undefined && prefixContainer === true ? "<a href='#" + member.Container + "' onclick=\"loadDocumentation('" + member.Container + "')\">" + member.Container + "</a>" : ""));
format = format.replace("{[>]}", (prefixContainer !== undefined && prefixContainer === true ? ">" : ""));
format = format.replace("{[Access]}", (member.Access !== "" ? "<span class='access'>" + member.Access + "</span>" : ""));
format = format.replace("{[Static]}", (member.Static === true ? "<span class='static'>static</span>" : ""));
format = format.replace("{[Type]}", (member.Type !== "" ? "<span class='type'>" + member.Type + "</span>" : ""));
format = format.replace("{[Name]}", "<span class='member'>" + member.Name + "</span>");
format = format.replace("{[=]}", (member.Default !== "" ? "=" : ""));
format = format.replace("{[Default]}", (member.Default !== "" ? (member.Type.toLowerCase() === "string" && member.Default.toLowerCase() !== "null" ? "\"" : "") + "<span class='default'>" + (member.Default.toLowerCase() !== "string.empty" ? member.Default : "") + "</span>" + (member.Type.toLowerCase() === "string" && member.Default.toLowerCase() !== "null" ? "\"" : "") : ""));
format += (member.Description !== "" ? "<br><span class='description'>" + member.Description.replace(/\n/g, "<br>") + "</span>" : "");
return createElement("div", format, "member");
}
function createFunctionDocumentation(func, prefixContainer)
{
var formatFunction = "{[Container]} {[>]} {[Access]} {[Static]} {[Virtual]} {[Returns]} {[Name]}";
var formatParm = "{[Type]} {[Name]} {[=]} {[Default]}";
var formatParmDescription = "@{[Name]} = {[Description]}";
var parm = "";
var parms = "";
for (var i = 0 ; i < func.Parameters.length ; i++)
{
parm = formatParm;
parm = parm.replace("{[Type]}", (func.Parameters[i].Type !== "" ? "<span class='type'>" + func.Parameters[i].Type + "</span>" : ""));
parm = parm.replace("{[Name]}", "<span class='parameter'>" + func.Parameters[i].Name + "</span>");
parm = parm.replace("{[=]}", (func.Parameters[i].Default !== "" ? "=" : ""));
parm = parm.replace("{[Default]}", (func.Parameters[i].Default !== "" ? (func.Parameters[i].Type.toLowerCase() === "string" && func.Parameters[i].Default.toLowerCase() !== "null" ? "\"" : "") + "<span class='default'>" + (func.Parameters[i].Default.toLowerCase() !== "string.empty" ? func.Parameters[i].Default : "") + "</span>" + (func.Parameters[i].Type.toLowerCase() === "string" && func.Parameters[i].Default.toLowerCase() !== "null" ? "\"" : "") : ""));
parms += (parms != "" ? " , " : "") + parm;
}
formatFunction = formatFunction.replace("{[Container]}", (prefixContainer !== undefined && prefixContainer === true ? "<a href='#" + func.Container + "' onclick=\"loadDocumentation('" + func.Container + "')\">" + func.Container + "</a>" : ""));
formatFunction = formatFunction.replace("{[>]}", (prefixContainer !== undefined && prefixContainer === true ? ">" : ""));
formatFunction = formatFunction.replace("{[Access]}", (func.Access !== "" ? "<span class='access'>" + func.Access + "</span>" : ""));
formatFunction = formatFunction.replace("{[Static]}", (func.Static === true ? "<span class='static'>static</span>" : ""));
formatFunction = formatFunction.replace("{[Virtual]}", (func.Virtual === true ? "<span class='virtual'>virtual</span>" : ""));
formatFunction = formatFunction.replace("{[Returns]}", (func.Returns !== "" ? "<span class='type'>" + func.Returns + "</span>" : ""));
formatFunction = formatFunction.replace("{[Name]}", "<span class='function'>" + func.Name + "</span>( " + parms + " )");
formatFunction += (func.Description !== "" ? "<br><span class='description'>" + func.Description.replace(/\n/g, "<br>") + "</span>" : "");
for (var i = 0 ; i < func.Parameters.length ; i++)
{
formatFunction += "<br>" + formatParmDescription;
formatFunction = formatFunction.replace("{[Name]}", "<span class='parameter'>" + func.Parameters[i].Name + "</span>");
formatFunction = formatFunction.replace("{[Description]}", "<span class='description'>" + func.Parameters[i].Description.replace(/\n/g, "<br>") + "</span>");
}
return createElement("div", formatFunction, "function");
}
function createElement(type, value, cls)
{
var e = document.createElement(type);
if (value !== undefined)
e.innerHTML = value;
if (cls !== undefined)
e.setAttribute("class", cls);
return e;
}
function getElementByName(arr, n)
{
for (var i = 0 ; i < arr.length ; i++)
if (arr[i].Name === n)
return arr[i];
return null;
}
function arrayContains(arr, element)
{
for (var i = 0 ; i < arr.length ; i++)
if (arr[i] === element)
return true;
return false;
}
function search()
{
var s = prompt("Search functions and members by name.\nEnter +<search> to also search parameters and descriptions.", "");
if (s === null || s === "")
return;
// Clear content
window.scrollTo(0, 0);
var content = document.getElementById("content");
content.innerHTML = "";
// Determine whether to do simple or full search
var searchAll = (s.indexOf("+") === 0);
s = (searchAll === true ? s.substring(1) : s);
// Add headline
content.appendChild(createElement("h1", "Search results - " + s + (searchAll === true ? " (searching everything)" : "")));
// Search members
s = s.toLowerCase();
var headerPrinted = false;
for (var i = 0 ; i < members.length ; i++)
{
if (searchAll === false && members[i].Name.toLowerCase().indexOf(s) === -1)
continue
else if (searchAll === true && members[i].Name.toLowerCase().indexOf(s) === -1 && members[i].Description.toLowerCase().indexOf(s) === -1)
continue
if (headerPrinted === false)
{
headerPrinted = true;
content.appendChild(createElement("div", "Members", "members"));
}
content.appendChild(createMemberDocumentation(members[i], true));
}
// Search functions
headerPrinted = false;
var skip = false;
for (var i = 0 ; i < functions.length ; i++)
{
skip = false;
if (searchAll === false && functions[i].Name.toLowerCase().indexOf(s) === -1)
{
continue
}
else if (searchAll === true)
{
if (functions[i].Name.toLowerCase().indexOf(s) === -1 && functions[i].Description.toLowerCase().indexOf(s) === -1)
{
skip = true;
for (j = 0 ; j < functions[i].Parameters.length ; j++)
{
skip = (functions[i].Parameters[j].Name.toLowerCase().indexOf(s) === -1 && functions[i].Parameters[j].Description.toLowerCase().indexOf(s) === -1);
if (skip === false)
break;
}
}
}
if (skip === true)
continue;
if (headerPrinted == false)
{
headerPrinted = true;
content.appendChild(createElement("div", "Functions", "functions"));
}
content.appendChild(createFunctionDocumentation(functions[i], true));
}
}
</script>
<div class="page">
<div id="menu" class="menu">
</div>
<div id="content" class="content">
</div>
<div style="clear: both"></div>
</div>
</body>
</html>