diff --git a/public/javascripts/app.js b/public/javascripts/app.js index 8db8ee3..62cf9f4 100644 --- a/public/javascripts/app.js +++ b/public/javascripts/app.js @@ -24,7 +24,7 @@ var Search = { this.bind_grep_tool(); this.bind_tail_tool(); this.bind_options(); - + if (!this.past_params) return; // return if no prev settings, nothing to set // set tool selector @@ -35,14 +35,14 @@ var Search = { // set search fields jQuery.each(this.search_fields, function(){ - $('#'+this).val(this.past_params[this]); - }); + $('#'+this).val(Search.past_params[this]); + }); }, // bind option selectors bind_options: function() { $('#auto-scroll').bind('change', function(){ - Search.scrollToBottom(this.checked); + Search.autoScroll(this.checked); }); $('#auto-scroll').attr('checked', true).trigger('change'); // by default, turn on }, @@ -99,20 +99,28 @@ var Search = { // Misc utitilies // - scrollToBottom: function(enabled) { - if ((enabled == true) && (this.scroll_fnId == null)) { + autoScroll: function(enabled) { + if (enabled == true) { + if (this.scroll_fnId) + return; // already running + + //console.log("scroll ON!") + window._currPos = 0; // init pos this.scroll_fnId = setInterval ( function(){ - var iframe = document.getElementById('results'); - var win = iframe.contentWindow; - var doc = iframe.contentDocument || iframe.contentWindow.document; - win.scrollTo(0, doc.height); + if (window._currPos < document.height) { + window.scrollTo(0, document.height); + window._currPos = document.height; + } }, 250 ); } else { - // clear timeout + if (!this.scroll_fnId) + return; + //console.log("scroll off") if (this.scroll_fnId) { clearInterval(this.scroll_fnId); + window._currPost = 0; + this.scroll_fnId = null; } - this.scroll_fnId = null; } } diff --git a/public/stylesheets/app.css b/public/stylesheets/app.css index 75df860..eea8ade 100644 --- a/public/stylesheets/app.css +++ b/public/stylesheets/app.css @@ -16,7 +16,10 @@ body{font:13px/1.5 'Helvetica Neue',Arial,'Liberation Sans',FreeSans,sans-serif} #toolbar { color: #333; font-size: 12px; min-width: 980px; height: 100px; - padding: 0 10px; background: #f0f0f0; border-bottom: 2px solid #000;} + padding: 0 10px; background: #f0f0f0; border-bottom: 2px solid #000; + position:fixed; top: 0; margin: 0 -10px; width: 100%; + font-family: 'Helvetica Neue',Arial,'Liberation Sans',FreeSans,sans-serif; + } #toolbar a { color: blue; background: none; } #toolbar a:hover { background: none; } @@ -36,6 +39,12 @@ table.actions input[type=text] { width: 200px; padding: 2px; border: 1px solid # div.results-div { position: absolute; left: 0; right: 0; top: 102px; bottom: 0; width: 100%; min-width: 980px;background: #111;} div.results-div #results { width: 100%; height: 100%; } -div#option-ctrl { position: absolute; z-index: 100; bottom: 0; right: 0; min-width: 60px; min-height: 20px; height: 20px; padding: 5px; border: 1px solid #ddd; background: #f0f0f0; font-size: 11px;} +div#option-ctrl { position: fixed; z-index: 100; bottom: 0; right: 0; min-width: 60px; min-height: 20px; height: 20px; padding: 5px; border: 1px solid #ddd; background: #f0f0f0; font-size: 11px; color: #000; + font-family: 'Helvetica Neue',Arial,'Liberation Sans',FreeSans,sans-serif; } div#option-ctrl ul { list-style:none; margin: 0; padding: 0;} div#option-ctrl ul li { list-style:none; margin: 0 5px 0 0; float:left; } + +/* output */ +body { margin: 10px; padding-top: 110px; font-family: 'Monaco', 'Deja Vu Sans Mono', 'Inconsolata' ,'Consolas',monospace; background:#111 none repeat scroll 0 0; color:#fff; font-size:10px;} +a { color: #0f0; } +a:hover { background-color: #03c; color: white; text-decoration: none; } diff --git a/server.rb b/server.rb index 91f381f..92a6c46 100644 --- a/server.rb +++ b/server.rb @@ -89,7 +89,7 @@ def welcome_page end def results_page - ERB.new(open('./views/results.html.erb').read).result(binding) + ERB.new(open('./views/index.html.erb').read).result(binding) end def tail_page diff --git a/views/error.html.erb b/views/error.html.erb index 2770bff..86a15dc 100644 --- a/views/error.html.erb +++ b/views/error.html.erb @@ -4,15 +4,69 @@ Log Search Server - + + +
+ + + +
+ +
+ +
+ +

Error

diff --git a/views/index.html.erb b/views/index.html.erb index 2a8de54..d0a1c08 100644 --- a/views/index.html.erb +++ b/views/index.html.erb @@ -6,13 +6,6 @@ - @@ -56,19 +49,22 @@ - + -
- -
+
- - + + +