// ==UserScript==Feel free to play around with the script if you think you can make it look better.
// @name Google Reader OmniMents Link
// @description Adds a OmniMent to the end of the action row
// @namespace http://omniments.appspot.com
// @include http://www.google.tld/reader/*
// @include https://www.google.tld/reader/*
// ==/UserScript==
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 OMLink ="http://omniments.appspot.com/display.html?article=" + link;
var span = document.createElement("span");
span.className = "OmniMents";
var a_link = document.createElement("a");
a_link.href = OMLink;
a_link.title = "OmniMents For: " + title;
a_link.setAttribute('style','text-decoration:none;padding-right:10px;margin-right:10px; background: center right no-repeat;');
a_link.setAttribute('target', '_blank');
a_link.appendChild(document.createTextNode("OmniMents"));
span.appendChild(a_link);
var iframe = document.createElement("iframe");
iframe.setAttribute('src', 'http://omniments.appspot.com/count.html?article=' + link);
iframe.setAttribute('frameborder','0');
iframe.setAttribute('width','20');
iframe.setAttribute('height','20');
iframe.setAttribute('vspace','0');
iframe.setAttribute('hspace','0');
iframe.setAttribute('marginwidth','0');
iframe.setAttribute('scrolling','no');
linkbar.appendChild(span);
linkbar.appendChild(iframe);
}
}
My current list of features to be added (in no particular order):
- OmniMents popup in a bubble in Google Reader(I think I can do this with an iframe too)
- Build a firefox extension for OmniMents so you guys don't have to update your scripts everytime I make a change
- OmniMents favicon and logo. (If anyone has artistic ability and wants to take a shot at this, go for it.)
- Style the OmniMents page
- Add threading and ratings to the OmniMents
- Ajax and web 2.0 -ify anything I can
- Home page for OmniMents that shows hot and recent threads, and the ones you commented on recently
- Any other ideas guys? Let me know
Thanks!
No comments:
Post a Comment