10
10
* @property array $jquery_code_for_compile
11
11
*/
12
12
trait JsUtilsEventsTrait {
13
- protected $ jquery_events = array (
14
- " bind " ,
15
- " blur " ,
16
- " change " ,
17
- " click " ,
18
- " dblclick " ,
19
- " delegate " ,
20
- " die " ,
21
- " error " ,
22
- " focus " ,
23
- " focusin " ,
24
- " focusout " ,
25
- " hover " ,
26
- " keydown " ,
27
- " keypress " ,
28
- " keyup " ,
29
- " live " ,
30
- " load " ,
31
- " mousedown " ,
32
- " mousseenter " ,
33
- " mouseleave " ,
34
- " mousemove " ,
35
- " mouseout " ,
36
- " mouseover " ,
37
- " mouseup " ,
38
- " off " ,
39
- " on " ,
40
- " one " ,
41
- " ready " ,
42
- " resize " ,
43
- " scroll " ,
44
- " select " ,
45
- " submit " ,
46
- " toggle " ,
47
- " trigger " ,
48
- " triggerHandler " ,
49
- " undind " ,
50
- " undelegate " ,
51
- " unload "
52
- ) ;
13
+ protected $ jquery_events = [
14
+ ' bind ' ,
15
+ ' blur ' ,
16
+ ' change ' ,
17
+ ' click ' ,
18
+ ' dblclick ' ,
19
+ ' delegate ' ,
20
+ ' die ' ,
21
+ ' error ' ,
22
+ ' focus ' ,
23
+ ' focusin ' ,
24
+ ' focusout ' ,
25
+ ' hover ' ,
26
+ ' keydown ' ,
27
+ ' keypress ' ,
28
+ ' keyup ' ,
29
+ ' live ' ,
30
+ ' load ' ,
31
+ ' mousedown ' ,
32
+ ' mousseenter ' ,
33
+ ' mouseleave ' ,
34
+ ' mousemove ' ,
35
+ ' mouseout ' ,
36
+ ' mouseover ' ,
37
+ ' mouseup ' ,
38
+ ' off ' ,
39
+ ' on ' ,
40
+ ' one ' ,
41
+ ' ready ' ,
42
+ ' resize ' ,
43
+ ' scroll ' ,
44
+ ' select ' ,
45
+ ' submit ' ,
46
+ ' toggle ' ,
47
+ ' trigger ' ,
48
+ ' triggerHandler ' ,
49
+ ' undind ' ,
50
+ ' undelegate ' ,
51
+ ' unload '
52
+ ] ;
53
53
54
54
abstract public function _add_event ($ element , $ js , $ event , $ preventDefault = false , $ stopPropagation = false , $ immediatly = true , $ listenerOn =false );
55
55
@@ -62,8 +62,8 @@ abstract public function _add_event($element, $js, $event, $preventDefault = fal
62
62
* code to execute
63
63
* @return string
64
64
*/
65
- public function blur ($ element = 'this ' , $ js = '' ) {
66
- return $ this ->_add_event ( $ element , $ js , 'blur ' );
65
+ public function blur ($ element = 'this ' , $ js = '' , $ preventDefault = false , $ stopPropagation = false , $ listenerOn = false ) {
66
+ return $ this ->_add_event ( $ element , $ js , 'blur ' , $ preventDefault , $ stopPropagation , true , $ listenerOn );
67
67
}
68
68
69
69
/**
@@ -75,10 +75,11 @@ public function blur($element = 'this', $js = '') {
75
75
* code to execute
76
76
* @param boolean $preventDefault
77
77
* @param boolean $stopPropagation
78
+ * @param boolean|string $listenerOn use a selector for a delegated event handler
78
79
* @return string
79
80
*/
80
- public function change ($ element = 'this ' , $ js = '' , $ preventDefault = false , $ stopPropagation = false ) {
81
- return $ this ->_add_event ( $ element , $ js , 'change ' , $ preventDefault , $ stopPropagation );
81
+ public function change ($ element = 'this ' , $ js = '' , $ preventDefault = false , $ stopPropagation = false , $ listenerOn = false ) {
82
+ return $ this ->_add_event ( $ element , $ js , 'change ' , $ preventDefault , $ stopPropagation, true , $ listenerOn );
82
83
}
83
84
84
85
/**
@@ -92,9 +93,10 @@ public function change($element = 'this', $js = '', $preventDefault = false, $st
92
93
* or not to return false
93
94
* @param boolean $preventDefault
94
95
* @param boolean $stopPropagation
96
+ * @param boolean|string $listenerOn use a selector for a delegated event handler
95
97
* @return string
96
98
*/
97
- public function click ($ element = 'this ' , $ js = '' , $ ret_false = TRUE , $ preventDefault = false , $ stopPropagation = false ) {
99
+ public function click ($ element = 'this ' , $ js = '' , $ ret_false = TRUE , $ preventDefault = false , $ stopPropagation = false , $ listenerOn = false ) {
98
100
if (! is_array ( $ js )) {
99
101
$ js = array (
100
102
$ js
@@ -105,7 +107,7 @@ public function click($element = 'this', $js = '', $ret_false = TRUE, $preventDe
105
107
$ js [] = "return false; " ;
106
108
}
107
109
108
- return $ this ->_add_event ( $ element , $ js , 'click ' , $ preventDefault , $ stopPropagation );
110
+ return $ this ->_add_event ( $ element , $ js , 'click ' , $ preventDefault , $ stopPropagation, true , $ listenerOn );
109
111
}
110
112
111
113
/**
@@ -115,10 +117,13 @@ public function click($element = 'this', $js = '', $ret_false = TRUE, $preventDe
115
117
* element to attach the event to
116
118
* @param string $js
117
119
* code to execute
120
+ * @param boolean $preventDefault
121
+ * @param boolean $stopPropagation
122
+ * @param boolean|string $listenerOn use a selector for a delegated event handler
118
123
* @return string
119
124
*/
120
- public function contextmenu ($ element = 'this ' , $ js = '' ) {
121
- return $ this ->_add_event ( $ element , $ js , 'contextmenu ' );
125
+ public function contextmenu ($ element = 'this ' , $ js = '' , $ preventDefault = false , $ stopPropagation = false , $ listenerOn = false ) {
126
+ return $ this ->_add_event ( $ element , $ js , 'contextmenu ' , $ preventDefault , $ stopPropagation , true , $ listenerOn );
122
127
}
123
128
124
129
/**
@@ -128,10 +133,13 @@ public function contextmenu($element = 'this', $js = '') {
128
133
* element to attach the event to
129
134
* @param string $js
130
135
* code to execute
136
+ * @param boolean $preventDefault
137
+ * @param boolean $stopPropagation
138
+ * @param boolean|string $listenerOn use a selector for a delegated event handler
131
139
* @return string
132
140
*/
133
- public function dblclick ($ element = 'this ' , $ js = '' ) {
134
- return $ this ->_add_event ( $ element , $ js , 'dblclick ' );
141
+ public function dblclick ($ element = 'this ' , $ js = '' , $ preventDefault = false , $ stopPropagation = false , $ listenerOn = false ) {
142
+ return $ this ->_add_event ( $ element , $ js , 'dblclick ' , $ preventDefault , $ stopPropagation , true , $ listenerOn );
135
143
}
136
144
137
145
/**
@@ -154,10 +162,13 @@ public function error($element = 'this', $js = '') {
154
162
* element to attach the event to
155
163
* @param string $js
156
164
* code to execute
165
+ * @param boolean $preventDefault
166
+ * @param boolean $stopPropagation
167
+ * @param boolean|string $listenerOn use a selector for a delegated event handler
157
168
* @return string
158
169
*/
159
- public function focus ($ element = 'this ' , $ js = '' ) {
160
- return $ this ->_add_event ( $ element , $ js , 'focus ' );
170
+ public function focus ($ element = 'this ' , $ js = '' , $ preventDefault = false , $ stopPropagation = false , $ listenerOn = false ) {
171
+ return $ this ->_add_event ( $ element , $ js , 'focus ' , $ preventDefault , $ stopPropagation , true , $ listenerOn );
161
172
}
162
173
163
174
/**
@@ -183,10 +194,13 @@ public function hover($element = 'this', $over = '', $out = '') {
183
194
* element to attach the event to
184
195
* @param string $js
185
196
* code to execute
197
+ * @param boolean $preventDefault
198
+ * @param boolean $stopPropagation
199
+ * @param boolean|string $listenerOn use a selector for a delegated event handler
186
200
* @return string
187
201
*/
188
- public function keydown ($ element = 'this ' , $ js = '' ) {
189
- return $ this ->_add_event ( $ element , $ js , 'keydown ' );
202
+ public function keydown ($ element = 'this ' , $ js = '' , $ preventDefault = false , $ stopPropagation = false , $ listenerOn = false ) {
203
+ return $ this ->_add_event ( $ element , $ js , 'keydown ' , $ preventDefault , $ stopPropagation , true , $ listenerOn );
190
204
}
191
205
192
206
/**
@@ -196,10 +210,13 @@ public function keydown($element = 'this', $js = '') {
196
210
* element to attach the event to
197
211
* @param string $js
198
212
* code to execute
213
+ * @param boolean $preventDefault
214
+ * @param boolean $stopPropagation
215
+ * @param boolean|string $listenerOn use a selector for a delegated event handler
199
216
* @return string
200
217
*/
201
- public function keypress ($ element = 'this ' , $ js = '' ) {
202
- return $ this ->_add_event ( $ element , $ js , 'keypress ' );
218
+ public function keypress ($ element = 'this ' , $ js = '' , $ preventDefault = false , $ stopPropagation = false , $ listenerOn = false ) {
219
+ return $ this ->_add_event ( $ element , $ js , 'keypress ' , $ preventDefault , $ stopPropagation , true , $ listenerOn );
203
220
}
204
221
205
222
/**
@@ -209,10 +226,13 @@ public function keypress($element = 'this', $js = '') {
209
226
* element to attach the event to
210
227
* @param string $js
211
228
* code to execute
229
+ * @param boolean $preventDefault
230
+ * @param boolean $stopPropagation
231
+ * @param boolean|string $listenerOn use a selector for a delegated event handler
212
232
* @return string
213
233
*/
214
- public function keyup ($ element = 'this ' , $ js = '' ) {
215
- return $ this ->_add_event ( $ element , $ js , 'keyup ' );
234
+ public function keyup ($ element = 'this ' , $ js = '' , $ preventDefault = false , $ stopPropagation = false , $ listenerOn = false ) {
235
+ return $ this ->_add_event ( $ element , $ js , 'keyup ' , $ preventDefault , $ stopPropagation , true , $ listenerOn );
216
236
}
217
237
218
238
/**
@@ -222,10 +242,13 @@ public function keyup($element = 'this', $js = '') {
222
242
* element to attach the event to
223
243
* @param string $js
224
244
* code to execute
245
+ * @param boolean $preventDefault
246
+ * @param boolean $stopPropagation
247
+ * @param boolean|string $listenerOn use a selector for a delegated event handler
225
248
* @return string
226
249
*/
227
- public function load ($ element = 'this ' , $ js = '' ) {
228
- return $ this ->_add_event ( $ element , $ js , 'load ' );
250
+ public function load ($ element = 'this ' , $ js = '' , $ preventDefault = false , $ stopPropagation = false , $ listenerOn = false ) {
251
+ return $ this ->_add_event ( $ element , $ js , 'load ' , $ preventDefault , $ stopPropagation , true , $ listenerOn );
229
252
}
230
253
231
254
/**
@@ -235,10 +258,13 @@ public function load($element = 'this', $js = '') {
235
258
* element to attach the event to
236
259
* @param string $js
237
260
* code to execute
261
+ * @param boolean $preventDefault
262
+ * @param boolean $stopPropagation
263
+ * @param boolean|string $listenerOn use a selector for a delegated event handler
238
264
* @return string
239
265
*/
240
- public function mousedown ($ element = 'this ' , $ js = '' ) {
241
- return $ this ->_add_event ( $ element , $ js , 'mousedown ' );
266
+ public function mousedown ($ element = 'this ' , $ js = '' , $ preventDefault = false , $ stopPropagation = false , $ listenerOn = false ) {
267
+ return $ this ->_add_event ( $ element , $ js , 'mousedown ' , $ preventDefault , $ stopPropagation , true , $ listenerOn );
242
268
}
243
269
244
270
/**
@@ -248,10 +274,13 @@ public function mousedown($element = 'this', $js = '') {
248
274
* element to attach the event to
249
275
* @param string $js
250
276
* code to execute
277
+ * @param boolean $preventDefault
278
+ * @param boolean $stopPropagation
279
+ * @param boolean|string $listenerOn use a selector for a delegated event handler
251
280
* @return string
252
281
*/
253
- public function mouseout ($ element = 'this ' , $ js = '' , $ preventDefault = false , $ stopPropagation = false ) {
254
- return $ this ->_add_event ( $ element , $ js , 'mouseout ' , $ preventDefault , $ stopPropagation );
282
+ public function mouseout ($ element = 'this ' , $ js = '' , $ preventDefault = false , $ stopPropagation = false , $ listenerOn = false ) {
283
+ return $ this ->_add_event ( $ element , $ js , 'mouseout ' , $ preventDefault , $ stopPropagation, true , $ listenerOn );
255
284
}
256
285
257
286
/**
@@ -261,10 +290,13 @@ public function mouseout($element = 'this', $js = '', $preventDefault = false, $
261
290
* element to attach the event to
262
291
* @param string $js
263
292
* code to execute
293
+ * @param boolean $preventDefault
294
+ * @param boolean $stopPropagation
295
+ * @param boolean|string $listenerOn use a selector for a delegated event handler
264
296
* @return string
265
297
*/
266
- public function mouseleave ($ element = 'this ' , $ js = '' , $ preventDefault = false , $ stopPropagation = false ) {
267
- return $ this ->_add_event ( $ element , $ js , 'mouseleave ' , $ preventDefault , $ stopPropagation );
298
+ public function mouseleave ($ element = 'this ' , $ js = '' , $ preventDefault = false , $ stopPropagation = false , $ listenerOn = false ) {
299
+ return $ this ->_add_event ( $ element , $ js , 'mouseleave ' , $ preventDefault , $ stopPropagation, true , $ listenerOn );
268
300
}
269
301
270
302
/**
@@ -274,10 +306,13 @@ public function mouseleave($element = 'this', $js = '', $preventDefault = false,
274
306
* element to attach the event to
275
307
* @param string $js
276
308
* code to execute
309
+ * @param boolean $preventDefault
310
+ * @param boolean $stopPropagation
311
+ * @param boolean|string $listenerOn use a selector for a delegated event handler
277
312
* @return string
278
313
*/
279
- public function mouseenter ($ element = 'this ' , $ js = '' , $ preventDefault = false , $ stopPropagation = false ) {
280
- return $ this ->_add_event ( $ element , $ js , 'mouseenter ' , $ preventDefault , $ stopPropagation );
314
+ public function mouseenter ($ element = 'this ' , $ js = '' , $ preventDefault = false , $ stopPropagation = false , $ listenerOn = false ) {
315
+ return $ this ->_add_event ( $ element , $ js , 'mouseenter ' , $ preventDefault , $ stopPropagation, true , $ listenerOn );
281
316
}
282
317
283
318
/**
@@ -287,10 +322,13 @@ public function mouseenter($element = 'this', $js = '', $preventDefault = false,
287
322
* element to attach the event to
288
323
* @param string $js
289
324
* code to execute
325
+ * @param boolean $preventDefault
326
+ * @param boolean $stopPropagation
327
+ * @param boolean|string $listenerOn use a selector for a delegated event handler
290
328
* @return string
291
329
*/
292
- public function mouseover ($ element = 'this ' , $ js = '' ) {
293
- return $ this ->_add_event ( $ element , $ js , 'mouseover ' );
330
+ public function mouseover ($ element = 'this ' , $ js = '' , $ preventDefault = false , $ stopPropagation = false , $ listenerOn = false ) {
331
+ return $ this ->_add_event ( $ element , $ js , 'mouseover ' , $ preventDefault , $ stopPropagation , true , $ listenerOn );
294
332
}
295
333
296
334
/**
@@ -300,10 +338,13 @@ public function mouseover($element = 'this', $js = '') {
300
338
* element to attach the event to
301
339
* @param string $js
302
340
* code to execute
341
+ * @param boolean $preventDefault
342
+ * @param boolean $stopPropagation
343
+ * @param boolean|string $listenerOn use a selector for a delegated event handler
303
344
* @return string
304
345
*/
305
- public function mouseup ($ element = 'this ' , $ js = '' ) {
306
- return $ this ->_add_event ( $ element , $ js , 'mouseup ' );
346
+ public function mouseup ($ element = 'this ' , $ js = '' , $ preventDefault = false , $ stopPropagation = false , $ listenerOn = false ) {
347
+ return $ this ->_add_event ( $ element , $ js , 'mouseup ' , $ preventDefault , $ stopPropagation , true , $ listenerOn );
307
348
}
308
349
309
350
/**
@@ -313,10 +354,13 @@ public function mouseup($element = 'this', $js = '') {
313
354
* element to attach the event to
314
355
* @param string $js
315
356
* code to execute
357
+ * @param boolean $preventDefault
358
+ * @param boolean $stopPropagation
359
+ * @param boolean|string $listenerOn use a selector for a delegated event handler
316
360
* @return string
317
361
*/
318
- public function unload ($ element = 'this ' , $ js = '' ) {
319
- return $ this ->_add_event ( $ element , $ js , 'unload ' );
362
+ public function unload ($ element = 'this ' , $ js = '' , $ preventDefault = false , $ stopPropagation = false , $ listenerOn = false ) {
363
+ return $ this ->_add_event ( $ element , $ js , 'unload ' , $ preventDefault , $ stopPropagation , true , $ listenerOn );
320
364
}
321
365
322
366
// --------------------------------------------------------------------
@@ -327,10 +371,13 @@ public function unload($element = 'this', $js = '') {
327
371
* element to attach the event to
328
372
* @param string $js
329
373
* code to execute
374
+ * @param boolean $preventDefault
375
+ * @param boolean $stopPropagation
376
+ * @param boolean|string $listenerOn use a selector for a delegated event handler
330
377
* @return string
331
378
*/
332
- public function resize ($ element = 'this ' , $ js = '' ) {
333
- return $ this ->_add_event ( $ element , $ js , 'resize ' );
379
+ public function resize ($ element = 'this ' , $ js = '' , $ preventDefault = false , $ stopPropagation = false , $ listenerOn = false ) {
380
+ return $ this ->_add_event ( $ element , $ js , 'resize ' , $ preventDefault , $ stopPropagation , true , $ listenerOn );
334
381
}
335
382
336
383
// --------------------------------------------------------------------
@@ -341,9 +388,12 @@ public function resize($element = 'this', $js = '') {
341
388
* element to attach the event to
342
389
* @param string $js
343
390
* code to execute
391
+ * @param boolean $preventDefault
392
+ * @param boolean $stopPropagation
393
+ * @param boolean|string $listenerOn use a selector for a delegated event handler
344
394
* @return string
345
395
*/
346
- public function scroll ($ element = 'this ' , $ js = '' ) {
347
- return $ this ->_add_event ( $ element , $ js , 'scroll ' );
396
+ public function scroll ($ element = 'this ' , $ js = '' , $ preventDefault = false , $ stopPropagation = false , $ listenerOn = false ) {
397
+ return $ this ->_add_event ( $ element , $ js , 'scroll ' , $ preventDefault , $ stopPropagation , true , $ listenerOn );
348
398
}
349
399
}
0 commit comments