Skip to content

Commit

Permalink
Merge pull request #2 from kohver/master
Browse files Browse the repository at this point in the history
Хоткей и пауза по клику
  • Loading branch information
bobrik committed Aug 28, 2012
2 parents e3bd458 + 9b85efa commit 43c5597
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions public/index.html
Expand Up @@ -146,6 +146,21 @@ <h3>Settings<i class="icon-ban-circle" id="health-icon"></i></h3>
<script type="text/javascript" src="/socket.io/socket.io.js"></script>
<script type="text/javascript">
jQuery(document).ready(function() {
var KEY = window.KEY = {
LEFT: 37,
UP: 38,
RIGHT: 39,
DOWN: 40,
DEL: 8,
TAB: 9,
RETURN: 13,
ENTER: 13,
ESC: 27,
PAGEUP: 33,
PAGEDOWN: 34,
SPACE: 32
};

var logLinesTable = jQuery("#log-lines"),
logsListContainer = jQuery("#logs-list"),
logsList = jQuery(),
Expand All @@ -166,6 +181,7 @@ <h3>Settings<i class="icon-ban-circle" id="health-icon"></i></h3>
currentLogType = undefined,
bufferLength = 20,
outputPaused = false,
mouseDowned = false,
linkSeparator = '!!!';

pauseButton.click(function() {
Expand Down Expand Up @@ -342,6 +358,27 @@ <h3>Settings<i class="icon-ban-circle" id="health-icon"></i></h3>
}, 1000);
});

jQuery(window).keydown(function(e) {
if (e.keyCode == KEY.SPACE && e.target == jQuery('body')[0]) {
pauseButton.click();
return false;
}
});

logLinesTable.mousedown(function() {
if (!outputPaused) {
outputPaused = true;
mouseDowned = true;
}
});

logLinesTable.mouseup(function() {
if (mouseDowned) {
outputPaused = false;
mouseDowned = false;
}
});

(function initFromURI() {
function getURLParameter(name) {
var value = (RegExp(name + '=' + '(.*?)(&|$)').exec(location.search)||[,null])[1];
Expand Down

0 comments on commit 43c5597

Please sign in to comment.