Google Reader Auto Share Stared

By Wangweijia Last update Jun 25, 2008 — Installed 109 times.
// ==UserScript==
// @name                Google Reader Auto Share Stared
// @namespace          http://google.com/reader/userscript
// @description        Share item automatically when top left star button is clicked
// @include             http://google.com/reader/*
// @include             http://*.google.com/reader/*
// @include             https://google.com/reader/*
// @include             https://*.google.com/reader/*
// ==/UserScript==


// Google Reader + del.icio.us
// Adapted from http://userscripts.org/scripts/show/6497 by JohnM
// All bugs are mine, and not JohnM's.

// Updates by Scott Cowan http://userscripts.org/users/32932
// added fix for prefilling the Title, and https sites from Liu Yang http://userscripts.org/users/27500
// moved the entry box about the buttons instead of below
// Note: if your using Google Reader Optimized you'll need to change css for .entry-actions to float: left instead of right

//Modified from http://userscripts.org/scripts/show/7957


var entries=document.getElementById("entries");
entries.addEventListener('DOMNodeInserted', function(event){googlereaderAutoShareNodeInserted(event);},true);


function googlereaderAutoShareNodeInserted(event){   
    if (event.target.tagName=="DIV"){
        //GM_log("Added - "+event.target.className);
        try{
            if (event.target.className!=""){
                var linkbar;
                if (event.target.className=="entry"){
                    item=event.target.firstChild.firstChild.childNodes[1].childNodes[1].
            firstChild.childNodes[1];
          item.addEventListener("click", shareStarBookmark,false);

          //GM_log("Added - "+item.className);
                }
                else
                    return;
                /*
                var btn=document.createElement("span");
                btn.className="item-star star link";
                btn.addEventListener("click", shareStarBookmark,false);
                GM_log("Added - elem");
                item.appendChild(btn);
        */
        //GM_log("Added -" + )
 

            }
        }
        catch(e){
            GM_log(e);
        }
    }
}



function shareStarBookmark(event)
{
  //alert("ok");
  //GM_log("event -"+event.target);
  var parent=event.target.parentNode
  //GM_log("1st parent -"+parent.className);
  parent = parent.parentNode;
  //GM_log("2nd parent" + parent.className);
  parent = parent.parentNode;
  //GM_log("3rd parent" + parent.className);
  parent = parent.parentNode.parentNode;
  var sharebut = parent.childNodes[2].childNodes[1].firstChild.childNodes[1];
  //GM_log("shared - "+sharebut.className);

  var evtObj = document.createEvent('MouseEvents');    
  evtObj.initMouseEvent(   "click",   true,   true,   window,   1,   0,   0,   0,   0,   false,   false,   true,   false,   0,   null);    
  sharebut.dispatchEvent(   evtObj   );


 
}