Source for "Digg Later on Instapaper"

By Jsatt
Has 3 other scripts.


//Digg Later
//Version 1.2
//By Jeremy Satterfield
//Released under
//Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License
//http://creativecommons.org/licenses/by-nc-sa/3.0/

//Adds a button to your Digg pages to save a link
//to the Digg in your Instapaper.com account for
//later review without having to digg it.

// ==UserScript==
// @name          Digg Later on Instapaper
// @namespace     http://jsatt.blogspot.com
// @description   Adds a "Read Later" link to quickly post to Instapaper.com.
// @include       http://digg.com/*
// @include       http://www.digg.com/*
// ==/UserScript==
var ukey='2OvVv3ghBxnB';

var arts = document.getElementsByTagName('div');
for (i = 0; i < arts.length; i++) {
	if (arts[i].className == 'news-body') {
		headline = null;
                headLinks = arts[i].getElementsByTagName('a');
		for(ii=0; ii < headLinks.length; ii++){
                          if(headLinks[ii].parentNode.className != 'list' && headline == null)
                          headline=headLinks[ii];
                }
                ttl = headline.innerHTML;
		url = arts[i].getElementsByClassName('news-details')[0].getElementsByClassName('comments')[0].href;
		var a = document.createElement('a');
		a.href = "javascript:var%20doc=document,win=window,ws=win.getSelection,ds=doc.getSelection,ss=doc.selection,sel=(ws?ws():(ds)?ds():(ss?ss.createRange().text:0)),bu='http://www.instapaper.com/b',loc=doc.location,en=encodeURIComponent,pu='?v=4&k="+ukey+"&u='+en('"+url+"')%20+'&t='+en('Digg: "+ttl.replace(/\'/gi,"\\\'")+"')%20+'&s='+en(sel),url=bu+pu;try{if(!/^(.*\.)?instapaper([^.]*)?$/.test(loc.host))throw(0);iptstbt();}catch(z){op%20=function(){if(!win.open(url,'t','toolbar=0,resizable=0,status=1,width=250,height=150'))loc.href=url;};if(/Firefox/.test(navigator.userAgent))setTimeout(op,0);else%20op();}void(0)";
                a.innerHTML = "Read Later";
		a.className = "tool faved";
		arts[i].getElementsByClassName('news-details')[0].insertBefore(a, arts[i].getElementsByClassName('news-details')[0].getElementsByClassName('comments')[0]);
	}
}