From 3c6d11fbcd035f3ed24eea9b2ce33f7f4fe0c5f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kry=C5=A1tof=20Tulinger?= Date: Mon, 10 Jul 2017 18:17:01 +0200 Subject: [PATCH 1/2] adding more colors for symbol highlighting fixes #1634 --- src/org/opensolaris/opengrok/web/Scripts.java | 2 +- web/default/style.css | 12 ++++++++- web/help.jsp | 6 ++--- web/js/{utils-0.0.9.js => utils-0.0.10.js} | 26 +++++++++++++++---- 4 files changed, 36 insertions(+), 10 deletions(-) rename web/js/{utils-0.0.9.js => utils-0.0.10.js} (98%) diff --git a/src/org/opensolaris/opengrok/web/Scripts.java b/src/org/opensolaris/opengrok/web/Scripts.java index 8f2d76cc34c..7d8ceed350b 100644 --- a/src/org/opensolaris/opengrok/web/Scripts.java +++ b/src/org/opensolaris/opengrok/web/Scripts.java @@ -125,7 +125,7 @@ public String toHtml() { SCRIPTS.put("jquery-tablesorter", new FileScript("js/jquery-tablesorter-2.26.6.min.js", 12)); SCRIPTS.put("tablesorter-parsers", new FileScript("js/tablesorter-parsers-0.0.1.js", 13)); SCRIPTS.put("searchable-option-list", new FileScript("js/searchable-option-list-2.0.3.min.js", 14)); - SCRIPTS.put("utils", new FileScript("js/utils-0.0.9.js", 15)); + SCRIPTS.put("utils", new FileScript("js/utils-0.0.10.js", 15)); SCRIPTS.put("repos", new FileScript("js/repos-0.0.1.js", 20)); SCRIPTS.put("diff", new FileScript("js/diff-0.0.1.js", 20)); } diff --git a/web/default/style.css b/web/default/style.css index 909d56aec7f..4cd30815249 100644 --- a/web/default/style.css +++ b/web/default/style.css @@ -833,11 +833,21 @@ a.scope { /* scope */ color: steelblue; font-weight: bol max-height: 400px; } -.symbol-highlighted { +.symbol-highlighted.hightlight-yellow { background-color: #ffd700; background-color: rgb(255, 215, 0); } +.symbol-highlighted.hightlight-green { + background-color: #00ff00; + background-color: rgb(0, 255, 0); +} + +.symbol-highlighted.hightlight-blue { + background-color: #00ccff; + background-color: rgb(0, 204, 255); +} + .messages-window { width: 40%; max-height: 400px; diff --git a/web/help.jsp b/web/help.jsp index d10ba5583d1..db986027418 100644 --- a/web/help.jsp +++ b/web/help.jsp @@ -202,10 +202,10 @@ Key "1" toggles Intelligence Window. It gives the user many helper a
Symbol Highlighting

-Key "2" toggles highlighting of the last symbol pointed by the mouse cursor. This functionality is also accessible via the Intelligence Window. +Keys "2", "3", "4" toggles highlighting of the last symbol pointed by the mouse cursor. This functionality is also accessible via the Intelligence Window.

-Key "3" toggles unhighlighting all symbols. This functionality is also accessible via the Intelligence Window. +Key "5" toggles unhighlighting all symbols. This functionality is also accessible via the Intelligence Window.

@@ -216,7 +216,7 @@ Key "3" toggles unhighlighting all symbols. This functionality is also accessibl
Symbol jumping

By 'n' for next and 'b' for back you can jump between the symbols easily only with keyboard. When there is no symbol highlighted then the jump -is made to the next symbol in the file from the current one. If you have highlighted a specific symbol then the jump is done only among the highlighted symbols. +is made to the next symbol in the file from the current one. If you have highlighted a specific symbol then the jump is done only among the highlighted symbols regardless the color of the symbol.

Diff jumper

