Show access keys distinct from numbers in link search
Keys are invoked with Alt+key. Numeric access keys don't work and are not shown as such.
This commit is contained in:
parent
2460c161dd
commit
867d8ce87e
1 changed files with 38 additions and 12 deletions
|
@ -991,6 +991,14 @@ midori_view_web_view_navigation_decision_cb (WebKitWebView* web_view
|
||||||
" parent.removeChild(links[i]); } }",
|
" parent.removeChild(links[i]); } }",
|
||||||
NULL);
|
NULL);
|
||||||
g_free (result);
|
g_free (result);
|
||||||
|
result = sokoke_js_script_eval (js_context,
|
||||||
|
"var links = document.getElementsByClassName ('midori_access_key_fc04de');"
|
||||||
|
"if (links != undefined && links.length > 0) {"
|
||||||
|
" for (var i = links.length - 1; i >= 0; i--) {"
|
||||||
|
" var parent = links[i].parentNode;"
|
||||||
|
" parent.removeChild(links[i]); } }",
|
||||||
|
NULL);
|
||||||
|
g_free (result);
|
||||||
view->find_links = -1;
|
view->find_links = -1;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1886,28 +1894,38 @@ gtk_widget_key_press_event_cb (WebKitWebView* web_view,
|
||||||
if (view->find_links == -1)
|
if (view->find_links == -1)
|
||||||
{
|
{
|
||||||
result = sokoke_js_script_eval (js_context,
|
result = sokoke_js_script_eval (js_context,
|
||||||
"(function (selector, rule) { "
|
" var style_func = (function (selector, rule) { "
|
||||||
" var style = document.createElement ('style');"
|
" var style = document.createElement ('style');"
|
||||||
" style.setAttribute ('type', 'text/css');"
|
" style.setAttribute ('type', 'text/css');"
|
||||||
" var heads = document.getElementsByTagName ('head');"
|
" var heads = document.getElementsByTagName ('head');"
|
||||||
" heads[0].appendChild (style);"
|
" heads[0].appendChild (style);"
|
||||||
" document.styleSheets[0].insertRule (selector + ' ' + rule);"
|
" document.styleSheets[0].insertRule (selector + ' ' + rule);"
|
||||||
" } )"
|
" } );"
|
||||||
" ('.midoriHKD87346', '{ "
|
" style_func ('.midoriHKD87346', '{ "
|
||||||
" font-size:small !important; font-weight:bold !important;"
|
" font-size:small !important; font-weight:bold !important;"
|
||||||
" z-index:500; border-radius:0.3em; line-height:1 !important;"
|
" z-index:500; border-radius:0.3em; line-height:1 !important;"
|
||||||
" background: white !important; color: black !important;"
|
" background: white !important; color: black !important;"
|
||||||
" border:1px solid gray; padding:0 0.1em !important;"
|
" border:1px solid gray; padding:0 0.1em !important;"
|
||||||
" position:absolute; display:inline !important; }');"
|
" position:absolute; display:inline !important; }');"
|
||||||
"var links = document.getElementsByTagName ('a');"
|
" style_func ('.midori_access_key_fc04de', '{ "
|
||||||
"var label_count = 0;"
|
" font-size:small !important; font-weight:bold !important;"
|
||||||
"for (i in links) {"
|
" z-index:500; border-radius:0.3em; line-height:1 !important;"
|
||||||
" if (links[i].insertBefore && links[i].href) { "
|
" background: black !important; color: white !important;"
|
||||||
|
" border:1px solid gray; padding:0 0.1em 0.2em 0.1em !important;"
|
||||||
|
" position:absolute; display:inline !important; }');"
|
||||||
|
" var label_count = 0;"
|
||||||
|
" for (i in document.links) {"
|
||||||
|
" if (document.links[i].href && document.links[i].insertBefore) {"
|
||||||
" var child = document.createElement ('span');"
|
" var child = document.createElement ('span');"
|
||||||
|
" if (document.links[i].accessKey && isNaN (document.links[i].accessKey)) {"
|
||||||
|
" child.setAttribute ('class', 'midori_access_key_fc04de');"
|
||||||
|
" child.appendChild (document.createTextNode (document.links[i].accessKey));"
|
||||||
|
" } else {"
|
||||||
" child.setAttribute ('class', 'midoriHKD87346');"
|
" child.setAttribute ('class', 'midoriHKD87346');"
|
||||||
" child.appendChild (document.createTextNode (label_count));"
|
" child.appendChild (document.createTextNode (label_count));"
|
||||||
" links[i].insertBefore (child);"
|
" label_count++;"
|
||||||
" label_count++; } }",
|
" }"
|
||||||
|
" document.links[i].insertBefore (child); } }",
|
||||||
NULL);
|
NULL);
|
||||||
view->find_links = 0;
|
view->find_links = 0;
|
||||||
}
|
}
|
||||||
|
@ -1957,6 +1975,14 @@ gtk_widget_key_press_event_cb (WebKitWebView* web_view,
|
||||||
" parent.removeChild(links[i]); }",
|
" parent.removeChild(links[i]); }",
|
||||||
NULL);
|
NULL);
|
||||||
g_free (result);
|
g_free (result);
|
||||||
|
result = sokoke_js_script_eval (js_context,
|
||||||
|
"var links = document.getElementsByClassName ('midori_access_key_fc04de');"
|
||||||
|
"if (links != undefined && links.length > 0) {"
|
||||||
|
" for (var i = links.length - 1; i >= 0; i--) {"
|
||||||
|
" var parent = links[i].parentNode;"
|
||||||
|
" parent.removeChild(links[i]); } }",
|
||||||
|
NULL);
|
||||||
|
g_free (result);
|
||||||
view->find_links = -1;
|
view->find_links = -1;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
Loading…
Reference in a new issue