Created
October 8, 2013 14:30
-
-
Save daniyalzade/6885636 to your computer and use it in GitHub Desktop.
Fancy's way of detecting if app exists and launching app accordingly. It does referrer checking to see if the link is coming from email, and only does it then.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
var thing_id = "441444475001111765"; | |
$('.thing-related-photo img').each(function(){ | |
if($(this).width()>$(this).height()){ | |
$(this).css("height","60px"); | |
}else{ | |
$(this).css("width","60px"); | |
} | |
}); | |
jQuery(function($){ | |
var ref = ""; | |
if(/ref=/.test(location.search)){ | |
ref = "?ref="+(location.search).match(/ref=([^&]*)?/)[1]; | |
} | |
$('#header a.app').attr('href','intent://things/'+thing_id+ref+'#Intent;scheme=fancy;package=com.thefancy.app;end'); | |
if(!document.referrer) $('<iframe>').css({width:0,height:0,opacity:0}).attr('src', 'fancy://things/'+thing_id).appendTo('body'); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment