Created
May 19, 2013 21:56
-
-
Save enigmaticape/5609203 to your computer and use it in GitHub Desktop.
Hack mouse zoom into safari via extension javascript.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zoomWithWheel = false; | |
zoomLevel = 1; | |
zoomIncrement = 0.2; | |
document.addEventListener( "mousewheel", function( event ) { | |
if( zoomWithWheel ) { | |
if( event.wheelDeltaY > 0 ) { | |
zoomLevel += zoomIncrement; | |
} | |
if( event.wheelDeltaY < 0 ) { | |
zoomLevel -= zoomIncrement; | |
} | |
document.body.style.zoom = zoomLevel; | |
return false; | |
} | |
}, true ); | |
document.addEventListener( "click", function( event ) { | |
if(event.button == 1) { | |
event.preventDefault(); | |
zoomWithWheel = !zoomWithWheel; | |
} | |
}, true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment