Function: Created key_press function to dynamically generate key detection javascript.

Voicemail: Ctrl+A checks all checkboxes, pressing Delete deletes the checked Voicemails.
Editor: Integrated key_press function.
Command: Integrated key_press function.
This commit is contained in:
reliberate
2016-03-31 17:11:37 -06:00
parent db122a3da6
commit 2ca72bd99d
7 changed files with 196 additions and 167 deletions
+13 -24
View File
@@ -137,31 +137,20 @@ echo "</script>";
// keyboard shortcut bindings
echo "<script language='JavaScript' type='text/javascript' src='".PROJECT_PATH."/resources/jquery/jquery-1.11.1.js'></script>\n";
echo "<script>\n";
echo " $(window).keypress(function(event) {\n";
echo " //save file [Ctrl+S]\n";
echo " if ((event.which == 115 && event.ctrlKey) || (event.which == 19)) {\n";
echo " parent.$('form#frm_edit').submit();\n";
echo " return false;\n";
echo " }\n";
echo " //open file manager/clip library pane [Ctrl+Q]\n";
echo " else if ((event.which == 113 && event.ctrlKey) || (event.which == 19)) {\n";
echo " parent.toggle_sidebar();\n";
echo " parent.focus_editor();\n";
echo " return false;\n";
echo " }\n";
echo " //block backspace\n";
echo " else if (event.which == 8) {\n";
echo " return false;\n";
echo " }\n";
echo " //otherwise, default action\n";
echo " else {\n";
echo " return true;\n";
echo " }\n";
echo " });\n";
echo "</script>\n";
echo "<head>\n";
//save file
key_press('ctrl+s', 'down', 'window', null, null, "if (parent.document.getElementById('frm_edit')) { parent.$('form#frm_edit').submit(); return false; }", true);
//open file manager/clip library pane
key_press('ctrl+q', 'down', 'window', null, null, "if (parent.document.getElementById('sidebar')) { parent.toggle_sidebar(); parent.focus_editor(); return false; }", true);
//prevent backspace (browser history back)
key_press('backspace', 'down', 'window', null, null, 'return false;', true);
//keyboard shortcut to execute command (when included on command page)
key_press('ctrl+enter', 'down', 'window', null, null, "if (!parent.document.getElementById('sidebar')) { parent.$('form#frm').submit(); return false; }", true);
echo "</head>\n";
echo "<body style='margin: 0; padding: 5px;' onfocus='blur();'>\n";
echo "<div style='text-align: left; padding-top: 3px;'>\n";