Skip to content
This repository has been archived by the owner on Apr 15, 2023. It is now read-only.

Commit

Permalink
Add module for plugins.
Browse files Browse the repository at this point in the history
  • Loading branch information
rshin committed May 10, 2011
1 parent cfd79e0 commit 59ae784
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions modules/embeds.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
phantom.modules = phantom.modules || {};
phantom.modules.embeds = {
run: function() {
var embeds = phantom.util.forAllChildFrames(function(doc) {
var result = [];
_.each(doc.getElementsByTagName('embed'), function(elem) {
if (elem && elem.src)
result.push(elem.src);
});
return result;
});

var applets = phantom.util.forAllChildFrames(function(doc) {
var result = [];
_.each(doc.getElementsByTagName('applet'), function(elem) {
if (elem && elem.src)
result.push(elem.src);
});
return result;
});

var objects = phantom.util.forAllChildFrames(function(doc) {
var result = [];
_.each(doc.getElementsByTagName('object'), function(elem) {
if (elem && elem.data)
result.push(elem.data);
});
return result;
});

return _.uniq(Array.prototype.concat(embeds, applets, objects));
}
};

0 comments on commit 59ae784

Please sign in to comment.