forked from vitalets/x-editable
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mocks.js
74 lines (59 loc) · 1.46 KB
/
mocks.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
var timeout = 200;
$(function () {
$.mockjaxSettings.responseTime = 50;
$.mockjax({
url: 'post.php',
responseText: '{"success": true}'
});
$.mockjax({
url: 'error.php',
status: 500,
statusText: 'Internal Server Error',
responseText: 'customtext'
});
$.mockjax({
url: 'post-resp.php',
response: function(settings) {
this.responseText = settings;
}
});
window.groups = {
0: 'Guest',
1: 'Service',
2: 'Customer',
3: 'Operator',
4: 'Support',
5: 'Admin',
6: '',
'': 'Nothing'
};
//groups as array
window.groupsArr = [];
window.groupsArr2 = [];
for(var i in groups) {
groupsArr.push({value: i, text: groups[i]});
groupsArr2.push({id: i, text: groups[i]});
}
window.size = groupsArr.length;
$.mockjax({
url: 'groups.php',
responseText: groups
});
$.mockjax({
url: 'groupsArr',
responseText: groupsArr
});
$.mockjax({
url: 'groupsArr2',
responseText: groupsArr2
});
$.mockjax({
url: 'groups-error.php',
status: 500,
responseText: 'Internal Server Error'
});
});
// usefull functions
function tip(e) {
return e.data('editableContainer').tip();
}