1
|
|
|
|
2
|
|
|
var error = function (data) { |
3
|
|
|
console.error('restUrl', data); |
4
|
|
|
AddMessage(data.message.error); |
5
|
|
|
}; |
6
|
|
|
|
7
|
|
|
var success = function (data) { |
8
|
|
|
console.log('restUrl', data); |
|
|
|
|
9
|
|
|
console.table(data); |
10
|
|
|
AddMessage(data.message.info); |
11
|
|
|
}; |
12
|
|
|
|
13
|
|
|
|
14
|
|
|
// var form = new RestForm(document, error, success); |
15
|
|
|
|
16
|
|
|
var incl = new Include(); |
|
|
|
|
17
|
|
|
|
18
|
|
|
var rout = new Router(incl); |
|
|
|
|
19
|
|
|
|
20
|
|
|
// router, config, listener, config |
21
|
|
|
var web = new Apiunit(); |
|
|
|
|
22
|
|
|
// web.target("#home-plugins"); |
23
|
|
|
|
24
|
|
|
web.router(rout); |
25
|
|
|
// "domain": "http://localhost:88", |
26
|
|
|
// "//js.apiunit.com/rest.js", |
27
|
|
|
// "//js.apiunit.com/form-event.js", |
28
|
|
|
// "script_delay": [ |
29
|
|
|
// "/visitor/newsletter/js/foot.js" |
30
|
|
|
// ] |
31
|
|
|
// "//js.apiunit.com/rest-url.js" |
32
|
|
|
// "//js.apiunit.com/formToObject.min.js", |
33
|
|
|
|
34
|
|
|
|
35
|
|
|
web.json({ |
36
|
|
|
"docs": { |
37
|
|
|
"version": "0.0.1", |
38
|
|
|
"author": "Tom Sapletta", |
39
|
|
|
"company": "Softreck", |
40
|
|
|
"name": "Newsletter", |
41
|
|
|
"tags": "Newsletter, Create, Read, Update, Delete" |
42
|
|
|
}, |
43
|
|
|
"target": "#home-plugins", |
44
|
|
|
"image": [ |
45
|
|
|
"//app.apiunit.com/visitor/home/img/apiunit.png" |
46
|
|
|
], |
47
|
|
|
"html": [ |
48
|
|
|
"//app.apiunit.com/visitor/home/plugin/messages.html", |
49
|
|
|
"//app.apiunit.com/visitor/newsletter/plugin/create.html" |
50
|
|
|
], |
51
|
|
|
"style": [ |
52
|
|
|
"//app.apiunit.com/visitor/newsletter/css/black.css", |
53
|
|
|
"//app.apiunit.com/visitor/home/css/mobile.css" |
54
|
|
|
], |
55
|
|
|
"script": [ |
56
|
|
|
"//js.apiunit.com/message.js", |
57
|
|
|
] |
58
|
|
|
},100); |
59
|
|
|
|
60
|
|
|
|
61
|
|
|
var elem = new E(); |
|
|
|
|
62
|
|
|
// var resp = new Response(); |
63
|
|
|
// |
64
|
|
|
// var rout = new Listener(elem, Response); |
65
|
|
|
// |
66
|
|
|
// var event = new Apiunit(); |
67
|
|
|
// event.router(rout); |
68
|
|
|
// event.json({ |
69
|
|
|
// "submit": { |
70
|
|
|
// "target": "form", |
71
|
|
|
// "url": "//app.apiunit.com/visitor/newsletter/php/index.php", |
72
|
|
|
// "method": "get" |
73
|
|
|
// }, |
74
|
|
|
// }, 200); |
75
|
|
|
|
76
|
|
|
// |
77
|
|
|
// |
78
|
|
|
// var environment = new Apiunit(); |
79
|
|
|
// |
80
|
|
|
// environment.router(form); |
81
|
|
|
// |
82
|
|
|
// environment.json({ |
83
|
|
|
// "local": { |
84
|
|
|
// "domain": "/visitor/newsletter/php/index.php", |
85
|
|
|
// "method": "get" |
86
|
|
|
// }, |
87
|
|
|
// }); |
88
|
|
|
|
89
|
|
|
// apiunit.event({ |
90
|
|
|
// "target": "form", |
91
|
|
|
// "event": "submit", |
92
|
|
|
// "url": "" |
93
|
|
|
// }); |
94
|
|
|
|