Sha256: 2dd2ba0c7677070aab90d1594c8a3e03fa7e05a62ec957004a6b77dd8b6fb1ea

Contents?: true

Size: 1.22 KB

Versions: 4

Compression:

Stored size: 1.22 KB

Contents

<a id="applink1" href="#{@url.url}">Opening the awesome event now!</a>



:javascript
  var ref = document.referrer; 
  if(ref && ref.toLowerCase().indexOf("twitter.com")!==-1){
    window.location.href="/";
  }
  var appstorefail = "itms://itunes.apple.com/us/app/tminus-make-share-countdown/id507726329?mt=8";  
  function applink(fail){
      return function(){
          var clickedAt = +new Date;
          // During tests on 3g/3gs this timeout fires immediately if less than 500ms.
          setTimeout(function(){
              // To avoid failing on return to MobileSafari, ensure freshness!
              if (+new Date - clickedAt < 2000){
                  window.location = fail;
              }
          }, 500);    
      };
  }
  document.getElementById("applink1").onclick = applink(appstorefail); 
  var button = document.getElementById("applink1")
  simulateClick("applink1");
  function simulateClick(elId) {
    var evt;
    var el = document.getElementById(elId);
    if (document.createEvent) {
        evt = document.createEvent("MouseEvents");
        evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
    }
    (evt) ? el.dispatchEvent(evt) : (el.click && el.click());
  }

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tmin-0.1.3 views/redirect.haml
tmin-0.1.2 views/redirect.haml
tmin-0.1.1 views/redirect.haml
tmin-0.1.0 views/redirect.haml