Permalink
Browse files

Merge pull request #2 from kohver/master

Хоткей и пауза по клику
  • Loading branch information...
2 parents e3bd458 + 9b85efa commit 43c5597df5262cb4d337c02f811eec27624abe7e @bobrik committed Aug 28, 2012
Showing with 37 additions and 0 deletions.
  1. +37 −0 public/index.html
View
@@ -146,6 +146,21 @@
<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(),
@@ -166,6 +181,7 @@
currentLogType = undefined,
bufferLength = 20,
outputPaused = false,
+ mouseDowned = false,
linkSeparator = '!!!';
pauseButton.click(function() {
@@ -342,6 +358,27 @@
}, 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];

0 comments on commit 43c5597

Please sign in to comment.