Skip to content

Instantly share code, notes, and snippets.

@azat-co
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azat-co/d70592aa5f537395330d to your computer and use it in GitHub Desktop.
Save azat-co/d70592aa5f537395330d to your computer and use it in GitHub Desktop.
//Executed through a self-invoking anonymous function
(function(){
//declare the variables that we will need
var imgName = "10584590_588581994607732_199003263_n.jpg";
var uriA = "http://photos-e.ak.instagram.com/hphotos-ak-xfa1/10584590_588581994607732_199003263_n.jpg";
var uri1 = "http://instagram.com/p/sLLSiTCXB5/?modal=true";
var uri2 = "http://instagram.com/p/sLLSiTCXB5/";
//build the logic
if (document.URL === uri1) {
window.open(uriA, "_self");
} else if
(document.URL === uri2) {
window.open(uriA, "_self");
} else {
alert ("Sorry The image isn't here!");
}
})();
// I didn't know how to add logic to traverse the DOM and make the Image clickable.
// Started to look at that, but got lost in a spiral of Stackoverflow threads.
// document.getElementsByName(imgName===uriA);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment