Skip to content

Instantly share code, notes, and snippets.

@kevr
Created August 12, 2015 02:33
Show Gist options
  • Save kevr/2a217c60a3853a1b2f4d to your computer and use it in GitHub Desktop.
Save kevr/2a217c60a3853a1b2f4d to your computer and use it in GitHub Desktop.
function GetImage(){
if(jQuery('div.sm-lightbox-focused').length > 0)
{
jQuery('div.sm-lightbox-focused').addClass('.sm-lightbox-clean');
jQuery('div button.sm-lightbox-close').click();
}
var last = "";
jQuery('li.sm-tile-photo a div').each(function(i,e){
var element = e;
var promise = new Promise(function(resolve, reject){
jQuery(element).click();
console.log(this);
resolve(1);
});
promise.then(function(value) {
var url = jQuery('img.sm-lightbox-image').css('background-image').split('url(');
var loc = url[1].slice(0, -1);
console.log(loc);
if(last !== loc)
window.open(loc, '_blank');
last = loc;
});
});
};
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
document.querySelector('html').insertBefore(jq, document.body);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment