Guest User

Untitled

a guest
Jul 18th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. var globalTimeOut = null;
  2.  
  3. var feeddown = $.Event("keydown", { keyCode: 87 }); //w button
  4. var feedup = $.Event("keyup", { keyCode: 87 }); //w button
  5. var splitdown = $.Event("keydown", { keyCode: 32 }); //space button
  6. var splitup = $.Event("keyup", { keyCode: 32 }); //space button
  7. $(document)
  8. .bind("mousedown", function(e) {
  9. if (e.which == 1) {
  10. globalTimeOut = setInterval(function() {
  11. $("body").trigger(feeddown);
  12. $("body").trigger(feedup);
  13. }, 100);
  14. } else if (e.which == 3) {
  15. $("body").trigger(splitdown);
  16. $("body").trigger(splitup);
  17. //console.log("split");
  18. }
  19. })
  20. .bind("contextmenu", function(e) {
  21. e.preventDefault();
  22. });
  23. $(document)
  24. .bind("mouseup", function(e) {
  25. clearInterval(globalTimeOut);
  26. })
  27. .bind("contextmenu", function(e) {
  28. e.preventDefault();
  29. });
  30. //alert("mouse enabled");
Add Comment
Please, Sign In to add comment