From a22ae2818c3dfdd5039222dc2fc0a7bde7c29036 Mon Sep 17 00:00:00 2001 From: Spreadyy Date: Tue, 27 Sep 2016 11:41:47 +0200 Subject: [PATCH 1/3] Fix scroll JS for xkcd. Fix wrong scroll.height for xkcd. Solution according to: http://stackoverflow.com/questions/1145850/how-to-get-height-of-entire-document-with-javascript --- qutebrowser/javascript/scroll.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qutebrowser/javascript/scroll.js b/qutebrowser/javascript/scroll.js index fa0f311b3..9da413136 100644 --- a/qutebrowser/javascript/scroll.js +++ b/qutebrowser/javascript/scroll.js @@ -61,12 +61,13 @@ window._qutebrowser.scroll = (function() { funcs.pos = function() { var elem = document.documentElement; + var body = document.body; var pos = { "px": {"x": window.scrollX, "y": window.scrollY}, "scroll": { - "width": elem.scrollWidth, - "height": elem.scrollHeight, + "width": Math.max(body.scrollWidth, body.offsetWidth, elem.scrollWidth, elem.offsetWidth), + "height": Math.max(body.scrollHeight, body.offsetHeight, elem.scrollHeight, elem.offsetHeight), }, "inner": { "width": window.innerWidth, From f2e471597de49b419be6ada5dd1e8f7bb76f2bb7 Mon Sep 17 00:00:00 2001 From: Spreadyy Date: Tue, 27 Sep 2016 23:24:12 +0200 Subject: [PATCH 2/3] Lint test failed --> edited line length --- qutebrowser/javascript/scroll.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/qutebrowser/javascript/scroll.js b/qutebrowser/javascript/scroll.js index 9da413136..699a59599 100644 --- a/qutebrowser/javascript/scroll.js +++ b/qutebrowser/javascript/scroll.js @@ -66,8 +66,18 @@ window._qutebrowser.scroll = (function() { var pos = { "px": {"x": window.scrollX, "y": window.scrollY}, "scroll": { - "width": Math.max(body.scrollWidth, body.offsetWidth, elem.scrollWidth, elem.offsetWidth), - "height": Math.max(body.scrollHeight, body.offsetHeight, elem.scrollHeight, elem.offsetHeight), + "width": Math.max( + body.scrollWidth, + body.offsetWidth, + elem.scrollWidth, + elem.offsetWidth + ), + "height": Math.max( + body.scrollHeight, + body.offsetHeight, + elem.scrollHeight, + elem.offsetHeight + ), }, "inner": { "width": window.innerWidth, From 0c5d95c943f71c7f0e0566a5be10d9db75238833 Mon Sep 17 00:00:00 2001 From: Spreadyy Date: Thu, 29 Sep 2016 08:59:46 +0200 Subject: [PATCH 3/3] scroll.js --> fix scroll measures scroll measures failed a travis test where document.documentElement.offsetHeight and document.documentElement.scrollHeight diffed by one pixel when the browser zoomed. --> Removed offsetHeight. --- qutebrowser/javascript/scroll.js | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/qutebrowser/javascript/scroll.js b/qutebrowser/javascript/scroll.js index 699a59599..cd8a5baab 100644 --- a/qutebrowser/javascript/scroll.js +++ b/qutebrowser/javascript/scroll.js @@ -66,18 +66,8 @@ window._qutebrowser.scroll = (function() { var pos = { "px": {"x": window.scrollX, "y": window.scrollY}, "scroll": { - "width": Math.max( - body.scrollWidth, - body.offsetWidth, - elem.scrollWidth, - elem.offsetWidth - ), - "height": Math.max( - body.scrollHeight, - body.offsetHeight, - elem.scrollHeight, - elem.offsetHeight - ), + "width": Math.max(body.scrollWidth, elem.scrollWidth), + "height": Math.max(body.scrollHeight, elem.scrollHeight), }, "inner": { "width": window.innerWidth,