From 26918b69dd8608b7c9cb6087459c5875d4e155c4 Mon Sep 17 00:00:00 2001 From: Chris Perivolaropoulos Date: Wed, 17 May 2017 17:21:29 +0100 Subject: [PATCH] Try translating "next"/"previous" links to history commands --- common/content/buffer.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/common/content/buffer.js b/common/content/buffer.js index 29dd0186c..64c95452d 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -592,6 +592,19 @@ const Buffer = Module("buffer", { let elem = res.snapshotItem(i); if (regex.test(elem.textContent) || regex.test(elem.title) || Array.some(elem.childNodes, function (child) regex.test(child.alt))) { + if (elem.href + && typeof history.session[history.session.index - 1] !== "undefined" + && history.session[history.session.index - 1].URI.spec === elem.href) { + history.stepTo(-1); + return true; + } + if (elem.href + && typeof history.session[history.session.index + 1] !== "undefined" + && history.session[history.session.index + 1].URI.spec === elem.href) { + history.stepTo(1); + return true; + } + buffer.followLink(elem, liberator.CURRENT_TAB); return true; }