jquery-simulate-ext

The jQuery Simulate Extended plugin (a.k.a. jquery-simulate-ext) provides methods for simulating complex user interactions based on the jQuery.simulate() plugin. The plugin provides simulation of: (i) Drag & Drop, (ii) Key Sequences, (iii) Key Combinations. Additionally, the extended plugin includes documentation and fixes for the jQuery simulate plugin itself.

Este script no debería instalarse directamente. Es una biblioteca que utilizan otros scripts mediante la meta-directiva de inclusión // @require https://update.greatest.deepsurf.us/scripts/24820/745006/jquery-simulate-ext.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. options = options || {};
  21. if (options.pageX || options.pageY) {
  22. var doc = rdocument.test(Object.prototype.toString.call(this.target))? this.target : (this.target.ownerDocument || document);
  23. options.clientX = (options.pageX || 0) - $(doc).scrollLeft();
  24. options.clientY = (options.pageY || 0) - $(doc).scrollTop();
  25. }
  26. return originalMouseEvent.apply(this, [type, options]);
  27. };
  28. })( jQuery );