java/sql-vyuka/web/klavesoveZkratky.js
author František Kučera <franta-hg@frantovo.cz>
Fri May 29 01:31:01 2009 +0200 (2009-05-29)
changeset 14 d08769933940
child 71 880162b55145
permissions -rw-r--r--
Klávesové zkratky pro vykonání příkazu (ctrl+enter) a zobrazení historie (ctrl+h). A možnost zadávat tabulátor jako součást SQL.
franta-hg@14
     1
/** Klávesové zkratky pro celou stránku */
franta-hg@14
     2
franta-hg@14
     3
var isCtrl = false;
franta-hg@14
     4
franta-hg@14
     5
document.onkeyup = function(e) {
franta-hg@14
     6
    if(e.which == 17) {
franta-hg@14
     7
        isCtrl = false;
franta-hg@14
     8
    }
franta-hg@14
     9
}
franta-hg@14
    10
franta-hg@14
    11
document.onkeydown = function(e) {
franta-hg@14
    12
    if(e.which == 17) {
franta-hg@14
    13
        isCtrl = true;
franta-hg@14
    14
    }
franta-hg@14
    15
franta-hg@14
    16
    if (isCtrl) {
franta-hg@14
    17
        if (e.which == 13) {
franta-hg@14
    18
            /** ctrl+enter → vykonáme SQL */
franta-hg@14
    19
            ajaxVykonatSQL();
franta-hg@14
    20
            return false;
franta-hg@14
    21
        } else if (e.which == 72) {
franta-hg@14
    22
            /** ctrl+h → uobrazíme historii */
franta-hg@14
    23
            ajaxZobrazitHistorii();
franta-hg@14
    24
            return false;
franta-hg@14
    25
        }
franta-hg@14
    26
        return true;
franta-hg@14
    27
    } else {
franta-hg@14
    28
        return true;
franta-hg@14
    29
    }
franta-hg@14
    30
}