Permalink
Browse files

Пауза логгирования на SPACE и при выделении текста

  • Loading branch information...
1 parent c759a9a commit 374054749b5de75af3958a9937ecae3b209ef837 @kohver kohver committed Aug 14, 2012
Showing with 37 additions and 0 deletions.
  1. +37 −0 public/index.html
View
@@ -138,6 +138,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(),
@@ -152,6 +167,7 @@
currentLog = undefined,
bufferLength = 20,
outputPaused = false,
+ mouseDowned = false,
linkSeparator = '!!!';
pauseButton.click(function() {
@@ -312,6 +328,27 @@
rebuildCurrentLink();
});
+ jQuery(window).keydown(function(e) {
+ if (e.keyCode == KEY.SPACE) {
+ 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 3740547

Please sign in to comment.