]> spindle.queued.net Git - midori/commitdiff
Count link labels separately from actual elements
authorAlexander Friesen <a_06357@fastmail.fm>
Mon, 4 Apr 2011 22:02:14 +0000 (00:02 +0200)
committerChristian Dywan <christian@twotoasts.de>
Mon, 4 Apr 2011 22:02:14 +0000 (00:02 +0200)
Not all link elements will have visible labels.

midori/midori-view.c

index 3a309a6a29bf383e86084857e9e901395a3b58cb..0280b266c1b91bb2c85d4d0c895f5815119ffc61 100644 (file)
@@ -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;
         }