Files
votianng/html/lib/project/js/key_events_menu.js
2026-03-29 10:34:57 +02:00

139 lines
3.2 KiB
JavaScript

<script language="JavaScript1.2" type="text/javascript">
<!--
// General functionality for all browsers in this section
// Status of the event to be checked
var keyDownEventEnabled = true;
var Netscape = new Boolean();
Netscape = false;
if (navigator.appName == "Netscape") Netscape = true;
// Status informations
// document.write(navigator.appName + "<br>" + navigator.appVersion + "<br>" + navigator.appCodeName + "<br><br><br>");
function disableEvent(e) {
if (!e) var e = window.event;
e.cancelBubble = true;
if (e.stopPropagation) e.stopPropagation();
if (e.preventDefault) {
if (e.cancelable) e.preventDefault();
} else {
e.keyCode = 0;
e.returnValue = 0;
// e.cancelBubble = true;
}
keyDownEventEnabled = false;
}
function actionEvent(task) {
if (task == "admin") {
top.location.href = "../admin/menu_fs.php?navigationLevel=2&navigationPoint=verwaltung";
}
if (task == "job_edit") {
top.jb_edit = window.open("../jobs/job_edit.php","job_edit");
}
if (task == "job_edit2") {
top.jb_edit = window.open("../jobs2/job_edit.php","job_edit");
}
if (task == "job_list") {
top.menu.location.href = "../admin/menu.php";
top.maincontent.location.href = "../admin/jb_list.php";
}
}
//-->
</script>
<script language="JavaScript1.2" type="text/javascript">
<!--
function eventKeyDownPressed(e) {
if (e.altKey) {
keyDownEventEnabled = true;
}
return true;
}
function eventKeyUpPressed(e) {
// if (e.altKey) {
keyDownEventEnabled = true;
// }
return true;
}
function eventKeyPressed(e) {
if (Netscape) {
// Verwaltung
if (keyDownEventEnabled && e.altKey && e.which == 49) { // "alt-1"
disableEvent(e);
actionEvent("admin");
}
// Auftragserfassung
if (keyDownEventEnabled && e.altKey && e.which == 50) { // "alt-2"
disableEvent(e);
if (!top.job_edit) {
actionEvent("job_edit");
} else {
if (top.job_edit.open) {
top.job_edit.focus();
} else {
actionEvent("job_edit");
}
}
}
// Auftragslisten
if (keyDownEventEnabled && e.altKey && e.which == 51) { // "alt-3"
disableEvent(e);
actionEvent("job_list");
}
}
};
if (Netscape) {
document.addEventListener("keydown", eventKeyDownPressed, true);
document.addEventListener("keyup", eventKeyUpPressed, true);
document.addEventListener("keypress", eventKeyPressed, true);
}
//-->
</script>
<!-- JScript-Bereiche fuer MS Internet Explorer -->
<script for="document" event="onkeydown()" language="JScript" type="text/jscript">
<!--
{
// Verwaltung
if (window.event.altKey && event.keyCode == 49) { // "alt-1"
disableEvent(window.event);
actionEvent("admin");
}
// Auftragserfassung
if (window.event.altKey && event.keyCode == 50) { // "alt-2"
disableEvent(window.event);
if (!top.job_edit) {
actionEvent("job_edit");
} else {
if (top.job_edit.open) {
top.job_edit.focus();
} else {
actionEvent("job_edit");
}
}
}
// Auftragslisten
if (window.event.altKey && event.keyCode == 51) { // "alt-3"
disableEvent(window.event);
actionEvent("job_list");
}
}
//-->
</script>