title: Getting parameters from the script depending on the source with javascript
body: <p>I've search for a long time and i didn't found the answer for my problem.
  The thing is i have an addon that can insert JS into any site, and my task is to verify if the script has loaded, retrive it's src and it parameters depending on domein and alert() them.</p>
  
  <p>Example script src looks like this:</p>
  
  <pre><code>&lt;script src="https://example.com/tags?id={FOO}_{BAR}_{VARIOUS_THINGS}_{ID},{ID},{ID}"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>I tried to use some snippets form here <a href="https://stackoverflow.com/questions/9521298/verify-external-script-is-loaded">Verify External Script Is Loaded</a>, especially this one, which i altered a bit with timeout and other stuff:</p>
  
  <pre><code>window.onload = function(){ setTimeout( function(){
  var foo = $('script[src*="example.com"]').length;
  if (foo === 0) 
      {
      alert('no script here');
      }
  else {
      alert('Yay! script is here!');
      }
  }, 2500); };
  </code></pre>
  
  <p>But it only checks if script is there and if foo matches the string that i gave, and i would want to check also what are the parameters, so i tried to alter this <code>$('script[src*="example.com"]')</code> to things that I normally get in <code>{VARIOUS_THINGS}</code> macro, let's say these are <code>"boogie1"</code>, <code>"chewingGum"</code> and <code>"PinkFlamingo"</code>. They work, for example when I change <code>"example.com"</code> to <code>"PinkFlamingo"</code> it only detects <code>"PinkFlamingo"</code> but not the <code>"boogie1"</code> or other macros. I tried to put <code>*</code> in there so it would take whole <code>example.com*</code> but id doesn't work either.</p>
  
  <p>Basically i don't know how to set the conditions that it would take whole src when given a domain, and retrive and alert some variable in the script src <code>{VARIOUS_THINGS}</code> and return only matching one (not true/false statement).
  I also tried <code>getElementByTagName</code> and currentScript but i did not manage to do anything that works...</p>