By Jordi De Groof
Has 8 other scripts.
// ==UserScript==
// @name Google reader digg news
// @namespace http://jordi.degroof.googlepages.com/
// @description Adds a digg control to every post in google reader
// @source http://userscripts.org/scripts/show/10311
// @identifier http://userscripts.org/scripts/review/10311?format=txt
// @version 1.1
// @date 2008-08-07
// @include http://www.google.com/reader/*
// @include https://www.google.com/reader/*
// @include http://digg.com/tools/diggthis.php?u=*&s=compact&k=ccdeaf#googlereader
// ==/UserScript==
// update automatically (http://userscripts.org/scripts/show/2296)
var SCRIPT = {
name: " Google reader digg news",
namespace: "http://jordi.degroof.googlepages.com/",
source: "http://userscripts.org/scripts/show/10311", // script homepage
identifier: "http://userscripts.org/scripts/10311?format=txt",
version: "1.1", // version
date: (new Date(2008, 8 -1, 7)) // update date
.valueOf()
};
try {
window.addEventListener("load", function () {
try {
unsafeWindow.UserScriptUpdates.requestAutomaticUpdates(SCRIPT);
} catch (ex) {}
}, false);
} catch (ex) {}
var mode;
// Check whether we're on the page with the digg-widget
if(location.href.indexOf("http://digg.com/tools/diggthis.php?u=") === 0 && location.hash.indexOf("#googlereader") === 0)
{
// Open digg story in new page
try { // The form isn't available when the story isn't submitted yet
document.getElementById("f1").target= "_blank";
}
catch(e){}
// Change target of links
var links= document.getElementsByTagName("A");
for (var a= 0; a < links.length; a++)
{
links[a].target= "_blank";
}
return;
}
var entries=document.getElementById("entries");
if(entries)
entries.addEventListener('DOMNodeInserted', function(event){nodeInserted(event);},true);
function nodeInserted(event){
if (event.target.tagName=="DIV"){
if (event.target.className === "entry-actions"){
// List mode
var linkbar=event.target;
} else if (event.target.firstChild && event.target.firstChild.className=="card"){
// Expanded mode
var linkbar=event.target.firstChild.firstChild.childNodes[2].childNodes[1].firstChild;
} else
return;
var parent= linkbar;
while (parent.tagName != "TBODY") {
parent= parent.parentNode;
}
var link = parent.getElementsByClassName("entry-title-link")[0].getAttribute('href');
var site = parent.getElementsByClassName("entry-source-title-parent")[0].getElementsByTagName("A")[0].firstChild.nodeValue;
var title = parent.getElementsByClassName("entry-title-link")[0].firstChild.nodeValue;
var btn= document.createElement("iframe");
btn.setAttribute("src", "http://digg.com/tools/diggthis.php?u="+escape(link)+"&s=compact&k=ccdeaf#googlereader");
btn.setAttribute("style", "height:15.5px; width:120px;");
btn.setAttribute("frameborder", "0");
btn.setAttribute("scrolling", "no");
linkbar.appendChild(btn);
}
}