title: Userscript works in Opera but Firefox and Chrome give "variable not defined" error?
body: <p>I am creating a userscript and in Opera it works like a charm, but in Fire Fox and Chrome it gives the following error:</p>
  
  <blockquote>
    <p>Error: PunishCalc is not defined</p>
  </blockquote>
  
  <p>I have the variables (so users can config multiple items in the script) at the top of the script like this:</p>
  
  <pre><code>var LoginFormat     = true;
  var PunishCalc      = true;
  var WorldList       = true;
  var aWerelden       = Array();
  var TitleTickets    = true;
  var OverviewLink    = true;
  var CookieMarker    = true;
  </code></pre>
  
  <p>As you can see, <code>PunishCalc</code> is actually defined there.</p>
  
  <p>This is the most vital part of the script: it implements jQuery on the page.</p>
  
  <pre><code>function addJQuery(callback) 
  {
      var script = document.createElement("script");
      script.setAttribute("src", "http://code.jquery.com/jquery-1.7.2.min.js");
      script.addEventListener("load", function() 
      {
          var script = document.createElement("script");
          script.textContent = "(" + callback.toString() + ")();";
          document.body.appendChild(script);
      }, false);
      document.body.appendChild(script);
  }
  
  function main()
  {
      // All the code will be in here
  }
  
  addJQuery(main);
  </code></pre>
  
  <p>That leads me to the piece of code that uses the variable:</p>
  
  <pre><code>else if(document.location.href.indexOf("village.php?mode=list") &gt; -1 &amp;&amp; PunishCalc === true)
  {
      // Code here
  }
  </code></pre>
  
  <p>As you can see it just checks if the variable is true or not. That's all it has to do. Does anyone have an idea why it works in Opera but not in Chrome or Firefox?</p>