Code Duplication    Length = 18-18 lines in 2 locations

api/js/egw_action/test/js/dhtmlxmenu.js 1 location

@@ 1555-1572 (lines=18) @@
1552
*   @param: pos - the position (int)
1553
*   @type: public
1554
*/
1555
dhtmlXMenuObject.prototype.setItemPosition = function(id, pos) {
1556
	id = this.idPrefix+id;
1557
	if (this.idPull[id] == null) { return; }
1558
	// added in 0.4
1559
	var isOnTopLevel = (this.itemPull[id]["parent"] == this.idPrefix+this.topId);
1560
	//
1561
	var itemData = this.idPull[id];
1562
	var itemPos = this.getItemPosition(id.replace(this.idPrefix,""));
1563
	var parent = this.itemPull[id]["parent"];
1564
	// var obj = (this.idPull["polygon_"+parent]!=null?this.idPull["polygon_"+parent].tbd:this.base);
1565
	var obj = (this.idPull["polygon_"+parent]!=null?this.idPull["polygon_"+parent].tbd:this.cont);
1566
	obj.removeChild(obj.childNodes[itemPos]);
1567
	if (pos < 0) pos = 0;
1568
	// added in 0.4
1569
	if (isOnTopLevel && pos < 1) { pos = 1; }
1570
	//
1571
	if (pos < obj.childNodes.length) { obj.insertBefore(itemData, obj.childNodes[pos]); } else { obj.appendChild(itemData); }
1572
}
1573
1574
/**
1575
*   @desc: returns parent's id

api/js/dhtmlxMenu/sources/dhtmlxmenu.js 1 location

@@ 1523-1540 (lines=18) @@
1520
*   @param: pos - the position (int)
1521
*   @type: public
1522
*/
1523
dhtmlXMenuObject.prototype.setItemPosition = function(id, pos) {
1524
	id = this.idPrefix+id;
1525
	if (this.idPull[id] == null) { return; }
1526
	// added in 0.4
1527
	var isOnTopLevel = (this.itemPull[id]["parent"] == this.idPrefix+this.topId);
1528
	//
1529
	var itemData = this.idPull[id];
1530
	var itemPos = this.getItemPosition(id.replace(this.idPrefix,""));
1531
	var parent = this.itemPull[id]["parent"];
1532
	// var obj = (this.idPull["polygon_"+parent]!=null?this.idPull["polygon_"+parent].tbd:this.base);
1533
	var obj = (this.idPull["polygon_"+parent]!=null?this.idPull["polygon_"+parent].tbd:this.cont);
1534
	obj.removeChild(obj.childNodes[itemPos]);
1535
	if (pos < 0) pos = 0;
1536
	// added in 0.4
1537
	if (isOnTopLevel && pos < 1) { pos = 1; }
1538
	//
1539
	if (pos < obj.childNodes.length) { obj.insertBefore(itemData, obj.childNodes[pos]); } else { obj.appendChild(itemData); }
1540
}
1541
1542
/**
1543
*   @desc: returns parent's id