dphelper 0.2.35 → 0.2.40
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/.github/FUNDING.yml +12 -0
- package/.vscode/settings.json +19 -4
- package/README.md +82 -28
- package/assets/images/banner.png +0 -0
- package/assets/logos/logo.svg +64 -0
- package/init.js +10 -95
- package/package.json +1 -2
- package/scripts/anchorToOnClick.js +4 -4
- package/scripts/array.js +33 -6
- package/scripts/browser.js +65 -0
- package/scripts/{pushState.js → coodinates.js} +19 -11
- package/scripts/cookie.js +4 -4
- package/scripts/load.js +14 -0
- package/scripts/number.js +2 -2
- package/scripts/obj.js +2 -2
- package/scripts/scrollbar.js +1 -1
- /package/{SPA.code-workspace → ws.code-workspace} +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# These are supported funding model platforms
|
|
2
|
+
|
|
3
|
+
github: passariello
|
|
4
|
+
patreon: passariello
|
|
5
|
+
open_collective: # Replace with a single Open Collective username
|
|
6
|
+
ko_fi: passariello
|
|
7
|
+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
|
8
|
+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
|
9
|
+
liberapay: # Replace with a single Liberapay username
|
|
10
|
+
issuehunt: # Replace with a single IssueHunt username
|
|
11
|
+
otechie: # Replace with a single Otechie username
|
|
12
|
+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
package/.vscode/settings.json
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
{
|
|
2
|
-
"typescript.suggestionActions.enabled": false,
|
|
3
|
-
"javascript.suggestionActions.enabled": false
|
|
4
|
-
|
|
1
|
+
{
|
|
2
|
+
"typescript.suggestionActions.enabled": false,
|
|
3
|
+
"javascript.suggestionActions.enabled": false,
|
|
4
|
+
"sqltools.connections": [
|
|
5
|
+
{
|
|
6
|
+
"mysqlOptions": {
|
|
7
|
+
"authProtocol": "default"
|
|
8
|
+
},
|
|
9
|
+
"previewLimit": 50,
|
|
10
|
+
"server": "localhost",
|
|
11
|
+
"port": 3306,
|
|
12
|
+
"driver": "MySQL",
|
|
13
|
+
"name": "localhost",
|
|
14
|
+
"database": "asset",
|
|
15
|
+
"username": "admin",
|
|
16
|
+
"password": "admin"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
package/README.md
CHANGED
|
@@ -1,21 +1,36 @@
|
|
|
1
1
|
# dpHelper
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
Manager | DevTools by [Dario Passariello (c)](https://dario.passariello.ca)
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+

|
|
4
9
|
|
|
5
10
|
## about
|
|
6
11
|
|
|
7
12
|
You have a lot of tools for you that make your life easier and faster!
|
|
13
|
+
Please visit the github repository @ [dpHelper on Github](https://github.com/passariello/dpHelper)
|
|
8
14
|
|
|
9
15
|
## install
|
|
10
16
|
|
|
11
17
|
```js
|
|
12
|
-
npm
|
|
18
|
+
npm i dphelper
|
|
19
|
+
|
|
20
|
+
or update:
|
|
21
|
+
|
|
22
|
+
npm i dphelper@latest
|
|
23
|
+
|
|
13
24
|
```
|
|
14
25
|
|
|
15
26
|
in the index (and only there):
|
|
16
27
|
|
|
17
28
|
```js
|
|
18
29
|
import "dphelper"
|
|
30
|
+
|
|
31
|
+
or
|
|
32
|
+
|
|
33
|
+
require("dphelper")
|
|
19
34
|
```
|
|
20
35
|
|
|
21
36
|
## check
|
|
@@ -24,6 +39,14 @@ type 'dphelper' in your console to have a look about all available tools that yo
|
|
|
24
39
|
|
|
25
40
|
You can call these from everywhere without import (just one at index)
|
|
26
41
|
|
|
42
|
+
## DOWNLOAD THE BROWSER EXTENSION (SOON)
|
|
43
|
+
|
|
44
|
+

|
|
45
|
+
|
|
46
|
+
This extension allows you to manage your app's dpHelper NPM. Here you will find all the tools with description and methods of use. Designed to simplify API operations, data manipulation and retention. You will be able to monitor memory usage and localStorage. You will always be updated on updates and tricks for your daily work. The dpHelper tool is a collection of scripts to simplify, improve and speed up your work. Designed to be easy to install and use. Just use "import 'dphelper'" in your project index. All scripts work in global and are reachable everywhere.
|
|
47
|
+
|
|
48
|
+
Actually in development...
|
|
49
|
+
|
|
27
50
|
## LIST
|
|
28
51
|
|
|
29
52
|
### CURRENCY
|
|
@@ -59,53 +82,78 @@ dphelper.indexedDB.store( storeName, table )
|
|
|
59
82
|
dphelper.indexedDB.insert( storeName, table, key, value )
|
|
60
83
|
dphelper.indexedDB.update( storeName, table, key, value )
|
|
61
84
|
dphelper.indexedDB.get( storeName, table, key )
|
|
62
|
-
|
|
63
|
-
window.dphelper.dbExist() -> know databases
|
|
85
|
+
dphelper.indexedDB.list()
|
|
64
86
|
```
|
|
65
87
|
|
|
66
88
|
### NUMBERS
|
|
67
89
|
|
|
68
90
|
```js
|
|
69
|
-
dphelper.rnd() // generate long random number
|
|
70
|
-
dphelper.tmr() // generate number by timer
|
|
91
|
+
dphelper.number.rnd() // generate long random number
|
|
92
|
+
dphelper.number.tmr() // generate number by timer
|
|
93
|
+
dphelper.number.add()
|
|
94
|
+
dphelper.number.sub()
|
|
95
|
+
dphelper.number.multi()
|
|
96
|
+
dphelper.number.div()
|
|
97
|
+
dphelper.number.rem()
|
|
98
|
+
dphelper.number.exp()
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### TIME
|
|
102
|
+
|
|
103
|
+
```js
|
|
104
|
+
dphelper.time.epoch() // return epoch time
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### DATE
|
|
108
|
+
|
|
109
|
+
```js
|
|
110
|
+
dphelper.date.toIso( value , int = 'en' ) // format in bese of internationalization
|
|
111
|
+
dphelper.date.toMMDDYYYY( value ) // format not common
|
|
112
|
+
dphelper.date.convert( value , format ) // format like 23 Dec, 2021
|
|
113
|
+
dphelper.date.iso2Epoch( value ) // format iso date to epoch
|
|
114
|
+
dphelper.date.localIsoTime( value ) // format Thu, 31 May 2012 08:33:41 +0000
|
|
115
|
+
dphelper.date.utc() // generate UTC date format
|
|
116
|
+
dphelper.date.parse( value ) // epoch to human date
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### PATH
|
|
120
|
+
|
|
121
|
+
------ url
|
|
122
|
+
|
|
123
|
+
```js
|
|
124
|
+
dphelper.path.rail() // Generate array start from subFolders
|
|
125
|
+
dphelper.path.query() // Generate array start from querystring
|
|
126
|
+
dphelper.path.hash() // Generate array start from hash path
|
|
71
127
|
```
|
|
72
128
|
|
|
73
|
-
|
|
129
|
+
------ Browser:
|
|
74
130
|
|
|
75
131
|
```js
|
|
76
|
-
dphelper.
|
|
77
|
-
dphelper.
|
|
78
|
-
dphelper.
|
|
79
|
-
dphelper.
|
|
80
|
-
dphelper.
|
|
81
|
-
dphelper.date2MMDDYYYY( value ) // format like 12312021
|
|
82
|
-
dphelper.date2Iso( value , int = 'en' ) // format in bese of internationalization
|
|
83
|
-
dphelper.localISOTime( value ) // format Thu, 31 May 2012 08:33:41 +0000
|
|
132
|
+
dphelper.browser.state( state, title, url ) // Create a new spushState and avoid page reload
|
|
133
|
+
dphelper.browser.forw( times ) // go next visited page
|
|
134
|
+
dphelper.browser.back( times ) // go previous page (type 1 or more - times is ever negative)
|
|
135
|
+
dphelper.browser.href( url ) // go previous page (type 1 or more - times is ever negative)
|
|
136
|
+
dphelper.browser.reload() // reload page and discard POST data
|
|
84
137
|
```
|
|
85
138
|
|
|
86
|
-
|
|
139
|
+
------ options
|
|
87
140
|
|
|
88
141
|
```js
|
|
89
|
-
dphelper.
|
|
90
|
-
dphelper.pathQuery() // Generate array start from querystring
|
|
91
|
-
dphelper.pathHash() // Generate array start from hash path
|
|
92
|
-
dphelper.pushState(state, title, url) // Create a new spushState and avoid page reload
|
|
93
|
-
dphelper.anchorToOnClick( container ) // Transform all a href to onclick (use . for class or # for div )
|
|
142
|
+
dphelper.anchorToOnClick( element ) // Transform all a href to onclick (use . for class or # for div )
|
|
94
143
|
```
|
|
95
144
|
|
|
96
|
-
###
|
|
145
|
+
### LOAD
|
|
97
146
|
|
|
98
147
|
```js
|
|
99
|
-
dphelper.
|
|
100
|
-
dphelper.
|
|
101
|
-
dphelper.
|
|
148
|
+
dphelper.load.file(element, path) // text to element
|
|
149
|
+
dphelper.load.json( file ) // load json data to a variable
|
|
150
|
+
dphelper.load.jsonRemote( path, method='GET', type='application/json' ) // load json from remote to variable
|
|
102
151
|
```
|
|
103
152
|
|
|
104
153
|
### FORM
|
|
105
154
|
|
|
106
155
|
```js
|
|
107
|
-
dphelper.
|
|
108
|
-
dphelper.objSerialize(value) // serialize object to json
|
|
156
|
+
dphelper.form.serialize( form ) // serialize a form (input array) to json
|
|
109
157
|
```
|
|
110
158
|
|
|
111
159
|
### ARRAY
|
|
@@ -115,8 +163,14 @@ dphelper.array.find( id, array ) // find value by ID into array
|
|
|
115
163
|
dphelper.array.delete( id, array ) // delete value by ID from array
|
|
116
164
|
dphelper.array.merge( arrayA , arrayB ) // merge two array
|
|
117
165
|
dphelper.array.unique( array ) // remove all duplicates
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### OBJECT
|
|
118
169
|
|
|
119
|
-
|
|
170
|
+
```js
|
|
171
|
+
dphelper.obj.toArray( obj ) // convert objet to array (compatible with old browsers)
|
|
172
|
+
dphelper.obj.serialize( value ) // serialize
|
|
173
|
+
dphelper.obj.deSerialize( value ) // de-serialize
|
|
120
174
|
```
|
|
121
175
|
|
|
122
176
|
... TO BE CONTINUE
|
|
Binary file
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
3
|
+
|
|
4
|
+
<svg
|
|
5
|
+
width="93.683228"
|
|
6
|
+
height="119.23308"
|
|
7
|
+
viewBox="0 0 99.148077 126.18834"
|
|
8
|
+
version="1.1"
|
|
9
|
+
id="svg5"
|
|
10
|
+
inkscape:export-filename="C:\Users\dario\Desktop\dphelper_manager_48.png"
|
|
11
|
+
inkscape:export-xdpi="9.000001"
|
|
12
|
+
inkscape:export-ydpi="9.000001"
|
|
13
|
+
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
|
|
14
|
+
sodipodi:docname="logo.svg"
|
|
15
|
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
16
|
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
17
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
18
|
+
xmlns:svg="http://www.w3.org/2000/svg">
|
|
19
|
+
<sodipodi:namedview
|
|
20
|
+
id="namedview7"
|
|
21
|
+
pagecolor="#ffffff"
|
|
22
|
+
bordercolor="#666666"
|
|
23
|
+
borderopacity="1.0"
|
|
24
|
+
inkscape:pageshadow="2"
|
|
25
|
+
inkscape:pageopacity="0.0"
|
|
26
|
+
inkscape:pagecheckerboard="0"
|
|
27
|
+
inkscape:document-units="mm"
|
|
28
|
+
showgrid="false"
|
|
29
|
+
inkscape:zoom="0.7500982"
|
|
30
|
+
inkscape:cx="556.59379"
|
|
31
|
+
inkscape:cy="359.95287"
|
|
32
|
+
inkscape:window-width="1920"
|
|
33
|
+
inkscape:window-height="1027"
|
|
34
|
+
inkscape:window-x="-8"
|
|
35
|
+
inkscape:window-y="-8"
|
|
36
|
+
inkscape:window-maximized="1"
|
|
37
|
+
inkscape:current-layer="layer1"
|
|
38
|
+
scale-x="4"
|
|
39
|
+
units="px" />
|
|
40
|
+
<defs
|
|
41
|
+
id="defs2">
|
|
42
|
+
<pattern
|
|
43
|
+
id="WMFhbasepattern"
|
|
44
|
+
patternUnits="userSpaceOnUse"
|
|
45
|
+
width="6"
|
|
46
|
+
height="6"
|
|
47
|
+
x="0"
|
|
48
|
+
y="0" />
|
|
49
|
+
</defs>
|
|
50
|
+
<g
|
|
51
|
+
inkscape:label="Layer 1"
|
|
52
|
+
inkscape:groupmode="layer"
|
|
53
|
+
id="layer1"
|
|
54
|
+
transform="translate(-89.565622,-102.08653)">
|
|
55
|
+
<path
|
|
56
|
+
style="fill:#0093dd;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.37544"
|
|
57
|
+
d="m 166.83728,102.08653 -0.85247,4.03896 -0.60497,3.73603 -0.39875,3.46197 -0.19249,3.21673 -0.013,2.97152 0.17875,2.76958 0.32997,2.55319 0.495,2.36567 0.61873,2.22142 0.74246,2.06276 0.86623,1.93293 0.94873,1.81752 1.04496,1.73099 1.11372,1.65884 1.18245,1.60117 1.22373,1.55789 2.51617,3.07247 2.55742,3.1302 1.26496,1.63 1.22372,1.70213 1.1687,1.78869 1.12747,1.90408 1.04498,2.00504 0.96245,2.16374 0.86623,2.30797 0.75623,2.4955 0.64622,2.68301 0.49499,2.8994 0.34374,3.11576 0.19249,3.37541 0.0276,3.44755 -0.10994,3.30327 -0.23374,3.1879 -0.3575,3.04363 -0.49498,2.92826 -0.60498,2.79841 -0.72874,2.6686 -0.83871,2.55318 -0.94874,2.4378 -1.05871,2.30798 -1.1687,2.20701 -1.25122,2.07718 -1.37495,1.96176 -1.4437,1.84639 -1.55372,1.7454 -1.63621,1.61559 -1.71869,1.51461 -1.78745,1.41363 -1.88368,1.29823 -1.95243,1.19727 -2.00745,1.09629 -2.08993,0.99531 -2.15869,0.87991 -2.19992,0.79337 -2.26868,0.69238 -2.32368,0.59143 -2.37868,0.50486 -2.40618,0.4039 -2.46116,0.31735 -2.50244,0.21636 -2.54366,0.12976 -2.57118,0.0432 -2.57116,-0.0721 -2.52993,-0.21637 -2.50241,-0.36062 -2.46119,-0.49046 -2.41992,-0.62025 -2.37867,-0.76453 -2.32368,-0.87992 -2.26868,-1.00973 -2.22743,-1.12513 -2.15869,-1.24055 -2.08993,-1.34151 -2.03495,-1.47133 -1.96618,-1.55788 -1.89744,-1.65885 -1.81494,-1.77427 -1.74621,-1.84636 -1.64995,-1.94737 -1.58119,-2.0339 -1.484949,-2.12044 -1.402457,-2.207 -1.30622,-2.26471 -1.209952,-2.35124 -1.113716,-2.40896 -1.003724,-2.48106 -0.893717,-2.53878 -0.783726,-2.61089 -0.687489,-2.65416 -0.549972,-2.71188 -0.453736,-2.74072 -0.316251,-2.79842 -0.192489,-2.84169 -0.06869,-2.88496 0.06869,-2.91383 0.192489,-2.95708 0.329989,-2.98596 0.467491,-3.01477 0.591237,-3.0148 0.742477,-3.04363 0.879962,-3.02922 1.031219,-3.01479 1.168719,-3.00038 1.319959,-2.97151 1.45746,-2.92824 1.622439,-2.88498 1.773697,-2.82726 1.92495,-2.75515 2.08993,-2.69744 2.24119,-2.6109 2.40616,-2.50992 2.57118,-2.42336 2.73617,-2.30798 2.90115,-2.207 3.07991,-2.06275 3.2449,-1.93294 3.42364,-1.8031 3.6024,-1.64443 3.78112,-1.47133 3.95988,-1.31267 4.13863,-1.13955 4.33111,-0.93762 4.50985,-0.76452 4.70236,-0.54814 4.89486,-0.33177 z"
|
|
58
|
+
id="path30" />
|
|
59
|
+
<path
|
|
60
|
+
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.37544"
|
|
61
|
+
d="m 136.91822,132.58065 0.30249,4.09665 0.48123,3.76489 0.64623,3.44753 0.81123,3.14461 0.93497,2.87054 1.07246,2.62532 1.18246,2.36568 1.29247,2.1493 1.3887,1.94735 1.47122,1.75984 1.5262,1.58673 1.59494,1.44249 1.6362,1.29823 1.6637,1.19725 1.6912,1.09629 1.70495,1.00975 1.67744,0.96645 1.67745,0.90877 1.64996,0.89434 1.60869,0.87991 1.53995,0.89435 1.4987,0.92318 1.40247,0.98089 1.31994,1.03859 1.20997,1.12515 1.11373,1.22611 0.9762,1.34151 0.83873,1.48575 0.68749,1.64442 0.52248,1.81755 0.35748,2.01946 0.165,2.22143 0.013,2.29355 -0.0687,2.20701 -0.15119,2.10602 -0.24747,2.0339 -0.33001,1.94735 -0.39873,1.87524 -0.48123,1.77425 -0.56374,1.70212 -0.63247,1.61559 -0.70123,1.54345 -0.78373,1.47135 -0.83873,1.38478 -0.90747,1.29823 -0.96246,1.24053 -1.03122,1.15399 -1.08623,1.08187 -1.15495,1.00974 -1.19622,0.93761 -1.25121,0.86549 -1.29247,0.8078 -1.34745,0.72123 -1.3887,0.66355 -1.42997,0.59142 -1.4712,0.51929 -1.51245,0.4616 -1.55371,0.40388 -1.58119,0.33178 -1.6087,0.27407 -1.63621,0.20194 -1.66369,0.14421 -1.6912,0.0866 -1.70495,0.0289 -1.71869,-0.0432 -1.6912,-0.14421 -1.6637,-0.24523 -1.64995,-0.31734 -1.6087,-0.41832 -1.58121,-0.50488 -1.53994,-0.59141 -1.5262,-0.67797 -1.47122,-0.73566 -1.4437,-0.83665 -1.3887,-0.89434 -1.36121,-0.98089 -1.30621,-1.03859 -1.26497,-1.11071 -1.20995,-1.16841 -1.15496,-1.24053 -1.11372,-1.29823 -1.04497,-1.35595 -0.98997,-1.41363 -0.93497,-1.45691 -0.86622,-1.5146 -0.81124,-1.55789 -0.72872,-1.61559 -0.67373,-1.64442 -0.60498,-1.70213 -0.52248,-1.73099 -0.45373,-1.77424 -0.37124,-1.80311 -0.28874,-1.83196 -0.22,-1.86081 -0.12375,-1.88964 -0.0413,-1.91851 0.0275,-1.93292 0.0825,-1.93293 0.15119,-1.94736 0.20625,-1.94734 0.26124,-1.94737 0.31624,-1.93292 0.37124,-1.94735 0.43998,-1.93294 0.48125,-1.9185 0.53623,-1.91851 0.60497,-1.88964 0.65998,-1.88965 0.70123,-1.8608 0.76997,-1.83197 0.81124,-1.81752 0.87996,-1.78869 0.92123,-1.75982 0.98997,-1.74541 1.03122,-1.68771 1.08622,-1.67328 1.14121,-1.61559 1.18246,-1.58672 1.25121,-1.54345 1.29247,-1.50019 1.34745,-1.45691 1.40246,-1.39921 1.44371,-1.34151 1.4987,-1.29823 1.5537,-1.24054 1.59495,-1.16842 1.64995,-1.12513 z"
|
|
62
|
+
id="path32" />
|
|
63
|
+
</g>
|
|
64
|
+
</svg>
|
package/init.js
CHANGED
|
@@ -17,23 +17,22 @@
|
|
|
17
17
|
|
|
18
18
|
// CREATE ROOT STORE
|
|
19
19
|
const dphelper = window.dphelper = {};
|
|
20
|
-
|
|
21
|
-
window.dphelper._list = require('./data/list.json');
|
|
20
|
+
|
|
21
|
+
window.dphelper._list = require('./data/list.json');
|
|
22
22
|
window.dphelper._list.scripts = [];
|
|
23
23
|
window.dphelper._list.version = pjson.version;
|
|
24
24
|
|
|
25
25
|
const cache = {};
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
(key) => (
|
|
30
|
-
cache[key] =
|
|
27
|
+
const importAll = ( cntx ) => {
|
|
28
|
+
cntx.keys().forEach(
|
|
29
|
+
( key ) => (
|
|
30
|
+
cache[ key ] = cntx( key )
|
|
31
31
|
)
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
importAll(
|
|
36
|
-
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
var cntx = require.context( __dirname + '/scripts/', false , /\.js$/ );
|
|
35
|
+
importAll( cntx );
|
|
37
36
|
|
|
38
37
|
// FIRST MESSAGE
|
|
39
38
|
console.groupCollapsed( `%c${pjson.name} v${pjson.version}%c`,"color:orange","" );
|
|
@@ -49,88 +48,4 @@
|
|
|
49
48
|
console.debug( 'email: %c' + pjson.author.email,"color:orange","" );
|
|
50
49
|
console.groupEnd();
|
|
51
50
|
|
|
52
|
-
/*
|
|
53
|
-
// SYSTEM
|
|
54
|
-
require('./scripts/addListenerMulti.js');
|
|
55
|
-
|
|
56
|
-
// 3party
|
|
57
|
-
require('./3party/shortcut.js');
|
|
58
|
-
|
|
59
|
-
// CURRENCY
|
|
60
|
-
require('./scripts/currency.js');
|
|
61
|
-
|
|
62
|
-
// MEMORY
|
|
63
|
-
require('./scripts/storage.js');
|
|
64
|
-
require('./scripts/cookie.js');
|
|
65
|
-
require('./scripts/indexedDB.js');
|
|
66
|
-
|
|
67
|
-
// NUMBERS
|
|
68
|
-
require('./scripts/randomNum.js');
|
|
69
|
-
require('./scripts/randomNumTmr.js');
|
|
70
|
-
|
|
71
|
-
// TIME
|
|
72
|
-
require('./scripts/epoch.js');
|
|
73
|
-
require('./scripts/parseDate.js');
|
|
74
|
-
require('./scripts/dateUTC.js');
|
|
75
|
-
require('./scripts/dateIso2Epoch.js');
|
|
76
|
-
require('./scripts/dateConvert.js');
|
|
77
|
-
require('./scripts/date2MMDDYYYY.js');
|
|
78
|
-
require('./scripts/date2Iso.js');
|
|
79
|
-
require('./scripts/dateLocal-ISOTime.js');
|
|
80
|
-
|
|
81
|
-
// PATH
|
|
82
|
-
require('./scripts/pathRail.js');
|
|
83
|
-
require('./scripts/pathQuery.js');
|
|
84
|
-
require('./scripts/pathHash.js');
|
|
85
|
-
require('./scripts/pushState.js');
|
|
86
|
-
require('./scripts/anchorToOnClick.js');
|
|
87
|
-
|
|
88
|
-
// FILE
|
|
89
|
-
require('./scripts/loadFile.js');
|
|
90
|
-
//require('./scripts/loadAsset.js');
|
|
91
|
-
require('./scripts/loadJson.js');
|
|
92
|
-
require('./scripts/loadJsonExternal.js');
|
|
93
|
-
|
|
94
|
-
// FORMS
|
|
95
|
-
require('./scripts/serializeForm.js');
|
|
96
|
-
require('./scripts/serializeObj.js');
|
|
97
|
-
|
|
98
|
-
// ARRAY
|
|
99
|
-
// require('./scripts/arrayItemFinder.js');
|
|
100
|
-
// require('./scripts/arrayDeleteItem.js');
|
|
101
|
-
// require('./scripts/arrayMerge.js');
|
|
102
|
-
// require('./scripts/arrayUnique.js');
|
|
103
|
-
require('./scripts/array.js');
|
|
104
|
-
require('./scripts/object2array.js');
|
|
105
|
-
|
|
106
|
-
// SCROLL
|
|
107
|
-
require('./scripts/scrollToElement.js');
|
|
108
|
-
require('./scripts/scrollSmooth.js');
|
|
109
|
-
require('./scripts/scrollIndicator.js');
|
|
110
|
-
require('./scripts/scrollMemory.js');
|
|
111
|
-
require('./scripts/scrollCustom.js');
|
|
112
|
-
|
|
113
|
-
// OTHER
|
|
114
|
-
require('./scripts/camelCase.js');
|
|
115
|
-
require('./scripts/fontFit.js');
|
|
116
|
-
require('./scripts/uuid.js');
|
|
117
|
-
require('./scripts/noCache.js');
|
|
118
|
-
require('./scripts/parseBool.js');
|
|
119
|
-
require('./scripts/isPromise.js');
|
|
120
|
-
require('./scripts/textChanger.js');
|
|
121
|
-
require('./scripts/nl2br.js');
|
|
122
|
-
require('./scripts/sleep.js');
|
|
123
|
-
require('./scripts/printInfo.js');
|
|
124
|
-
require('./scripts/disableSelect.js');
|
|
125
|
-
require('./scripts/fullScreen.js');
|
|
126
|
-
require('./scripts/disableSpellCheck.js');
|
|
127
|
-
require('./scripts/triggerClick.js');
|
|
128
|
-
require('./scripts/handleEvent.js');
|
|
129
|
-
require('./scripts/window.js');
|
|
130
|
-
require('./scripts/purge.js');
|
|
131
|
-
require('./scripts/svgSupport.js');
|
|
132
|
-
require('./scripts/stopConsole.js');
|
|
133
|
-
require('./scripts/onBeforeUnLoad.js');
|
|
134
|
-
*/
|
|
135
|
-
|
|
136
51
|
})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dphelper",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.40",
|
|
4
4
|
"description": "Developer Tools",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"publishConfig": {},
|
|
@@ -61,7 +61,6 @@
|
|
|
61
61
|
"license": "Apache-2.0",
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"jquery": "^3.6.0",
|
|
64
|
-
"jshint": "^2.13.1",
|
|
65
64
|
"require": "^0.4.4",
|
|
66
65
|
"uglify-js": "^3.14.5"
|
|
67
66
|
},
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
|
|
22
22
|
/***********************************************************************/
|
|
23
23
|
|
|
24
|
-
window.dphelper.anchorToOnClick = function(
|
|
24
|
+
window.dphelper.anchorToOnClick = function( el ){
|
|
25
25
|
|
|
26
|
-
$(
|
|
26
|
+
$( el + ' a' ).each( function( index ) {
|
|
27
27
|
|
|
28
28
|
let elem = $( this );
|
|
29
29
|
let href = elem.attr( 'href' );
|
|
@@ -37,8 +37,8 @@ window.dphelper.anchorToOnClick = function( container ){
|
|
|
37
37
|
.addClass( dphelper.pathRail()[3].replace(/\//g, '') )
|
|
38
38
|
.removeAttr( 'href' )
|
|
39
39
|
.on( 'click', function(){
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
dphelper.browser.href( href );
|
|
41
|
+
dphelper.browser.push( '', '', href );
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
|
package/scripts/array.js
CHANGED
|
@@ -24,6 +24,15 @@
|
|
|
24
24
|
},{
|
|
25
25
|
"name":"merge",
|
|
26
26
|
"description":"test"
|
|
27
|
+
},{
|
|
28
|
+
"name":"asc",
|
|
29
|
+
"description":"test"
|
|
30
|
+
},{
|
|
31
|
+
"name":"desc",
|
|
32
|
+
"description":"test"
|
|
33
|
+
},{
|
|
34
|
+
"name":"duplicates",
|
|
35
|
+
"description":"test"
|
|
27
36
|
}
|
|
28
37
|
],
|
|
29
38
|
"example" : "",
|
|
@@ -65,14 +74,13 @@ window.dphelper.array = {
|
|
|
65
74
|
return true;
|
|
66
75
|
}
|
|
67
76
|
|
|
68
|
-
var key = Object.keys(o);
|
|
69
|
-
|
|
70
77
|
for (let key of Object.keys(o)) {
|
|
71
78
|
let value = o[key];
|
|
72
79
|
if(value.length && typeof value === 'object') return value && value.map(iter);
|
|
73
80
|
}
|
|
74
81
|
|
|
75
82
|
// OLD SCHOOL WAY
|
|
83
|
+
//var key = Object.keys(o);
|
|
76
84
|
// for (var p=0; p < key.length; ++p){
|
|
77
85
|
// if( o[key[p]]?.length && typeof o[key[p]] === 'object') return o[key[p]] && o[key[p]].some(iter);
|
|
78
86
|
// }
|
|
@@ -83,12 +91,31 @@ window.dphelper.array = {
|
|
|
83
91
|
|
|
84
92
|
// MERGE
|
|
85
93
|
merge: ( arrayA, arrayB ) => {
|
|
86
|
-
for (const key of Object.keys(
|
|
87
|
-
if (
|
|
94
|
+
for (const key of Object.keys(arrayA)) {
|
|
95
|
+
if (arrayA[key] instanceof Object && arrayB[key]) Object.assign(arrayA[key], window.dphelper.mergeArrays(arrayB[key], arrayA[key]));
|
|
88
96
|
}
|
|
89
97
|
|
|
90
|
-
Object.assign(
|
|
91
|
-
return
|
|
98
|
+
Object.assign(arrayB || {}, arrayA);
|
|
99
|
+
return arrayB;
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
// ASCENDING
|
|
103
|
+
asc: ( array ) => {
|
|
104
|
+
array.sort((a, b) => a - b);
|
|
105
|
+
return array;
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
// ASCENDING
|
|
109
|
+
desc: ( array ) => {
|
|
110
|
+
array.sort(function(a, b){ return b-a; });
|
|
111
|
+
return array;
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
// FIND DUPLICATES
|
|
115
|
+
duplicates: ( array ) => {
|
|
116
|
+
const toFindDuplicates = arr => arr.filter( (item, index) => arr.indexOf( item ) !== index);
|
|
117
|
+
const duplicateElements = toFindDuplicates( array );
|
|
118
|
+
return duplicateElements;
|
|
92
119
|
}
|
|
93
120
|
|
|
94
121
|
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
+
* Copyright (c) 2021, Dario Passariello.
|
|
4
|
+
* Licensed under the Apache-2.0 License.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/***********************************************************************/
|
|
8
|
+
|
|
9
|
+
var description = {
|
|
10
|
+
"name" : "Browser",
|
|
11
|
+
"description" : "test",
|
|
12
|
+
"version" : "0.0.1",
|
|
13
|
+
"command" : "browser",
|
|
14
|
+
"subCommand" : [
|
|
15
|
+
{
|
|
16
|
+
"name":"state",
|
|
17
|
+
"description":"test"
|
|
18
|
+
},{
|
|
19
|
+
"name":"forw",
|
|
20
|
+
"description":"test"
|
|
21
|
+
},{
|
|
22
|
+
"name":"back",
|
|
23
|
+
"description":"test"
|
|
24
|
+
},{
|
|
25
|
+
"name":"reload",
|
|
26
|
+
"description":"test"
|
|
27
|
+
},{
|
|
28
|
+
"name":"href",
|
|
29
|
+
"description":"test"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"example" : "",
|
|
33
|
+
"author" : "Dario Passariello",
|
|
34
|
+
"active" : true
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
window.dphelper._list.scripts.push( description );
|
|
38
|
+
|
|
39
|
+
/***********************************************************************/
|
|
40
|
+
|
|
41
|
+
window.dphelper.browser = {
|
|
42
|
+
|
|
43
|
+
state: (state, title, url) => {
|
|
44
|
+
return history.pushState( state, title, url );
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
forw: ( times ) => {
|
|
48
|
+
return history.go( times );
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
back: ( times ) => {
|
|
52
|
+
return history.go( -Math.abs( times ) );
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
reload: () => {
|
|
56
|
+
// DISCARD POST
|
|
57
|
+
return window.location.href = window.location.href;
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
href: ( url ) => {
|
|
61
|
+
// DISCARD POST
|
|
62
|
+
return window.location.href = url;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
};
|
|
@@ -7,16 +7,11 @@
|
|
|
7
7
|
/***********************************************************************/
|
|
8
8
|
|
|
9
9
|
var description = {
|
|
10
|
-
"name" : "
|
|
10
|
+
"name" : "Coordinates Tools",
|
|
11
11
|
"description" : "test",
|
|
12
12
|
"version" : "0.0.1",
|
|
13
|
-
"command" : "
|
|
14
|
-
"subCommand" : [
|
|
15
|
-
{
|
|
16
|
-
"name":"state",
|
|
17
|
-
"description":"test"
|
|
18
|
-
}
|
|
19
|
-
],
|
|
13
|
+
"command" : "coords",
|
|
14
|
+
"subCommand" : [],
|
|
20
15
|
"example" : "",
|
|
21
16
|
"author" : "Dario Passariello",
|
|
22
17
|
"active" : true
|
|
@@ -25,9 +20,22 @@
|
|
|
25
20
|
window.dphelper._list.scripts.push( description );
|
|
26
21
|
|
|
27
22
|
/***********************************************************************/
|
|
23
|
+
//
|
|
28
24
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
let R = 6378.1;
|
|
26
|
+
window.dphelper.coords = {
|
|
27
|
+
|
|
28
|
+
degreesToRadians: ( degrees ) => {
|
|
29
|
+
var pi = Math.PI;
|
|
30
|
+
return degrees * (pi/180);
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
latToMeters: ( latitude , longitude ) => {
|
|
34
|
+
return R * Math.cos(latitude) * Math.cos(longitude);
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
lngToMeters: ( latitude , longitude ) => {
|
|
38
|
+
return R * Math.cos(latitude) * Math.sin(longitude);
|
|
32
39
|
}
|
|
40
|
+
|
|
33
41
|
};
|
package/scripts/cookie.js
CHANGED
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
|
|
48
48
|
// CREATE THE COOKIE
|
|
49
49
|
|
|
50
|
-
set:
|
|
50
|
+
set: ( cname , value , time , path = '/' ) => {
|
|
51
51
|
var d = new Date();
|
|
52
52
|
d.setTime( d.getTime() + 3600 * 1000 * 24 * 365 );
|
|
53
53
|
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
|
|
60
60
|
// GET THE COOKIE
|
|
61
61
|
|
|
62
|
-
get:
|
|
62
|
+
get: ( cname ) => {
|
|
63
63
|
var asCookies = document.cookie.split( "; " );
|
|
64
64
|
|
|
65
65
|
for ( var i = 0; i < asCookies.length; i++ ){
|
|
@@ -72,13 +72,13 @@
|
|
|
72
72
|
|
|
73
73
|
// DELETE THE COOKIE
|
|
74
74
|
|
|
75
|
-
delete:
|
|
75
|
+
delete: ( cname ) => {
|
|
76
76
|
document.cookie = cname + '=;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/;SameSite=' + CookieSameSite + ';requireSSL='+ CookieSecure +';' + CookieSecure;
|
|
77
77
|
},
|
|
78
78
|
|
|
79
79
|
// CLEAR ALL COOKIE
|
|
80
80
|
|
|
81
|
-
clearAll:
|
|
81
|
+
clearAll: () => {
|
|
82
82
|
var cookies = document.cookie.split(";");
|
|
83
83
|
|
|
84
84
|
for ( var i = 0; i < cookies.length; i++ ) {
|
package/scripts/load.js
CHANGED
|
@@ -34,6 +34,20 @@
|
|
|
34
34
|
|
|
35
35
|
window.dphelper.load = {
|
|
36
36
|
|
|
37
|
+
/*
|
|
38
|
+
Example:
|
|
39
|
+
var cntx = require.context( __dirname + '/scripts/', false , /\.js$/ );
|
|
40
|
+
dphelper.load.import( cntx );
|
|
41
|
+
*/
|
|
42
|
+
import: ( dir , type = false , extension = /\.js$/ ) => {
|
|
43
|
+
let r = require.context( dir , type , extension );
|
|
44
|
+
r.keys().forEach(
|
|
45
|
+
( key ) => (
|
|
46
|
+
cache[ key ] = r( key )
|
|
47
|
+
)
|
|
48
|
+
);
|
|
49
|
+
},
|
|
50
|
+
|
|
37
51
|
file: (element, path) => {
|
|
38
52
|
fetch(path).then(async function (response) {
|
|
39
53
|
const text = await response.text();
|
package/scripts/number.js
CHANGED
package/scripts/obj.js
CHANGED
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
.map( ( [ key, value ] ) => Object.assign( { key } , value && typeof value === 'object' ? { forms: ObjToArray( value ) } : { value, forms: [] } ) );
|
|
41
41
|
},
|
|
42
42
|
|
|
43
|
-
serialize: (value) => {
|
|
43
|
+
serialize: ( value ) => {
|
|
44
44
|
|
|
45
45
|
if (typeof value === 'function') {
|
|
46
46
|
return value.toString();
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
|
|
60
60
|
},
|
|
61
61
|
|
|
62
|
-
deSerialize: (valueNew) => {
|
|
62
|
+
deSerialize: ( valueNew ) => {
|
|
63
63
|
|
|
64
64
|
if (valueNew.toLowerCase().startsWith( 'function(' ) ) {
|
|
65
65
|
return Function('"use strict";return ' + valueNew);
|
package/scripts/scrollbar.js
CHANGED
|
File without changes
|