dphelper 0.2.48 → 0.2.57
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/.editorconfig +15 -0
- package/.env +3 -0
- package/.eslintignore +8 -0
- package/.eslintrc.json +36 -0
- package/.gitattributes +2 -0
- package/.hintrc +11 -0
- package/.jsbeautifyrc +25 -0
- package/.jshintrc +14 -0
- package/.prettierignore +2 -0
- package/.prettierrc +7 -0
- package/.vscode/settings.json +54 -0
- package/3party/shortcut.js +224 -0
- package/backup.bat +43 -0
- package/data/list.json +19 -0
- package/dist/LICENSE +201 -0
- package/dist/README.md +176 -0
- package/index.d.ts +14 -0
- package/index.js +10 -2
- package/init.js +48 -0
- package/jest.config.js +18 -0
- package/package.json +127 -75
- package/public/assets/images/banner.png +0 -0
- package/public/assets/logos/logo.svg +64 -0
- package/scripts/anchorToOnClick.js +47 -0
- package/scripts/array.js +142 -0
- package/scripts/browser.js +65 -0
- package/scripts/console.js +86 -0
- package/scripts/coodinates.js +41 -0
- package/scripts/cookie.js +97 -0
- package/scripts/currency.js +41 -0
- package/scripts/date.js +101 -0
- package/scripts/disable.js +90 -0
- package/scripts/event.js +39 -0
- package/scripts/font.js +52 -0
- package/scripts/form.js +113 -0
- package/scripts/function.js +47 -0
- package/scripts/indexedDB.js +222 -0
- package/scripts/json.js +42 -0
- package/scripts/load.js +85 -0
- package/scripts/noCache.js +26 -0
- package/scripts/number.js +66 -0
- package/scripts/obj.js +81 -0
- package/scripts/onBeforeUnLoad.js +120 -0
- package/scripts/parseBool.js +27 -0
- package/scripts/path.js +94 -0
- package/scripts/promise.js +35 -0
- package/scripts/purge.js +53 -0
- package/scripts/screen.js +64 -0
- package/scripts/scrollbar.js +245 -0
- package/scripts/shortcut.js +70 -0
- package/scripts/storage.js +62 -0
- package/scripts/svg.js +372 -0
- package/scripts/text.js +78 -0
- package/scripts/time.js +41 -0
- package/scripts/timer.js +35 -0
- package/scripts/trigger.js +46 -0
- package/scripts/type.js +56 -0
- package/scripts/uuid.js +33 -0
- package/scripts/window.js +50 -0
- package/tests/ld-json-funtions.test.ts +21 -0
- package/tests/ld-json.test.ts +46 -0
- package/webpack.config.js +240 -0
- package/index.js.LICENSE.txt +0 -24
|
@@ -0,0 +1,50 @@
|
|
|
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" : "Window Options",
|
|
11
|
+
"description" : "test",
|
|
12
|
+
"version" : "0.0.1",
|
|
13
|
+
"command" : "window",
|
|
14
|
+
"subCommand" : [],
|
|
15
|
+
"example" : "",
|
|
16
|
+
"author" : "Dario Passariello",
|
|
17
|
+
"active" : true
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
dphelper._list.scripts.push( description );
|
|
21
|
+
|
|
22
|
+
/***********************************************************************/
|
|
23
|
+
|
|
24
|
+
dphelper.window = () => {
|
|
25
|
+
|
|
26
|
+
window.offScreenBuffering = "auto";
|
|
27
|
+
|
|
28
|
+
// HIDE STATUS INFORMATION ON BROWSER BAR
|
|
29
|
+
//***************************************
|
|
30
|
+
|
|
31
|
+
window.status = "";
|
|
32
|
+
window.defaultStatus = "";
|
|
33
|
+
|
|
34
|
+
// WINDOW ANIMATION
|
|
35
|
+
//**********************************
|
|
36
|
+
|
|
37
|
+
( () => {
|
|
38
|
+
return (
|
|
39
|
+
window.requestAnimationFrame ||
|
|
40
|
+
window.webkitRequestAnimationFrame ||
|
|
41
|
+
window.mozRequestAnimationFrame ||
|
|
42
|
+
window.oRequestAnimationFrame ||
|
|
43
|
+
window.msRequestAnimationFrame ||
|
|
44
|
+
function( callback ){
|
|
45
|
+
window.setTimeout( callback, 1000 / 120 );
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
})();
|
|
49
|
+
|
|
50
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Jest imports
|
|
2
|
+
import 'jest-get-type'
|
|
3
|
+
//import 'html-validate/jest'
|
|
4
|
+
//import 'jest-chain'
|
|
5
|
+
//import 'jest-extended'
|
|
6
|
+
//import 'jsdom-global/register'
|
|
7
|
+
import 'jsdom-worker'
|
|
8
|
+
|
|
9
|
+
// test('SchemaLinks() generates proper links', async () => {
|
|
10
|
+
// const data = Schema.schemaLinks('Graph', 'https://mydomain.com/homepage.htm')
|
|
11
|
+
// expect(data).toBeArray()
|
|
12
|
+
// expect(data.length).toBe(3)
|
|
13
|
+
// data.forEach(btn => {
|
|
14
|
+
// expect(btn.url.match(MockData.RegExIsUrl)).toBeArray()
|
|
15
|
+
// })
|
|
16
|
+
// })
|
|
17
|
+
|
|
18
|
+
// test('ldJsonCard() creates card with proper HTML', () => {
|
|
19
|
+
// const data = ldJsonCard(MockData.LdJsonSample, MockData.UrlSample).getDiv().innerHTML
|
|
20
|
+
// expect(data).toBeString().toHTMLValidate()
|
|
21
|
+
// })
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Jest imports
|
|
2
|
+
import 'jest-get-type'
|
|
3
|
+
//import 'html-validate/jest'
|
|
4
|
+
//import 'jest-chain'
|
|
5
|
+
//import 'jest-extended'
|
|
6
|
+
//import 'jsdom-global/register'
|
|
7
|
+
import 'jsdom-worker'
|
|
8
|
+
|
|
9
|
+
// describe('codeInjector() mocking the func', () => {
|
|
10
|
+
// beforeEach(() => {
|
|
11
|
+
// jest.spyOn(actions, 'codeInjector').mockImplementation(() => [MockData.LdJsonSample])
|
|
12
|
+
// jest.spyOn(main, 'sendTaskToWorker').mockImplementation(() => {})
|
|
13
|
+
// })
|
|
14
|
+
|
|
15
|
+
// afterEach(() => {
|
|
16
|
+
// jest.clearAllMocks()
|
|
17
|
+
// })
|
|
18
|
+
|
|
19
|
+
// test('codeInjector() returns valid script(s)', async () => {
|
|
20
|
+
// const data = actions.codeInjector()
|
|
21
|
+
// expect(data).toBeArray()
|
|
22
|
+
// expect(data[0]).toBeObject()
|
|
23
|
+
// expect(actions.codeInjector).toBeCalledTimes(1)
|
|
24
|
+
// })
|
|
25
|
+
|
|
26
|
+
// test('reportGenerator() generates valid HTML from complex LD+JSON', () =>
|
|
27
|
+
// actions.reportGenerator(MockData.UrlSample, actions.codeInjector(), MockData.reportTester))
|
|
28
|
+
|
|
29
|
+
// test('reportGenerator() generates valid HTML from empty Url', () =>
|
|
30
|
+
// actions.reportGenerator('', actions.codeInjector(), MockData.reportTester))
|
|
31
|
+
// })
|
|
32
|
+
|
|
33
|
+
// describe('reportGenerator()', () => {
|
|
34
|
+
// beforeEach(() => {
|
|
35
|
+
// jest.spyOn(main, 'sendTaskToWorker').mockImplementation(() => {})
|
|
36
|
+
// })
|
|
37
|
+
|
|
38
|
+
// test('reportGenerator() LD-JSON testing report', () =>
|
|
39
|
+
// actions.reportGenerator(MockData.UrlSample, [MockData.LdJsonSample], MockData.reportTester))
|
|
40
|
+
|
|
41
|
+
// test('reportGenerator() generates valid HTML from empty LD+JSON', () =>
|
|
42
|
+
// actions.reportGenerator(MockData.UrlSample, [], MockData.reportTester))
|
|
43
|
+
|
|
44
|
+
// test('reportGenerator() generates valid HTML from empty Url and empty LD+JSON', () =>
|
|
45
|
+
// actions.reportGenerator('', [], MockData.reportTester))
|
|
46
|
+
// })
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright: © 2022 Dario Passariello <dariopassariello@gmail.com>
|
|
3
|
+
License: CC BY-NC-ND 4.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const webpack = require("webpack");
|
|
8
|
+
const dotenv = require('dotenv').config({path: __dirname + '/.env'});
|
|
9
|
+
const TerserPlugin = require("terser-webpack-plugin");
|
|
10
|
+
const CopyPlugin = require("copy-webpack-plugin");
|
|
11
|
+
|
|
12
|
+
let pjson = require('./package.json');
|
|
13
|
+
|
|
14
|
+
module.exports = (env, argv) => {
|
|
15
|
+
|
|
16
|
+
console.log(
|
|
17
|
+
{
|
|
18
|
+
version: pjson.version,
|
|
19
|
+
codeName: pjson.appCode,
|
|
20
|
+
relaseCodeName: pjson.appCodeRelease,
|
|
21
|
+
relaseType: pjson.appType,
|
|
22
|
+
appName: pjson.appName,
|
|
23
|
+
root: pjson.appFolder,
|
|
24
|
+
folderAPI: pjson.appAPI,
|
|
25
|
+
mode: argv.mode === 'development' ? 'development' : 'production',
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
console.debug( "\n\tYour API came from: " + JSON.stringify( pjson.apiDev ) + "\n\n");
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
|
|
33
|
+
mode: argv.mode === 'development' ? 'development' : 'production',
|
|
34
|
+
devtool: argv.mode === 'development' ? 'eval-source-map' : 'cheap-module-source-map',
|
|
35
|
+
stats: argv.mode === 'development' ? 'errors-warnings' : '',
|
|
36
|
+
cache: argv.mode === 'development' ? false : true,
|
|
37
|
+
target: 'web',
|
|
38
|
+
|
|
39
|
+
devServer: {
|
|
40
|
+
|
|
41
|
+
static: {
|
|
42
|
+
directory: path.join( __dirname, 'dist'),
|
|
43
|
+
publicPath: '/',
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
port: pjson.appPort,
|
|
47
|
+
compress: argv.mode === 'development' ? false : true,
|
|
48
|
+
magicHtml: argv.mode === 'development' ? true : false,
|
|
49
|
+
liveReload: argv.mode === 'development' ? true : false,
|
|
50
|
+
hot: argv.mode === 'development' ? true : false,
|
|
51
|
+
historyApiFallback: true,
|
|
52
|
+
open: false,
|
|
53
|
+
|
|
54
|
+
headers: {
|
|
55
|
+
'Access-Control-Allow-Origin': '*',
|
|
56
|
+
'Access-Control-Allow-Credentials': true,
|
|
57
|
+
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',
|
|
58
|
+
'Access-Control-Allow-Headers': 'X-Requested-With, content-type, Authorization',
|
|
59
|
+
'Accept-Encoding': '*',
|
|
60
|
+
'Crossorigin': 'anonymous',
|
|
61
|
+
'Author': 'Dario Passariello',
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
webSocketServer: 'ws',
|
|
65
|
+
client: {
|
|
66
|
+
overlay: argv.mode === 'development' ? true : false,
|
|
67
|
+
webSocketTransport: 'ws',
|
|
68
|
+
//progress: true,
|
|
69
|
+
//logging: 'info',
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
entry: {
|
|
75
|
+
index: ['./index.js']
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
output: {
|
|
79
|
+
filename: '[name].js?t=' + new Date().getTime(),
|
|
80
|
+
path: path.resolve(__dirname, 'dist'),
|
|
81
|
+
clean: true,
|
|
82
|
+
publicPath: '/'
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
performance: {
|
|
86
|
+
hints: argv.mode === 'development' ? 'error' : false,
|
|
87
|
+
maxEntrypointSize: 51200000,
|
|
88
|
+
maxAssetSize: 51200000
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
optimization: {
|
|
92
|
+
minimize: argv.mode === 'development' ? false : true,
|
|
93
|
+
minimizer: [new TerserPlugin({
|
|
94
|
+
exclude: /static/,
|
|
95
|
+
})]
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
resolve: {
|
|
99
|
+
|
|
100
|
+
fallback: {
|
|
101
|
+
"fs": false
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
alias: {
|
|
105
|
+
Assets: path.resolve( __dirname, 'public/assets' ),
|
|
106
|
+
Components: path.resolve( __dirname, 'src/components' ),
|
|
107
|
+
Shared: path.resolve( __dirname, 'src/shared' ),
|
|
108
|
+
App: path.resolve( __dirname, 'src/app' ),
|
|
109
|
+
Config: path.resolve( __dirname, 'src/config' ),
|
|
110
|
+
Data: path.resolve( __dirname, 'src/data' ),
|
|
111
|
+
Pages: path.resolve( __dirname, 'src/pages' ),
|
|
112
|
+
Scripts: path.resolve( __dirname, 'src/scripts' ),
|
|
113
|
+
Styles: path.resolve( __dirname, 'src/styles' ),
|
|
114
|
+
Typings: path.resolve( __dirname, 'src/typings' ),
|
|
115
|
+
Utils: path.resolve( __dirname, 'src/utils' ),
|
|
116
|
+
Validators: path.resolve( __dirname, 'src/validators' ),
|
|
117
|
+
Layout: path.resolve( __dirname, 'src/layout' ),
|
|
118
|
+
Root: path.resolve( __dirname, 'src/' )
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
modules: [path.resolve('node_modules')],
|
|
122
|
+
extensions: [".ts", ".tsx", ".js", ".less", ".css", "sass", "scss"],
|
|
123
|
+
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
module: {
|
|
127
|
+
|
|
128
|
+
rules: [
|
|
129
|
+
// we use babel-loader to load our jsx and tsx files
|
|
130
|
+
{
|
|
131
|
+
test: /\.(ts|tsx|js|jsx)$/,
|
|
132
|
+
loader: require.resolve('babel-loader'),
|
|
133
|
+
exclude: [ /node_modules/, /.OLD/ ],
|
|
134
|
+
options: {
|
|
135
|
+
//plugins: ['react-hot-loader/babel'],
|
|
136
|
+
cacheDirectory: argv.mode === 'development' ? true : false,
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
// plain file loader
|
|
141
|
+
{
|
|
142
|
+
test: /\.(txt)$/i, //
|
|
143
|
+
loader: 'file-loader',
|
|
144
|
+
exclude: [ /.OLD/ ]
|
|
145
|
+
},
|
|
146
|
+
|
|
147
|
+
// CSS, SCSS
|
|
148
|
+
{
|
|
149
|
+
test: /\.(s?(c|a)ss)(\?v=\d+\.\d+\.\d+)?$/i,
|
|
150
|
+
use: [
|
|
151
|
+
{
|
|
152
|
+
loader: "style-loader"
|
|
153
|
+
},{
|
|
154
|
+
loader: 'css-loader',
|
|
155
|
+
options: {
|
|
156
|
+
importLoaders: 1,
|
|
157
|
+
modules: false,
|
|
158
|
+
sourceMap: false,
|
|
159
|
+
url: false
|
|
160
|
+
},
|
|
161
|
+
},{
|
|
162
|
+
loader: "sass-loader"
|
|
163
|
+
},
|
|
164
|
+
],
|
|
165
|
+
exclude: [ /.OLD/ ]
|
|
166
|
+
},
|
|
167
|
+
|
|
168
|
+
// css-loader and less-loader
|
|
169
|
+
{
|
|
170
|
+
test: /\.(less)(\?v=\d+\.\d+\.\d+)?$/i,
|
|
171
|
+
use: [
|
|
172
|
+
{
|
|
173
|
+
loader: "style-loader"
|
|
174
|
+
},{
|
|
175
|
+
loader: "css-loader",
|
|
176
|
+
options: {
|
|
177
|
+
sourceMap: true,
|
|
178
|
+
modules: true,
|
|
179
|
+
url: false
|
|
180
|
+
}
|
|
181
|
+
},{
|
|
182
|
+
loader: "less-loader"
|
|
183
|
+
},
|
|
184
|
+
],
|
|
185
|
+
exclude: [ /.OLD/ ]
|
|
186
|
+
},
|
|
187
|
+
|
|
188
|
+
// assets
|
|
189
|
+
{
|
|
190
|
+
test: /\.(a?png|jpe?g|gif|ico|bmp|webb|svg)(\?v=\d+\.\d+\.\d+)?$/i,
|
|
191
|
+
type: 'asset/resource',
|
|
192
|
+
exclude: [ /node_modules/, /.OLD/ ],
|
|
193
|
+
},
|
|
194
|
+
|
|
195
|
+
// fonts
|
|
196
|
+
{
|
|
197
|
+
test: /\.(woff(2)?|ttf|eot)(\?v=\d+\.\d+\.\d+)?$/i,
|
|
198
|
+
type: 'asset/resource',
|
|
199
|
+
exclude: [ /node_modules/, /.OLD/ ],
|
|
200
|
+
},
|
|
201
|
+
|
|
202
|
+
],
|
|
203
|
+
},
|
|
204
|
+
|
|
205
|
+
plugins: [
|
|
206
|
+
|
|
207
|
+
//Environment
|
|
208
|
+
new webpack.DefinePlugin({
|
|
209
|
+
'process.env.NODE_ENV': JSON.stringify( argv.mode ),
|
|
210
|
+
'process.env': dotenv.parsed,
|
|
211
|
+
'process.env.debug': argv.mode === 'development' ? true : false
|
|
212
|
+
}),
|
|
213
|
+
|
|
214
|
+
new CopyPlugin({
|
|
215
|
+
patterns: [
|
|
216
|
+
{
|
|
217
|
+
from: "./public",
|
|
218
|
+
to: "./",
|
|
219
|
+
noErrorOnMissing: true,
|
|
220
|
+
globOptions: {
|
|
221
|
+
gitignore: true
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
{ from: "./.github", to: "./.github" },
|
|
225
|
+
{ from: "./package.json", to: "./" },
|
|
226
|
+
{ from: "./LICENSE", to: "./" },
|
|
227
|
+
{ from: "./README.md", to: "./" }
|
|
228
|
+
],
|
|
229
|
+
options: {
|
|
230
|
+
concurrency: 100,
|
|
231
|
+
}
|
|
232
|
+
})
|
|
233
|
+
|
|
234
|
+
]
|
|
235
|
+
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
|
package/index.js.LICENSE.txt
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Sizzle CSS Selector Engine v2.3.6
|
|
3
|
-
* https://sizzlejs.com/
|
|
4
|
-
*
|
|
5
|
-
* Copyright JS Foundation and other contributors
|
|
6
|
-
* Released under the MIT license
|
|
7
|
-
* https://js.foundation/
|
|
8
|
-
*
|
|
9
|
-
* Date: 2021-02-16
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/*!
|
|
13
|
-
* jQuery JavaScript Library v3.6.0
|
|
14
|
-
* https://jquery.com/
|
|
15
|
-
*
|
|
16
|
-
* Includes Sizzle.js
|
|
17
|
-
* https://sizzlejs.com/
|
|
18
|
-
*
|
|
19
|
-
* Copyright OpenJS Foundation and other contributors
|
|
20
|
-
* Released under the MIT license
|
|
21
|
-
* https://jquery.org/license
|
|
22
|
-
*
|
|
23
|
-
* Date: 2021-03-02T17:08Z
|
|
24
|
-
*/
|