Last active
August 29, 2015 14:14
-
-
Save otarza/4866b57acd4e1f15778f to your computer and use it in GitHub Desktop.
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
var magicCollection = []; | |
var interval; | |
jQuery(document).ready(function ($) { | |
console.log("Magic Media loaded"); | |
var magicButtonInit = function () { | |
$('#photoborder').append("<a id='magicButton' href='#'> Cast the spell </a>"); | |
$('#photoborder').append('<input type="text" id="folder" name="folder">'); | |
$('#magicButton').click(function (e) { | |
interval = setInterval(function () { | |
var url = $('#fbPhotoImage').attr('src'); | |
if (magicCollection.length && magicCollection[0] == url) { | |
$("body").append("<div id='magicCollection'>" + JSON.stringify(magicCollection) + "</div>"); | |
clearInterval(interval); | |
} else { | |
magicCollection.push(url); | |
} | |
PhotoPermalink.getInstance().page(1); | |
}, 1000) | |
return false; | |
}); | |
} | |
if ($('#fbPhotoImage').length) { | |
magicButtonInit(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment