From 985912a9cd6a398d19042109d119f13795d9c063 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Sat, 30 Oct 2010 21:53:44 +0200 Subject: [PATCH] Go back to conservative page next from 0.2.6 This reverts to behaviour as of commit c2be3d67cfb6b13af5a4. --- midori/midori-view.c | 84 +++++++------------------------------------- 1 file changed, 12 insertions(+), 72 deletions(-) diff --git a/midori/midori-view.c b/midori/midori-view.c index 14353c46..cd221a9a 100644 --- a/midori/midori-view.c +++ b/midori/midori-view.c @@ -4854,42 +4854,12 @@ midori_view_get_previous_page (MidoriView* view) web_frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view->web_view)); js_context = webkit_web_frame_get_global_context (web_frame); katze_assign (uri, sokoke_js_script_eval (js_context, - "(function (g) {" - "var ind = ['prev','←','<'];" - "var nind = ['next','→','>'];" - "for (h in g) {" - "l = g[h];" - "for (i in l)" - "if (l[i].rel && (l[i].rel == ind[0]))" - "return l[i].href;" - "for (j in ind)" - "for (i in l)" - "if (l[i].innerHTML" - "&& (l[i].innerHTML.toLowerCase ().indexOf (ind[j]) != -1)" - "&& (l[i].innerHTML.toLowerCase ().indexOf (nind[j]) == -1))" - "return l[i].href;" - "var wa = window.location.href.split (/\\d+/);" - "var wn = window.location.href.split (/[^\\d]+/);" - "wn = wn.slice (1,wn.length - 1);" - "var cand = [];" - "for (i in wn)" - "{" - "cand[i] = '';" - "for (j = 0; j <= i; j++)" - "{" - "cand[i] += wa[j];" - "if (wn[j])" - "cand[i] += parseInt (wn[j]) - ((i == j) ? 1 : 0);" - "}" - "}" - "for (j in cand)" - "for (i in l)" - "if (cand[j].length && l[i].href && (l[i].href.indexOf (cand[j]) == 0))" - "return l[i].href;" - "}" - "return 0;" - "}) ([document.getElementsByTagName ('link')," - "document.getElementsByTagName ('a')]);", NULL)); + "(function (l) { for (i in l) " + "if ((l[i].rel && l[i].rel == 'prev') " + " || (l[i].innerHTML" + " && l[i].innerHTML.toLowerCase ().indexOf ('prev') != -1)) " + "{ return l[i].href; } return 0; })(" + "document.getElementsByTagName ('a'));", NULL)); return uri && uri[0] != '0' ? uri : NULL; } @@ -4918,42 +4888,12 @@ midori_view_get_next_page (MidoriView* view) web_frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view->web_view)); js_context = webkit_web_frame_get_global_context (web_frame); katze_assign (uri, sokoke_js_script_eval (js_context, - "(function (g) {" - "var ind = ['next','→','>'];" - "var nind = ['prev','←','<'];" - "for (h in g) {" - "l = g[h];" - "for (i in l)" - "if (l[i].rel && (l[i].rel == ind[0]))" - "return l[i].href;" - "for (j in ind)" - "for (i in l)" - "if (l[i].innerHTML" - "&& (l[i].innerHTML.toLowerCase ().indexOf (ind[j]) != -1)" - "&& (l[i].innerHTML.toLowerCase ().indexOf (nind[j]) == -1))" - "return l[i].href;" - "var wa = window.location.href.split (/\\d+/);" - "var wn = window.location.href.split (/[^\\d]+/);" - "wn = wn.slice (1,wn.length - 1);" - "var cand = [];" - "for (i in wn)" - "{" - "cand[i] = '';" - "for (j = 0; j <= i; j++)" - "{" - "cand[i] += wa[j];" - "if (wn[j])" - "cand[i] += parseInt (wn[j]) + ((i == j) ? 1 : 0);" - "}" - "}" - "for (j in cand)" - "for (i in l)" - "if (cand[j].length && l[i].href && (l[i].href.indexOf (cand[j]) == 0))" - "return l[i].href;" - "}" - "return 0;" - "}) ([document.getElementsByTagName ('link')," - "document.getElementsByTagName ('a')]);", NULL)); + "(function (l) { for (i in l) " + "if ((l[i].rel && l[i].rel == 'next') " + " || (l[i].innerHTML" + " && l[i].innerHTML.toLowerCase ().indexOf ('next') != -1)) " + "{ return l[i].href; } return 0; })(" + "document.getElementsByTagName ('a'));", NULL)); return uri && uri[0] != '0' ? uri : NULL; } -- 2.39.5