By masukomi
—
Last update
Jun 15, 2007
—
Installed
149 times.
// ==UserScript==
// @name DeliciousRedditToolbar
// @namespace http://www.masukomi.org/
// @description Add del.icio.us links to reddit links opened with a reddit toolbar fram above them.
// @include http://reddit.com/toolbar*
// @include http://*.reddit.com/toolbar*
// @include http://reddit.com/goto?*
// @include http://*.reddit.com/goto?
// UPDATED Jun 15 2007: New URL structure being used by Reddit toolbar.
// UPDATED May 15 2007: Includes fix for bookmarking pages whose titles have apostrophes in them.
// ==/UserScript==
try {
var breakoutLink = document.evaluate( "//td[@id='buttons']//a[2]",
document,
null,
XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null).snapshotItem(0);
if (breakoutLink){
var breakoutCell = document.evaluate("//td[@id='buttons']",
document,
null,
XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null).snapshotItem(0);
var url = breakoutLink.href;
var delSpan = document.createElement('span');
postTarget = "javascript:(function(){open('http://del.icio.us/post?v=4;noui=yes;jump=close;url="
+ encodeURIComponent(url)
+ ';title='
+ encodeURIComponent(top.document.title).replace(/'/g, "\\'")
+ "','delicious','toolbar=no,width=700,height=400')})()";
delSpan.innerHTML = "<a class=\"bylink\" href='#' onClick=\"" + postTarget + "\">del.icio.us</a>";
breakoutCell.innerHTML = "<span > " + delSpan.innerHTML + "</span>" + breakoutCell.innerHTML;
}
} catch (e){
//eat it.
}