Skip to content

Instantly share code, notes, and snippets.

@sters
Last active January 4, 2016 07:59
Show Gist options
  • Select an option

  • Save sters/8592787 to your computer and use it in GitHub Desktop.

Select an option

Save sters/8592787 to your computer and use it in GitHub Desktop.
(function(){
var urlRegExp = [/.+/, /.+/];
var outputs = [];
var ifrm = $("<iframe>").appendTo($("body"));
var lists = $("a").filter(function(i){
return
$(this).attr("target") == "_blank" &&
$(this).attr("href").match(urlRegExp[0]);
});
var index = 0, max = lists.length;
var next = function(){
if(index > max) {
document.write("");
outputs.forEach(function(item){
document.write(item + "<br>");
});
return;
}
var _this = lists.eq(index);
ifrm.attr("src", _this.attr("href"));
location.hash = index + "_:_" + max;
index++;
};
ifrm.load(function(){
ifrm.contents().find("a").filter(function(i){
return
$(this).attr("target") == "_blank" &&
$(this).attr("href").match(urlRegExp[1]);
}).each(function() {
outputs.push($(this).attr("href"));
setTimeout(next, 3000);
});
});
next();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment