Code Duplication    Length = 14-14 lines in 7 locations

Ajax/common/traits/JsUtilsActionsTrait.php 7 locations

@@ 207-220 (lines=14) @@
204
	 * @param boolean $immediatly defers the execution if set to false
205
	 * @return string
206
	 */
207
	public function fadeIn($element='this', $speed='', $callback='', $immediatly=false) {
208
		$element=Javascript::prep_element($element);
209
		$speed=$this->_validate_speed($speed);
210
211
		if ($callback!='') {
212
			$callback=", function(){\n{$callback}\n}";
213
		}
214
215
		$str="$({$element}).fadeIn({$speed}{$callback});";
216
217
		if ($immediatly)
218
			$this->jquery_code_for_compile[]=$str;
219
		return $str;
220
	}
221
222
	/**
223
	 * Execute a javascript library hide action
@@ 231-244 (lines=14) @@
228
	 * @param boolean $immediatly defers the execution if set to false
229
	 * @return string
230
	 */
231
	public function fadeOut($element='this', $speed='', $callback='', $immediatly=false) {
232
		$element=Javascript::prep_element($element);
233
		$speed=$this->_validate_speed($speed);
234
235
		if ($callback!='') {
236
			$callback=", function(){\n{$callback}\n}";
237
		}
238
239
		$str="$({$element}).fadeOut({$speed}{$callback});";
240
241
		if ($immediatly)
242
			$this->jquery_code_for_compile[]=$str;
243
		return $str;
244
	}
245
246
	/**
247
	 * Execute a javascript library slideUp action
@@ 255-268 (lines=14) @@
252
	 * @param boolean $immediatly defers the execution if set to false
253
	 * @return string
254
	 */
255
	public function slideUp($element='this', $speed='', $callback='', $immediatly=false) {
256
		$element=Javascript::prep_element($element);
257
		$speed=$this->_validate_speed($speed);
258
259
		if ($callback!='') {
260
			$callback=", function(){\n{$callback}\n}";
261
		}
262
263
		$str="$({$element}).slideUp({$speed}{$callback});";
264
265
		if ($immediatly)
266
			$this->jquery_code_for_compile[]=$str;
267
		return $str;
268
	}
269
270
	/**
271
	 * Execute a javascript library removeClass action
@@ 291-304 (lines=14) @@
288
	 * @param boolean $immediatly defers the execution if set to false
289
	 * @return string
290
	 */
291
	public function slideDown($element='this', $speed='', $callback='', $immediatly=false) {
292
		$element=Javascript::prep_element($element);
293
		$speed=$this->_validate_speed($speed);
294
295
		if ($callback!='') {
296
			$callback=", function(){\n{$callback}\n}";
297
		}
298
299
		$str="$({$element}).slideDown({$speed}{$callback});";
300
301
		if ($immediatly)
302
			$this->jquery_code_for_compile[]=$str;
303
		return $str;
304
	}
305
306
	/**
307
	 * Execute a javascript library slideToggle action
@@ 315-328 (lines=14) @@
312
	 * @param boolean $immediatly defers the execution if set to false
313
	 * @return string
314
	 */
315
	public function slideToggle($element='this', $speed='', $callback='', $immediatly=false) {
316
		$element=Javascript::prep_element($element);
317
		$speed=$this->_validate_speed($speed);
318
319
		if ($callback!='') {
320
			$callback=", function(){\n{$callback}\n}";
321
		}
322
323
		$str="$({$element}).slideToggle({$speed}{$callback});";
324
325
		if ($immediatly)
326
			$this->jquery_code_for_compile[]=$str;
327
		return $str;
328
	}
329
330
	/**
331
	 * Execute a javascript library hide action
@@ 339-352 (lines=14) @@
336
	 * @param boolean $immediatly defers the execution if set to false
337
	 * @return string
338
	 */
339
	public function hide($element='this', $speed='', $callback='', $immediatly=false) {
340
		$element=Javascript::prep_element($element);
341
		$speed=$this->_validate_speed($speed);
342
343
		if ($callback!='') {
344
			$callback=", function(){\n{$callback}\n}";
345
		}
346
347
		$str="$({$element}).hide({$speed}{$callback});";
348
349
		if ($immediatly)
350
			$this->jquery_code_for_compile[]=$str;
351
		return $str;
352
	}
353
354
	/**
355
	 * Execute a javascript library toggle action
@@ 405-418 (lines=14) @@
402
	 * @param boolean $immediatly defers the execution if set to false
403
	 * @return string
404
	 */
405
	public function show($element='this', $speed='', $callback='', $immediatly=false) {
406
		$element=Javascript::prep_element($element);
407
		$speed=$this->_validate_speed($speed);
408
409
		if ($callback!='') {
410
			$callback=", function(){\n{$callback}\n}";
411
		}
412
413
		$str="$({$element}).show({$speed}{$callback});";
414
415
		if ($immediatly)
416
			$this->jquery_code_for_compile[]=$str;
417
		return $str;
418
	}
419
420
	/**
421
	 * Creates a jQuery sortable