diff --git a/web/js/utils-0.0.9.js b/web/js/utils-0.0.10.js similarity index 98% rename from web/js/utils-0.0.9.js rename to web/js/utils-0.0.10.js index 33d81c5aa67..c5e0ec59ad8 100644 --- a/web/js/utils-0.0.9.js +++ b/web/js/utils-0.0.10.js @@ -807,10 +807,20 @@ break; case 50: // 2 if (that.symbol) { - that.unhighlight(that.symbol).length === 0 && that.highlight(that.symbol); + that.unhighlight(that.symbol).length === 0 && that.highlight(that.symbol, 'yellow'); } break; case 51: // 3 + if (that.symbol) { + that.unhighlight(that.symbol).length === 0 && that.highlight(that.symbol, 'green'); + } + break; + case 52: // 4 + if (that.symbol) { + that.unhighlight(that.symbol).length === 0 && that.highlight(that.symbol, 'blue'); + } + break; + case 53: // 5 that.unhighlightAll(); break; case 110: // n @@ -882,13 +892,13 @@ getSymbols: function () { return (this.$symbols = this.$symbols || $(this.options.selector)); }, - highlight: function (symbol) { + highlight: function (symbol, color) { if (this.$current.text() === symbol) { this.$last_highlighted_current = this.$current; } return this.getSymbols().filter(function () { return $(this).text() === symbol; - }).addClass('symbol-highlighted') + }).addClass('symbol-highlighted').addClass('hightlight-' + (color || 'yellow')) }, unhighlight: function (symbol) { if (this.$last_highlighted_current && @@ -900,11 +910,17 @@ return this.getSymbols().filter(".symbol-highlighted").filter(function () { return $(this).text() === symbol; }).removeClass('symbol-highlighted') - + .removeClass("hightlight-blue") + .removeClass("hightlight-green") + .removeClass("hightlight-yellow") }, unhighlightAll: function () { this.$last_highlighted_current = undefined - return this.getSymbols().filter(".symbol-highlighted").removeClass("symbol-highlighted") + return this.getSymbols().filter(".symbol-highlighted") + .removeClass("symbol-highlighted") + .removeClass("hightlight-blue") + .removeClass("hightlight-green") + .removeClass("hightlight-yellow") }, scrollTop: function ($el) { if (this.options.scrollTop) { From 7696356253ee17136a781aebf61eebe5ba972a8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kry=C5=A1tof=20Tulinger?= Date: Thu, 13 Jul 2017 11:16:23 +0200 Subject: [PATCH 2/2] different class names + updating the other css styles --- web/default/style.css | 9 ++++++--- web/js/utils-0.0.10.js | 16 ++++++---------- web/offwhite/style.css | 15 ++++++++++++++- web/polished/style.css | 15 ++++++++++++++- 4 files changed, 40 insertions(+), 15 deletions(-) diff --git a/web/default/style.css b/web/default/style.css index 4cd30815249..e7fc600a14f 100644 --- a/web/default/style.css +++ b/web/default/style.css @@ -833,17 +833,20 @@ a.scope { /* scope */ color: steelblue; font-weight: bol max-height: 400px; } -.symbol-highlighted.hightlight-yellow { +.symbol-highlighted.hightlight-color-1 { + /* yellow */ background-color: #ffd700; background-color: rgb(255, 215, 0); } -.symbol-highlighted.hightlight-green { +.symbol-highlighted.hightlight-color-2 { + /* green */ background-color: #00ff00; background-color: rgb(0, 255, 0); } -.symbol-highlighted.hightlight-blue { +.symbol-highlighted.hightlight-color-3 { + /* blue */ background-color: #00ccff; background-color: rgb(0, 204, 255); } diff --git a/web/js/utils-0.0.10.js b/web/js/utils-0.0.10.js index c5e0ec59ad8..4b0cbdf4354 100644 --- a/web/js/utils-0.0.10.js +++ b/web/js/utils-0.0.10.js @@ -807,17 +807,17 @@ break; case 50: // 2 if (that.symbol) { - that.unhighlight(that.symbol).length === 0 && that.highlight(that.symbol, 'yellow'); + that.unhighlight(that.symbol).length === 0 && that.highlight(that.symbol, 1); } break; case 51: // 3 if (that.symbol) { - that.unhighlight(that.symbol).length === 0 && that.highlight(that.symbol, 'green'); + that.unhighlight(that.symbol).length === 0 && that.highlight(that.symbol, 2); } break; case 52: // 4 if (that.symbol) { - that.unhighlight(that.symbol).length === 0 && that.highlight(that.symbol, 'blue'); + that.unhighlight(that.symbol).length === 0 && that.highlight(that.symbol, 3); } break; case 53: // 5 @@ -898,7 +898,7 @@ } return this.getSymbols().filter(function () { return $(this).text() === symbol; - }).addClass('symbol-highlighted').addClass('hightlight-' + (color || 'yellow')) + }).addClass('symbol-highlighted').addClass('hightlight-color-' + (color || 1)) }, unhighlight: function (symbol) { if (this.$last_highlighted_current && @@ -910,17 +910,13 @@ return this.getSymbols().filter(".symbol-highlighted").filter(function () { return $(this).text() === symbol; }).removeClass('symbol-highlighted') - .removeClass("hightlight-blue") - .removeClass("hightlight-green") - .removeClass("hightlight-yellow") + .removeClass("hightlight-color-1 hightlight-color-2 hightlight-color-3"); }, unhighlightAll: function () { this.$last_highlighted_current = undefined return this.getSymbols().filter(".symbol-highlighted") .removeClass("symbol-highlighted") - .removeClass("hightlight-blue") - .removeClass("hightlight-green") - .removeClass("hightlight-yellow") + .removeClass("hightlight-color-1 hightlight-color-2 hightlight-color-3"); }, scrollTop: function ($el) { if (this.options.scrollTop) { diff --git a/web/offwhite/style.css b/web/offwhite/style.css index 60b45b07476..ae81c812677 100644 --- a/web/offwhite/style.css +++ b/web/offwhite/style.css @@ -878,11 +878,24 @@ a.scope { /* scope */ color: steelblue; font-weight: bol max-height: 400px; } -.symbol-highlighted { +.symbol-highlighted.hightlight-color-1 { + /* yellow */ background-color: #ffd700; background-color: rgb(255, 215, 0); } +.symbol-highlighted.hightlight-color-2 { + /* green */ + background-color: #00ff00; + background-color: rgb(0, 255, 0); +} + +.symbol-highlighted.hightlight-color-3 { + /* blue */ + background-color: #00ccff; + background-color: rgb(0, 204, 255); +} + .messages-window { width: 40%; max-height: 400px; diff --git a/web/polished/style.css b/web/polished/style.css index 511d0aa1344..0768e456e1a 100644 --- a/web/polished/style.css +++ b/web/polished/style.css @@ -933,11 +933,24 @@ a.scope { /* scope */ color: steelblue; font-weight: bol max-height: 400px; } -.symbol-highlighted { +.symbol-highlighted.hightlight-color-1 { + /* yellow */ background-color: #ffd700; background-color: rgb(255, 215, 0); } +.symbol-highlighted.hightlight-color-2 { + /* green */ + background-color: #00ff00; + background-color: rgb(0, 255, 0); +} + +.symbol-highlighted.hightlight-color-3 { + /* blue */ + background-color: #00ccff; + background-color: rgb(0, 204, 255); +} + .messages-window { width: 40%; max-height: 400px;