dphelper 0.2.26 → 0.2.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/{cmd.exe.lnk → #cmd.exe.lnk} +0 -0
- package/data/list.json +38 -17
- package/init.js +6 -0
- package/package.json +14 -7
- package/scripts/addListenerMulti.js +10 -0
- package/scripts/camelCase.js +29 -0
- package/scripts/disableSelect.js +9 -6
- package/scripts/fontFit.js +24 -0
- package/scripts/pathHash.js +1 -2
- package/scripts/pathRail.js +12 -13
- package/README.md.bak +0 -70
|
File without changes
|
package/data/list.json
CHANGED
|
@@ -1,18 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
{
|
|
3
|
-
"
|
|
4
|
-
"description" : "
|
|
5
|
-
"version" : "0.0.1",
|
|
6
|
-
"command" : "<command>\r\ndphelper.anchorToOnClick\r\n</command>",
|
|
7
|
-
"author" : "Dario Passariello",
|
|
8
|
-
"active" : true
|
|
1
|
+
{
|
|
2
|
+
"info" : {
|
|
3
|
+
"title" : "List",
|
|
4
|
+
"description" : "Complete list of tools"
|
|
9
5
|
},
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
6
|
+
"categories" : [
|
|
7
|
+
"3dparty",
|
|
8
|
+
"system",
|
|
9
|
+
"financial",
|
|
10
|
+
"memory",
|
|
11
|
+
"numbers",
|
|
12
|
+
"time",
|
|
13
|
+
"path",
|
|
14
|
+
"file",
|
|
15
|
+
"forms",
|
|
16
|
+
"ui",
|
|
17
|
+
"other"
|
|
18
|
+
],
|
|
19
|
+
"scripts" : [
|
|
20
|
+
{
|
|
21
|
+
"name" : "Anchors to onClick",
|
|
22
|
+
"description" : "Transform all anchor inside specific elements in to onClick (DOM)\r\n<br/>\r\n<br/>\r\n\r\nUsage: <br/>\r\n<br/>\r\n\r\n<code>\r\ndphelper.anchorToOnClick( \"your element(s)\" )\r\n</code>\r\n\r\n<br/>\r\n<br/>\r\nAutomatically all anchors became onClick. Use it at end off page or defer or after DOMs loaded \r\n\r\n",
|
|
23
|
+
"version" : "0.0.1",
|
|
24
|
+
"command" : "anchorToOnClick",
|
|
25
|
+
"example" : "dphelper.anchorToOnClick(\"nav\") --> now all nav anchor are onClick ( href is removed )",
|
|
26
|
+
"author" : "Dario Passariello",
|
|
27
|
+
"active" : true
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name" : "Arrays Tools",
|
|
31
|
+
"description" : "Useful way to andle array without efforts\r\n<br/>\r\n\r\n\r\n",
|
|
32
|
+
"version" : "0.0.1",
|
|
33
|
+
"command" : "array",
|
|
34
|
+
"example" : "// FIND\r\ndphelper.array.find( 12345 , YourArray ) --> search your data\r\n\r\n// UNIQUE\r\ndphelper.array.unique( YourArray ) --> remove duplicates\r\n\r\n// DELETE\r\ndphelper.array.delete( 12345 , YourArray ) --> remove a sub-data using id\r\n\r\n// MERGE\r\ndphelper.array.merge( YourArray1 , YourArray2 ) --> result is YourArray3 ",
|
|
35
|
+
"author" : "Dario Passariello",
|
|
36
|
+
"active" : true
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
}
|
package/init.js
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
const dphelper = window.dphelper = {};
|
|
20
20
|
|
|
21
21
|
window.dphelper.list = require('./data/list.json');
|
|
22
|
+
window.dphelper.list.version = pjson.version;
|
|
22
23
|
|
|
23
24
|
// FIRST MESSAGE
|
|
24
25
|
console.groupCollapsed( `%c${pjson.name} v${pjson.version}%c`,"color:orange","" );
|
|
@@ -36,6 +37,9 @@
|
|
|
36
37
|
|
|
37
38
|
const $ = require("jquery");
|
|
38
39
|
|
|
40
|
+
// SYSTEM
|
|
41
|
+
require('./scripts/addListenerMulti.js');
|
|
42
|
+
|
|
39
43
|
// 3party
|
|
40
44
|
require('./3party/shortcut.js');
|
|
41
45
|
|
|
@@ -94,6 +98,8 @@
|
|
|
94
98
|
require('./scripts/scrollCustom.js');
|
|
95
99
|
|
|
96
100
|
// OTHER
|
|
101
|
+
require('./scripts/camelCase.js');
|
|
102
|
+
require('./scripts/fontFit.js');
|
|
97
103
|
require('./scripts/uuid.js');
|
|
98
104
|
require('./scripts/noCache.js');
|
|
99
105
|
require('./scripts/parseBool.js');
|
package/package.json
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dphelper",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.2.30",
|
|
4
|
+
"description": "Developer Tools",
|
|
5
|
+
|
|
5
6
|
"main": "index.js",
|
|
6
7
|
"publishConfig": {},
|
|
7
|
-
|
|
8
|
-
"test1": "echo \"Error: no test specified\" && exit 1",
|
|
9
|
-
"test": "jest --silent --detectOpenHandles",
|
|
10
|
-
"test-coverage": "jest --coverage --silent"
|
|
11
|
-
},
|
|
8
|
+
|
|
12
9
|
"targets": {
|
|
13
10
|
"main": {
|
|
14
11
|
"includeNodeModules": {
|
|
@@ -27,6 +24,16 @@
|
|
|
27
24
|
"url": "https://github.com/passariello/dpHelper",
|
|
28
25
|
"help": "https://github.com/passariello/dpHelper#readme"
|
|
29
26
|
},
|
|
27
|
+
"funding": [
|
|
28
|
+
{
|
|
29
|
+
"type" : "individual",
|
|
30
|
+
"url" : "https://www.paypal.com/donate/?business=HC7LJ2ZXRRNDL&no_recurring=0&item_name=I+am+a+software+developer.+Just+a+donation+can+help+me+to+have+more+time+to+dedicate+on+this+project¤cy_code=CAD"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"type" : "patreon",
|
|
34
|
+
"url" : "https://www.patreon.com/passariello"
|
|
35
|
+
}
|
|
36
|
+
],
|
|
30
37
|
"eslintConfig": {
|
|
31
38
|
"globals": {
|
|
32
39
|
"window": true
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
+
*
|
|
4
|
+
* camelCase / PascalCase
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2021, Dario Passariello.
|
|
7
|
+
* Licensed under the Apache-2.0 License.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/***********************************************************************/
|
|
11
|
+
|
|
12
|
+
window.dphelper.camelCase = {
|
|
13
|
+
|
|
14
|
+
// toSpace
|
|
15
|
+
toSpace: ( string ) => {
|
|
16
|
+
return string
|
|
17
|
+
.replace(/([A-Z])/g, ' $1')
|
|
18
|
+
.replace(/^./, function(str){ return str.toUpperCase(); })
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
// toUnderscore
|
|
22
|
+
toUnderscore: ( string ) => {
|
|
23
|
+
return string
|
|
24
|
+
.replace(/\.?([A-Z])/g, function (x,y){ return "_" + y.toLowerCase()})
|
|
25
|
+
.replace(/^_/, "");
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
};
|
|
29
|
+
|
package/scripts/disableSelect.js
CHANGED
|
@@ -9,13 +9,16 @@
|
|
|
9
9
|
|
|
10
10
|
/***********************************************************************/
|
|
11
11
|
|
|
12
|
-
window.dphelper.disableSelect = function(
|
|
12
|
+
window.dphelper.disableSelect = function( el = 'body' ){
|
|
13
|
+
|
|
14
|
+
var $ = require( "jquery" );
|
|
15
|
+
var e = e || event;
|
|
13
16
|
|
|
14
|
-
const disabling = (
|
|
17
|
+
const disabling = ( el ) => {
|
|
15
18
|
|
|
16
|
-
const $ = require("jquery");
|
|
19
|
+
const $ = require( "jquery" );
|
|
17
20
|
|
|
18
|
-
$(
|
|
21
|
+
$( el ).each( function( e ){
|
|
19
22
|
|
|
20
23
|
$( this )
|
|
21
24
|
.prop( "unselectable" , "on" )
|
|
@@ -36,8 +39,8 @@
|
|
|
36
39
|
|
|
37
40
|
};
|
|
38
41
|
|
|
39
|
-
document.
|
|
40
|
-
document.
|
|
42
|
+
document.querySelector( el ).addEventListener( 'mousedown' , function( e ){ disabling( el ); }, false );
|
|
43
|
+
document.querySelector( el ).onmousedown = function( e ){ disabling( el ); };
|
|
41
44
|
console.debug("%cSelection Disabled:%c true", "color:gray", "");
|
|
42
45
|
|
|
43
46
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
function fontFitStart(){
|
|
4
|
+
|
|
5
|
+
var divs = document.querySelectorAll( name );
|
|
6
|
+
if( divs.length <= 0 ) return;
|
|
7
|
+
|
|
8
|
+
for(var i = 0; i < divs.length; i++) {
|
|
9
|
+
var fontSize = divs[i].offsetWidth * 0.05;
|
|
10
|
+
divs[i].style.fontSize = fontSize+'px';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
window.dphelper.fontFit = ( name ) => {
|
|
15
|
+
|
|
16
|
+
if( !name ) return;
|
|
17
|
+
window.dphelper.addListenerMulti( window , 'load resize', () => {
|
|
18
|
+
fontFitStart( name );
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
package/scripts/pathHash.js
CHANGED
|
@@ -10,8 +10,7 @@
|
|
|
10
10
|
/***********************************************************************/
|
|
11
11
|
|
|
12
12
|
window.dphelper.pathHash = () => {
|
|
13
|
-
const array = location.hash
|
|
14
|
-
.replace('#', '').split('/');
|
|
13
|
+
const array = location.hash.replace('#', '').split('/');
|
|
15
14
|
if (array.length) {
|
|
16
15
|
return array.filter(item => item);
|
|
17
16
|
} else {
|
package/scripts/pathRail.js
CHANGED
|
@@ -10,17 +10,16 @@
|
|
|
10
10
|
/***********************************************************************/
|
|
11
11
|
|
|
12
12
|
window.dphelper.pathRail = () => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
13
|
+
const array = location.href
|
|
14
|
+
.split("?")[0]
|
|
15
|
+
.replace(location.protocol, '')
|
|
16
|
+
.replace(location.host, '')
|
|
17
|
+
.replace(location.hash, '')
|
|
18
|
+
.split('/');
|
|
19
|
+
if ( array.length > 0 ) {
|
|
20
|
+
const arrayFinal = array.filter(item => item);
|
|
21
|
+
return arrayFinal;
|
|
22
|
+
} else {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
26
25
|
};
|
package/README.md.bak
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
# dpHelper
|
|
2
|
-
|
|
3
|
-
Many utils for your projects
|
|
4
|
-
|
|
5
|
-
Use "npm i dphelper" to install
|
|
6
|
-
|
|
7
|
-
in the index:
|
|
8
|
-
|
|
9
|
-
```js
|
|
10
|
-
import "dphelper"
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
type 'dphelper' in your console to have a look about all available functions that you can use globaly!
|
|
14
|
-
|
|
15
|
-
You can call these from everywhere without import
|
|
16
|
-
|
|
17
|
-
## CURRENCY
|
|
18
|
-
|
|
19
|
-
```js
|
|
20
|
-
dphelper.currency( val, int = 'en-US', cur = 'USD' )
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## MEMORY
|
|
24
|
-
|
|
25
|
-
### STORAGE
|
|
26
|
-
|
|
27
|
-
```js
|
|
28
|
-
dphelper.storage.get( name )
|
|
29
|
-
dphelper.storage.set( name , value )
|
|
30
|
-
dphelper.storage.delete( name )
|
|
31
|
-
dphelper.storage.clearAll()
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
### COOKIE
|
|
35
|
-
|
|
36
|
-
```js
|
|
37
|
-
dphelper.cookie.set( name , value , time , path = '/' )
|
|
38
|
-
dphelper.cookie.get( name )
|
|
39
|
-
dphelper.cookie.delete( name )
|
|
40
|
-
dphelper.cookie.clearAll()
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
### INDEXED-DB
|
|
44
|
-
|
|
45
|
-
```js
|
|
46
|
-
dphelper.indexedDB.create( storeName, table, name )
|
|
47
|
-
dphelper.indexedDB.open( storeName )
|
|
48
|
-
dphelper.indexedDB.store( storeName, table )
|
|
49
|
-
dphelper.indexedDB.insert( storeName, table, key, value )
|
|
50
|
-
dphelper.indexedDB.update( storeName, table, key, value )
|
|
51
|
-
dphelper.indexedDB.get( storeName, table, key )
|
|
52
|
-
|
|
53
|
-
window.dphelper.dbExist() -> know databases
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### NUMBERS
|
|
57
|
-
|
|
58
|
-
```js
|
|
59
|
-
dphelper.rnd() // generate long random number
|
|
60
|
-
dphelper.tmr() // generate number by timer
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
### TIME
|
|
64
|
-
|
|
65
|
-
```js
|
|
66
|
-
dphelper.epoch() // return epoch time
|
|
67
|
-
dphelper.parseDate(value) // epoch to human date
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### 3Party
|