MouseEvent.prototype.x or MouseEvent.prototype.y not supported fix

for browsers that don't support MouseEvent.prototype.x or MouseEvent.prototype.y

  1. // ==UserScript==
  2. // @name MouseEvent.prototype.x or MouseEvent.prototype.y not supported fix
  3. // @namespace http://bzzzzdzzzz.blogspot.com/
  4. // @description for browsers that don't support MouseEvent.prototype.x or MouseEvent.prototype.y
  5. // @author BZZZZ
  6. // @include *
  7. // @version 0.2
  8. // @grant unsafeWindow
  9. // @run-at document-start
  10. // ==/UserScript==
  11.  
  12. (function(){
  13. "use strict";
  14. var d=Object.defineProperty,g=Object.getOwnPropertyDescriptor,p=unsafeWindow.MouseEvent.prototype,h=Object.prototype.hasOwnProperty.bind(p);
  15. h("x")||d(p,"x",g(p,"clientX"));
  16. h("y")||d(p,"y",g(p,"clientY"));
  17. })();