dphelper 1.9.24 → 1.9.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CODE_OF_CONDUCT.md +12 -12
- package/CONTRIBUTING.md +3 -3
- package/HISTORY.md +1 -1
- package/LICENSE.md +17 -5
- package/README.md +46 -11
- package/SECURITY.md +1 -1
- package/SUMMARY.md +1 -0
- package/docs/index.md +46 -11
- package/documents/SESSION.md +58 -0
- package/documents/STATE.md +2 -0
- package/documents/STORE.md +2 -0
- package/documents/TOOLS.md +1145 -475
- package/index.js +1 -1
- package/package.json +11 -17
package/documents/TOOLS.md
CHANGED
|
@@ -2,612 +2,1282 @@
|
|
|
2
2
|
|
|
3
3
|
## Overview
|
|
4
4
|
|
|
5
|
-
This document provides a comprehensive list of all available functions in the
|
|
5
|
+
This document provides a comprehensive list of all available functions in the ```js
|
|
6
|
+
dphelper` library along with their descriptions.
|
|
6
7
|
|
|
7
8
|
## Functions
|
|
8
9
|
|
|
9
10
|
### Anchor
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
```js
|
|
13
|
+
dphelper.anchor.toOnClick(el)
|
|
14
|
+
// Converts an element's href attribute to an onclick event.
|
|
15
|
+
```
|
|
13
16
|
|
|
14
17
|
### Array
|
|
15
18
|
|
|
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
|
-
|
|
19
|
+
```js
|
|
20
|
+
dphelper.array.find(array, key)
|
|
21
|
+
// Finds an element in an array by key.
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
dphelper.array.unique(array)
|
|
26
|
+
// Returns an array with unique elements.
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
dphelper.array.delete(array, key)
|
|
31
|
+
// Deletes an element from an array by key.
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
dphelper.array.merge(arrayA, arrayB)
|
|
36
|
+
// Merges two arrays.
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
```js
|
|
40
|
+
dphelper.array.mergeByKey(arrayA, arrayB, key)
|
|
41
|
+
// Merges two arrays by a specific key.
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
dphelper.array.asc(array)
|
|
46
|
+
// Sorts an array in ascending order.
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
```js
|
|
50
|
+
dphelper.array.desc(array)
|
|
51
|
+
// Sorts an array in descending order.
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
```js
|
|
55
|
+
dphelper.array.duplicates(array)
|
|
56
|
+
// Returns an array of duplicate elements.
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
```js
|
|
60
|
+
dphelper.array.even(array)
|
|
61
|
+
// Returns an array of even numbers.
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
```js
|
|
65
|
+
dphelper.array.odd(array)
|
|
66
|
+
// Returns an array of odd numbers.
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
```js
|
|
70
|
+
dphelper.array.toObj(array)
|
|
71
|
+
// Converts an array to an object.
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
```js
|
|
75
|
+
dphelper.array.sumColumn(array, column)
|
|
76
|
+
// Sums the values of a specific column in an array.
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
```js
|
|
80
|
+
dphelper.array.shuffle(array)
|
|
81
|
+
// Shuffles the elements of an array.
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
```js
|
|
85
|
+
dphelper.array.generate(num)
|
|
86
|
+
// Generates an array with a specified number of elements.
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
```js
|
|
90
|
+
dphelper.array.testArrayInt(array)
|
|
91
|
+
// Tests if the elements of an array are integers.
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
```js
|
|
95
|
+
dphelper.array.rand32(number)
|
|
96
|
+
// Generates a random 32-bit number.
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
```js
|
|
100
|
+
dphelper.array.findindex(array, key)
|
|
101
|
+
// Finds the index of an element in an array by key.
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
```js
|
|
105
|
+
dphelper.array.pathToJson(array, separator?)
|
|
106
|
+
// Converts an array to a JSON object using a separator.
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
```js
|
|
110
|
+
deepClone(src)
|
|
111
|
+
// Creates a deep clone of an object.
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
```js
|
|
115
|
+
dphelper.array.match(arrayWords, arrayToCheck)
|
|
116
|
+
// Checks if two arrays match.
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
```js
|
|
120
|
+
dphelper.array.shallow(array)
|
|
121
|
+
// Generate a shallow copy of an object.
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
```js
|
|
125
|
+
dphelper.array.deeCopy(array)
|
|
126
|
+
// Generate a structured copy of an object.
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
```js
|
|
130
|
+
dphelper.array.groupBy(array, key)
|
|
131
|
+
// Generate a structured copy of an object.
|
|
132
|
+
```
|
|
62
133
|
|
|
63
134
|
### Audio
|
|
64
135
|
|
|
65
|
-
|
|
66
|
-
|
|
136
|
+
```js
|
|
137
|
+
dphelper.audio.play(url)
|
|
138
|
+
// Plays an audio file from a URL.
|
|
139
|
+
```
|
|
67
140
|
|
|
68
141
|
### Avoid
|
|
69
142
|
|
|
70
|
-
|
|
71
|
-
|
|
143
|
+
```js
|
|
144
|
+
dphelper.avoid.cache(uri)
|
|
145
|
+
// Caches a URI.
|
|
146
|
+
```
|
|
72
147
|
|
|
73
148
|
### Browser
|
|
74
149
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
150
|
+
```js
|
|
151
|
+
dphelper.browser.state(state, title, url)
|
|
152
|
+
// Changes the browser state.
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
```js
|
|
156
|
+
dphelper.browser.forw(times)
|
|
157
|
+
// Moves forward in the browser history.
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
```js
|
|
161
|
+
dphelper.browser.back(times)
|
|
162
|
+
// Moves backward in the browser history.
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
```js
|
|
166
|
+
dphelper.browser.reload()
|
|
167
|
+
// Reloads the current page.
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
```js
|
|
171
|
+
dphelper.browser.href(url)
|
|
172
|
+
// Navigates to a URL.
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
```js
|
|
176
|
+
dphelper.browser.offLine(text?)
|
|
177
|
+
// Displays an offline message.
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
```js
|
|
181
|
+
dphelper.browser.zoom()
|
|
182
|
+
// Gets the current zoom level.
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
```js
|
|
186
|
+
dphelper.browser.status(code)
|
|
187
|
+
// Gets the status text for a status code.
|
|
188
|
+
```
|
|
91
189
|
|
|
92
190
|
### Check
|
|
93
191
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
192
|
+
```js
|
|
193
|
+
dphelper.check.url(url)
|
|
194
|
+
// Checks if a URL is valid.
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
```js
|
|
198
|
+
dphelper.check.version(v1, v2, opts)
|
|
199
|
+
// Compares two version strings.
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
```js
|
|
203
|
+
dphelper.check.npmVer(npm)
|
|
204
|
+
// Gets the version of an npm package.
|
|
205
|
+
```
|
|
100
206
|
|
|
101
207
|
### Color
|
|
102
208
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
209
|
+
```js
|
|
210
|
+
dphelper.color.hex(c)
|
|
211
|
+
// Converts a color to hex format.
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
```js
|
|
215
|
+
dphelper.color.toHex(rgb)
|
|
216
|
+
// Converts RGB to hex format.
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
```js
|
|
220
|
+
dphelper.color.toRGB(c)
|
|
221
|
+
// Converts a color to RGB format.
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
```js
|
|
225
|
+
dphelper.color.oleColor(c)
|
|
226
|
+
// Converts a color to OLE format.
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
```js
|
|
230
|
+
dphelper.color.gradient(colorStart, colorEnd, colorCount)
|
|
231
|
+
// Generates a gradient between two colors.
|
|
232
|
+
```
|
|
113
233
|
|
|
114
234
|
### Console
|
|
115
235
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
236
|
+
```js
|
|
237
|
+
dphelper.console.info(name, message, fn)
|
|
238
|
+
// Logs an info message to the console.
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
```js
|
|
242
|
+
dphelper.console.stop(options?[])
|
|
243
|
+
// Stops the console.
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
```js
|
|
247
|
+
dphelper.console.toHtml(el)
|
|
248
|
+
// Converts console output to HTML.
|
|
249
|
+
```
|
|
122
250
|
|
|
123
251
|
### Cookie
|
|
124
252
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
253
|
+
```js
|
|
254
|
+
dphelper.cookie.set(params: { name, value, time?, path?: "/", sameSite?: "Lax", secure?: "Secure" | "false" })
|
|
255
|
+
// Sets a cookie.
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
```js
|
|
259
|
+
dphelper.cookie.get(name)
|
|
260
|
+
// Gets a cookie by name.
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
```js
|
|
264
|
+
dphelper.cookie.delete(name)
|
|
265
|
+
// Deletes a cookie by name.
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
```js
|
|
269
|
+
dphelper.cookie.removeAll()
|
|
270
|
+
// Clears all cookies.
|
|
271
|
+
```
|
|
133
272
|
|
|
134
273
|
### Coords
|
|
135
274
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
275
|
+
```js
|
|
276
|
+
dphelper.coods.degreesToRadians(degrees)
|
|
277
|
+
// Converts degrees to radians.
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
```js
|
|
281
|
+
dphelper.coods.latToMeters(points)
|
|
282
|
+
// Converts latitude to meters.
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
```js
|
|
286
|
+
dphelper.coods.toVector(points)
|
|
287
|
+
// Converts points to a vector.
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
```js
|
|
291
|
+
dphelper.coods.convertToDecDegrees(deg, minutes, sec, direction)
|
|
292
|
+
// Converts coordinates to decimal degrees.
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
```js
|
|
296
|
+
dphelper.coods.distance(point1, point2)
|
|
297
|
+
// Calculates the distance between two points.
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
```js
|
|
301
|
+
dphelper.coods.polarToCartesian(centerX, centerY, radius, angleInDegrees)
|
|
302
|
+
// Converts polar coordinates to Cartesian coordinates.
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
```js
|
|
306
|
+
dphelper.coods.mapDegreesToPixels(degree, minDegree, maxDegree, minPixel, maxPixel, padding)
|
|
307
|
+
// Maps degrees to pixels.
|
|
308
|
+
```
|
|
150
309
|
|
|
151
310
|
### Date
|
|
152
311
|
|
|
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
|
-
|
|
312
|
+
```js
|
|
313
|
+
dphelper.date.days(lang?)
|
|
314
|
+
// Returns the days of the week in a specified language.
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
```js
|
|
318
|
+
dphelper.date.months(lang?)
|
|
319
|
+
// Returns the months of the year in a specified language.
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
```js
|
|
323
|
+
dphelper.date.year()
|
|
324
|
+
// Returns the current year.
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
```js
|
|
328
|
+
dphelper.date.toIso(value, int?)
|
|
329
|
+
// Converts a date to ISO format.
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
```js
|
|
333
|
+
dphelper.date.toMMDDYYYY(value)
|
|
334
|
+
// Converts a date to MM/DD/YYYY format.
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
```js
|
|
338
|
+
dphelper.date.toYYYYMMDD(value)
|
|
339
|
+
// Converts a date to YYYY/MM/DD format.
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
```js
|
|
343
|
+
dphelper.date.toHuman(value)
|
|
344
|
+
// Converts a date to a human-readable format.
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
```js
|
|
348
|
+
dphelper.date.convert(value, format[])
|
|
349
|
+
// Converts a date to a specified format.
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
```js
|
|
353
|
+
dphelper.date.iso2Epoch(value)
|
|
354
|
+
// Converts an ISO date to epoch time.
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
```js
|
|
358
|
+
dphelper.date.localIsoTime(value)
|
|
359
|
+
// Converts a date to local ISO time.
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
```js
|
|
363
|
+
dphelper.date.utc()
|
|
364
|
+
// Returns the current UTC time.
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
```js
|
|
368
|
+
dphelper.date.parse(value, separator?)
|
|
369
|
+
// Parses a date string.
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
```js
|
|
373
|
+
dphelper.date.addDays(date, days)
|
|
374
|
+
// Adds days to a date.
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
```js
|
|
378
|
+
dphelper.date.dateTimeToString(dateObject)
|
|
379
|
+
// Converts a date object to a string.
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
```js
|
|
383
|
+
dphelper.date.isoToHuman(value, symbol?)
|
|
384
|
+
// Converts an ISO date to a human-readable format.
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
```js
|
|
388
|
+
dphelper.date.fullDate()
|
|
389
|
+
// Returns the full date.
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
```js
|
|
393
|
+
dphelper.date.epoch()
|
|
394
|
+
// Returns the current epoch time.
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
```js
|
|
398
|
+
dphelper.date.diffInDays(d1, d2)
|
|
399
|
+
// Calculates the difference in days between two dates.
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
```js
|
|
403
|
+
dphelper.date.diffInWeeks(d1, d2)
|
|
404
|
+
// Calculates the difference in weeks between two dates.
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
```js
|
|
408
|
+
dphelper.date.diffInMonths(d1, d2)
|
|
409
|
+
// Calculates the difference in months between two dates.
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
```js
|
|
413
|
+
dphelper.date.diffInYears(d1, d2)
|
|
414
|
+
// Calculates the difference in years between two dates.
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
```js
|
|
418
|
+
dphelper.date.dateToYMD(date)
|
|
419
|
+
// Converts a date to YYYY-MM-DD format.
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
```js
|
|
423
|
+
dphelper.date.collection(params: { date?; type; locale? })
|
|
424
|
+
// Returns a collection of dates.
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
```js
|
|
428
|
+
dphelper.date.timeZones()
|
|
429
|
+
// Returns a list of time zones.
|
|
430
|
+
```
|
|
201
431
|
|
|
202
432
|
### Disable
|
|
203
433
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
-
|
|
217
|
-
|
|
434
|
+
```js
|
|
435
|
+
dphelper.disable.select(el?)
|
|
436
|
+
// Disables text selection.
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
```js
|
|
440
|
+
dphelper.disable.spellCheck(tmr?)
|
|
441
|
+
// Disables spell check.
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
```js
|
|
445
|
+
dphelper.disable.rightClick(el?)
|
|
446
|
+
// Disables right-click.
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
```js
|
|
450
|
+
dphelper.disable.copy(el?)
|
|
451
|
+
// Disables copy.
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
```js
|
|
455
|
+
dphelper.disable.paste(el?)
|
|
456
|
+
// Disables paste.
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
```js
|
|
460
|
+
dphelper.disable.cut(el?)
|
|
461
|
+
// Disables cut.
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
```js
|
|
465
|
+
dphelper.disable.drag(el?)
|
|
466
|
+
// Disables drag.
|
|
467
|
+
```
|
|
218
468
|
|
|
219
469
|
### Dispatch
|
|
220
470
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
471
|
+
```js
|
|
472
|
+
dphelper.dispatch.set(name, value?)
|
|
473
|
+
// Sets a dispatch event.
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
```js
|
|
477
|
+
dphelper.dispatch.listen(name, cb?, flag?)
|
|
478
|
+
// Listens for a dispatch event.
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
```js
|
|
482
|
+
dphelper.dispatch.remove(name)
|
|
483
|
+
// Removes a dispatch event.
|
|
484
|
+
```
|
|
227
485
|
|
|
228
486
|
### Element
|
|
229
487
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
488
|
+
```js
|
|
489
|
+
dphelper.element.fitScale(el, scale?, fit?)
|
|
490
|
+
// Fits an element to a scale.
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
```js
|
|
494
|
+
dphelper.element.scaleBasedOnWindow(elm, scale, fit)
|
|
495
|
+
// Scales an element based on the window size.
|
|
496
|
+
```
|
|
234
497
|
|
|
235
498
|
### Events
|
|
236
499
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
500
|
+
```js
|
|
501
|
+
dphelper.events.list(el)
|
|
502
|
+
// Lists all events on an element.
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
```js
|
|
506
|
+
dphelper.events.multi(element, eventNames, listenerListener)
|
|
507
|
+
// Adds multiple event listeners to an element.
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
```js
|
|
511
|
+
dphelper.events.copy(el)
|
|
512
|
+
// Copies an element.
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
```js
|
|
516
|
+
dphelper.events.onDrag(elem)
|
|
517
|
+
// Adds a drag event to an element.
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
```js
|
|
521
|
+
dphelper.events.keys(e): { key; ctrl; alt; shift }
|
|
522
|
+
// Gets the key, ctrl, alt, and shift status from a keyboard event.
|
|
523
|
+
```
|
|
247
524
|
|
|
248
525
|
### Form
|
|
249
526
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
527
|
+
```js
|
|
528
|
+
dphelper.form.serialize(form): { [key] }
|
|
529
|
+
// Serializes a form to an object.
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
```js
|
|
533
|
+
dphelper.form.confirmType(type, value)
|
|
534
|
+
// Confirms the type of a value.
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
```js
|
|
538
|
+
dphelper.form.required(value)
|
|
539
|
+
// Checks if a value is required.
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
```js
|
|
543
|
+
dphelper.form.minLength(value, num?)
|
|
544
|
+
// Checks if a value meets the minimum length.
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
```js
|
|
548
|
+
dphelper.form.maxLength(value, num?)
|
|
549
|
+
// Checks if a value exceeds the maximum length.
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
```js
|
|
553
|
+
dphelper.form.maxPhoneNumber(value, num?)
|
|
554
|
+
// Checks if a phone number exceeds the maximum length.
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
```js
|
|
558
|
+
dphelper.form.isNumeric(value)
|
|
559
|
+
// Checks if a value is numeric.
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
```js
|
|
563
|
+
dphelper.form.isEmail(value)
|
|
564
|
+
// Checks if a value is an email.
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
```js
|
|
568
|
+
dphelper.form.pattern(e)
|
|
569
|
+
// Validates a pattern.
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
```js
|
|
573
|
+
dphelper.form.noSpecialChars(e)
|
|
574
|
+
// Disallows special characters.
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
```js
|
|
578
|
+
dphelper.form.table(size, id, elem)
|
|
579
|
+
// Creates a table.
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
```js
|
|
583
|
+
dphelper.form.sanitize(str)
|
|
584
|
+
// Sanitizes a string.
|
|
585
|
+
```
|
|
274
586
|
|
|
275
587
|
### Format
|
|
276
588
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
589
|
+
```js
|
|
590
|
+
dphelper.format.currency(value, locale?, currency?)
|
|
591
|
+
// Formats a value as currency.
|
|
592
|
+
```
|
|
593
|
+
|
|
594
|
+
```js
|
|
595
|
+
dphelper.format.phoneNumber(value, countryCode?)
|
|
596
|
+
// Formats a phone number.
|
|
597
|
+
```
|
|
281
598
|
|
|
282
599
|
### Imports
|
|
283
600
|
|
|
284
|
-
|
|
285
|
-
|
|
601
|
+
```js
|
|
602
|
+
dphelper.imports.file(elem, file)
|
|
603
|
+
// Imports a file.
|
|
604
|
+
```
|
|
286
605
|
|
|
287
606
|
### Json
|
|
288
607
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
608
|
+
```js
|
|
609
|
+
dphelper.json.counter(json, key?, val?)
|
|
610
|
+
// Counts occurrences in a JSON object.
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
```js
|
|
614
|
+
dphelper.json.toCsv(jsonInput)
|
|
615
|
+
// Converts JSON to CSV.
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
```js
|
|
619
|
+
dphelper.json.saveCsvAs(csvData, fileName)
|
|
620
|
+
// Saves CSV data as a file.
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
```js
|
|
624
|
+
dphelper.json.is(str)
|
|
625
|
+
// Checks if a string is valid JSON.
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
```js
|
|
629
|
+
dphelper.json.parse(file)
|
|
630
|
+
// Parses a JSON file.
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
```js
|
|
634
|
+
dphelper.json.sanitize(str)
|
|
635
|
+
// Sanitizes a JSON string.
|
|
636
|
+
```
|
|
637
|
+
|
|
638
|
+
```js
|
|
639
|
+
dphelper.json.sanitizeJsonValue(str)
|
|
640
|
+
// Sanitizes a JSON value.
|
|
641
|
+
```
|
|
303
642
|
|
|
304
643
|
### Load
|
|
305
644
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
645
|
+
```js
|
|
646
|
+
dphelper.load.all(context, cacheName?)
|
|
647
|
+
// Loads all modules in a context.
|
|
648
|
+
```
|
|
649
|
+
|
|
650
|
+
```js
|
|
651
|
+
dphelper.load.file(filePath)
|
|
652
|
+
// Loads a file.
|
|
653
|
+
```
|
|
654
|
+
|
|
655
|
+
```js
|
|
656
|
+
dphelper.load.fileToElement(elementSelector, filePath)
|
|
657
|
+
// Loads a file into an element.
|
|
658
|
+
```
|
|
659
|
+
|
|
660
|
+
```js
|
|
661
|
+
dphelper.load.json(filePath)
|
|
662
|
+
// Loads a JSON file.
|
|
663
|
+
```
|
|
664
|
+
|
|
665
|
+
```js
|
|
666
|
+
dphelper.load.remote(path, method?, headers?)
|
|
667
|
+
// Loads data from a remote URL.
|
|
668
|
+
```
|
|
669
|
+
|
|
670
|
+
```js
|
|
671
|
+
dphelper.load.script(scripts[], elementSelector?)
|
|
672
|
+
// Loads scripts.
|
|
673
|
+
```
|
|
674
|
+
|
|
675
|
+
```js
|
|
676
|
+
dphelper.load.toJson(context, cacheName?)
|
|
677
|
+
// Converts a context to JSON.
|
|
678
|
+
```
|
|
320
679
|
|
|
321
680
|
### Logging
|
|
322
681
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
682
|
+
```js
|
|
683
|
+
dphelper.logging.list: { type; message }
|
|
684
|
+
// List of log messages.
|
|
685
|
+
```
|
|
686
|
+
|
|
687
|
+
```js
|
|
688
|
+
dphelper.logging.reg(txt)
|
|
689
|
+
// Logs a regular message.
|
|
690
|
+
```
|
|
691
|
+
|
|
692
|
+
```js
|
|
693
|
+
dphelper.logging.debug(txt)
|
|
694
|
+
// Logs a debug message.
|
|
695
|
+
```
|
|
696
|
+
|
|
697
|
+
```js
|
|
698
|
+
dphelper.logging.error(txt)
|
|
699
|
+
// Logs an error message.
|
|
700
|
+
```
|
|
331
701
|
|
|
332
702
|
### Math
|
|
333
703
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
704
|
+
```js
|
|
705
|
+
dphelper.math.rnd()
|
|
706
|
+
// Generates a random number.
|
|
707
|
+
```
|
|
708
|
+
|
|
709
|
+
```js
|
|
710
|
+
dphelper.math.tmr()
|
|
711
|
+
// Returns the current time in milliseconds.
|
|
712
|
+
```
|
|
713
|
+
|
|
714
|
+
```js
|
|
715
|
+
dphelper.math.add(a, b)
|
|
716
|
+
// Adds two numbers.
|
|
717
|
+
```
|
|
718
|
+
|
|
719
|
+
```js
|
|
720
|
+
dphelper.math.sub(a, b)
|
|
721
|
+
// Subtracts two numbers.
|
|
722
|
+
```
|
|
723
|
+
|
|
724
|
+
```js
|
|
725
|
+
dphelper.math.multi(a, b)
|
|
726
|
+
// Multiplies two numbers.
|
|
727
|
+
```
|
|
728
|
+
|
|
729
|
+
```js
|
|
730
|
+
dphelper.math.div(a, b)
|
|
731
|
+
// Divides two numbers.
|
|
732
|
+
```
|
|
733
|
+
|
|
734
|
+
```js
|
|
735
|
+
dphelper.math.rem(a, b)
|
|
736
|
+
// Returns the remainder of two numbers.
|
|
737
|
+
```
|
|
738
|
+
|
|
739
|
+
```js
|
|
740
|
+
dphelper.math.exp(a, b)
|
|
741
|
+
// Returns the exponent of two numbers.
|
|
742
|
+
```
|
|
743
|
+
|
|
744
|
+
```js
|
|
745
|
+
dphelper.math.isOdd(a)
|
|
746
|
+
// Checks if a number is odd.
|
|
747
|
+
```
|
|
748
|
+
|
|
749
|
+
```js
|
|
750
|
+
dphelper.math.float2int(a)
|
|
751
|
+
// Converts a float to an integer.
|
|
752
|
+
```
|
|
753
|
+
|
|
754
|
+
```js
|
|
755
|
+
dphelper.math.percent(n, tot)
|
|
756
|
+
// Calculates the percentage.
|
|
757
|
+
```
|
|
758
|
+
|
|
759
|
+
```js
|
|
760
|
+
dphelper.math.isPrime(n)
|
|
761
|
+
// Checks if a number is prime.
|
|
762
|
+
```
|
|
358
763
|
|
|
359
764
|
### Memory
|
|
360
765
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
766
|
+
```js
|
|
767
|
+
dphelper.memory.lock(obj)
|
|
768
|
+
// Locks an object in memory.
|
|
769
|
+
```
|
|
770
|
+
|
|
771
|
+
```js
|
|
772
|
+
dphelper.memory.unlock(obj)
|
|
773
|
+
// Unlocks an object in memory.
|
|
774
|
+
```
|
|
365
775
|
|
|
366
776
|
### Object
|
|
367
777
|
|
|
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
|
-
|
|
778
|
+
```js
|
|
779
|
+
dphelper.obj.toArray(object)
|
|
780
|
+
// Converts an object to an array.
|
|
781
|
+
```
|
|
782
|
+
|
|
783
|
+
```js
|
|
784
|
+
dphelper.obj.replaceNullObjects(data)
|
|
785
|
+
// Replaces null objects in a record.
|
|
786
|
+
```
|
|
787
|
+
|
|
788
|
+
```js
|
|
789
|
+
dphelper.obj.serialize(value)
|
|
790
|
+
// Serializes a value.
|
|
791
|
+
```
|
|
792
|
+
|
|
793
|
+
```js
|
|
794
|
+
dphelper.obj.deSerialize(valueNew)
|
|
795
|
+
// Deserializes a value.
|
|
796
|
+
```
|
|
797
|
+
|
|
798
|
+
```js
|
|
799
|
+
dphelper.obj.sort(o)
|
|
800
|
+
// Sorts an object.
|
|
801
|
+
```
|
|
802
|
+
|
|
803
|
+
```js
|
|
804
|
+
dphelper.obj.toXML(obj)
|
|
805
|
+
// Converts an object to XML.
|
|
806
|
+
```
|
|
807
|
+
|
|
808
|
+
```js
|
|
809
|
+
dphelper.obj.find(object, key, value)
|
|
810
|
+
// Finds an element in an object by key and value.
|
|
811
|
+
```
|
|
812
|
+
|
|
813
|
+
```js
|
|
814
|
+
dphelper.obj.instance(obj)
|
|
815
|
+
// Returns the instance of an object.
|
|
816
|
+
```
|
|
817
|
+
|
|
818
|
+
```js
|
|
819
|
+
dphelper.obj.updateByKey(obj, key, newValue)
|
|
820
|
+
// Updates an object by key.
|
|
821
|
+
```
|
|
822
|
+
|
|
823
|
+
```js
|
|
824
|
+
dphelper.obj.findindex(object, key)
|
|
825
|
+
// Finds the index of an element in an object by key.
|
|
826
|
+
```
|
|
827
|
+
|
|
828
|
+
```js
|
|
829
|
+
dphelper.obj.parse(val)
|
|
830
|
+
// Parses a value.
|
|
831
|
+
```
|
|
832
|
+
|
|
833
|
+
```js
|
|
834
|
+
dphelper.obj.isObject(val)
|
|
835
|
+
// Checks if a value is an object.
|
|
836
|
+
```
|
|
837
|
+
|
|
838
|
+
```js
|
|
839
|
+
dphelper.obj.diff(obj1, obj2)
|
|
840
|
+
// Finds the difference between two objects.
|
|
841
|
+
```
|
|
842
|
+
|
|
843
|
+
```js
|
|
844
|
+
dphelper.obj.path(prop, object[], separator?)
|
|
845
|
+
// Converts a property path to a string.
|
|
846
|
+
```
|
|
847
|
+
|
|
848
|
+
```js
|
|
849
|
+
dphelper.obj.shallow(object)
|
|
850
|
+
// Generate a shallow copy of an object.
|
|
851
|
+
```
|
|
852
|
+
|
|
853
|
+
```js
|
|
854
|
+
dphelper.obj.deeCopy(object)
|
|
855
|
+
// Generate a structured copy of an object.
|
|
856
|
+
```
|
|
400
857
|
|
|
401
858
|
### Path
|
|
402
859
|
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
860
|
+
```js
|
|
861
|
+
dphelper.path.rail()
|
|
862
|
+
// Returns the rail path.
|
|
863
|
+
```
|
|
864
|
+
|
|
865
|
+
```js
|
|
866
|
+
dphelper.path.hash()
|
|
867
|
+
// Returns the hash path.
|
|
868
|
+
```
|
|
869
|
+
|
|
870
|
+
```js
|
|
871
|
+
dphelper.path.query(url)
|
|
872
|
+
// Parses the query string of a URL.
|
|
873
|
+
```
|
|
409
874
|
|
|
410
875
|
### Promise
|
|
411
876
|
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
877
|
+
```js
|
|
878
|
+
dphelper.promise.check(p)
|
|
879
|
+
// Checks if a value is a promise.
|
|
880
|
+
```
|
|
881
|
+
|
|
882
|
+
```js
|
|
883
|
+
dphelper.promise.resolve(data)
|
|
884
|
+
// Resolves a promise with data.
|
|
885
|
+
```
|
|
416
886
|
|
|
417
887
|
### Sanitize
|
|
418
888
|
|
|
419
|
-
|
|
420
|
-
|
|
889
|
+
```js
|
|
890
|
+
dphelper.sanitize.html(s)
|
|
891
|
+
// Sanitizes HTML.
|
|
892
|
+
```
|
|
421
893
|
|
|
422
894
|
### Screen
|
|
423
895
|
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
896
|
+
```js
|
|
897
|
+
dphelper.screen.fullScreen(el)
|
|
898
|
+
// Enables full screen mode for an element.
|
|
899
|
+
```
|
|
900
|
+
|
|
901
|
+
```js
|
|
902
|
+
dphelper.screen.toggle(el)
|
|
903
|
+
// Toggles full screen mode for an element.
|
|
904
|
+
```
|
|
905
|
+
|
|
906
|
+
```js
|
|
907
|
+
dphelper.screen.info(): { width; height; availWidth; availHeight; colorDepth; pixelDepth }
|
|
908
|
+
// Gets screen information.
|
|
909
|
+
```
|
|
430
910
|
|
|
431
911
|
### Scrollbar
|
|
432
912
|
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
913
|
+
```js
|
|
914
|
+
dphelper.scrollbar.custom(el, options)
|
|
915
|
+
// Customizes a scrollbar.
|
|
916
|
+
```
|
|
917
|
+
|
|
918
|
+
```js
|
|
919
|
+
dphelper.scrollbar.indicator(props)
|
|
920
|
+
// Adds a scrollbar indicator.
|
|
921
|
+
```
|
|
922
|
+
|
|
923
|
+
```js
|
|
924
|
+
dphelper.scrollbar.position: { get(el); set(el) }
|
|
925
|
+
// Gets and sets scrollbar position.
|
|
926
|
+
```
|
|
927
|
+
|
|
928
|
+
```js
|
|
929
|
+
dphelper.scrollbar.smooth(target, speed, smooth)
|
|
930
|
+
// Smooth scrolls to a target.
|
|
931
|
+
```
|
|
932
|
+
|
|
933
|
+
```js
|
|
934
|
+
dphelper.scrollbar.scrollTo(container, element, gap?)
|
|
935
|
+
// Scrolls to an element within a container.
|
|
936
|
+
```
|
|
443
937
|
|
|
444
938
|
### Security
|
|
445
939
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
940
|
+
```js
|
|
941
|
+
dphelper.security.uuid: { byVal(string); v4; v5 }
|
|
942
|
+
// Generates UUIDs.
|
|
943
|
+
```
|
|
944
|
+
|
|
945
|
+
```js
|
|
946
|
+
dphelper.security.hashPass(u, p, t?)
|
|
947
|
+
// Hashes a password.
|
|
948
|
+
```
|
|
949
|
+
|
|
950
|
+
```js
|
|
951
|
+
dphelper.security.crypt(u, p, mode?)
|
|
952
|
+
// Encrypts data.
|
|
953
|
+
```
|
|
954
|
+
|
|
955
|
+
```js
|
|
956
|
+
dphelper.security.deCrypt(u, p, mode?)
|
|
957
|
+
// Decrypts data.
|
|
958
|
+
```
|
|
959
|
+
|
|
960
|
+
```js
|
|
961
|
+
dphelper.security.AES_KeyGen(passKey?)
|
|
962
|
+
// Generates an AES key.
|
|
963
|
+
```
|
|
964
|
+
|
|
965
|
+
```js
|
|
966
|
+
dphelper.security.SHA256_Hex(passKey)
|
|
967
|
+
// Generates a SHA256 hash.
|
|
968
|
+
```
|
|
969
|
+
|
|
970
|
+
```js
|
|
971
|
+
dphelper.security.ulid()
|
|
972
|
+
// Generates ULID (Universally Unique Lexicographically Sortable Identifier).
|
|
973
|
+
```
|
|
460
974
|
|
|
461
975
|
### Shortcut
|
|
462
976
|
|
|
463
|
-
|
|
464
|
-
|
|
977
|
+
```js
|
|
978
|
+
dphelper.shortcut.keys(e, trigger)
|
|
979
|
+
// Adds a keyboard shortcut.
|
|
980
|
+
```
|
|
465
981
|
|
|
466
982
|
### Socket
|
|
467
983
|
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
984
|
+
```js
|
|
985
|
+
dphelper.socket.info()
|
|
986
|
+
// Gets socket information.
|
|
987
|
+
```
|
|
988
|
+
|
|
989
|
+
```js
|
|
990
|
+
dphelper.socket.start(element, server)
|
|
991
|
+
// Starts a socket connection.
|
|
992
|
+
```
|
|
993
|
+
|
|
994
|
+
```js
|
|
995
|
+
dphelper.socket.conn(id, server)
|
|
996
|
+
// Connects to a socket server.
|
|
997
|
+
```
|
|
998
|
+
|
|
999
|
+
```js
|
|
1000
|
+
dphelper.socket.connect(server)
|
|
1001
|
+
// Connects to a server.
|
|
1002
|
+
```
|
|
1003
|
+
|
|
1004
|
+
```js
|
|
1005
|
+
dphelper.socket.open(id, server)
|
|
1006
|
+
// Opens a socket connection.
|
|
1007
|
+
```
|
|
1008
|
+
|
|
1009
|
+
```js
|
|
1010
|
+
dphelper.socket.send(mex, type?)
|
|
1011
|
+
// Sends a message through a socket.
|
|
1012
|
+
```
|
|
1013
|
+
|
|
1014
|
+
```js
|
|
1015
|
+
dphelper.socket.ping()
|
|
1016
|
+
// Sends a ping through a socket.
|
|
1017
|
+
```
|
|
1018
|
+
|
|
1019
|
+
```js
|
|
1020
|
+
dphelper.socket.receive(el?)
|
|
1021
|
+
// Receives a message through a socket.
|
|
1022
|
+
```
|
|
1023
|
+
|
|
1024
|
+
```js
|
|
1025
|
+
dphelper.socket.keepAlive()
|
|
1026
|
+
// Keeps a socket connection alive.
|
|
1027
|
+
```
|
|
1028
|
+
|
|
1029
|
+
```js
|
|
1030
|
+
dphelper.socket.check()
|
|
1031
|
+
// Checks the status of a socket connection.
|
|
1032
|
+
```
|
|
1033
|
+
|
|
1034
|
+
```js
|
|
1035
|
+
dphelper.socket.list()
|
|
1036
|
+
// Lists all socket connections.
|
|
1037
|
+
```
|
|
490
1038
|
|
|
491
1039
|
### SVG
|
|
492
1040
|
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
1041
|
+
```js
|
|
1042
|
+
dphelper.svg.init(container, source1, source2, cb?)
|
|
1043
|
+
// Initializes an SVG container.
|
|
1044
|
+
```
|
|
1045
|
+
|
|
1046
|
+
```js
|
|
1047
|
+
dphelper.svg.check()
|
|
1048
|
+
// Checks if SVG is supported.
|
|
1049
|
+
```
|
|
1050
|
+
|
|
1051
|
+
```js
|
|
1052
|
+
dphelper.svg.update(rect1, rect2, cxn)
|
|
1053
|
+
// Updates an SVG element.
|
|
1054
|
+
```
|
|
1055
|
+
|
|
1056
|
+
```js
|
|
1057
|
+
dphelper.svg.getCurve(p1, p2, dx)
|
|
1058
|
+
// Gets a curve path between two points.
|
|
1059
|
+
```
|
|
1060
|
+
|
|
1061
|
+
```js
|
|
1062
|
+
dphelper.svg.getIntersection(dx, dy, cx, cy, w, h)
|
|
1063
|
+
// Gets the intersection point of a curve.
|
|
1064
|
+
```
|
|
1065
|
+
|
|
1066
|
+
```js
|
|
1067
|
+
dphelper.svg.setConnector(source, side)
|
|
1068
|
+
// Sets a connector for an SVG element.
|
|
1069
|
+
```
|
|
1070
|
+
|
|
1071
|
+
```js
|
|
1072
|
+
dphelper.svg.removeConnection(container)
|
|
1073
|
+
// Removes a connection from an SVG container.
|
|
1074
|
+
```
|
|
1075
|
+
|
|
1076
|
+
```js
|
|
1077
|
+
dphelper.svg.makeScrollable(svgContainer, scrollContainer, elm1, elm2, rect1, rect2)
|
|
1078
|
+
// Makes an SVG container scrollable.
|
|
1079
|
+
```
|
|
1080
|
+
|
|
1081
|
+
```js
|
|
1082
|
+
dphelper.svg.makeDraggable(evt)
|
|
1083
|
+
// Makes an SVG element draggable.
|
|
1084
|
+
```
|
|
1085
|
+
|
|
1086
|
+
```js
|
|
1087
|
+
dphelper.svg.toggle(evt, container, source1, source2)
|
|
1088
|
+
// Toggles an SVG element.
|
|
1089
|
+
```
|
|
1090
|
+
|
|
1091
|
+
```js
|
|
1092
|
+
dphelper.svg.convert(options)
|
|
1093
|
+
// Converts an SVG element.
|
|
1094
|
+
```
|
|
515
1095
|
|
|
516
1096
|
### System
|
|
517
1097
|
|
|
518
|
-
|
|
519
|
-
|
|
1098
|
+
```js
|
|
1099
|
+
dphelper.svg.multiSplit()
|
|
1100
|
+
// Splits a string into multiple parts.
|
|
1101
|
+
```
|
|
520
1102
|
|
|
521
1103
|
### Terminal
|
|
522
1104
|
|
|
523
|
-
|
|
524
|
-
|
|
1105
|
+
```js
|
|
1106
|
+
dphelper.terminal()
|
|
1107
|
+
// Initializes a terminal.
|
|
1108
|
+
```
|
|
525
1109
|
|
|
526
1110
|
### Text
|
|
527
1111
|
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
1112
|
+
```js
|
|
1113
|
+
dphelper.text.trim(s, c, b, e)
|
|
1114
|
+
// Trims a string.
|
|
1115
|
+
```
|
|
1116
|
+
|
|
1117
|
+
```js
|
|
1118
|
+
dphelper.text.capitalize(txt)
|
|
1119
|
+
// Capitalizes a string.
|
|
1120
|
+
```
|
|
1121
|
+
|
|
1122
|
+
```js
|
|
1123
|
+
dphelper.text.lower(txt)
|
|
1124
|
+
// Converts a string to lowercase.
|
|
1125
|
+
```
|
|
1126
|
+
|
|
1127
|
+
```js
|
|
1128
|
+
dphelper.text.upper(txt)
|
|
1129
|
+
// Converts a string to uppercase.
|
|
1130
|
+
```
|
|
1131
|
+
|
|
1132
|
+
```js
|
|
1133
|
+
dphelper.text.nl2br(str)
|
|
1134
|
+
// Converts newlines to
|
|
1135
|
+
tags.
|
|
1136
|
+
```
|
|
1137
|
+
|
|
1138
|
+
```js
|
|
1139
|
+
dphelper.text.sanitize(str)
|
|
1140
|
+
// Sanitizes a string.
|
|
1141
|
+
```
|
|
1142
|
+
|
|
1143
|
+
```js
|
|
1144
|
+
dphelper.text.camelCase(str)
|
|
1145
|
+
// Converts camelCase to space or underscore.
|
|
1146
|
+
```
|
|
1147
|
+
|
|
1148
|
+
```js
|
|
1149
|
+
dphelper.text.fitContainer(el)
|
|
1150
|
+
// Fits a text element to its container.
|
|
1151
|
+
```
|
|
544
1152
|
|
|
545
1153
|
### Timer
|
|
546
1154
|
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
1155
|
+
```js
|
|
1156
|
+
dphelper.timer.sleep(ms)
|
|
1157
|
+
// Pauses execution for a specified time.
|
|
1158
|
+
```
|
|
1159
|
+
|
|
1160
|
+
```js
|
|
1161
|
+
dphelper.timer.percentage(start, end)
|
|
1162
|
+
// Calculates the percentage of time elapsed.
|
|
1163
|
+
```
|
|
551
1164
|
|
|
552
1165
|
### Tools
|
|
553
1166
|
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
1167
|
+
```js
|
|
1168
|
+
dphelper.dev.getip()
|
|
1169
|
+
// Gets the IP address.
|
|
1170
|
+
```
|
|
1171
|
+
|
|
1172
|
+
```js
|
|
1173
|
+
dphelper.dev.byteSize(bytes)
|
|
1174
|
+
// Converts bytes to a human-readable format.
|
|
1175
|
+
```
|
|
1176
|
+
|
|
1177
|
+
```js
|
|
1178
|
+
dphelper.dev.zIndex()
|
|
1179
|
+
// Gets the z-index.
|
|
1180
|
+
```
|
|
1181
|
+
|
|
1182
|
+
```js
|
|
1183
|
+
dphelper.dev.zeroToFalse(value)
|
|
1184
|
+
// Converts zero to false.
|
|
1185
|
+
```
|
|
562
1186
|
|
|
563
1187
|
### Translators
|
|
564
1188
|
|
|
565
|
-
|
|
566
|
-
|
|
1189
|
+
```js
|
|
1190
|
+
dphelper.translator.convertMatrixToScale(values)
|
|
1191
|
+
// Converts a matrix to a scale.
|
|
1192
|
+
```
|
|
567
1193
|
|
|
568
1194
|
### Trigger
|
|
569
1195
|
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
1196
|
+
```js
|
|
1197
|
+
dphelper.trigger.click(elem)
|
|
1198
|
+
// Triggers a click event.
|
|
1199
|
+
```
|
|
1200
|
+
|
|
1201
|
+
```js
|
|
1202
|
+
dphelper.trigger.change(elem)
|
|
1203
|
+
// Triggers a change event.
|
|
1204
|
+
```
|
|
1205
|
+
|
|
1206
|
+
```js
|
|
1207
|
+
dphelper.trigger.input(elem)
|
|
1208
|
+
// Triggers an input event.
|
|
1209
|
+
```
|
|
576
1210
|
|
|
577
1211
|
### Type
|
|
578
1212
|
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
1213
|
+
```js
|
|
1214
|
+
dphelper.type.of(p)
|
|
1215
|
+
// Gets the type of a value.
|
|
1216
|
+
```
|
|
1217
|
+
|
|
1218
|
+
```js
|
|
1219
|
+
dphelper.type.instOfObj(p)
|
|
1220
|
+
// Checks if a value is an instance of an object.
|
|
1221
|
+
```
|
|
1222
|
+
|
|
1223
|
+
```js
|
|
1224
|
+
dphelper.type.isNull(p)
|
|
1225
|
+
// Checks if a value is null.
|
|
1226
|
+
```
|
|
1227
|
+
|
|
1228
|
+
```js
|
|
1229
|
+
dphelper.type.isBool(val)
|
|
1230
|
+
// Checks if a value is a boolean.
|
|
1231
|
+
```
|
|
587
1232
|
|
|
588
1233
|
### UI
|
|
589
1234
|
|
|
590
|
-
|
|
591
|
-
|
|
1235
|
+
```js
|
|
1236
|
+
dphelper.ui: null`
|
|
1237
|
+
// User interface operations.
|
|
1238
|
+
```
|
|
592
1239
|
|
|
593
1240
|
### Window
|
|
594
1241
|
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
1242
|
+
```js
|
|
1243
|
+
dphelper.window.enhancement()
|
|
1244
|
+
// Enhances the window.
|
|
1245
|
+
```
|
|
1246
|
+
|
|
1247
|
+
```js
|
|
1248
|
+
dphelper.window.animationframe()
|
|
1249
|
+
// Gets the animation frame.
|
|
1250
|
+
```
|
|
1251
|
+
|
|
1252
|
+
```js
|
|
1253
|
+
dphelper.window.center(params: { url; title; name; w; h })
|
|
1254
|
+
// Centers a window.
|
|
1255
|
+
```
|
|
1256
|
+
|
|
1257
|
+
```js
|
|
1258
|
+
dphelper.window.onBeforeUnLoad(e)
|
|
1259
|
+
// Handles the before unload event.
|
|
1260
|
+
```
|
|
1261
|
+
|
|
1262
|
+
```js
|
|
1263
|
+
dphelper.window.purge(d?, time?)
|
|
1264
|
+
// Purges the document.
|
|
1265
|
+
```
|
|
1266
|
+
|
|
1267
|
+
```js
|
|
1268
|
+
dphelper.window.stopZoomWheel(e)
|
|
1269
|
+
// Stops the zoom wheel.
|
|
1270
|
+
```
|
|
1271
|
+
|
|
1272
|
+
```js
|
|
1273
|
+
dphelper.window.setZoom(element?, zoom?)
|
|
1274
|
+
// Sets the zoom level.
|
|
1275
|
+
```
|
|
1276
|
+
|
|
1277
|
+
```js
|
|
1278
|
+
dphelper.window.getZoom(element?)
|
|
1279
|
+
// Gets the zoom level.
|
|
1280
|
+
```
|
|
611
1281
|
|
|
612
1282
|
## License
|
|
613
1283
|
|