Permalink
Switch branches/tags
Nothing to show
Find file Copy path
3971931 Nov 24, 2016
1 contributor

Users who have contributed to this file

22 lines (20 sloc) 790 Bytes
window.browser = (function () {
return window.msBrowser ||
window.browser ||
window.chrome;
})();
console.log("Dare Angel content script started");
browser.runtime.onMessage.addListener(
function (request, sender, sendResponse) {
if (request.command == "requestImages") {
var images: HTMLImageElement[] = <HTMLImageElement[]><any>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));
}
});