Clean up JS
This commit is contained in:
parent
323d5fc9e7
commit
4407ef032a
@ -23,20 +23,20 @@ window._qutebrowser.scroll = (function() {
|
|||||||
var funcs = {};
|
var funcs = {};
|
||||||
|
|
||||||
funcs.to_perc = function(x, y) {
|
funcs.to_perc = function(x, y) {
|
||||||
var elem = document.documentElement;
|
|
||||||
var x_px = window.scrollX;
|
var x_px = window.scrollX;
|
||||||
var y_px = window.scrollY;
|
var y_px = window.scrollY;
|
||||||
|
|
||||||
var width = Math.max(
|
var width = Math.max(
|
||||||
document.body.scrollWidth,
|
document.body.scrollWidth,
|
||||||
document.body.offsetWidth,
|
document.body.offsetWidth,
|
||||||
elem.scrollWidth,
|
document.documentElement.scrollWidth,
|
||||||
elem.offsetWidth
|
document.documentElement.offsetWidth
|
||||||
);
|
);
|
||||||
var height = Math.max(
|
var height = Math.max(
|
||||||
document.body.scrollHeight,
|
document.body.scrollHeight,
|
||||||
document.body.offsetHeight,
|
document.body.offsetHeight,
|
||||||
elem.scrollHeight,
|
document.documentElement.scrollHeight,
|
||||||
elem.offsetHeight
|
document.documentElement.offsetHeight
|
||||||
);
|
);
|
||||||
|
|
||||||
if (x !== undefined) {
|
if (x !== undefined) {
|
||||||
@ -52,12 +52,12 @@ window._qutebrowser.scroll = (function() {
|
|||||||
"x": x,
|
"x": x,
|
||||||
"window.scrollX": window.scrollX,
|
"window.scrollX": window.scrollX,
|
||||||
"window.innerWidth": window.innerWidth,
|
"window.innerWidth": window.innerWidth,
|
||||||
"elem.scrollWidth": elem.scrollWidth,
|
"elem.scrollWidth": document.documentElement.scrollWidth,
|
||||||
"x_px": x_px,
|
"x_px": x_px,
|
||||||
"y": y,
|
"y": y,
|
||||||
"window.scrollY": window.scrollY,
|
"window.scrollY": window.scrollY,
|
||||||
"window.innerHeight": window.innerHeight,
|
"window.innerHeight": window.innerHeight,
|
||||||
"elem.scrollHeight": elem.scrollHeight,
|
"elem.scrollHeight": document.documentElement.scrollHeight,
|
||||||
"y_px": y_px,
|
"y_px": y_px,
|
||||||
}));
|
}));
|
||||||
*/
|
*/
|
||||||
@ -72,23 +72,20 @@ window._qutebrowser.scroll = (function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
funcs.pos = function() {
|
funcs.pos = function() {
|
||||||
var elem = document.documentElement;
|
|
||||||
var body = document.body;
|
|
||||||
|
|
||||||
var pos = {
|
var pos = {
|
||||||
"px": {"x": window.scrollX, "y": window.scrollY},
|
"px": {"x": window.scrollX, "y": window.scrollY},
|
||||||
"scroll": {
|
"scroll": {
|
||||||
"width": Math.max(
|
"width": Math.max(
|
||||||
body.scrollWidth,
|
document.body.scrollWidth,
|
||||||
body.offsetWidth,
|
document.body.offsetWidth,
|
||||||
elem.scrollWidth,
|
document.documentElement.scrollWidth,
|
||||||
elem.offsetWidth
|
document.documentElement.offsetWidth
|
||||||
),
|
),
|
||||||
"height": Math.max(
|
"height": Math.max(
|
||||||
body.scrollHeight,
|
document.body.scrollHeight,
|
||||||
body.offsetHeight,
|
document.body.offsetHeight,
|
||||||
elem.scrollHeight,
|
document.documentElement.scrollHeight,
|
||||||
elem.offsetHeight
|
document.documentElement.offsetHeight
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
"inner": {
|
"inner": {
|
||||||
|
Loading…
Reference in New Issue
Block a user