Code Duplication    Length = 47-47 lines in 2 locations

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

@@ 884-930 (lines=47) @@
881
	}
882
}
883
/* complex arrow manipulations, over added in 0.4 */
884
dhtmlXMenuObject.prototype._updateItemComplexState = function(id, state, over) {
885
	// 0.2 FIX :: topLevel's items can have complex items with arrow
886
	if ((!this.context) && (this._getItemLevelType(id.replace(this.idPrefix,"")) == "TopLevel")) {
887
		// 30.06.2008 fix > complex state for top level item, state only, no arrow
888
		this.itemPull[id]["complex"] = state;
889
		return;
890
	}
891
	if ((this.idPull[id] == null) || (this.itemPull[id] == null)) { return; }
892
	// 0.2 FIX :: end
893
	this.itemPull[id]["complex"] = state;
894
	// fixed in 0.4 for context
895
	if (id == this.idPrefix+this.topId) return;
896
	// end fix
897
	// try to retrieve arrow img object
898
	var arrowObj = null;
899
	
900
	
901
	var item = this.idPull[id].childNodes[this._rtl?0:2];
902
	if (item.childNodes[0]) if (String(item.childNodes[0].className).search("complex_arrow") === 0) arrowObj = item.childNodes[0];
903
	
904
	if (this.itemPull[id]["complex"]) {
905
		// create arrow
906
		if (arrowObj == null) {
907
			arrowObj = document.createElement("DIV");
908
			arrowObj.className = "complex_arrow";
909
			arrowObj.id = "arrow_"+id;
910
			while (item.childNodes.length > 0) item.removeChild(item.childNodes[0]);
911
			item.appendChild(arrowObj);
912
		}
913
		// over state added in 0.4
914
		
915
		if (this.dLoad && (this.itemPull[id]["loaded"] == "get") && this.loaderIcon) {
916
			// change arrow to loader
917
			if (arrowObj.className != "complex_arrow_loading") arrowObj.className = "complex_arrow_loading";
918
		} else {
919
			arrowObj.className = "complex_arrow";
920
		}
921
		
922
		return;
923
	}
924
	
925
	if ((!this.itemPull[id]["complex"]) && (arrowObj!=null)) {
926
		item.removeChild(arrowObj);
927
		if (this.itemPull[id]["hotkey_backup"] != null && this.setHotKey) { this.setHotKey(id.replace(this.idPrefix, ""), this.itemPull[id]["hotkey_backup"]); }
928
	}
929
	
930
}
931
932
/* return css-part level type */
933
dhtmlXMenuObject.prototype._getItemLevelType = function(id) {

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

@@ 855-901 (lines=47) @@
852
	}
853
}
854
/* complex arrow manipulations, over added in 0.4 */
855
dhtmlXMenuObject.prototype._updateItemComplexState = function(id, state, over) {
856
	// 0.2 FIX :: topLevel's items can have complex items with arrow
857
	if ((!this.context) && (this._getItemLevelType(id.replace(this.idPrefix,"")) == "TopLevel")) {
858
		// 30.06.2008 fix > complex state for top level item, state only, no arrow
859
		this.itemPull[id]["complex"] = state;
860
		return;
861
	}
862
	if ((this.idPull[id] == null) || (this.itemPull[id] == null)) { return; }
863
	// 0.2 FIX :: end
864
	this.itemPull[id]["complex"] = state;
865
	// fixed in 0.4 for context
866
	if (id == this.idPrefix+this.topId) return;
867
	// end fix
868
	// try to retrieve arrow img object
869
	var arrowObj = null;
870
	
871
	
872
	var item = this.idPull[id].childNodes[this._rtl?0:2];
873
	if (item.childNodes[0]) if (String(item.childNodes[0].className).search("complex_arrow") === 0) arrowObj = item.childNodes[0];
874
	
875
	if (this.itemPull[id]["complex"]) {
876
		// create arrow
877
		if (arrowObj == null) {
878
			arrowObj = document.createElement("DIV");
879
			arrowObj.className = "complex_arrow";
880
			arrowObj.id = "arrow_"+id;
881
			while (item.childNodes.length > 0) item.removeChild(item.childNodes[0]);
882
			item.appendChild(arrowObj);
883
		}
884
		// over state added in 0.4
885
		
886
		if (this.dLoad && (this.itemPull[id]["loaded"] == "get") && this.loaderIcon) {
887
			// change arrow to loader
888
			if (arrowObj.className != "complex_arrow_loading") arrowObj.className = "complex_arrow_loading";
889
		} else {
890
			arrowObj.className = "complex_arrow";
891
		}
892
		
893
		return;
894
	}
895
	
896
	if ((!this.itemPull[id]["complex"]) && (arrowObj!=null)) {
897
		item.removeChild(arrowObj);
898
		if (this.itemPull[id]["hotkey_backup"] != null && this.setHotKey) { this.setHotKey(id.replace(this.idPrefix, ""), this.itemPull[id]["hotkey_backup"]); }
899
	}
900
	
901
}
902
903
/* return css-part level type */
904
dhtmlXMenuObject.prototype._getItemLevelType = function(id) {