backend-plus 2.2.4 → 2.2.7
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/LICENSE +21 -21
- package/README.md +263 -263
- package/for-client/new-password-result.jade +3 -3
- package/install/semver_to_decimal-fun.sql +11 -11
- package/lib/backend-plus.d.ts +1 -1
- package/lib/table-def-adapt.js +358 -358
- package/lib/tables/table-tokens.js +28 -28
- package/package.json +134 -134
- package/unlogged/compatibilidad.js +161 -161
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
module.exports = function(context){
|
|
4
|
-
var admin=context.be.isAdmin(context);
|
|
5
|
-
return context.be.tableDefAdapt({
|
|
6
|
-
name:'tokens',
|
|
7
|
-
elementName:'token',
|
|
8
|
-
schema:'his',
|
|
9
|
-
editable:admin,
|
|
10
|
-
fields:[
|
|
11
|
-
{name:'token' , typeName:'text' , nullable:false },
|
|
12
|
-
{name:'date' , typeName:'timestamp' , nullable:false },
|
|
13
|
-
{name:'username' , typeName:'text' , nullable:false },
|
|
14
|
-
{name:'useragent' , typeName:'jsonb' , nullable:false },
|
|
15
|
-
{name:'tokentype' , typeName:'text' },
|
|
16
|
-
{name:'due' , typeName:'timestamp' },
|
|
17
|
-
{name:'info' , typeName:'jsonb' },
|
|
18
|
-
],
|
|
19
|
-
primaryKey:['token'],
|
|
20
|
-
foreignKeys:[
|
|
21
|
-
//{references:'usuarios', fields:['usuario']},
|
|
22
|
-
],
|
|
23
|
-
sql:{
|
|
24
|
-
isTable: true,
|
|
25
|
-
from: `(select * from his.tokens order by date desc)`,
|
|
26
|
-
skipEnance:true,
|
|
27
|
-
},
|
|
28
|
-
}, context);
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
module.exports = function(context){
|
|
4
|
+
var admin=context.be.isAdmin(context);
|
|
5
|
+
return context.be.tableDefAdapt({
|
|
6
|
+
name:'tokens',
|
|
7
|
+
elementName:'token',
|
|
8
|
+
schema:'his',
|
|
9
|
+
editable:admin,
|
|
10
|
+
fields:[
|
|
11
|
+
{name:'token' , typeName:'text' , nullable:false },
|
|
12
|
+
{name:'date' , typeName:'timestamp' , nullable:false },
|
|
13
|
+
{name:'username' , typeName:'text' , nullable:false },
|
|
14
|
+
{name:'useragent' , typeName:'jsonb' , nullable:false },
|
|
15
|
+
{name:'tokentype' , typeName:'text' },
|
|
16
|
+
{name:'due' , typeName:'timestamp' },
|
|
17
|
+
{name:'info' , typeName:'jsonb' },
|
|
18
|
+
],
|
|
19
|
+
primaryKey:['token'],
|
|
20
|
+
foreignKeys:[
|
|
21
|
+
//{references:'usuarios', fields:['usuario']},
|
|
22
|
+
],
|
|
23
|
+
sql:{
|
|
24
|
+
isTable: true,
|
|
25
|
+
from: `(select * from his.tokens order by date desc)`,
|
|
26
|
+
skipEnance:true,
|
|
27
|
+
},
|
|
28
|
+
}, context);
|
|
29
29
|
}
|
package/package.json
CHANGED
|
@@ -1,134 +1,134 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "backend-plus",
|
|
3
|
-
"description": "Backend for the anti Pareto rule",
|
|
4
|
-
"version": "2.2.
|
|
5
|
-
"author": "Codenautas <codenautas@googlegroups.com>",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"repository": "codenautas/backend-plus",
|
|
8
|
-
"main": "lib/backend-plus.js",
|
|
9
|
-
"types": "lib/backend-plus.d.ts",
|
|
10
|
-
"files": [
|
|
11
|
-
"lib",
|
|
12
|
-
"for-client",
|
|
13
|
-
"unlogged",
|
|
14
|
-
"src",
|
|
15
|
-
"install"
|
|
16
|
-
],
|
|
17
|
-
"contributors": [
|
|
18
|
-
{
|
|
19
|
-
"name": "Estefanía Capece",
|
|
20
|
-
"email": "eycapece@gmail.com"
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"name": "Emilio Platzer",
|
|
24
|
-
"email": "emilioplatzer@gmail.com"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"name": "Manuel De la Penna",
|
|
28
|
-
"email": "manueldelapenna@gmail.com"
|
|
29
|
-
}
|
|
30
|
-
],
|
|
31
|
-
"dependencies": {
|
|
32
|
-
"@upgraded/locate-path": "^6.0.0-alfa.1",
|
|
33
|
-
"ajax-best-promise": "^0.4.2",
|
|
34
|
-
"backend-skins": "^0.1.15",
|
|
35
|
-
"best-globals": "^1.1.6",
|
|
36
|
-
"big.js": "^6.2.2",
|
|
37
|
-
"body-parser": "^2.2.0",
|
|
38
|
-
"cast-error": "^0.1.1",
|
|
39
|
-
"castellano": "^0.1.4",
|
|
40
|
-
"connect-pg-simple": "^10.0.0",
|
|
41
|
-
"cookie-parser": "^1.4.7",
|
|
42
|
-
"dialog-promise": "^0.10.1",
|
|
43
|
-
"discrepances": "^0.2.8",
|
|
44
|
-
"express": "^4.21.2",
|
|
45
|
-
"express-session": "^1.18.1",
|
|
46
|
-
"express-useragent": "^1.0.15",
|
|
47
|
-
"fs-extra": "^11.3.0",
|
|
48
|
-
"js-to-html": "^1.3.2",
|
|
49
|
-
"js-yaml": "^4.1.0",
|
|
50
|
-
"json4all": "^1.4.0",
|
|
51
|
-
"lazy-some": "^0.1.0",
|
|
52
|
-
"like-ar": "^0.5.1",
|
|
53
|
-
"login-plus": "^1.7.2",
|
|
54
|
-
"memorystore": "^1.6.7",
|
|
55
|
-
"mini-tools": "^1.13.2",
|
|
56
|
-
"moment": "^2.30.1",
|
|
57
|
-
"multiparty": "^4.2.3",
|
|
58
|
-
"nodemailer": "^6.10.0",
|
|
59
|
-
"numeral": "^2.0.6",
|
|
60
|
-
"pg-promise-strict": "^1.4.2",
|
|
61
|
-
"pikaday": "^1.8.2",
|
|
62
|
-
"pug": "^3.0.3",
|
|
63
|
-
"read-yaml-promise": "^1.0.2",
|
|
64
|
-
"regexplicit": "^0.1.3",
|
|
65
|
-
"require-bro": "^0.3.1",
|
|
66
|
-
"self-explain": "^0.11.0",
|
|
67
|
-
"serve-content": "^0.4.0",
|
|
68
|
-
"session-file-store": "^1.5.0",
|
|
69
|
-
"sql-tools": "^0.1.2",
|
|
70
|
-
"stack-trace": "^0.0.10",
|
|
71
|
-
"stylus": "0.64.0",
|
|
72
|
-
"type-store": "^0.4.5",
|
|
73
|
-
"typed-controls": "^0.12.2",
|
|
74
|
-
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz"
|
|
75
|
-
},
|
|
76
|
-
"devDependencies": {
|
|
77
|
-
"@types/big.js": "^6.2.2",
|
|
78
|
-
"@types/expect.js": "~0.3.32",
|
|
79
|
-
"@types/express": "^5.0.1",
|
|
80
|
-
"@types/express-useragent": "^1.0.5",
|
|
81
|
-
"@types/fs-extra": "^11.0.4",
|
|
82
|
-
"@types/js-yaml": "^4.0.9",
|
|
83
|
-
"@types/mocha": "^10.0.10",
|
|
84
|
-
"@types/multiparty": "~4.2.1",
|
|
85
|
-
"@types/node": "^22.14.0",
|
|
86
|
-
"@types/nodemailer": "^6.4.17",
|
|
87
|
-
"@types/numeral": "~2.0.5",
|
|
88
|
-
"@types/session-file-store": "^1.2.5",
|
|
89
|
-
"@types/stack-trace": "~0.0.33",
|
|
90
|
-
"@types/websql": "~0.0.30",
|
|
91
|
-
"esprima": "^4.0.1",
|
|
92
|
-
"expect.js": "~0.3.1",
|
|
93
|
-
"karma": "6.4.4",
|
|
94
|
-
"karma-chrome-launcher": "^3.2.0",
|
|
95
|
-
"karma-expect": "^1.1.3",
|
|
96
|
-
"karma-firefox-launcher": "^2.1.3",
|
|
97
|
-
"karma-ie-launcher": "^1.0.0",
|
|
98
|
-
"karma-mocha": "^2.0.1",
|
|
99
|
-
"kill-9": "~0.4.3",
|
|
100
|
-
"mocha": "^11.1.0",
|
|
101
|
-
"nyc": "^17.1.0",
|
|
102
|
-
"puppeteer": "^24.6.0",
|
|
103
|
-
"sinon": "^20.0.0",
|
|
104
|
-
"supertest": "^7.1.0",
|
|
105
|
-
"types.d.ts": "~0.6.22",
|
|
106
|
-
"typescript": "^5.8.3",
|
|
107
|
-
"why-is-node-running": "^3.2.2"
|
|
108
|
-
},
|
|
109
|
-
"engines": {
|
|
110
|
-
"node": ">= 18"
|
|
111
|
-
},
|
|
112
|
-
"scripts": {
|
|
113
|
-
"test": "(npm run prepublish || echo \"continue w/error\") && mocha --reporter spec --single-run --bail test/test-*.js",
|
|
114
|
-
"test-karma": "(npm run prepublish || echo \"continue w/error\") && mocha --reporter spec --bail test/test-k*.js",
|
|
115
|
-
"test-why": "node --expose-internals ./node_modules/mocha/bin/_mocha --reporter spec --bail test/test*.js",
|
|
116
|
-
"test-ci": "(npm run prepublish || echo \"continue w/error\") && mocha --reporter spec --bail test/test*.js",
|
|
117
|
-
"test-good": "mocha --reporter spec --bail --check-leaks test/test*.js",
|
|
118
|
-
"example-pu": "node test/puppeteer/first-step.js",
|
|
119
|
-
"test-pu": "node ./test/download_puppeteer && mocha --reporter spec --bail --check-leaks --globals cptable --globals QUOTE --globals __core-js_shared__ test/test-pu.js",
|
|
120
|
-
"test-server": "mocha --reporter spec --single-run --bail test/test.js",
|
|
121
|
-
"server-test": "node test/run-simple-backend.js",
|
|
122
|
-
"example-tables": "node examples/tables/server/server-tables.js --dir-x examples/tables",
|
|
123
|
-
"example-fichas": "node examples/fichero/server/server-fichas.js",
|
|
124
|
-
"example-4test": "node examples/4test/server/server-4test.js",
|
|
125
|
-
"prepublish": "(tsc -p tsconfig-server.json || echo \"continue w/error\") && (tsc -p tsconfig-client.json || echo \"continue w/error\")"
|
|
126
|
-
},
|
|
127
|
-
"qa-control": {
|
|
128
|
-
"package-version": "0.3.0",
|
|
129
|
-
"run-in": "server",
|
|
130
|
-
"type": "lib",
|
|
131
|
-
"stage": "designing",
|
|
132
|
-
"coverage": 100
|
|
133
|
-
}
|
|
134
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "backend-plus",
|
|
3
|
+
"description": "Backend for the anti Pareto rule",
|
|
4
|
+
"version": "2.2.7",
|
|
5
|
+
"author": "Codenautas <codenautas@googlegroups.com>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": "codenautas/backend-plus",
|
|
8
|
+
"main": "lib/backend-plus.js",
|
|
9
|
+
"types": "lib/backend-plus.d.ts",
|
|
10
|
+
"files": [
|
|
11
|
+
"lib",
|
|
12
|
+
"for-client",
|
|
13
|
+
"unlogged",
|
|
14
|
+
"src",
|
|
15
|
+
"install"
|
|
16
|
+
],
|
|
17
|
+
"contributors": [
|
|
18
|
+
{
|
|
19
|
+
"name": "Estefanía Capece",
|
|
20
|
+
"email": "eycapece@gmail.com"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "Emilio Platzer",
|
|
24
|
+
"email": "emilioplatzer@gmail.com"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "Manuel De la Penna",
|
|
28
|
+
"email": "manueldelapenna@gmail.com"
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@upgraded/locate-path": "^6.0.0-alfa.1",
|
|
33
|
+
"ajax-best-promise": "^0.4.2",
|
|
34
|
+
"backend-skins": "^0.1.15",
|
|
35
|
+
"best-globals": "^1.1.6",
|
|
36
|
+
"big.js": "^6.2.2",
|
|
37
|
+
"body-parser": "^2.2.0",
|
|
38
|
+
"cast-error": "^0.1.1",
|
|
39
|
+
"castellano": "^0.1.4",
|
|
40
|
+
"connect-pg-simple": "^10.0.0",
|
|
41
|
+
"cookie-parser": "^1.4.7",
|
|
42
|
+
"dialog-promise": "^0.10.1",
|
|
43
|
+
"discrepances": "^0.2.8",
|
|
44
|
+
"express": "^4.21.2",
|
|
45
|
+
"express-session": "^1.18.1",
|
|
46
|
+
"express-useragent": "^1.0.15",
|
|
47
|
+
"fs-extra": "^11.3.0",
|
|
48
|
+
"js-to-html": "^1.3.2",
|
|
49
|
+
"js-yaml": "^4.1.0",
|
|
50
|
+
"json4all": "^1.4.0",
|
|
51
|
+
"lazy-some": "^0.1.0",
|
|
52
|
+
"like-ar": "^0.5.1",
|
|
53
|
+
"login-plus": "^1.7.2",
|
|
54
|
+
"memorystore": "^1.6.7",
|
|
55
|
+
"mini-tools": "^1.13.2",
|
|
56
|
+
"moment": "^2.30.1",
|
|
57
|
+
"multiparty": "^4.2.3",
|
|
58
|
+
"nodemailer": "^6.10.0",
|
|
59
|
+
"numeral": "^2.0.6",
|
|
60
|
+
"pg-promise-strict": "^1.4.2",
|
|
61
|
+
"pikaday": "^1.8.2",
|
|
62
|
+
"pug": "^3.0.3",
|
|
63
|
+
"read-yaml-promise": "^1.0.2",
|
|
64
|
+
"regexplicit": "^0.1.3",
|
|
65
|
+
"require-bro": "^0.3.1",
|
|
66
|
+
"self-explain": "^0.11.0",
|
|
67
|
+
"serve-content": "^0.4.0",
|
|
68
|
+
"session-file-store": "^1.5.0",
|
|
69
|
+
"sql-tools": "^0.1.2",
|
|
70
|
+
"stack-trace": "^0.0.10",
|
|
71
|
+
"stylus": "0.64.0",
|
|
72
|
+
"type-store": "^0.4.5",
|
|
73
|
+
"typed-controls": "^0.12.2",
|
|
74
|
+
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz"
|
|
75
|
+
},
|
|
76
|
+
"devDependencies": {
|
|
77
|
+
"@types/big.js": "^6.2.2",
|
|
78
|
+
"@types/expect.js": "~0.3.32",
|
|
79
|
+
"@types/express": "^5.0.1",
|
|
80
|
+
"@types/express-useragent": "^1.0.5",
|
|
81
|
+
"@types/fs-extra": "^11.0.4",
|
|
82
|
+
"@types/js-yaml": "^4.0.9",
|
|
83
|
+
"@types/mocha": "^10.0.10",
|
|
84
|
+
"@types/multiparty": "~4.2.1",
|
|
85
|
+
"@types/node": "^22.14.0",
|
|
86
|
+
"@types/nodemailer": "^6.4.17",
|
|
87
|
+
"@types/numeral": "~2.0.5",
|
|
88
|
+
"@types/session-file-store": "^1.2.5",
|
|
89
|
+
"@types/stack-trace": "~0.0.33",
|
|
90
|
+
"@types/websql": "~0.0.30",
|
|
91
|
+
"esprima": "^4.0.1",
|
|
92
|
+
"expect.js": "~0.3.1",
|
|
93
|
+
"karma": "6.4.4",
|
|
94
|
+
"karma-chrome-launcher": "^3.2.0",
|
|
95
|
+
"karma-expect": "^1.1.3",
|
|
96
|
+
"karma-firefox-launcher": "^2.1.3",
|
|
97
|
+
"karma-ie-launcher": "^1.0.0",
|
|
98
|
+
"karma-mocha": "^2.0.1",
|
|
99
|
+
"kill-9": "~0.4.3",
|
|
100
|
+
"mocha": "^11.1.0",
|
|
101
|
+
"nyc": "^17.1.0",
|
|
102
|
+
"puppeteer": "^24.6.0",
|
|
103
|
+
"sinon": "^20.0.0",
|
|
104
|
+
"supertest": "^7.1.0",
|
|
105
|
+
"types.d.ts": "~0.6.22",
|
|
106
|
+
"typescript": "^5.8.3",
|
|
107
|
+
"why-is-node-running": "^3.2.2"
|
|
108
|
+
},
|
|
109
|
+
"engines": {
|
|
110
|
+
"node": ">= 18"
|
|
111
|
+
},
|
|
112
|
+
"scripts": {
|
|
113
|
+
"test": "(npm run prepublish || echo \"continue w/error\") && mocha --reporter spec --single-run --bail test/test-*.js",
|
|
114
|
+
"test-karma": "(npm run prepublish || echo \"continue w/error\") && mocha --reporter spec --bail test/test-k*.js",
|
|
115
|
+
"test-why": "node --expose-internals ./node_modules/mocha/bin/_mocha --reporter spec --bail test/test*.js",
|
|
116
|
+
"test-ci": "(npm run prepublish || echo \"continue w/error\") && mocha --reporter spec --bail test/test*.js",
|
|
117
|
+
"test-good": "mocha --reporter spec --bail --check-leaks test/test*.js",
|
|
118
|
+
"example-pu": "node test/puppeteer/first-step.js",
|
|
119
|
+
"test-pu": "node ./test/download_puppeteer && mocha --reporter spec --bail --check-leaks --globals cptable --globals QUOTE --globals __core-js_shared__ test/test-pu.js",
|
|
120
|
+
"test-server": "mocha --reporter spec --single-run --bail test/test.js",
|
|
121
|
+
"server-test": "node test/run-simple-backend.js",
|
|
122
|
+
"example-tables": "node examples/tables/server/server-tables.js --dir-x examples/tables",
|
|
123
|
+
"example-fichas": "node examples/fichero/server/server-fichas.js",
|
|
124
|
+
"example-4test": "node examples/4test/server/server-4test.js",
|
|
125
|
+
"prepublish": "(tsc -p tsconfig-server.json || echo \"continue w/error\") && (tsc -p tsconfig-client.json || echo \"continue w/error\")"
|
|
126
|
+
},
|
|
127
|
+
"qa-control": {
|
|
128
|
+
"package-version": "0.3.0",
|
|
129
|
+
"run-in": "server",
|
|
130
|
+
"type": "lib",
|
|
131
|
+
"stage": "designing",
|
|
132
|
+
"coverage": 100
|
|
133
|
+
}
|
|
134
|
+
}
|
|
@@ -1,162 +1,162 @@
|
|
|
1
|
-
/* UTF-8:Sí
|
|
2
|
-
compatibilidad.js
|
|
3
|
-
*/
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
var controles_de_compatibilidad={
|
|
7
|
-
// Mejorados siguiendo los consejos de http://diveintohtml5.info/detect.html
|
|
8
|
-
'soporte JSON':{gravedad:'incompatible'
|
|
9
|
-
,controlar:function(){
|
|
10
|
-
return '["esto"]'==JSON.stringify(['esto']);
|
|
11
|
-
}},
|
|
12
|
-
'soporte para cookies':{gravedad:'incompatible'
|
|
13
|
-
,controlar:function(){
|
|
14
|
-
return navigator.cookieEnabled;
|
|
15
|
-
}},
|
|
16
|
-
'almacenamiento local (localStorage)':{gravedad:'incompatible'
|
|
17
|
-
,controlar:function(){
|
|
18
|
-
try {
|
|
19
|
-
return 'localStorage' in window && window['localStorage'] !== null;
|
|
20
|
-
}catch(e){
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
}},
|
|
24
|
-
'almacenamiento local por ventana (sessionStorage)':{gravedad:'incompatible'
|
|
25
|
-
,controlar:function(){
|
|
26
|
-
sessionStorage.setItem('prueba_de_soporte_sessionStorage','soportado');
|
|
27
|
-
return sessionStorage.getItem('prueba_de_soporte_sessionStorage')=='soportado';
|
|
28
|
-
}},
|
|
29
|
-
'almacenamiento de atributos internos (setAttribute)':{gravedad:'incompatible'
|
|
30
|
-
,controlar:function(parametros){
|
|
31
|
-
parametros.div.setAttribute('prueba_attribute','soportado');
|
|
32
|
-
return parametros.div.getAttribute('prueba_attribute')=='soportado';
|
|
33
|
-
}},
|
|
34
|
-
'posicionamiento inicial del cursor (autofocus HTML5)':{gravedad:'incomodidad'
|
|
35
|
-
,controlar:function(parametros){
|
|
36
|
-
var input=document.createElement('input');
|
|
37
|
-
return 'autofocus' in input;
|
|
38
|
-
}},
|
|
39
|
-
'movimiento lateral de teclas de cursor dentro de grillas (window.getSelection)':{gravedad:'incomodidad'
|
|
40
|
-
,controlar:function(parametros){
|
|
41
|
-
return window.getSelection;
|
|
42
|
-
}},
|
|
43
|
-
'soporte para trabajo fuera de línea (offline)':{gravedad:'incompatiblidad'
|
|
44
|
-
,controlar:function(parametros){
|
|
45
|
-
return 'serviceWorker' in navigator;
|
|
46
|
-
}},
|
|
47
|
-
'soporte para tratar eventos internos':{gravedad:'incompatible'
|
|
48
|
-
,controlar:function(parametros){
|
|
49
|
-
return !!window.addEventListener;
|
|
50
|
-
}},
|
|
51
|
-
'soporte para WebSocket':{gravedad:'antiguo'
|
|
52
|
-
,controlar:function(parametros){
|
|
53
|
-
return !!window.WebSocket;
|
|
54
|
-
}},
|
|
55
|
-
'conectividad via fetch':{gravedad:'incompatible'
|
|
56
|
-
,controlar:function(params){
|
|
57
|
-
return 'fetch' in window
|
|
58
|
-
}},
|
|
59
|
-
'funciones => sin this':{gravedad:'incompatible'
|
|
60
|
-
,controlar:function(params){
|
|
61
|
-
try{
|
|
62
|
-
return eval("[1].map((x)=>x+1)")[0] == 2;
|
|
63
|
-
}finally{}
|
|
64
|
-
}}
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
function controlar_compatibilidad(ya, id, idBoton){
|
|
68
|
-
"use strict";
|
|
69
|
-
var boton=document.getElementById(idBoton || 'login');
|
|
70
|
-
id = id || 'resultado_incompatibilidad';
|
|
71
|
-
var div=document.getElementById(id);
|
|
72
|
-
if(!div){
|
|
73
|
-
div = document.createElement('div');
|
|
74
|
-
div.id = id;
|
|
75
|
-
document.body.appendChild(div);
|
|
76
|
-
div.textContent='controlando la compatibilidad del navegador';
|
|
77
|
-
}
|
|
78
|
-
if(!ya){
|
|
79
|
-
if (boton) boton.disabled=true;
|
|
80
|
-
setTimeout(function(){
|
|
81
|
-
controlar_compatibilidad(true)
|
|
82
|
-
},100)
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
var hubo_errores=false;
|
|
86
|
-
var hubo_errores_tipo={};
|
|
87
|
-
div.innerHTML="";
|
|
88
|
-
for(var control in controles_de_compatibilidad){
|
|
89
|
-
var ok=false;
|
|
90
|
-
var def_control=controles_de_compatibilidad[control];
|
|
91
|
-
try{
|
|
92
|
-
ok=def_control.controlar({div:div});
|
|
93
|
-
}catch(err){
|
|
94
|
-
}
|
|
95
|
-
if(!ok){
|
|
96
|
-
var mensaje=document.createElement('div');
|
|
97
|
-
mensaje.textContent="Falla en "+control;
|
|
98
|
-
if(def_control.gravedad=='incompatible'){
|
|
99
|
-
mensaje.style.color='red';
|
|
100
|
-
}
|
|
101
|
-
div.appendChild(mensaje);
|
|
102
|
-
hubo_errores=true;
|
|
103
|
-
hubo_errores_tipo[def_control.gravedad]=true;
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
if(!hubo_errores_tipo['incompatible']){
|
|
107
|
-
if (boton) boton.disabled=false;
|
|
108
|
-
}
|
|
109
|
-
var attrsep = ": ";
|
|
110
|
-
var attr = function(base, prop, expected){
|
|
111
|
-
try {
|
|
112
|
-
if (!(base in window)) {
|
|
113
|
-
return attrsep + "sin "+base;
|
|
114
|
-
} else if (!(prop in (window[base]))) {
|
|
115
|
-
return attrsep + "sin "+base+"."+prop;
|
|
116
|
-
} else {
|
|
117
|
-
var mostrar = window[base][prop];
|
|
118
|
-
if (expected !== undefined) {
|
|
119
|
-
if (mostrar == expected) return "";
|
|
120
|
-
}
|
|
121
|
-
try {
|
|
122
|
-
mostrar = JSON.stringify(mostrar)
|
|
123
|
-
} catch (_) {
|
|
124
|
-
mostrar = mostrar + ""
|
|
125
|
-
}
|
|
126
|
-
return attrsep + (base == "navigator" ? "" : base + ".") + prop + "=" + mostrar
|
|
127
|
-
}
|
|
128
|
-
} catch (err) {
|
|
129
|
-
return attrsep + "sin capacidad de detectar " + base + "." + prop;
|
|
130
|
-
} finally {
|
|
131
|
-
attrsep = ", ";
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
var bloque = function(elementoContenedor, text){
|
|
135
|
-
var elemento = document.createElement('div');
|
|
136
|
-
elementoContenedor.appendChild(elemento);
|
|
137
|
-
elemento.textContent = text;
|
|
138
|
-
}
|
|
139
|
-
if(hubo_errores){
|
|
140
|
-
console.log('aca')
|
|
141
|
-
var alertDiv = document.createElement(hubo_errores_tipo['incompatible']?'h3':'div');
|
|
142
|
-
bloque(alertDiv, "El sistema no fue probado en este modelo de navegador. Si experimenta problemas durante el uso cuando avise del problema incluya el nombre y versión del navegador. Se recomienda usar una versión actualizada del navegador Google Chrome o MS Edge");
|
|
143
|
-
bloque(alertDiv, "Caracteristicas detectadas en el navegador"+
|
|
144
|
-
attr('navigator','appName')+
|
|
145
|
-
attr('navigator','appVersion')+
|
|
146
|
-
attr('navigator','vendor')+
|
|
147
|
-
attr('navigator','vendorSub')+
|
|
148
|
-
attr('navigator','cookieEnabled', true)+
|
|
149
|
-
attr('navigator','onLine', true)+
|
|
150
|
-
"."
|
|
151
|
-
);
|
|
152
|
-
if(hubo_errores_tipo['incompatible']){
|
|
153
|
-
var check = document.createElement('input');
|
|
154
|
-
check.type='checkbox';
|
|
155
|
-
check.onchange=function(){
|
|
156
|
-
if (boton) boton.disabled=!check.checked
|
|
157
|
-
}
|
|
158
|
-
alertDiv.appendChild(check);
|
|
159
|
-
}
|
|
160
|
-
div.appendChild(alertDiv);
|
|
161
|
-
}
|
|
1
|
+
/* UTF-8:Sí
|
|
2
|
+
compatibilidad.js
|
|
3
|
+
*/
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
var controles_de_compatibilidad={
|
|
7
|
+
// Mejorados siguiendo los consejos de http://diveintohtml5.info/detect.html
|
|
8
|
+
'soporte JSON':{gravedad:'incompatible'
|
|
9
|
+
,controlar:function(){
|
|
10
|
+
return '["esto"]'==JSON.stringify(['esto']);
|
|
11
|
+
}},
|
|
12
|
+
'soporte para cookies':{gravedad:'incompatible'
|
|
13
|
+
,controlar:function(){
|
|
14
|
+
return navigator.cookieEnabled;
|
|
15
|
+
}},
|
|
16
|
+
'almacenamiento local (localStorage)':{gravedad:'incompatible'
|
|
17
|
+
,controlar:function(){
|
|
18
|
+
try {
|
|
19
|
+
return 'localStorage' in window && window['localStorage'] !== null;
|
|
20
|
+
}catch(e){
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
}},
|
|
24
|
+
'almacenamiento local por ventana (sessionStorage)':{gravedad:'incompatible'
|
|
25
|
+
,controlar:function(){
|
|
26
|
+
sessionStorage.setItem('prueba_de_soporte_sessionStorage','soportado');
|
|
27
|
+
return sessionStorage.getItem('prueba_de_soporte_sessionStorage')=='soportado';
|
|
28
|
+
}},
|
|
29
|
+
'almacenamiento de atributos internos (setAttribute)':{gravedad:'incompatible'
|
|
30
|
+
,controlar:function(parametros){
|
|
31
|
+
parametros.div.setAttribute('prueba_attribute','soportado');
|
|
32
|
+
return parametros.div.getAttribute('prueba_attribute')=='soportado';
|
|
33
|
+
}},
|
|
34
|
+
'posicionamiento inicial del cursor (autofocus HTML5)':{gravedad:'incomodidad'
|
|
35
|
+
,controlar:function(parametros){
|
|
36
|
+
var input=document.createElement('input');
|
|
37
|
+
return 'autofocus' in input;
|
|
38
|
+
}},
|
|
39
|
+
'movimiento lateral de teclas de cursor dentro de grillas (window.getSelection)':{gravedad:'incomodidad'
|
|
40
|
+
,controlar:function(parametros){
|
|
41
|
+
return window.getSelection;
|
|
42
|
+
}},
|
|
43
|
+
'soporte para trabajo fuera de línea (offline)':{gravedad:'incompatiblidad'
|
|
44
|
+
,controlar:function(parametros){
|
|
45
|
+
return 'serviceWorker' in navigator;
|
|
46
|
+
}},
|
|
47
|
+
'soporte para tratar eventos internos':{gravedad:'incompatible'
|
|
48
|
+
,controlar:function(parametros){
|
|
49
|
+
return !!window.addEventListener;
|
|
50
|
+
}},
|
|
51
|
+
'soporte para WebSocket':{gravedad:'antiguo'
|
|
52
|
+
,controlar:function(parametros){
|
|
53
|
+
return !!window.WebSocket;
|
|
54
|
+
}},
|
|
55
|
+
'conectividad via fetch':{gravedad:'incompatible'
|
|
56
|
+
,controlar:function(params){
|
|
57
|
+
return 'fetch' in window
|
|
58
|
+
}},
|
|
59
|
+
'funciones => sin this':{gravedad:'incompatible'
|
|
60
|
+
,controlar:function(params){
|
|
61
|
+
try{
|
|
62
|
+
return eval("[1].map((x)=>x+1)")[0] == 2;
|
|
63
|
+
}finally{}
|
|
64
|
+
}}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
function controlar_compatibilidad(ya, id, idBoton){
|
|
68
|
+
"use strict";
|
|
69
|
+
var boton=document.getElementById(idBoton || 'login');
|
|
70
|
+
id = id || 'resultado_incompatibilidad';
|
|
71
|
+
var div=document.getElementById(id);
|
|
72
|
+
if(!div){
|
|
73
|
+
div = document.createElement('div');
|
|
74
|
+
div.id = id;
|
|
75
|
+
document.body.appendChild(div);
|
|
76
|
+
div.textContent='controlando la compatibilidad del navegador';
|
|
77
|
+
}
|
|
78
|
+
if(!ya){
|
|
79
|
+
if (boton) boton.disabled=true;
|
|
80
|
+
setTimeout(function(){
|
|
81
|
+
controlar_compatibilidad(true)
|
|
82
|
+
},100)
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
var hubo_errores=false;
|
|
86
|
+
var hubo_errores_tipo={};
|
|
87
|
+
div.innerHTML="";
|
|
88
|
+
for(var control in controles_de_compatibilidad){
|
|
89
|
+
var ok=false;
|
|
90
|
+
var def_control=controles_de_compatibilidad[control];
|
|
91
|
+
try{
|
|
92
|
+
ok=def_control.controlar({div:div});
|
|
93
|
+
}catch(err){
|
|
94
|
+
}
|
|
95
|
+
if(!ok){
|
|
96
|
+
var mensaje=document.createElement('div');
|
|
97
|
+
mensaje.textContent="Falla en "+control;
|
|
98
|
+
if(def_control.gravedad=='incompatible'){
|
|
99
|
+
mensaje.style.color='red';
|
|
100
|
+
}
|
|
101
|
+
div.appendChild(mensaje);
|
|
102
|
+
hubo_errores=true;
|
|
103
|
+
hubo_errores_tipo[def_control.gravedad]=true;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
if(!hubo_errores_tipo['incompatible']){
|
|
107
|
+
if (boton) boton.disabled=false;
|
|
108
|
+
}
|
|
109
|
+
var attrsep = ": ";
|
|
110
|
+
var attr = function(base, prop, expected){
|
|
111
|
+
try {
|
|
112
|
+
if (!(base in window)) {
|
|
113
|
+
return attrsep + "sin "+base;
|
|
114
|
+
} else if (!(prop in (window[base]))) {
|
|
115
|
+
return attrsep + "sin "+base+"."+prop;
|
|
116
|
+
} else {
|
|
117
|
+
var mostrar = window[base][prop];
|
|
118
|
+
if (expected !== undefined) {
|
|
119
|
+
if (mostrar == expected) return "";
|
|
120
|
+
}
|
|
121
|
+
try {
|
|
122
|
+
mostrar = JSON.stringify(mostrar)
|
|
123
|
+
} catch (_) {
|
|
124
|
+
mostrar = mostrar + ""
|
|
125
|
+
}
|
|
126
|
+
return attrsep + (base == "navigator" ? "" : base + ".") + prop + "=" + mostrar
|
|
127
|
+
}
|
|
128
|
+
} catch (err) {
|
|
129
|
+
return attrsep + "sin capacidad de detectar " + base + "." + prop;
|
|
130
|
+
} finally {
|
|
131
|
+
attrsep = ", ";
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
var bloque = function(elementoContenedor, text){
|
|
135
|
+
var elemento = document.createElement('div');
|
|
136
|
+
elementoContenedor.appendChild(elemento);
|
|
137
|
+
elemento.textContent = text;
|
|
138
|
+
}
|
|
139
|
+
if(hubo_errores){
|
|
140
|
+
console.log('aca')
|
|
141
|
+
var alertDiv = document.createElement(hubo_errores_tipo['incompatible']?'h3':'div');
|
|
142
|
+
bloque(alertDiv, "El sistema no fue probado en este modelo de navegador. Si experimenta problemas durante el uso cuando avise del problema incluya el nombre y versión del navegador. Se recomienda usar una versión actualizada del navegador Google Chrome o MS Edge");
|
|
143
|
+
bloque(alertDiv, "Caracteristicas detectadas en el navegador"+
|
|
144
|
+
attr('navigator','appName')+
|
|
145
|
+
attr('navigator','appVersion')+
|
|
146
|
+
attr('navigator','vendor')+
|
|
147
|
+
attr('navigator','vendorSub')+
|
|
148
|
+
attr('navigator','cookieEnabled', true)+
|
|
149
|
+
attr('navigator','onLine', true)+
|
|
150
|
+
"."
|
|
151
|
+
);
|
|
152
|
+
if(hubo_errores_tipo['incompatible']){
|
|
153
|
+
var check = document.createElement('input');
|
|
154
|
+
check.type='checkbox';
|
|
155
|
+
check.onchange=function(){
|
|
156
|
+
if (boton) boton.disabled=!check.checked
|
|
157
|
+
}
|
|
158
|
+
alertDiv.appendChild(check);
|
|
159
|
+
}
|
|
160
|
+
div.appendChild(alertDiv);
|
|
161
|
+
}
|
|
162
162
|
}
|