title: How can I write a router to open a Joomla Squeezebox modal from a URL parameter?
body: <p>I have a Joomla site which uses Squeezebox which the default modal javascript for Joomla.</p>
  
  <p>I've been using Squeezebox with template overrides. For example, I have a link that looks on every page that's part of the template override:</p>
  
  <pre><code>&lt;a href="http://www.viddler.com/embed/cd1b1bc5/?f=1&amp;autoplay=1&amp;player=full&amp;secret=104492144&amp;loop=0&amp;nologo=1&amp;hd=1" class="modal vid-primary" rel="{url:'http://www.viddler.com/embed/cd1b1bc5/?f=1&amp;autoplay=1&amp;player=full&amp;secret=104492144&amp;loop=0&amp;nologo=1&amp;hd=1', handler: 'iframe', size: {x:741, y:459} }" style="display: block; position: relative;"&gt;
  </code></pre>
  
  <p>These links open a video in a modal.</p>
  
  <p>What I need to do is to be able to open this video onLoad IF a URL parameter is present. For example:</p>
  
  <p><a href="http://mysite.com/page.html?vidload=vidload" rel="nofollow noreferrer">http://mysite.com/page.html?vidload=vidload</a></p>
  
  <p>So I need a router that will handle this. I <a href="https://stackoverflow.com/questions/10022543/open-modal-with-in-url">found something</a> close to what I'm after, but can't quite figure out how to make it work. Here's what I've got so far:</p>
  
  <pre><code>window.addEvent('domready', function() {
   function popModal() {
    SqueezeBox.open($('vid-primary'), {
          handler: 'adopt'
      });
  }
  
  var hash = window.location.hash;
  if (hash.substring(1) == 'vidload') {
    popModal();
  }
  
  });
  </code></pre>