Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var globalTimeOut = null;
- var feeddown = $.Event("keydown", { keyCode: 87 }); //w button
- var feedup = $.Event("keyup", { keyCode: 87 }); //w button
- var splitdown = $.Event("keydown", { keyCode: 32 }); //space button
- var splitup = $.Event("keyup", { keyCode: 32 }); //space button
- $(document)
- .bind("mousedown", function(e) {
- if (e.which == 1) {
- globalTimeOut = setInterval(function() {
- $("body").trigger(feeddown);
- $("body").trigger(feedup);
- }, 100);
- } else if (e.which == 3) {
- $("body").trigger(splitdown);
- $("body").trigger(splitup);
- //console.log("split");
- }
- })
- .bind("contextmenu", function(e) {
- e.preventDefault();
- });
- $(document)
- .bind("mouseup", function(e) {
- clearInterval(globalTimeOut);
- })
- .bind("contextmenu", function(e) {
- e.preventDefault();
- });
- //alert("mouse enabled");
Add Comment
Please, Sign In to add comment