Skip to content

Commit

Permalink
Merge pull request #35 from hospotho/master
Browse files Browse the repository at this point in the history
Feature detection for passive event does not work anymore
  • Loading branch information
Ocrosoft committed Dec 7, 2023
2 parents 77cfb33 + dec90e1 commit bfd0528
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions pixiv previewer.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -1623,16 +1623,9 @@ function CheckUrlTest() {
function preventDefault(e) {
e.preventDefault();
}
// modern Chrome requires { passive: false } when adding event
var supportsPassive = false;
try {
window.addEventListener("test", null, Object.defineProperty({}, 'passive', {
get: function () { supportsPassive = true; }
}));
} catch (e) { }

var wheelOpt = supportsPassive ? { passive: false } : false;
var wheelEvent = 'onwheel' in document.createElement('div') ? 'wheel' : 'mousewheel';

const wheelOpt = { passive: false };
const wheelEvent = 'onwheel' in document.createElement('div') ? 'wheel' : 'mousewheel';

function disableScroll() {
window.addEventListener(wheelEvent, preventDefault, wheelOpt);
Expand Down

0 comments on commit bfd0528

Please sign in to comment.