Skip to content

Instantly share code, notes, and snippets.

@otarza
Last active August 29, 2015 14:14
Show Gist options
  • Save otarza/4866b57acd4e1f15778f to your computer and use it in GitHub Desktop.
Save otarza/4866b57acd4e1f15778f to your computer and use it in GitHub Desktop.
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