diff --git a/html/content.html b/html/content.html index b51f73f..9a1c3ec 100644 --- a/html/content.html +++ b/html/content.html @@ -79,17 +79,18 @@ else document.body.className = ""; } - document.onkeydown = checkKey; - function checkKey(e) { e = e || window.event; - if (e.keyCode === '37') { + if (e.keyCode === 37) { window.location.href = "feedthemonkey:previous"; } - else if (e.keyCode === '39') { + else if (e.keyCode === 39) { window.location.href = "feedthemonkey:next"; } } + + window.addEventListener("keydown", checkKey); + diff --git a/qml/Content.qml b/qml/Content.qml index 086dbef..73885f1 100644 --- a/qml/Content.qml +++ b/qml/Content.qml @@ -17,7 +17,7 @@ * along with FeedTheMonkey. If not, see . */ -import QtWebEngine 1.0 +import QtWebEngine 1.7 import QtQuick 2.0 import QtQuick.Controls 1.3 import QtQuick.Layouts 1.1 @@ -87,12 +87,14 @@ Item { onNavigationRequested: { if (request.url == "feedthemonkey:previous") { - request.action = WebEngineView.IgnoreRequest; + // This is commented out because for some reason this reloads the page forever. + // This will show the error that the feedthemonkey:previous location is not supported + //request.action = WebEngineNavigationRequest.IgnoreRequest; app.showPreviousPost(); } else if (request.url == "feedthemonkey:next") { - request.action = WebEngineView.IgnoreRequest; + //request.action = WebEngineNavigationRequest.IgnoreRequest; app.showNextPost(); - } else if (request.navigationType != WebEngineView.LinkClickedNavigation) { + } else if (request.navigationType !== WebEngineNavigationRequest.LinkClickedNavigation) { request.action = WebEngineView.AcceptRequest; } else { request.action = WebEngineView.IgnoreRequest;