[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/kcfinder/js/ -> jquery.rightClick.js (source)

   1  // jQuery Right-Click Plugin

   2  //

   3  // Version 1.01

   4  //

   5  // Cory S.N. LaViska

   6  // A Beautiful Site (http://abeautifulsite.net/)

   7  // 20 December 2008

   8  //

   9  // Visit http://abeautifulsite.net/notebook/68 for more information

  10  //

  11  // Usage:

  12  //

  13  //        // Capture right click

  14  //        $("#selector").rightClick( function(e) {

  15  //            // Do something

  16  //        });

  17  //        

  18  //        // Capture right mouse down

  19  //        $("#selector").rightMouseDown( function(e) {

  20  //            // Do something

  21  //        });

  22  //        

  23  //        // Capture right mouseup

  24  //        $("#selector").rightMouseUp( function(e) {

  25  //            // Do something

  26  //        });

  27  //        

  28  //        // Disable context menu on an element

  29  //        $("#selector").noContext();

  30  // 

  31  // History:

  32  //

  33  //        1.01 - Updated (20 December 2008)

  34  //             - References to 'this' now work the same way as other jQuery plugins, thus

  35  //               the el parameter has been deprecated.  Use this or $(this) instead

  36  //             - The mouse event is now passed to the callback function

  37  //             - Changed license to GNU GPL

  38  //

  39  //        1.00 - Released (13 May 2008)

  40  //

  41  // License:

  42  // 

  43  // This plugin is dual-licensed under the GNU General Public License and the MIT License

  44  // and is copyright 2008 A Beautiful Site, LLC. 

  45  //

  46  if(jQuery) (function(){
  47      
  48      $.extend($.fn, {
  49          
  50          rightClick: function(handler) {
  51              $(this).each( function() {
  52                  $(this).mousedown( function(e) {
  53                      var evt = e;
  54                      $(this).mouseup( function() {
  55                          $(this).unbind('mouseup');
  56                          if( evt.button == 2 ) {
  57                              handler.call( $(this), evt );
  58                              return false;
  59                          } else {
  60                              return true;
  61                          }
  62                      });
  63                  });
  64                  $(this)[0].oncontextmenu = function() {
  65                      return false;
  66                  }
  67              });
  68              return $(this);
  69          },        
  70          
  71          rightMouseDown: function(handler) {
  72              $(this).each( function() {
  73                  $(this).mousedown( function(e) {
  74                      if( e.button == 2 ) {
  75                          handler.call( $(this), e );
  76                          return false;
  77                      } else {
  78                          return true;
  79                      }
  80                  });
  81                  $(this)[0].oncontextmenu = function() {
  82                      return false;
  83                  }
  84              });
  85              return $(this);
  86          },
  87          
  88          rightMouseUp: function(handler) {
  89              $(this).each( function() {
  90                  $(this).mouseup( function(e) {
  91                      if( e.button == 2 ) {
  92                          handler.call( $(this), e );
  93                          return false;
  94                      } else {
  95                          return true;
  96                      }
  97                  });
  98                  $(this)[0].oncontextmenu = function() {
  99                      return false;
 100                  }
 101              });
 102              return $(this);
 103          },
 104          
 105          noContext: function() {
 106              $(this).each( function() {
 107                  $(this)[0].oncontextmenu = function() {
 108                      return false;
 109                  }
 110              });
 111              return $(this);
 112          }
 113          
 114      });
 115      
 116  })(jQuery);    


Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1