020.jquery.rightClick.js 812 B

1234567891011121314151617181920212223242526
  1. /** This file is part of KCFinder project
  2. *
  3. * @desc Right Click jQuery Plugin
  4. * @package KCFinder
  5. * @version 3.12
  6. * @author Pavel Tzonkov <sunhater@sunhater.com>
  7. * @copyright 2010-2014 KCFinder Project
  8. * @license http://opensource.org/licenses/GPL-3.0 GPLv3
  9. * @license http://opensource.org/licenses/LGPL-3.0 LGPLv3
  10. * @link http://kcfinder.sunhater.com
  11. */
  12. (function($) {
  13. $.fn.rightClick = function(func) {
  14. var events = "contextmenu rightclick";
  15. $(this).each(function() {
  16. $(this).unbind(events).bind(events, function(e) {
  17. e.preventDefault();
  18. $.clearSelection();
  19. if ($.isFunction(func))
  20. func(this, e);
  21. });
  22. });
  23. return $(this);
  24. };
  25. })(jQuery);