Created
November 24, 2016 18:04
-
-
Save davrous/b6436e796fe94978b76217299e32b25a 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
console.log("Dare Angel content script started"); | |
browser.runtime.onMessage.addListener(function (request, sender, sendResponse) { | |
if (request.command == "requestImages") { | |
var images = document.getElementsByTagName('img'); | |
var imagesList = []; | |
for (var i = 0; i < images.length; i++) { | |
if ((images[i].src.toLowerCase().endsWith(".jpg") || images[i].src.toLowerCase().endsWith(".png")) | |
&& (images[i].width > 64 && images[i].height > 64)) { | |
imagesList.push({ url: images[i].src, alt: images[i].alt }); | |
} | |
} | |
sendResponse(JSON.stringify(imagesList)); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment