Created
October 4, 2012 07:34
-
-
Save jameshibbard/3831983 to your computer and use it in GitHub Desktop.
A Userscript file to create a button to open a subset of links on a webpage
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
// ==UserScript== | |
// @name Open CodeProject Links | |
// @namespace http://hibbard.eu/ | |
// @version 0.1 | |
// @description Opens all of the links from the CodeProject newsletter in one go | |
// @match http://www.codeproject.com/script/Mailouts/* | |
// @copyright 2012+, hibbard.eu | |
// @require http://code.jquery.com/jquery-latest.js | |
// ==/UserScript== | |
$(document).ready(function() { | |
var hrefs = new Array(); | |
var elements = $('.headline > a'); | |
elements.each(function() { | |
hrefs.push($(this).attr('href')) | |
}); | |
$('body').append('<input type="button" value="Open Links" id="CP">') | |
$("#CP").css("position", "fixed").css("top", 0).css("left", 0); | |
$('#CP').click(function(){ | |
$.each(hrefs, function(index, value) { | |
setTimeout(function(){ | |
window.open(value, '_blank'); | |
},1000); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment