layerpro 0.0.56 → 0.0.60
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 +13 -0
- package/.env +3 -0
- package/.eslintignore +12 -0
- package/.eslintrc.json +110 -0
- package/.gitattributes +2 -0
- package/.jsbeautifyrc +26 -0
- package/.prettierignore +2 -0
- package/.prettierrc +7 -0
- package/.vscode/launch.json +22 -0
- package/.vscode/settings.json +84 -0
- package/.vscodeignore +28 -0
- package/__mocks__/fileMock.js +3 -0
- package/__mocks__/styleMock.js +3 -0
- package/babel.config.js +34 -0
- package/backup.bat +43 -0
- package/coverage/clover.xml +6 -0
- package/coverage/coverage-final.json +1 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +101 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov.info +0 -0
- package/{LICENSE.txt → dist/LICENSE.txt} +0 -0
- package/{README.md → dist/README.md} +0 -0
- package/documents/LICENSE.txt +21 -0
- package/documents/README.md +7 -0
- package/{SECURITY.md → documents/SECURITY.md} +0 -0
- package/index.js +7 -2
- package/init.js +35 -0
- package/jest.config.js +61 -0
- package/jsconfig.json +10 -0
- package/node/createTag.js +7 -0
- package/node/gitDeploy.js +7 -0
- package/node/goLive.js +7 -0
- package/package.json +40 -28
- package/scripts/GenLayer.jsx +234 -0
- package/scripts/message.jsx +280 -0
- package/scripts/mouseCoords.jsx +45 -0
- package/scripts/popup.jsx +604 -0
- package/scripts/purge.jsx +29 -0
- package/scripts/smoothScroll.js +69 -0
- package/scripts/window.js +28 -0
- package/styles/dock.scss +100 -0
- package/styles/general.scss +241 -0
- package/styles/icons.scss +33 -0
- package/styles/input.scss +35 -0
- package/styles/messages.scss +76 -0
- package/styles/resize.scss +99 -0
- package/styles/root.scss +14 -0
- package/styles/scrollbar.scss +24 -0
- package/tests/setupJest.tsx +4 -0
- package/tsconfig.json +69 -0
- package/typings/image.d.ts +9 -0
- package/typings/index.d.ts +7 -0
- package/typings/layerpro.d.ts +22 -0
- package/typings/styles.d.ts +27 -0
- package/typings/vscode.d.ts +14724 -0
- package/webpack.config.js +239 -0
- package/index.js.LICENSE.txt +0 -29
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const moment = require('moment')
|
|
2
|
+
const execSync = require('node:child_process').execSync
|
|
3
|
+
const dateTime = moment().format('YYYYMMDDHHmmss')
|
|
4
|
+
const pjson = require('../package.json')
|
|
5
|
+
|
|
6
|
+
//https://stackoverflow.com/questions/55021363/how-to-pass-current-datetime-in-npm-script-for-git-commit-message-in-windows-and
|
|
7
|
+
execSync(`cd .. && git add . && git commit -m \"ver. ${pjson.version} / ${dateTime}\" && git pull && git push --all`, { stdio: [0, 1, 2] })
|
package/node/goLive.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const moment = require('moment')
|
|
2
|
+
const execSync = require('node:child_process').execSync
|
|
3
|
+
const dateTime = moment().format('YYYYMMDDHHmmss')
|
|
4
|
+
const pjson = require('../package.json')
|
|
5
|
+
|
|
6
|
+
//https://stackoverflow.com/questions/55021363/how-to-pass-current-datetime-in-npm-script-for-git-commit-message-in-windows-and
|
|
7
|
+
execSync(`cli-confirm \"Do you want go live?\" && npm version patch --force && cd.. && webpack --progress --color --mode production --config webpack.config.js && cd dist && npm publish`, { stdio: [0, 1, 2] })
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "layerpro",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.60",
|
|
4
4
|
"description": "Manage your popups and customize them",
|
|
5
5
|
"deprecated": false,
|
|
6
6
|
"appCode": "layerpro",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"typings/styles.d.ts"
|
|
29
29
|
],
|
|
30
30
|
"engines": {
|
|
31
|
-
"node": ">=0.
|
|
31
|
+
"node": ">=4.0.0"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"make-dist": "webpack --progress --color --mode production --config webpack.config.js",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"git-tag": "cd node && node createTag",
|
|
37
37
|
"backup": "backup.bat",
|
|
38
38
|
"goLive": "cd node && node goLive",
|
|
39
|
-
"test_jest": "jest --watchAll --coverage
|
|
40
|
-
"test_lint": "eslint --fix"
|
|
39
|
+
"test_jest": "jest --watchAll --coverage",
|
|
40
|
+
"test_lint": "eslint . --ext .ts,.tsx,.js,.jsx --fix"
|
|
41
41
|
},
|
|
42
42
|
"eslintConfig": {
|
|
43
43
|
"globals": {
|
|
@@ -83,46 +83,58 @@
|
|
|
83
83
|
"url": "https://github.com/passariello/layerpro/issues"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
|
+
"@typescript-eslint/eslint-plugin": "5.31.0",
|
|
86
87
|
"css-loader": "6.7.1",
|
|
87
|
-
"eslint": "8.
|
|
88
|
+
"eslint": "8.20.0",
|
|
89
|
+
"eslint-plugin-import": "2.26.0",
|
|
90
|
+
"eslint-plugin-jest": "26.6.0",
|
|
91
|
+
"eslint-plugin-node": "11.1.0",
|
|
92
|
+
"eslint-plugin-promise": "6.0.0",
|
|
93
|
+
"eslint-plugin-react": "7.30.1",
|
|
94
|
+
"eslint-plugin-unicorn": "43.0.2",
|
|
88
95
|
"file-loader": "6.2.0",
|
|
89
|
-
"jest": "
|
|
90
|
-
"less-loader": "
|
|
91
|
-
"sass-loader": "
|
|
96
|
+
"jest": "28.1.3",
|
|
97
|
+
"less-loader": "11.0.0",
|
|
98
|
+
"sass-loader": "13.0.2",
|
|
92
99
|
"style-loader": "3.3.1",
|
|
93
|
-
"webpack-cli": "4.
|
|
100
|
+
"webpack-cli": "4.10.0"
|
|
94
101
|
},
|
|
95
102
|
"dependencies": {
|
|
96
|
-
"@babel/plugin-proposal-class-properties": "7.
|
|
97
|
-
"@babel/plugin-transform-runtime": "7.
|
|
98
|
-
"@babel/preset-env": "7.
|
|
99
|
-
"@babel/preset-react": "7.
|
|
100
|
-
"@babel/preset-typescript": "7.
|
|
101
|
-
"@testing-library/jest-dom": "^5.16.
|
|
102
|
-
"@testing-library/user-event": "^14.
|
|
103
|
+
"@babel/plugin-proposal-class-properties": "7.18.6",
|
|
104
|
+
"@babel/plugin-transform-runtime": "7.18.9",
|
|
105
|
+
"@babel/preset-env": "7.18.9",
|
|
106
|
+
"@babel/preset-react": "7.18.6",
|
|
107
|
+
"@babel/preset-typescript": "7.18.6",
|
|
108
|
+
"@testing-library/jest-dom": "^5.16.4",
|
|
109
|
+
"@testing-library/user-event": "^14.3.0",
|
|
110
|
+
"@types/enzyme-adapter-react-16": "1.0.6",
|
|
111
|
+
"@typescript-eslint/parser": "5.31.0",
|
|
103
112
|
"babel-loader": "8.2.5",
|
|
104
113
|
"classnames": "2.3.1",
|
|
105
114
|
"cli-confirm": "1.0.1",
|
|
106
|
-
"compression-webpack-plugin": "
|
|
107
|
-
"concurrently": "7.
|
|
108
|
-
"copy-webpack-plugin": "
|
|
115
|
+
"compression-webpack-plugin": "10.0.0",
|
|
116
|
+
"concurrently": "7.3.0",
|
|
117
|
+
"copy-webpack-plugin": "11.0.0",
|
|
109
118
|
"css": "3.0.0",
|
|
110
|
-
"dotenv": "16.0.
|
|
119
|
+
"dotenv": "16.0.1",
|
|
120
|
+
"enzyme": "3.11.0",
|
|
111
121
|
"enzyme-to-json": "3.6.2",
|
|
112
122
|
"fs": "0.0.1-security",
|
|
113
123
|
"html-webpack-plugin": "5.5.0",
|
|
114
124
|
"jquery": "3.6.0",
|
|
115
125
|
"jsdom-worker": "0.2.1",
|
|
116
|
-
"jshint": "^2.13.
|
|
117
|
-
"less": "4.1.
|
|
118
|
-
"moment": "2.29.
|
|
126
|
+
"jshint": "^2.13.5",
|
|
127
|
+
"less": "4.1.3",
|
|
128
|
+
"moment": "2.29.4",
|
|
119
129
|
"path": "0.12.7",
|
|
120
130
|
"progress-bar-webpack-plugin": "2.1.0",
|
|
121
|
-
"react": "18.
|
|
122
|
-
"react-dom": "18.
|
|
131
|
+
"react": "18.2.0",
|
|
132
|
+
"react-dom": "18.2.0",
|
|
123
133
|
"require": "0.4.4",
|
|
124
|
-
"sass": "1.
|
|
125
|
-
"
|
|
126
|
-
"
|
|
134
|
+
"sass": "1.54.0",
|
|
135
|
+
"terser-webpack-plugin": "5.3.3",
|
|
136
|
+
"ts-jest": "28.0.7",
|
|
137
|
+
"typescript": "4.7.4",
|
|
138
|
+
"webpack": "5.74.0"
|
|
127
139
|
}
|
|
128
140
|
}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright: © 2022 Dario Passariello <dariopassariello@gmail.com>
|
|
3
|
+
License: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { createRoot } from 'react-dom/client'
|
|
7
|
+
|
|
8
|
+
export const GenLayer = (p) => {
|
|
9
|
+
|
|
10
|
+
var root // FUCKYOU FACEBOOK!
|
|
11
|
+
|
|
12
|
+
let pContainer = p.raised === true ? '.popup_raised_' + p.id : '#popup'
|
|
13
|
+
|
|
14
|
+
$('[class^="popup_window_"]', pContainer).removeClass('zHigh')
|
|
15
|
+
$('[class^="popup_bar_"]', pContainer).removeClass('pupup_bar_selected')
|
|
16
|
+
$('[class^="icon_"]', pContainer).removeClass('pupup_bar_selected')
|
|
17
|
+
|
|
18
|
+
if (p.raised === true) {
|
|
19
|
+
$('<div class="popup_raised_' + p.id + '">', pContainer)
|
|
20
|
+
.appendTo('#popup')
|
|
21
|
+
.css({
|
|
22
|
+
'pointer-events': 'auto',
|
|
23
|
+
'z-index': layerpro.popup.zIndex($('[class^="popup_overflow_"]', pContainer)) + 1000
|
|
24
|
+
})
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
$('<div class="popup_overflow_' + p.id + '">', pContainer)
|
|
28
|
+
.appendTo(pContainer)
|
|
29
|
+
.css({
|
|
30
|
+
'top': p.top,
|
|
31
|
+
'left': p.left,
|
|
32
|
+
'right': p.right,
|
|
33
|
+
'bottom': p.bottom,
|
|
34
|
+
'width': p.width,
|
|
35
|
+
'height': p.height,
|
|
36
|
+
'min-width': p.minWidth,
|
|
37
|
+
'min-height': p.minHeight,
|
|
38
|
+
'pointer-events': 'auto',
|
|
39
|
+
'z-index': layerpro.popup.zIndex($('[class^="popup_overflow_"]', pContainer)) + 1
|
|
40
|
+
})
|
|
41
|
+
.on("mousedown", function (e) { layerpro.popup.index(p) })
|
|
42
|
+
.hide()
|
|
43
|
+
.fadeIn(p.fadeIn)
|
|
44
|
+
|
|
45
|
+
let item = $('<div class="popup_window_' + p.id + '">', pContainer)
|
|
46
|
+
//.on("mouseup", function( e ){ layerpro.popup.index( p ); })
|
|
47
|
+
.appendTo('.popup_overflow_' + p.id)
|
|
48
|
+
.css({ 'pointer-events': 'auto' })
|
|
49
|
+
.addClass('zHigh')
|
|
50
|
+
|
|
51
|
+
/*******************************************************************/
|
|
52
|
+
// CHECK IF NEED CENTERED
|
|
53
|
+
|
|
54
|
+
const pos = [p.top, p.left, p.bottom, p.right]
|
|
55
|
+
const sum = pos.reduce((sumSoFar, nextValue) => {
|
|
56
|
+
if (typeof nextValue === "number" && isFinite(nextValue)) { return sumSoFar + nextValue }
|
|
57
|
+
return sumSoFar
|
|
58
|
+
}, 0)
|
|
59
|
+
|
|
60
|
+
if (sum === 0) layerpro.popup.center(p)
|
|
61
|
+
|
|
62
|
+
/*******************************************************************/
|
|
63
|
+
// BAR
|
|
64
|
+
|
|
65
|
+
$('<div class="popup_bar_' + p.id + '">', pContainer)
|
|
66
|
+
.appendTo(item)
|
|
67
|
+
.addClass('pupup_bar_selected')
|
|
68
|
+
|
|
69
|
+
$('<div class="popup_icon_' + p.id + '">' + p.icon + '</div>', pContainer)
|
|
70
|
+
.appendTo(".popup_bar_" + p.id)
|
|
71
|
+
|
|
72
|
+
$('<div class="popup_drag_' + p.id + '">' + p.name + '</div>', pContainer)
|
|
73
|
+
.appendTo(".popup_bar_" + p.id)
|
|
74
|
+
|
|
75
|
+
$('<div class="popup_option_' + p.id + '">', pContainer)
|
|
76
|
+
.appendTo(".popup_bar_" + p.id)
|
|
77
|
+
|
|
78
|
+
/*******************************************************************/
|
|
79
|
+
// DOCK GENERATION
|
|
80
|
+
|
|
81
|
+
if (p.iconize === true && $('#popup_dock').length === 0) {
|
|
82
|
+
|
|
83
|
+
$('#root').css('margin', '0 0 var( --dock-height ) 0')
|
|
84
|
+
|
|
85
|
+
let dock = `<div id="popup_dock">
|
|
86
|
+
<div id="popup_dock_icon"></div>
|
|
87
|
+
<div id="popup_dock_list"></div>
|
|
88
|
+
<div id="popup_dock_options"></div>
|
|
89
|
+
</div>`
|
|
90
|
+
|
|
91
|
+
$(dock)
|
|
92
|
+
.appendTo('#popup')
|
|
93
|
+
.css({
|
|
94
|
+
'pointer-events': 'auto',
|
|
95
|
+
'z-index': layerpro.popup.zIndex($('#popup')) + 1000
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/*******************************************************************/
|
|
101
|
+
// DOCK BEHAVIOR
|
|
102
|
+
|
|
103
|
+
if ($('#popup_dock').length > 0 && p.dockable === true) {
|
|
104
|
+
let dock_icon = `
|
|
105
|
+
<div class="icon_${p.id}">
|
|
106
|
+
<span>${p.icon}</span>
|
|
107
|
+
<span>${p.name}</span>
|
|
108
|
+
`
|
|
109
|
+
|
|
110
|
+
$(dock_icon, '#popup_dock')
|
|
111
|
+
.appendTo('#popup_dock_list')
|
|
112
|
+
.addClass('pupup_bar_selected')
|
|
113
|
+
.find("span")
|
|
114
|
+
.on('click', function () {
|
|
115
|
+
|
|
116
|
+
if ($(".popup_overflow_" + p.id + ':hidden')) {
|
|
117
|
+
layerpro.popup.iconize(p)
|
|
118
|
+
layerpro.popup.index(p)
|
|
119
|
+
} else {
|
|
120
|
+
layerpro.popup.iconize(p)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
layerpro.popup.index(p)
|
|
124
|
+
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
$(`<button class="icon_close_${p.id}">X</button>`, '#popup_dock')
|
|
128
|
+
.appendTo(`.icon_${p.id}`)
|
|
129
|
+
.on('click', function () { layerpro.popup.close(p) })
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/*******************************************************************/
|
|
133
|
+
// ICONIFICATION
|
|
134
|
+
|
|
135
|
+
if (p.iconize === true) {
|
|
136
|
+
$('<button class="button_iconize_' + p.id + ' iconize">', '#popup')
|
|
137
|
+
.appendTo(".popup_option_" + p.id)
|
|
138
|
+
.on('click', function () { layerpro.popup.iconize(p) })
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/*******************************************************************/
|
|
142
|
+
// MAXIMIZATION
|
|
143
|
+
|
|
144
|
+
if (p.maximize === true) {
|
|
145
|
+
$('<button class="button_maximize_' + p.id + ' maximize">', '#popup')
|
|
146
|
+
.appendTo(".popup_option_" + p.id)
|
|
147
|
+
.on('click', function () { layerpro.popup.maximize(p) })
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/*******************************************************************/
|
|
151
|
+
// CLOSE
|
|
152
|
+
|
|
153
|
+
if (p.close === true) {
|
|
154
|
+
$('<button class="button_close_' + p.id + ' close">', '#popup')
|
|
155
|
+
.appendTo(".popup_option_" + p.id)
|
|
156
|
+
.on('click', function () { layerpro.popup.close(p) })
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/*******************************************************************/
|
|
160
|
+
// BODY
|
|
161
|
+
|
|
162
|
+
let _overflow = $('<div class="popup_overflow_' + p.id + '">', '#popup')
|
|
163
|
+
|
|
164
|
+
$('<div class="popup_internal_' + p.id + '">', _overflow)
|
|
165
|
+
.appendTo(item)
|
|
166
|
+
|
|
167
|
+
$('<div class="popup_body_' + p.id + '">', _overflow)
|
|
168
|
+
.appendTo(".popup_internal_" + p.id)
|
|
169
|
+
.hide()
|
|
170
|
+
.fadeIn(p.fadeIn, function () { showBody() })
|
|
171
|
+
|
|
172
|
+
const showBody = () => {
|
|
173
|
+
if (p.body && !p.source) {
|
|
174
|
+
if (p.body.props) {
|
|
175
|
+
|
|
176
|
+
if (!p?.body?.props?.children) return (console.debug('You need to pass a component to LayerPro'))
|
|
177
|
+
|
|
178
|
+
if (!root) root = createRoot($('.popup_body_' + p.id)[0])
|
|
179
|
+
root.render(p.body.props.children)
|
|
180
|
+
$('.popup_body_' + p.id).delay(900).fadeIn(100)
|
|
181
|
+
|
|
182
|
+
//createRoot( $('.popup_body_' + p.id )[0] ).render( p.body.props.children );
|
|
183
|
+
|
|
184
|
+
} else {
|
|
185
|
+
|
|
186
|
+
$('.popup_body_' + p.id).html(p.body)
|
|
187
|
+
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return false
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/*******************************************************************/
|
|
194
|
+
// SOURCE
|
|
195
|
+
|
|
196
|
+
if (p.source) {
|
|
197
|
+
|
|
198
|
+
$('.popup_body_' + p.id).load(p.source, function (responseTxt, statusTxt, jqXHR) {
|
|
199
|
+
|
|
200
|
+
if (statusTxt === "success") {
|
|
201
|
+
$(this)
|
|
202
|
+
.hide()
|
|
203
|
+
.html(responseTxt)
|
|
204
|
+
.fadeIn(p.fadeIn)
|
|
205
|
+
/*.animate({ scrollTop:0 }, 500, 'swing'); */
|
|
206
|
+
//console.log( responseTxt );
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (statusTxt === "error") {
|
|
210
|
+
console.log("Error: " + jqXHR.status + " " + jqXHR.statusText)
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
})
|
|
214
|
+
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/*******************************************************************/
|
|
218
|
+
// MOVABLE
|
|
219
|
+
|
|
220
|
+
if (p.movable) layerpro.popup.movable(p)
|
|
221
|
+
|
|
222
|
+
/*******************************************************************/
|
|
223
|
+
// RESIZE
|
|
224
|
+
|
|
225
|
+
if (p.resizable) layerpro.popup.resizable(p)
|
|
226
|
+
|
|
227
|
+
/*******************************************************************/
|
|
228
|
+
// START MAXIMIZED
|
|
229
|
+
|
|
230
|
+
if (p.isMaximize) layerpro.popup.maximize(p)
|
|
231
|
+
|
|
232
|
+
return false
|
|
233
|
+
|
|
234
|
+
}
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright: © 2022 Dario Passariello <dariopassariello@gmail.com>
|
|
3
|
+
License: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/*****************************************************************************************/
|
|
7
|
+
// ALERT
|
|
8
|
+
|
|
9
|
+
layerpro.alert = (txt) => {
|
|
10
|
+
|
|
11
|
+
const pUp = layerpro.popup.open({
|
|
12
|
+
id: "__alert",
|
|
13
|
+
body: "",
|
|
14
|
+
source: "",
|
|
15
|
+
width: 380,
|
|
16
|
+
height: 220,
|
|
17
|
+
name: "Warning",
|
|
18
|
+
icon: "⚠",
|
|
19
|
+
iconize: false,
|
|
20
|
+
maximize: false,
|
|
21
|
+
close: true,
|
|
22
|
+
isMaximize: false,
|
|
23
|
+
dockable: false,
|
|
24
|
+
raised: true,
|
|
25
|
+
movable: true,
|
|
26
|
+
resizable: false,
|
|
27
|
+
store: false,
|
|
28
|
+
top: "",
|
|
29
|
+
left: "",
|
|
30
|
+
right: "",
|
|
31
|
+
bottom: "",
|
|
32
|
+
fadeIn: "",
|
|
33
|
+
fadeOut: "",
|
|
34
|
+
minWidth: "",
|
|
35
|
+
minHeight: "",
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
let view = ""
|
|
39
|
+
view += "<div class='popup_prompt'>"
|
|
40
|
+
view += '<div class="popup_message_body">'
|
|
41
|
+
view += '<center>'
|
|
42
|
+
view += txt
|
|
43
|
+
view += "</center>"
|
|
44
|
+
view += '</div>'
|
|
45
|
+
view += '<button id="a_' + pUp.id + '" type="button">CLOSE</button>'
|
|
46
|
+
|
|
47
|
+
$('.popup_body_' + pUp.id)
|
|
48
|
+
.html(view)
|
|
49
|
+
|
|
50
|
+
$('#a_' + pUp.id)
|
|
51
|
+
.css('width', '100%')
|
|
52
|
+
.on('click', function (e) { layerpro.popup.close(pUp) })
|
|
53
|
+
|
|
54
|
+
return false
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/*****************************************************************************************/
|
|
58
|
+
// MESSAGE
|
|
59
|
+
|
|
60
|
+
layerpro.message = (txt) => {
|
|
61
|
+
|
|
62
|
+
let pUp = layerpro.popup.open({
|
|
63
|
+
id: "__message",
|
|
64
|
+
body: "",
|
|
65
|
+
width: 380,
|
|
66
|
+
height: 220,
|
|
67
|
+
name: 'Message',
|
|
68
|
+
source: "",
|
|
69
|
+
icon: "⛭",
|
|
70
|
+
iconize: false,
|
|
71
|
+
maximize: false,
|
|
72
|
+
close: true,
|
|
73
|
+
isMaximize: false,
|
|
74
|
+
dockable: false,
|
|
75
|
+
raised: true,
|
|
76
|
+
movable: true,
|
|
77
|
+
resizable: false,
|
|
78
|
+
store: false,
|
|
79
|
+
top: "",
|
|
80
|
+
left: "",
|
|
81
|
+
right: "",
|
|
82
|
+
bottom: "",
|
|
83
|
+
fadeIn: "",
|
|
84
|
+
fadeOut: "",
|
|
85
|
+
minWidth: "",
|
|
86
|
+
minHeight: "",
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
let view = ""
|
|
90
|
+
view += "<div class='popup_prompt'>"
|
|
91
|
+
view += '<div class="popup_message_body">'
|
|
92
|
+
view += '<center>'
|
|
93
|
+
view += txt
|
|
94
|
+
view += "</center>"
|
|
95
|
+
view += '</div>'
|
|
96
|
+
view += '<button id="a_' + pUp.id + '" type="button">CLOSE</button>'
|
|
97
|
+
|
|
98
|
+
$('.popup_body_' + pUp.id)
|
|
99
|
+
.html(view)
|
|
100
|
+
|
|
101
|
+
$('#a_' + pUp.id)
|
|
102
|
+
.css('width', '100%')
|
|
103
|
+
.on('click', function () { layerpro.popup.close(pUp) })
|
|
104
|
+
|
|
105
|
+
return false
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/*****************************************************************************************/
|
|
109
|
+
// CONFIRM
|
|
110
|
+
|
|
111
|
+
layerpro.confirm = (txt, function_, noFunction) => {
|
|
112
|
+
|
|
113
|
+
if ($('.confirm').length === 0) {
|
|
114
|
+
|
|
115
|
+
let pUp = layerpro.popup.open({
|
|
116
|
+
id: "__confirm",
|
|
117
|
+
body: "",
|
|
118
|
+
source: "",
|
|
119
|
+
width: 380,
|
|
120
|
+
height: 220,
|
|
121
|
+
name: 'Confirm',
|
|
122
|
+
icon: "☑",
|
|
123
|
+
iconize: false,
|
|
124
|
+
maximize: false,
|
|
125
|
+
close: true,
|
|
126
|
+
isMaximize: false,
|
|
127
|
+
dockable: false,
|
|
128
|
+
raised: true,
|
|
129
|
+
movable: true,
|
|
130
|
+
resizable: false,
|
|
131
|
+
store: false,
|
|
132
|
+
top: "",
|
|
133
|
+
left: "",
|
|
134
|
+
right: "",
|
|
135
|
+
bottom: "",
|
|
136
|
+
fadeIn: "",
|
|
137
|
+
fadeOut: "",
|
|
138
|
+
minWidth: "",
|
|
139
|
+
minHeight: "",
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
let view = ""
|
|
143
|
+
view += "<div class='popup_prompt'>"
|
|
144
|
+
view += '<div class="popup_message_body">'
|
|
145
|
+
view += '<center>'
|
|
146
|
+
view += txt
|
|
147
|
+
view += "</center>"
|
|
148
|
+
view += '</div>'
|
|
149
|
+
view += '<button id="a_' + pUp.id + '" type="button">CONFIRM</button>'
|
|
150
|
+
view += '<button id="b_' + pUp.id + '" type="button">CANCEL</button>'
|
|
151
|
+
|
|
152
|
+
$('.popup_body_' + pUp.id)
|
|
153
|
+
.html(view)
|
|
154
|
+
|
|
155
|
+
$('#a_' + pUp.id).on('click', function () {
|
|
156
|
+
if (function_) { function_() }
|
|
157
|
+
layerpro.popup.close(pUp)
|
|
158
|
+
})
|
|
159
|
+
|
|
160
|
+
$('#b_' + pUp.id).on('click', function () {
|
|
161
|
+
if (noFunction) { noFunction() }
|
|
162
|
+
layerpro.popup.close(pUp)
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return false
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/*****************************************************************************************/
|
|
171
|
+
// PROMPT
|
|
172
|
+
|
|
173
|
+
layerpro.prompt = (txt, value) => {
|
|
174
|
+
|
|
175
|
+
// txt = JSON.stringify( txt );
|
|
176
|
+
// value = JSON.stringify( value ) || "_prompt";
|
|
177
|
+
value = value || "_prompt"
|
|
178
|
+
|
|
179
|
+
let pUp = layerpro.popup.open({
|
|
180
|
+
id: "__prompt",
|
|
181
|
+
body: "",
|
|
182
|
+
source: "",
|
|
183
|
+
width: 380,
|
|
184
|
+
height: 220,
|
|
185
|
+
name: 'Prompt',
|
|
186
|
+
icon: "✎",
|
|
187
|
+
iconize: false,
|
|
188
|
+
maximize: false,
|
|
189
|
+
close: true,
|
|
190
|
+
isMaximize: false,
|
|
191
|
+
dockable: false,
|
|
192
|
+
raised: true,
|
|
193
|
+
movable: true,
|
|
194
|
+
resizable: false,
|
|
195
|
+
store: false,
|
|
196
|
+
top: "",
|
|
197
|
+
left: "",
|
|
198
|
+
right: "",
|
|
199
|
+
bottom: "",
|
|
200
|
+
fadeIn: "",
|
|
201
|
+
fadeOut: "",
|
|
202
|
+
minWidth: "",
|
|
203
|
+
minHeight: "",
|
|
204
|
+
})
|
|
205
|
+
|
|
206
|
+
let view = ""
|
|
207
|
+
view += "<div class='popup_prompt'>"
|
|
208
|
+
view += '<div class="popup_message_body">'
|
|
209
|
+
view += '<center>'
|
|
210
|
+
view += txt
|
|
211
|
+
view += "</center>"
|
|
212
|
+
view += '</div>'
|
|
213
|
+
view += '<input id="input_' + pUp.id + '" type="text" placeholder="write here" /><br/>'
|
|
214
|
+
view += '<button id="a_' + pUp.id + '" type="button">OK</button>'
|
|
215
|
+
view += '<button id="b_' + pUp.id + '" type="button">CANCEL</button>'
|
|
216
|
+
view += "</div>"
|
|
217
|
+
|
|
218
|
+
$('.popup_body_' + pUp.id)
|
|
219
|
+
.html(view)
|
|
220
|
+
|
|
221
|
+
$('#input_' + pUp.id)
|
|
222
|
+
.on('focus', function () { $(this).attr('placeholder', "") })
|
|
223
|
+
.on('blur', function () { $(this).attr('placeholder', "write here") })
|
|
224
|
+
|
|
225
|
+
$('#a_' + pUp.id).on('click', function (e) {
|
|
226
|
+
|
|
227
|
+
if ($('#input_' + pUp.id).val() > '') {
|
|
228
|
+
|
|
229
|
+
// localStorage.setItem( value , JSON.stringify( $('#input_' + pUp.id).val() ) );
|
|
230
|
+
// layerpro.popup.close( pUp );
|
|
231
|
+
|
|
232
|
+
layerpro.popup.close(pUp)
|
|
233
|
+
return JSON.stringify($('#input_' + pUp.id).val())
|
|
234
|
+
|
|
235
|
+
} else {
|
|
236
|
+
alert(`input can't be empty!`)
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
})
|
|
240
|
+
|
|
241
|
+
$('#b_' + pUp.id).on('click', function (e) {
|
|
242
|
+
layerpro.popup.close(pUp)
|
|
243
|
+
})
|
|
244
|
+
|
|
245
|
+
return false
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
/********************************************************** */
|
|
250
|
+
|
|
251
|
+
export const CustomMessage = () => {
|
|
252
|
+
|
|
253
|
+
// MESSAGE
|
|
254
|
+
// ***********************************************************************
|
|
255
|
+
window.message = (txt) => {
|
|
256
|
+
layerpro.message(txt)
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// ALERT
|
|
260
|
+
// ***********************************************************************
|
|
261
|
+
window.alert = (txt) => {
|
|
262
|
+
layerpro.alert(txt)
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// CONFIRM
|
|
266
|
+
// ***********************************************************************
|
|
267
|
+
window.confirm = (txt, function_, noFunction) => {
|
|
268
|
+
layerpro.confirm(txt, function_, noFunction)
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// PROMPT
|
|
272
|
+
// ***********************************************************************
|
|
273
|
+
window.prompt = (txt, function_, event) => {
|
|
274
|
+
layerpro.prompt(txt, function_, event)
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
CustomMessage()
|
|
280
|
+
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright: © 2022 Dario Passariello <dariopassariello@gmail.com>
|
|
3
|
+
License: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export const mouseCoord = function (e) {
|
|
7
|
+
|
|
8
|
+
let mClientX = e.clientX
|
|
9
|
+
let mClientY = e.clientY
|
|
10
|
+
let mScreenX = e.screenX
|
|
11
|
+
let mScreenY = e.screenY
|
|
12
|
+
|
|
13
|
+
return [mClientX, mClientY, mScreenX, mScreenY]
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/*****************************************************************************************/
|
|
18
|
+
|
|
19
|
+
let xDirection = ""
|
|
20
|
+
let yDirection = ""
|
|
21
|
+
let oldX = 0
|
|
22
|
+
let oldY = 0
|
|
23
|
+
|
|
24
|
+
export const getMouseDirection = function (e) {
|
|
25
|
+
|
|
26
|
+
xDirection = oldX < e.pageX ? 1 : 0
|
|
27
|
+
|
|
28
|
+
yDirection = oldY < e.pageY ? "down" : "up"
|
|
29
|
+
|
|
30
|
+
oldX = e.pageX
|
|
31
|
+
oldY = e.pageY
|
|
32
|
+
|
|
33
|
+
console.log(xDirection)
|
|
34
|
+
|
|
35
|
+
return xDirection
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//document.querySelector( "body" ).addEventListener( "mousemove" , getMouseDirection, false );
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|