Created
August 12, 2015 02:33
-
-
Save kevr/2a217c60a3853a1b2f4d 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
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