jQuery Simulate Extended Plugin 1.3.0

jQuery Simulate Extended Plugin

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.greatest.deepsurf.us/scripts/14096/88784/jQuery%20Simulate%20Extended%20Plugin%20130.js

  1. /*jshint camelcase:true, plusplus:true, forin:true, noarg:true, noempty:true, eqeqeq:true, bitwise:true, strict:true, undef:true, unused:true, curly:true, browser:true, devel:true, maxerr:100, white:false, onevar:false */
  2. /*global jQuery:true $:true */
  3.  
  4. /* jQuery Simulate Extended Plugin 1.3.0
  5. * http://github.com/j-ulrich/jquery-simulate-ext
  6. *
  7. * Copyright (c) 2014 Jochen Ulrich
  8. * Licensed under the MIT license (MIT-LICENSE.txt).
  9. */
  10.  
  11. ;(function( $ ) {
  12. "use strict";
  13.  
  14. /* Overwrite the $.simulate.prototype.mouseEvent function
  15. * to convert pageX/Y to clientX/Y
  16. */
  17. var originalMouseEvent = $.simulate.prototype.mouseEvent,
  18. rdocument = /\[object (?:HTML)?Document\]/;
  19. $.simulate.prototype.mouseEvent = function(type, options) {
  20. if (options.pageX || options.pageY) {
  21. var doc = rdocument.test(Object.prototype.toString.call(this.target))? this.target : (this.target.ownerDocument || document);
  22. options.clientX = (options.pageX || 0) - $(doc).scrollLeft();
  23. options.clientY = (options.pageY || 0) - $(doc).scrollTop();
  24. }
  25. return originalMouseEvent.apply(this, [type, options]);
  26. };
  27. })( jQuery );