Hi,

the attached patch exposes all visible hinting elements to styling via
style.css. Four classes are used:

- vimprobable_hinting_mode_hint: unfocused number
- vimprobable_hinting_mode_hint_focus: focused number
- vimprobable_hinted_element: unfocused complete link
- vimprobable_hinted_element_focus: focused complete link

You can override the defaults the same way Daniel described in his
earlier mail.

On a sidenote, I believe there is even a bug in the current hinting
script. It already attempts to set specific classes to focused and
unfocused hints, but gets confused in the process, I fear: class
names which aren't even set are attempted to be replaced. Daniel, maybe
I've been misreading something there? In any case, I believe this patch
fixes that as well.

Please test and provide feedback!

Hannes

diff --git a/hinting.js b/hinting.js
index 3896898..7814a1f 100644
--- a/hinting.js
+++ b/hinting.js
@@ -1,8 +1,8 @@
 /*
     (c) 2009 by Leon Winter
-    (c) 2009, 2010 by Hannes Schueller
+    (c) 2009-2014 by Hannes Schueller
     (c) 2010 by Hans-Peter Deifel
-    (c) 2011 by Daniel Carl
+    (c) 2011-2014 by Daniel Carl
     see LICENSE file
 */
 function Hints() {
@@ -11,8 +11,10 @@ function Hints() {
         hintCss: "z-index:100000;font-family:monospace;font-size:10px;"
                + "font-weight:bold;color:white;background-color:red;"
                + "padding:0px 1px;position:absolute;",
-        hintClass: "hinting_mode_hint",
-        hintClassFocus: "hinting_mode_hint_focus",
+        hintClass: "vimprobable_hinting_mode_hint",
+        hintClassFocus: "vimprobable_hinting_mode_hint_focus",
+        hintedElementClass: "vimprobable_hinted_element",
+        hintedElementClassFocus: "vimprobable_hinted_element_focus",
         elemBackground: "#ff0",
         elemBackgroundFocus: "#8f0",
         elemColor: "#000"
@@ -102,11 +104,13 @@ function Hints() {
                     elem:       elem,
                     number:     hintCount,
                     span:       hint,
+                    class:      elem.className,
                     background: elem.style.background,
                     foreground: elem.style.color}
                 );
 
                 /* make the link black to ensure it's readable */
+                elem.className = elem.className + " " + config.hintedElementClass;
                 elem.style.color = config.elemColor;
                 elem.style.background = config.elemBackground;
             }
@@ -142,7 +146,8 @@ function Hints() {
         /* reset previous focused hint */
         var hint = _getHintByNumber(currentFocusNum);
         if (hint !== null) {
-            hint.elem.className = hint.elem.className.replace(config.hintClassFocus, config.hintClass);
+            hint.elem.className = hint.elem.className.replace(config.hintedElementClassFocus, config.hintedElementClass);
+            hint.span.className = hint.span.className.replace(config.hintClassFocus, config.hintClass);
             hint.elem.style.background = config.elemBackground;
         }
 
@@ -151,7 +156,8 @@ function Hints() {
         /* mark new hint as focused */
         hint = _getHintByNumber(currentFocusNum);
         if (hint !== null) {
-            hint.elem.className = hint.elem.className.replace(config.hintClass, config.hintClassFocus);
+            hint.elem.className = hint.elem.className.replace(config.hintedElementClass, config.hintedElementClassFocus);
+            hint.span.className = hint.span.className.replace(config.hintClass, config.hintClassFocus);
             hint.elem.style.background = config.elemBackgroundFocus;
         }
     };
@@ -223,6 +229,7 @@ function Hints() {
             if (typeof(hint.elem) != "undefined") {
                 hint.elem.style.background = hint.background;
                 hint.elem.style.color = hint.foreground;
+                hint.elem.className = hint.class;
                 hint.span.parentNode.removeChild(hint.span);
             }
         }
@@ -372,6 +379,7 @@ function Hints() {
         if (hint.number === n) {
             hint.elem.style.background = hint.background;
             hint.elem.style.color = hint.foreground;
+            hint.elem.className = hint.class;
             hint.span.parentNode.removeChild(hint.span);
 
             /* remove hints from all hints */
------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
Vimprobable-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/vimprobable-users

Reply via email to