jqplot.mobile.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /**
  2. * jqplot.jquerymobile plugin
  3. * jQuery Mobile virtual event support.
  4. *
  5. * Version: @VERSION
  6. * Revision: @REVISION
  7. *
  8. * Copyright (c) 2011 Takashi Okamoto
  9. * jqPlot is currently available for use in all personal or commercial projects
  10. * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
  11. * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
  12. * choose the license that best suits your project and use it accordingly.
  13. *
  14. * Although not required, the author would appreciate an email letting him
  15. * know of any substantial use of jqPlot. You can reach the author at:
  16. * chris at jqplot dot com or see http://www.jqplot.com/info.php .
  17. *
  18. * If you are feeling kind and generous, consider supporting the project by
  19. * making a donation at: http://www.jqplot.com/donate.php .
  20. *
  21. */
  22. (function($) {
  23. function postInit(target, data, options){
  24. this.bindCustomEvents = function() {
  25. this.eventCanvas._elem.bind('vclick', {plot:this}, this.onClick);
  26. this.eventCanvas._elem.bind('dblclick', {plot:this}, this.onDblClick);
  27. this.eventCanvas._elem.bind('taphold', {plot:this}, this.onDblClick);
  28. this.eventCanvas._elem.bind('vmousedown', {plot:this}, this.onMouseDown);
  29. this.eventCanvas._elem.bind('vmousemove', {plot:this}, this.onMouseMove);
  30. this.eventCanvas._elem.bind('mouseenter', {plot:this}, this.onMouseEnter);
  31. this.eventCanvas._elem.bind('mouseleave', {plot:this}, this.onMouseLeave);
  32. if (this.captureRightClick) {
  33. this.eventCanvas._elem.bind('vmouseup', {plot:this}, this.onRightClick);
  34. this.eventCanvas._elem.get(0).oncontextmenu = function() {
  35. return false;
  36. };
  37. }
  38. else {
  39. this.eventCanvas._elem.bind('vmouseup', {plot:this}, this.onMouseUp);
  40. }
  41. };
  42. this.plugins.mobile = true;
  43. }
  44. $.jqplot.postInitHooks.push(postInit);
  45. })(jQuery);