title: Using jQuery plugins inside Greasemonkey scripts
body: <p>I am writing a simple GreaseMonkey script that has a jQuery plugin called hoverIntent embedded in it. (I am embedding it rather than hosting it because it's a very small plugin.) </p>
  
  <p>My problem: after the plugin attaches its event handler to a DOM object, the event triggers an error message that says: "jQuery is not defined."</p>
  
  <p>Is it a scope issue? Here is my entire script:</p>
  
  <pre><code>   if(unsafeWindow.console){
         var GM_log = unsafeWindow.console.log;
      }
  
  
      (function($){
              //HoverIntent
              $.fn.hoverIntent=function(f,g){...}; 
              //Removed the plugin code. You can see it in the link at the bottom 
              //of the post.
  
  
  
      //DOM is ready
      //Fetch all the rows with arrows
      $('.arrow')
          .each(function(){
              $(this).hoverIntent(mouseOver,mouseOut);            
          });
  
      //mouseOver
      function mouseOver(){
          //THIS IS WHERE THE ERROR HAPPENS
          $(this).click();
      }
  
      //mouseOut
      function mouseOut(){ //nothing here.
      }
  
      })(unsafeWindow.jQuery);
  </code></pre>
  
  <p>It works fine when I copy paste it, removing all GM specific tags, and run it from my console. And <a href="http://cherne.net/brian/resources/jquery.hoverIntent.js" rel="nofollow noreferrer">this is the plugin I am embedding</a>. </p>