Greasemonkey Script: Google Reader To Diigo
- 2008-11-02
- Trackback URL
- 未分类
This is a Greasemonkey script. With it you can open window to bookmark feed entries to Diigo when you are using Google Reader.
This script is based on John Keyes’ “Google Reader To Ma.gnolia” THX!
Here is source code:
// Author: StEELSnARL
// Website: http://steelsnarl.blogspot.com
// Version: 0.1
// Based on John Keyes’ “Google Reader To Ma.gnolia” (http://userscripts.org/scripts/show/27085) THX!
//
// ==UserScript==
// @name Google Reader To Diigo
// @namespace http://steelsnarl.blogspot.com
// @description Opens window to bookmark feed entries in Diigo.
// @include https://google.com/reader/*
// @include https://*.google.com/reader/*
// @include http://google.com/reader/*
// @include http://*.google.com/reader/*
// ==/UserScript==
document.getElementById(“entries”).addEventListener(‘DOMNodeInserted’, function (event) {
var node = event.target;
if (node.tagName.toLowerCase() == ‘div’) {
var entryactions;
if (hasClass(node, “entry-actions”)) {
entryactions = node;
}
else if (hasClass(node, “entry”) && hasClass(node.firstChild, “card”)) {
entryactions = node.firstChild.firstChild.childNodes[2].childNodes[1].firstChild;
}
if (entryactions) {
var action = document.createElement(“span”);
action.className = “tag link”;
action.innerHTML = “Post to Diigo”;
action.addEventListener(“click”, bookmark, false);
entryactions.appendChild(action);
}
}
}, true);
function bookmark(event){
var node = event.target;
var entry = findEntry(node);
var h2 = entry.getElementsByTagName(“h2″);
var link = h2[h2.length > 1 ? 1 : 0].firstChild;
var url = link.getAttribute(‘href’);
var title = link.textContent;
var tags = getTags(node.parentNode);
window.open(‘http://www.diigo.com/post?url=’+encodeURIComponent(url)+’&title=’+encodeURIComponent(title)+’&tags=’+encodeURIComponent(tags),’magnolia’,'scrollbars=1,status=0,location=0,toolbar=0′);
}
function getTags(linkbar) {
var lists = linkbar.getElementsByTagName(“ul”);
var tags = [];
for (var j = 0; j
If you have a suggestion or something to tell, please write it in the comment!


