Skip to content

Instantly share code, notes, and snippets.

@dinhvh
Created May 12, 2013 01:56
Show Gist options
  • Save dinhvh/5562112 to your computer and use it in GitHub Desktop.
Save dinhvh/5562112 to your computer and use it in GitHub Desktop.
var findCIDImageURLInNode = function(node, links) {
var child = node.firstChild;
while (child != null) {
var next;
next = child.nextSibling;
if (child.nodeType == Node.ELEMENT_NODE) {
var tagName;
tagName = child.tagName.toLowerCase()
if (tagName == 'img') {
var url = child.src;
if (url != null) {
if (url.indexOf('cid:') == 0) {
links.push(url);
}
if (url.indexOf('x-mailcore-image:') == 0) {
links.push(url);
}
}
}
}
findCIDImageURLInNode(child, links);
child = next;
}
}
var findCIDImageURL = function() {
var imgLinks = new Array();
findCIDImageURLInNode(document.body, imgLinks);
return JSON.stringify(imgLinks);
}
var loaded = function() {
//findCIDImageURL();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment