Skip to content

Instantly share code, notes, and snippets.

@jameshibbard
Created October 4, 2012 07:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jameshibbard/3831983 to your computer and use it in GitHub Desktop.
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
// ==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