[Xfce4-commits] <midori:master> Count link labels separately from actual elements

Christian Dywan noreply at xfce.org
Tue Apr 5 00:16:01 CEST 2011


Updating branch refs/heads/master
         to 850438daeed99102be05711fffb8db805776c704 (commit)
       from 69310256173b91bfcb7711d004c97b197e7f9ed1 (commit)

commit 850438daeed99102be05711fffb8db805776c704
Author: Alexander Friesen <a_06357 at fastmail.fm>
Date:   Tue Apr 5 00:02:14 2011 +0200

    Count link labels separately from actual elements
    
    Not all link elements will have visible labels.

 midori/midori-view.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/midori/midori-view.c b/midori/midori-view.c
index 3a309a6..0280b26 100644
--- a/midori/midori-view.c
+++ b/midori/midori-view.c
@@ -1885,12 +1885,14 @@ gtk_widget_key_press_event_cb (WebKitWebView* web_view,
                 " border:1px solid gray; padding:0 0.1em !important;"
                 " position:absolute; display:inline !important; }');"
                 "var links = document.getElementsByTagName ('a');"
+                "var label_count = 0;"
                 "for (i in links) {"
-                "  var child = document.createElement ('span');"
-                "  child.setAttribute ('class', 'midoriHKD87346');"
-                "  child.appendChild (document.createTextNode (i));"
-                "  if (links[i].insertBefore && links[i].href)"
-                "    links[i].insertBefore (child); }",
+                "  if (links[i].insertBefore && links[i].href) { "
+                "    var child = document.createElement ('span');"
+                "    child.setAttribute ('class', 'midoriHKD87346');"
+                "    child.appendChild (document.createTextNode (label_count));"
+                "    links[i].insertBefore (child);"
+                "    label_count++; } }",
                 NULL);
             view->find_links = 0;
         }



More information about the Xfce4-commits mailing list