Code Duplication    Length = 36-36 lines in 2 locations

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

@@ 1367-1402 (lines=36) @@
1364
*   @param: zoneId - id of the object on page to render as a contextual zone
1365
*   @type: public
1366
*/
1367
dhtmlXMenuObject.prototype.addContextZone = function(zoneId) {
1368
	if (zoneId == document.body) {
1369
		zoneId = "document.body."+this.idPrefix;
1370
		var zone = document.body;
1371
	} else {
1372
		var zone = document.getElementById(zoneId);
1373
	}
1374
	var zoneExists = false;
1375
	for (var a in this.contextZones) { zoneExists = zoneExists || (a == zoneId) || (this.contextZones[a] == zone); }
1376
	if (zoneExists == true) return false;
1377
	this.contextZones[zoneId] = zone;
1378
	var main_self = this;
1379
	if (_isOpera) {
1380
		this.operaContext = function(e){ main_self._doOnContextMenuOpera(e, main_self); }
1381
		zone.addEventListener("mouseup", this.operaContext, false);
1382
		//
1383
	} else {
1384
		if (zone.oncontextmenu != null && !zone._oldContextMenuHandler) zone._oldContextMenuHandler = zone.oncontextmenu;
1385
		zone.oncontextmenu = function(e) {
1386
			// autoclose any other opened context menues
1387
			for (var q in dhtmlxMenuObjectLiveInstances) {
1388
				if (q != main_self._UID) {
1389
					if (dhtmlxMenuObjectLiveInstances[q].context) {
1390
						dhtmlxMenuObjectLiveInstances[q]._hideContextMenu();
1391
					}
1392
				}
1393
			}
1394
			//
1395
			e = e||event;
1396
			e.cancelBubble = true;
1397
			e.returnValue = false;
1398
			main_self._doOnContextBeforeCall(e, this);
1399
			return false;
1400
		}
1401
	}
1402
}
1403
dhtmlXMenuObject.prototype._doOnContextMenuOpera = function(e, main_self) {
1404
	// autoclose any other opened context menues
1405
	for (var q in dhtmlxMenuObjectLiveInstances) {

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

@@ 1335-1370 (lines=36) @@
1332
*   @param: zoneId - id of the object on page to render as a contextual zone
1333
*   @type: public
1334
*/
1335
dhtmlXMenuObject.prototype.addContextZone = function(zoneId) {
1336
	if (zoneId == document.body) {
1337
		zoneId = "document.body."+this.idPrefix;
1338
		var zone = document.body;
1339
	} else {
1340
		var zone = document.getElementById(zoneId);
1341
	}
1342
	var zoneExists = false;
1343
	for (var a in this.contextZones) { zoneExists = zoneExists || (a == zoneId) || (this.contextZones[a] == zone); }
1344
	if (zoneExists == true) return false;
1345
	this.contextZones[zoneId] = zone;
1346
	var main_self = this;
1347
	if (_isOpera) {
1348
		this.operaContext = function(e){ main_self._doOnContextMenuOpera(e, main_self); }
1349
		zone.addEventListener("mouseup", this.operaContext, false);
1350
		//
1351
	} else {
1352
		if (zone.oncontextmenu != null && !zone._oldContextMenuHandler) zone._oldContextMenuHandler = zone.oncontextmenu;
1353
		zone.oncontextmenu = function(e) {
1354
			// autoclose any other opened context menues
1355
			for (var q in dhtmlxMenuObjectLiveInstances) {
1356
				if (q != main_self._UID) {
1357
					if (dhtmlxMenuObjectLiveInstances[q].context) {
1358
						dhtmlxMenuObjectLiveInstances[q]._hideContextMenu();
1359
					}
1360
				}
1361
			}
1362
			//
1363
			e = e||event;
1364
			e.cancelBubble = true;
1365
			e.returnValue = false;
1366
			main_self._doOnContextBeforeCall(e, this);
1367
			return false;
1368
		}
1369
	}
1370
}
1371
dhtmlXMenuObject.prototype._doOnContextMenuOpera = function(e, main_self) {
1372
	// autoclose any other opened context menues
1373
	for (var q in dhtmlxMenuObjectLiveInstances) {