Always 'var' in for and wrapping functions

Related to https://bugs.launchpad.net/midori/+bug/716887
This commit is contained in:
Christian Dywan 2011-04-14 21:46:01 +02:00
parent 547f0764b4
commit b06d7192e6

View file

@ -983,19 +983,21 @@ midori_view_web_view_navigation_decision_cb (WebKitWebView* web_view
/* Remove link labels */ /* Remove link labels */
js_context = webkit_web_frame_get_global_context (web_frame); js_context = webkit_web_frame_get_global_context (web_frame);
result = sokoke_js_script_eval (js_context, result = sokoke_js_script_eval (js_context,
"var links = document.getElementsByClassName ('midoriHKD87346');" "(function (links) {"
"if (links != undefined && links.length > 0) {" "if (links != undefined && links.length > 0) {"
" for (var i = links.length - 1; i >= 0; i--) {" " for (var i = links.length - 1; i >= 0; i--) {"
" var parent = links[i].parentNode;" " var parent = links[i].parentNode;"
" parent.removeChild(links[i]); } }", " parent.removeChild(links[i]); } } }) ("
"document.getElementsByClassName ('midoriHKD87346'));",
NULL); NULL);
g_free (result); g_free (result);
result = sokoke_js_script_eval (js_context, result = sokoke_js_script_eval (js_context,
"var links = document.getElementsByClassName ('midori_access_key_fc04de');" "(function (links) {"
"if (links != undefined && links.length > 0) {" "if (links != undefined && links.length > 0) {"
" for (var i = links.length - 1; i >= 0; i--) {" " for (var i = links.length - 1; i >= 0; i--) {"
" var parent = links[i].parentNode;" " var parent = links[i].parentNode;"
" parent.removeChild(links[i]); } }", " parent.removeChild(links[i]); } } }) ("
"document.getElementsByClassName ('midori_access_key_fc04de'));",
NULL); NULL);
g_free (result); g_free (result);
view->find_links = -1; view->find_links = -1;
@ -5194,9 +5196,9 @@ midori_view_get_previous_page (MidoriView* view)
js_context = webkit_web_frame_get_global_context (web_frame); js_context = webkit_web_frame_get_global_context (web_frame);
katze_assign (uri, sokoke_js_script_eval (js_context, katze_assign (uri, sokoke_js_script_eval (js_context,
"(function (tags) {" "(function (tags) {"
"for (tag in tags) {" "for (var tag in tags) {"
"var l = document.getElementsByTagName (tag);" "var l = document.getElementsByTagName (tag);"
"for (i in l) { " "for (var i in l) { "
"if ((l[i].rel && l[i].rel.toLowerCase () == 'prev') " "if ((l[i].rel && l[i].rel.toLowerCase () == 'prev') "
" || (l[i].innerHTML" " || (l[i].innerHTML"
" && l[i].innerHTML.toLowerCase ().indexOf ('prev') != -1)) " " && l[i].innerHTML.toLowerCase ().indexOf ('prev') != -1)) "
@ -5231,9 +5233,9 @@ midori_view_get_next_page (MidoriView* view)
js_context = webkit_web_frame_get_global_context (web_frame); js_context = webkit_web_frame_get_global_context (web_frame);
katze_assign (uri, sokoke_js_script_eval (js_context, katze_assign (uri, sokoke_js_script_eval (js_context,
"(function (tags) {" "(function (tags) {"
"for (tag in tags) {" "for (var tag in tags) {"
"var l = document.getElementsByTagName (tag);" "var l = document.getElementsByTagName (tag);"
"for (i in l) { " "for (var i in l) { "
"if ((l[i].rel && l[i].rel.toLowerCase () == 'next') " "if ((l[i].rel && l[i].rel.toLowerCase () == 'next') "
" || (l[i].innerHTML" " || (l[i].innerHTML"
" && l[i].innerHTML.toLowerCase ().indexOf ('next') != -1)) " " && l[i].innerHTML.toLowerCase ().indexOf ('next') != -1)) "