-
Notifications
You must be signed in to change notification settings - Fork 0
/
javascript.json
297 lines (297 loc) · 8.08 KB
/
javascript.json
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
{
"Document ready": {
"prefix": "s-doc-ready",
"body": [
"\\$(function() {",
"\t$0",
"});"
],
"description": "jQuery document.ready"
},
"Global loading spinner": {
"prefix": "s-loader",
"body": [
"window.parent.parent.\\$('.loadingFrame').show();"
],
"description": "Shows the global loading spinner"
},
"Colorbox": {
"prefix": "s-cbox",
"body": [
"\\$.colorbox({",
"\twidth: '98%',",
"\theight: '98%',",
"\tiframe: true,",
"\tfastIframe: false,",
"\tescKey: false,",
"\toverlayClose: false,",
"\tcloseButton: true,",
"\tfixed: true,",
"\thref: '$url'",
"});"
],
"description": "Create Colorbox"
},
"Show Noty wrapper": {
"prefix": "s-noty-func",
"body": [
"function $function_name($message, $type, $timeout) {",
"\tvar noty = [];",
"\tnoty['message'] = $message;",
"\tnoty['position'] = 'top';",
"\tnoty['type'] = $type;",
"\tnoty['modal'] = true;",
"\tnoty['timeout'] = $timeout;",
"\tshow_noty(noty);",
"}"
],
"description": "A wrapper for the show_noty-function"
},
"Attach tip": {
"prefix": "s-tip",
"body": [
"var form = \\$('#$form_name').data('Zebra_Form');",
"form.attach_tip($('#$field_name'), '<?php echo \\$translation->getValue('$translation');?>');"
],
"description": "Generate attach tip for control"
},
"Set Select2": {
"prefix": "s-select2",
"body": [
"\\$('select').select2({theme: 'bootstrap'});"
],
"description": "Set all selects to select2"
},
"ZebraForm callback": {
"prefix": "s-zf-callback",
"body": [
"function $callback_name($display_indicator, $control_name) {",
"\tif ($display_indicator) {",
"\t\t\\$('.' + $control_name).show();",
"\t} else {",
"\t\t\\$('.' + $control_name).hide();",
"",
"\t\t\\$('.' + $control_name).children().find('input, select').each(function(e) {",
"\t\t\tswitch($(this).get(0).type) {",
"\t\t\t\tcase 'select-one':",
"\t\t\t\t\t\\$(this).select2('val', '');",
"\t\t\t\t\tbreak;",
"\t\t\t\tcase 'radio':",
"\t\t\t\tcase 'checkbox':",
"\t\t\t\t\t\\$(this).attr('checked', false);",
"\t\t\t\t\tbreak;",
"\t\t\t\tcase 'text':",
"\t\t\t\t\t\\$(this).val('');",
"\t\t\t\t\tbreak;",
"\t\t\t}",
"\t\t});",
"\t}",
"}"
],
"description": "Callback for ZebraForm dependency"
},
"ZebraForm Date Callback": {
"prefix": "s-zf-date-onchange",
"body": [
"var callback = function() {",
"\tvar datepicker = $('#${2:fieldID}').data('Zebra_DatePicker');",
"\tdatepicker.update({",
"\t\t${1|onSelect,onClear|}: function() {",
"\t\t\tonChangeFunction();",
"\t\t}",
"\t});",
"}"
],
"description": "Paired with PHP snippet. onChange Date Callback for ZebraForm"
},
"Submit function": {
"prefix": "s-submit",
"body": [
"function $function_name() {",
"\tvar form = \\$('#$form_name').data('Zebra_Form');",
"",
"\tif (form.validate()) {",
"\t\t\\$('#$control_name').prop('disabled', true);",
"\t\tform.submit();",
"\t}",
"}"
],
"description": "Submit function"
},
"Datagrid iframe": {
"prefix": "s-dg-iframe",
"body": [
"\\$('#$id').show();",
"\\$('#$id').prop('src', '$url');",
"\\$('#$id').css({'height': window.innerHeight - $height});"
],
"description": "Show and populate datagrid in iframe"
},
"Datagrid": {
"prefix": "s-dg",
"body": [
"\\$('#$datagrid_id').datagrid({",
"\ttitle: '<?php echo \\$translation->getValue('$title_translation');?>',",
"\tsingleSelect: true,",
"\tfitColumns: true,",
"\tpagination: true,",
"\trownumbers: true,",
"\tpageSize: 10,",
"\tremoteSort: false,",
"\tmultiSort: true,",
"\tpageList: [10, 20, 30, 40, 50],",
"\ttoolbar: '#$toolbar_id',",
"\twidth: '100%',",
"\theight: window.innerHeight - 35,",
"\turl: '$url',",
"\tcolumns:[[",
"\t\t{field: '$field_id', halign: 'left', align: 'left', title: '<?php echo \\$translation->getValue('$field_translation');?>', width: 100, sortable: true},",
"\t\t{field: '$button_field_id', halign: 'left', align: 'center', title: '<?php echo \\$translation->getValue('$button_translation');?>'},",
"\t]],",
"\tonLoadError: function() {",
"\t\tvar notyE = [];",
"",
"\t\tnotyE['message'] = '<?php echo \\$translation->getValue('errOnverwagteFout');?>';",
"\t\tnotyE['position'] = 'top';",
"\t\tnotyE['type'] = 'E';",
"\t\tnotyE['modal'] = true;",
"\t\tnotyE['timeout'] = false;",
"",
"\t\tshow_noty(notyE);",
"\t},",
"\tonLoadSuccess : function(data) {",
"\t\tif (data.rows.length > 0 && typeof data.rows[0].ERROR != 'undefined' && data.rows[0].ERROR != '' && data.rows[0].ERROR != null) {",
"\t\t\tvar notyE = [];",
"",
"\t\t\tnotyE['message'] = data.rows[0].ERROR;",
"\t\t\tnotyE['position'] = 'top';",
"\t\t\tnotyE['type'] = 'E';",
"\t\t\tnotyE['modal'] = true;",
"\t\t\tnotyE['timeout'] = false;",
"",
"\t\t\tshow_noty(notyE);",
"\t\t}",
"\t}",
"});",
"",
"\\$('#$datagrid_id').datagrid('enableFilter');"
],
"description": "Create Datagrid"
},
"DatagridLyn": {
"prefix": "s-dg-addline",
"body": [
"{field: '$field_id', halign: 'left', align: 'left', title: '<?php echo \\$translation->getValue('$field_translation');?>', width: 100, sortable: true},"
],
"description": "Create Datagrid Line"
},
"AJAX call": {
"prefix": "s-ajax",
"body": [
"\\$.ajax({",
"\turl: '$url',",
"\tdataType: 'json',",
"\ttype: 'post',",
"\tdata: {",
"\t\t$var_naam: $var_value,",
"\t}",
"}).done(function(data) {",
"\tif (data._S != 'J') {",
"\t\tvar noty = [];",
"\t\tnoty['message'] = data.ErrorValue === '' ? data.ErrorType : data.ErrorValue;",
"\t\tnoty['position'] = 'top';",
"\t\tnoty['type'] = 'E';",
"\t\tnoty['modal'] = true;",
"\t\tnoty['timeout'] = false;",
"\t\tshow_noty(noty);",
"\t} else {",
"\t",
"\t}",
"});"
],
"description": "AJAX call"
},
"Noty Success": {
"prefix": "s-noty-success",
"body": [
"var noty = [];",
"noty['message'] = '<?php echo \\$translation->getValue('${1:translation}');?>';",
"noty['position'] = 'top';",
"noty['type'] = 'S';",
"noty['modal'] = true;",
"noty['timeout'] = 1500;",
"show_noty(noty);"
],
"description": "Show Success Noty"
},
"Noty Error": {
"prefix": "s-noty-error",
"body": [
"var noty = [];",
"noty['message'] = ${1|data.ErrorValue === '' ? data.ErrorType : data.ErrorValue,'<?php echo $translation->getValue('translation');?>'|};",
"noty['position'] = 'top';",
"noty['type'] = 'E';",
"noty['modal'] = true;",
"noty['timeout'] = false;",
"show_noty(noty);"
],
"description": "Show Error Noty"
},
"Noty Verwerk": {
"prefix": "s-noty-verwerk",
"body": [
"var noty = [];",
"noty['message'] = '<?php echo \\$translation->getValue('msgVerwerkingWA');?>';",
"noty['type'] = 'V';",
"noty['modal'] = true;",
"noty['timeout'] = false;",
"show_noty(noty);"
],
"description": "Show Processing Noty"
},
"Noty Confirm": {
"prefix": "s-noty-confirm",
"body": [
"var noty = [];",
"noty['message'] = '<?php echo \\$translation->getValue('$translation');?>';",
"noty['position'] = 'top';",
"noty['type'] = 'C';",
"noty['modal'] = true;",
"noty['button'] = {};",
"noty['button'][0] = {",
"\t'addClass': 'btn btn-success',",
"\t'text': '<?php echo \\$translation->getValue('$success_button_translation');?>',",
"\t'onClick': function() {",
"\t\t\\$.noty.closeAll();",
"\t}",
"}",
"noty['button'][1] = {",
"\t'addClass': 'btn btn-danger',",
"\t'text': '<?php echo \\$translation->getValue('$danger_button_translation');?>',",
"\t'onClick': function() {",
"\t\t\\$.noty.closeAll();",
"\t}",
"}",
"show_noty(noty);"
],
"description": "Show Confirm Noty"
},
"Noty Event": {
"prefix": "s-noty-event",
"body": [
"noty['event'] = {",
"\t${1|onShow,afterShow,onClose,afterClose,onCloseClick|}: function() {",
"\t\t$2",
"\t}",
"}$0"
],
"description": "Events for Noty"
},
"Preset Console Log": {
"prefix": "s-clog",
"body": [
"console.log('${1:identifier}',${2:data});"
],
"description": "Preset Console Log with identifier"
}
}