@@ 499-545 (lines=47) @@ | ||
496 | /* onClickMenu action (click on any end item to perform some actions) |
|
497 | optimized in version 0.3 added type feature (click on disabled items, click on complex nodes) |
|
498 | attachEvent feature from 0.4 */ |
|
499 | this._doOnClick = function(id, type, casState) { |
|
500 | this.menuLastClicked = id; |
|
501 | // href |
|
502 | if (this.itemPull[this.idPrefix+id]["href_link"] != null && this.itemPull[this.idPrefix+id].state == "enabled") { |
|
503 | var form = document.createElement("FORM"); |
|
504 | var k = String(this.itemPull[this.idPrefix+id]["href_link"]).split("?"); |
|
505 | form.action = k[0]; |
|
506 | if (k[1] != null) { |
|
507 | var p = String(k[1]).split("&"); |
|
508 | for (var q=0; q<p.length; q++) { |
|
509 | var j = String(p[q]).split("="); |
|
510 | var m = document.createElement("INPUT"); |
|
511 | m.type = "hidden"; |
|
512 | m.name = (j[0]||""); |
|
513 | m.value = (j[1]||""); |
|
514 | form.appendChild(m); |
|
515 | } |
|
516 | } |
|
517 | if (this.itemPull[this.idPrefix+id]["href_target"] != null) { form.target = this.itemPull[this.idPrefix+id]["href_target"]; } |
|
518 | form.style.display = "none"; |
|
519 | document.body.appendChild(form); |
|
520 | form.submit(); |
|
521 | if (form != null) { |
|
522 | document.body.removeChild(form); |
|
523 | form = null; |
|
524 | } |
|
525 | return; |
|
526 | } |
|
527 | // |
|
528 | // some fixes |
|
529 | if (type.charAt(0)=="c") return; // can't click on complex item |
|
530 | if (type.charAt(1)=="d") return; // can't click on disabled item |
|
531 | if (type.charAt(2)=="s") return; // can't click on separator |
|
532 | // |
|
533 | if (this.checkEvent("onClick")) { |
|
534 | // this.callEvent("onClick", [id, type, this.contextMenuZoneId]); |
|
535 | this.callEvent("onClick", [id, this.contextMenuZoneId, casState]); |
|
536 | } else { |
|
537 | if ((type.charAt(1) == "d") || (this.menuMode == "win" && type.charAt(2) == "t")) return; |
|
538 | } |
|
539 | if (this.context && this._isContextMenuVisible() && this.contextAutoHide) { |
|
540 | this._hideContextMenu(); |
|
541 | } else { |
|
542 | // if menu unloaded from click event |
|
543 | if (this._clearAndHide) this._clearAndHide(); |
|
544 | } |
|
545 | } |
|
546 | /* onTouchMenu action (select topLevel item), attachEvent added in 0.4 */ |
|
547 | this._doOnTouchMenu = function(id) { |
|
548 | if (this.menuTouched == false) { |
@@ 475-519 (lines=45) @@ | ||
472 | /* onClickMenu action (click on any end item to perform some actions) |
|
473 | optimized in version 0.3 added type feature (click on disabled items, click on complex nodes) |
|
474 | attachEvent feature from 0.4 */ |
|
475 | this._doOnClick = function(id, type, casState) { |
|
476 | this.menuLastClicked = id; |
|
477 | // href |
|
478 | if (this.itemPull[this.idPrefix+id]["href_link"] != null) { |
|
479 | var form = document.createElement("FORM"); |
|
480 | var k = String(this.itemPull[this.idPrefix+id]["href_link"]).split("?"); |
|
481 | form.action = k[0]; |
|
482 | if (k[1] != null) { |
|
483 | var p = String(k[1]).split("&"); |
|
484 | for (var q=0; q<p.length; q++) { |
|
485 | var j = String(p[q]).split("="); |
|
486 | var m = document.createElement("INPUT"); |
|
487 | m.type = "hidden"; |
|
488 | m.name = (j[0]||""); |
|
489 | m.value = (j[1]||""); |
|
490 | form.appendChild(m); |
|
491 | } |
|
492 | } |
|
493 | if (this.itemPull[this.idPrefix+id]["href_target"] != null) { form.target = this.itemPull[this.idPrefix+id]["href_target"]; } |
|
494 | form.style.display = "none"; |
|
495 | document.body.appendChild(form); |
|
496 | form.submit(); |
|
497 | if (form != null) { |
|
498 | document.body.removeChild(form); |
|
499 | form = null; |
|
500 | } |
|
501 | return; |
|
502 | } |
|
503 | // |
|
504 | // some fixes |
|
505 | if (type.charAt(0)=="c") return; // can't click on complex item |
|
506 | if (type.charAt(1)=="d") return; // can't click on disabled item |
|
507 | if (type.charAt(2)=="s") return; // can't click on separator |
|
508 | // |
|
509 | if (this.checkEvent("onClick")) { |
|
510 | // this.callEvent("onClick", [id, type, this.contextMenuZoneId]); |
|
511 | this._clearAndHide(); |
|
512 | if (this._isContextMenuVisible() && this.contextAutoHide) this._hideContextMenu(); |
|
513 | this.callEvent("onClick", [id, this.contextMenuZoneId, casState]); |
|
514 | } else { |
|
515 | if ((type.charAt(1) == "d") || (this.menuMode == "win" && type.charAt(2) == "t")) return; |
|
516 | this._clearAndHide(); |
|
517 | if (this._isContextMenuVisible() && this.contextAutoHide) this._hideContextMenu(); |
|
518 | } |
|
519 | } |
|
520 | /* onTouchMenu action (select topLevel item), attachEvent added in 0.4 */ |
|
521 | this._doOnTouchMenu = function(id) { |
|
522 | if (this.menuTouched == false) { |