Skip to content

Commit 957bbe6

Browse files
author
hoang.tran12
committed
middle mouse scroll
1 parent 15fcef1 commit 957bbe6

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

scripts/smoothScroll.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ export function run() {
829829
*/
830830
const cleanupMiddlemouse = (function (window) {
831831
let defaultOptions = {
832-
middleMouse: false,
832+
middleMouse: true,
833833
frameRate: 200,
834834
};
835835
let options = defaultOptions;
@@ -851,16 +851,15 @@ export function run() {
851851
/**
852852
* Initializes the image at the reference point.
853853
*/
854-
// function init() {
855-
// let url = chrome.runtime.getURL("../img/cursor.png");
856-
// let style = img.style;
857-
// style.background = "url(" + url + ") no-repeat";
858-
// style.position = "fixed";
859-
// style.zIndex = "1000";
860-
// style.width = "20px";
861-
// style.height = "20px";
862-
// new Image().src = url; // force download
863-
// }
854+
function init() {
855+
let url = chrome.runtime.getURL("/scripts/smoothscroll_cursor.png");
856+
img.style.background = "url(" + url + ") no-repeat";
857+
img.style.position = "fixed";
858+
img.style.zIndex = "999999999";
859+
img.style.width = "20px";
860+
img.style.height = "20px";
861+
new Image().src = url; // force download
862+
}
864863
/**
865864
* Removes event listeners and other traces left on the page.
866865
*/
@@ -970,8 +969,10 @@ export function run() {
970969
return Date.now();
971970
};
972971
})();
972+
973973
addEvent("mousedown", mousedown);
974-
// addEvent("DOMContentLoaded", init);
974+
if (document.readyState === "complete") init();
975+
else addEvent("load", init);
975976

976977
return cleanup;
977978
})(window);

scripts/smoothscroll_cursor.png

190 Bytes
Loading

0 commit comments

Comments
 (0)