1 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 * @fileoverview Handle shortcuts in various pages
4 * @name Shortcuts handler
11 * Register key events on load
13 $(document).ready(function () {
14 var databaseOp = false;
25 $(document).on('keyup', function (e) {
26 if (e.target.nodeName === 'INPUT' || e.target.nodeName === 'TEXTAREA' || e.target.nodeName === 'SELECT') {
30 if (e.keyCode === keyD) {
31 setTimeout(function () {
34 } else if (e.keyCode === keyT) {
35 setTimeout(function () {
40 $(document).on('keydown', function (e) {
41 if (e.ctrlKey && e.altKey && e.keyCode === keyC) {
45 if (e.ctrlKey && e.keyCode === keyK) {
50 if (e.target.nodeName === 'INPUT' || e.target.nodeName === 'TEXTAREA' || e.target.nodeName === 'SELECT') {
56 if (e.keyCode === keyD) {
58 } else if (e.keyCode === keyK) {
61 } else if (e.keyCode === keyS) {
62 if (databaseOp === true) {
63 isTable = PMA_commonParams.get('table');
64 isDb = PMA_commonParams.get('db');
65 if (isDb && ! isTable) {
66 $('.tab .ic_b_props').first().trigger('click');
68 } else if (tableOp === true) {
69 isTable = PMA_commonParams.get('table');
70 isDb = PMA_commonParams.get('db');
71 if (isDb && isTable) {
72 $('.tab .ic_b_props').first().trigger('click');
75 $('#pma_navigation_settings_icon').trigger('click');
77 } else if (e.keyCode === keyF) {
78 if (databaseOp === true) {
79 isTable = PMA_commonParams.get('table');
80 isDb = PMA_commonParams.get('db');
81 if (isDb && ! isTable) {
82 $('.tab .ic_b_search').first().trigger('click');
84 } else if (tableOp === true) {
85 isTable = PMA_commonParams.get('table');
86 isDb = PMA_commonParams.get('db');
87 if (isDb && isTable) {
88 $('.tab .ic_b_search').first().trigger('click');
91 } else if (e.keyCode === keyT) {
93 } else if (e.keyCode === keyE) {
94 $('.ic_b_export').first().trigger('click');
95 } else if (e.keyCode === keyBackSpace) {
96 window.history.back();
97 } else if (e.keyCode === keyH) {
98 $('.ic_b_home').first().trigger('click');