<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>Discussion on Google Reader All Starred | Userscripts.org</title>
    <link>http://userscripts.org/scripts/show/2345</link>
    <description>Recent comments on userscript: Google Reader All Starred</description>
    <language>en-us</language>
    <ttl>60</ttl>
    <item>
      <title>Updated Version, replied by Mark Hutton</title>
      <description>&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;As Ben hasn't updated his script in quite a few years and due to the impracticality of manually adding patches via discussions, I have created an updated version of this script available here: &lt;a href=&quot;http://userscripts.org/scripts/show/54074&quot;&gt;http://userscripts.org/scripts/show/54074&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It operates in exactly the same way as this script, injecting an &quot;All Starred&quot; link into the left hand menu which will then fetch all your starred links and produce a new html file with all the links in&lt;/p&gt;</description>
      <pubDate>Mon, 20 Jul 2009 14:28:13 +0000</pubDate>
      <guid isPermaLink="false">userscripts.org:31130:148268</guid>
      <author>Mark Hutton</author>
      <link>http://userscripts.org/posts/148268</link>
    </item>
    <item>
      <title>Archived Comments, replied by Richard Osbaldeston</title>
      <description>&lt;p&gt;For what it's worth the script has been broken again by changes to Google Reader. I'm stumped this time as Google Reader now seems to be dynamically generating much of the page content which prevents us from tapping into it from GreaseMonkey? at least its effective at  barring someone with my level of knowledge (low javascript foo).&lt;/p&gt;</description>
      <pubDate>Sat, 15 Nov 2008 15:16:28 +0000</pubDate>
      <guid isPermaLink="false">userscripts.org:15825:66577</guid>
      <author>Richard Osbaldeston</author>
      <link>http://userscripts.org/posts/66577</link>
    </item>
    <item>
      <title>Archived Comments, replied by Abhay Singh</title>
      <description>Here is the completely patched script.

// GoogleReaderAllStarred
// version 0.5
// 2005-12-13
// Copyright (c) 2005, Ben Beckwith
// Released under the GPL license
// &lt;a href=&quot;http://www.gnu.org/copyleft/gpl.html&quot;&gt;http://www.gnu.org/copyleft/gpl.html&lt;/a&gt;
//
// --------------------------------------------------------------------
//
// This is a Greasemonkey user script.  To install it, you need
// Greasemonkey 0.3 or later: &lt;a href=&quot;http://greasemonkey.mozdev.org/&quot;&gt;http://greasemonkey.mozdev.org/&lt;/a&gt;
// Then restart Firefox and revisit this script.
// Under Tools, there will be a new menu item to &quot;Install User Script&quot;.
// Accept the default configuration and install.
// 
// --------------------------------------------------------------------
// There are a couple of extra ideas I had for this, but these may need
//  1.) Make it easy to post all to del.icio.us
//  2.) Automatic/batch unstar of all items
//
// --------------------------------------------------------------------
// Changes
// 0.5          bnb
//      Updated to work with the latest Reader
// 0.1.1	bnb
//	Updated script to work with the new GR XML file for starred items
// 0.1	bnb
// 	Initial Version
// 
// --------------------------------------------------------------------
//
//
// ==UserScript==
// @name          Google Reader All Starred
// @namespace     &lt;a href=&quot;http://whitebucket.com/greasemonkey&quot;&gt;http://whitebucket.com/greasemonkey&lt;/a&gt;
// @description   Script to extract all links from google reader that have been starred.
// @include       &lt;a href=&quot;http://*.google.com/reader/&quot;&gt;http://*.google.com/reader/&lt;/a&gt;*
// @include	  &lt;a href=&quot;http://google.com/reader/&quot;&gt;http://google.com/reader/&lt;/a&gt;*
// @include	  &lt;a href=&quot;http://reader.google.com/&quot;&gt;http://reader.google.com/&lt;/a&gt;*
// ==/UserScript==


// Be informative for older versions of Greasemonkey
if (!GM_xmlhttpRequest) {
    alert('Please upgrade to the latest version of Greasemonkey.');
    return;
}

// The variable to hold the page output
var links = '';
// Get the userid from the script on the page
var uid = unsafeWindow[&quot;_USER_ID&quot;];
// Page number variable for output
var pages;

// kick off the collection
function getAllStarred()
{	
    // Set the text for the message box
    document.getElementById('GRAS_MSG').innerHTML = 'Getting links.';
    // Show the message box
    document.getElementById('GRAS_DIV').style.display = 'block';
    
    // Initialize the page variable
    pages = 1;
    
    // Begin the new links page
    links = '&amp;lt;head&gt;&amp;lt;title&gt;Google Reader Starred Entries&amp;lt;/title&gt;&amp;lt;/head&gt;&amp;lt;html&gt;' +
	//	'&amp;lt;input /&gt;' +
	//      '&amp;lt;input /&gt;' +
	'&lt;br /&gt;&lt;div&gt;&lt;/div&gt;' +
	'&lt;ul&gt;';
    
    // Make the initial request
    // The 'continuation' string isn't needed for the first request.
    googleRequest('');
}

// Perform the request for the starred item
// Param: c
//        This string is used as an offset if the initial
//        request didn't get all of starred items
//
function googleRequest(c){
    // Generate a request to get the list (xml) of starred items
    GM_xmlhttpRequest({
	    method: 'GET',
    		url: 'http://google.com/reader/atom/user/' + uid + '/state/com.google/starred?n=250'+c,
    		headers: {
		'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey/0.3',
		    'Accept': 'application/atom+xml,application/xml,text/xml',
		    },
    		onload: collectAllStarred
		});
}

// This function parses the response object to get the starred items.
// If it finds a continuation parameter, it will call googleRequest
// again until all of the starred items are collected.
function collectAllStarred(responseObj)
{
    document.getElementById('GRAS_MSG').innerHTML = 'Collecting links,  Set ' + pages++;
    // Create a new parser
    var dp = new XPCNativeWrapper(window, &quot;DOMParser()&quot;);
    var parser = new dp.DOMParser();
    var DOM = parser.parseFromString(responseObj.responseText, &quot;application/xhtml+xml&quot;);
    
    // Grab all of the entries
    var entries = DOM.getElementsByTagName('entry');
    
    // Loop through all of the entries
    for(var i = 0, len = entries.length; i &amp;lt; len; i++){
	// Grab the link URL
	var link = entries[i].getElementsByTagName('id')[0].getAttribute('gr:original-id');
	
	if (!(/^http/.test(link))) {
		link = entries[i].getElementsByTagName('link')[0].getAttribute('href');
	} 

	// Grab the item Title
	var title = entries[i].getElementsByTagName('title')[0].childNodes[0].nodeValue;
	// Grab the feed name
	var feedtitle = entries[i].getElementsByTagName('source')[0].getElementsByTagName('title')[0].textContent
	    // Add a new link to the page.
	    links += '&lt;li&gt;&lt;a href=&quot;' + link + '&quot;&gt;' + title + ' from ' + feedtitle +'&lt;/a&gt;&lt;/li&gt;\n';
	
	// Note that other fields can be displayed here as well.
    }
    
    // Check for continuation
    if(DOM.getElementsByTagName('gr:continuation')[0]){
	googleRequest('&amp;amp;c=' + DOM.getElementsByTagName('gr:continuation')[0].childNodes[0].nodeValue); 
    }else{
	// If there is no continuation, then we have finished and it is time to display the page
	
	// tidy up the page.
	links += &quot;&lt;/ul&gt;&amp;lt;/html&gt;&quot;;
	
	// Write a new document (another window)
	var d = open().document;
	d.write(links);
	d.close();
	
	// Hide the message box		
	document.getElementById('GRAS_DIV').style.display = 'none';
    }
}

// function pushToDelicious()
// {
    
// }

// function showDeliciousForm()
// {
//     alert('Clicked');
//     document.getElementById('GRAS_ACTIONFORM').innerHTML = 
// 	'&amp;lt;form&gt;&amp;lt;label&gt;Your del.icio.us ID:&amp;lt;/label&gt;&lt;br /&gt;&amp;lt;input /&gt;' +
// 	'&lt;br /&gt;&amp;lt;label&gt;Your del.icio.us Password:&amp;lt;/label&gt;&lt;br /&gt;&amp;lt;input /&gt;' +
// 	'&lt;br /&gt;&amp;lt;label&gt;Del.icio.us tags to use:&amp;lt;/label&gt;&lt;br /&gt;&amp;lt;input /&gt;' +
// 	'&lt;br /&gt;&amp;lt;input /&gt;';
// }

// function unstarLinks()
// {
//     alert(&quot;When I wish upon a star....&quot;);
// }

// Add a small messagebox to indicate that the script is working
var msg = document.createElement(&quot;div&quot;);
msg.innerHTML = '&lt;div&gt;&lt;p&gt; ' +
    'YOUR TEXT HERE ' +
    '&lt;/p&gt;&lt;/div&gt;';
// Add it at the end of the page.
document.body.appendChild(msg);

if(document.getElementById('selectors-container') &amp;amp;&amp;amp; document.getElementById('star-selector')) {
// Create a list item to add to the regular google links
var starlink = document.createElement(&quot;li&quot;);
starlink.setAttribute(&quot;class&quot;, &quot;selector&quot;);
starlink.setAttribute(&quot;id&quot;, &quot;all-starred-link&quot;);
// Add the text
starlink.innerHTML='&lt;a href=&quot;#&quot;&gt;All Starred&lt;/a&gt;';
// Create a listener to handle the click event
starlink.addEventListener('click',getAllStarred,false);
// Add the link to the Google Reader page.
document.getElementById('selectors-container').insertBefore(starlink, document.getElementById('star-selector').nextSibling);
} 

// if(document.getElementById('GRAS_DELICIOUS')){
//     document.getElementById('GRAS_DELICIOUS').addEventListener('click',showDeliciousForm,false);
// }
// if(document.getElementById('GRAS_UNSTAR')){
//     document.getElementById('GRAS_UNSTAR').addEventListener('click',unstarLinks,false);
// }&amp;lt;/form&gt;</description>
      <pubDate>Fri, 25 Jul 2008 06:05:33 +0000</pubDate>
      <guid isPermaLink="false">userscripts.org:15825:66578</guid>
      <author>Abhay Singh</author>
      <link>http://userscripts.org/posts/66578</link>
    </item>
    <item>
      <title>Archived Comments, replied by Abhay Singh</title>
      <description>&lt;p&gt;Thanks Mark.&lt;/p&gt;</description>
      <pubDate>Fri, 25 Jul 2008 04:38:48 +0000</pubDate>
      <guid isPermaLink="false">userscripts.org:15825:66579</guid>
      <author>Abhay Singh</author>
      <link>http://userscripts.org/posts/66579</link>
    </item>
    <item>
      <title>Archived Comments, replied by Mark Hutton</title>
      <description>&lt;p&gt;Script was only getting the first 250 for me.. it seems the &quot;continuation&quot; element is now called &quot;gr:continuation&quot;.. fixing this in the script gets it working again&lt;/p&gt;

&lt;p&gt;Now I have extracted all my 7530 starred item links from Google Reader :)&lt;/p&gt;

&lt;p&gt;Edit: Some of the extracted links are of the form &quot;tag:&quot; which I understand is something to do with Atom, however I needed real links - adding the following gets the real link in most cases I have seen where &quot;tag:...&quot; is used:&lt;/p&gt;

&lt;p&gt;find:
&lt;br /&gt;&lt;pre&gt;
	var link = entries[i].getElementsByTagName('id')[0].getAttribute('gr:original-id');
&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;add the following after the above line:
&lt;br /&gt;&lt;pre&gt;
	if (!(/^http/.test(link))) {
		link = entries[i].getElementsByTagName('link')[0].getAttribute('href');
	} 
&lt;/pre&gt;&lt;/p&gt;</description>
      <pubDate>Thu, 10 Jul 2008 10:56:32 +0000</pubDate>
      <guid isPermaLink="false">userscripts.org:15825:66580</guid>
      <author>Mark Hutton</author>
      <link>http://userscripts.org/posts/66580</link>
    </item>
    <item>
      <title>Archived Comments, replied by Abhay Singh</title>
      <description>&lt;p&gt;Well ok, Now I have my 3000+ links, I would like to &quot;unstar&quot; them and make room for new &quot;stars&quot; .  Would you know how to this this? I think some tweak in this script should be able to handle  this well.&lt;/p&gt;</description>
      <pubDate>Fri, 13 Jun 2008 14:46:37 +0000</pubDate>
      <guid isPermaLink="false">userscripts.org:15825:66581</guid>
      <author>Abhay Singh</author>
      <link>http://userscripts.org/posts/66581</link>
    </item>
    <item>
      <title>Archived Comments, replied by Richard Osbaldeston</title>
      <description>&lt;p&gt;Ah, just applied my own patch to the office computer and it wasn't quite right. Forget to escape the angle brackets around the &quot;All Starred&quot; link so the forum removed them. I modified the patch below so you might want to patch again. It's a cosmetic issue that meant &quot;All Starred&quot; wasn't being rendered as a link - but would still work when clicked.&lt;/p&gt;</description>
      <pubDate>Fri, 13 Jun 2008 09:42:15 +0000</pubDate>
      <guid isPermaLink="false">userscripts.org:15825:66582</guid>
      <author>Richard Osbaldeston</author>
      <link>http://userscripts.org/posts/66582</link>
    </item>
    <item>
      <title>Archived Comments, replied by Abhay Singh</title>
      <description>&lt;p&gt;Super Richard. I owe you a beer!&lt;/p&gt;</description>
      <pubDate>Fri, 13 Jun 2008 03:24:50 +0000</pubDate>
      <guid isPermaLink="false">userscripts.org:15825:66583</guid>
      <author>Abhay Singh</author>
      <link>http://userscripts.org/posts/66583</link>
    </item>
    <item>
      <title>Archived Comments, replied by Richard Osbaldeston</title>
      <description>&lt;p&gt;Noticed it had stopped working recently. Had a crack at patching it myself, edit the script and look for the line that starts &lt;code&gt;if(document.getElementById('broadcast-selector').parentNode) {
&lt;br /&gt;&lt;/code&gt; (line 176 near the end) and replace that whole if {} block with:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;
&lt;br /&gt;if(document.getElementById('selectors-container') &amp;amp;&amp;amp; document.getElementById('star-selector')) {
&lt;br /&gt;    // Create a list item to add to the regular google links
&lt;br /&gt;    var starlink = document.createElement(&quot;li&quot;);
&lt;br /&gt;    starlink.setAttribute(&quot;class&quot;, &quot;selector&quot;);
&lt;br /&gt;    starlink.setAttribute(&quot;id&quot;, &quot;all-starred-link&quot;);
&lt;br /&gt;    // Add the text
&lt;br /&gt;    starlink.innerHTML='&amp;lt;a href=&quot;#&quot;&amp;gt;All Starred&amp;lt;/a&amp;gt;';
&lt;br /&gt;    // Create a listener to handle the click event
&lt;br /&gt;    starlink.addEventListener('click',getAllStarred,false);
&lt;br /&gt;    // Add the link to the Google Reader page.
&lt;br /&gt;    document.getElementById('selectors-container').insertBefore(starlink, document.getElementById('star-selector').nextSibling);
&lt;br /&gt;}
&lt;br /&gt;&lt;/code&gt;&lt;/p&gt;</description>
      <pubDate>Wed, 11 Jun 2008 15:27:18 +0000</pubDate>
      <guid isPermaLink="false">userscripts.org:15825:66584</guid>
      <author>Richard Osbaldeston</author>
      <link>http://userscripts.org/posts/66584</link>
    </item>
    <item>
      <title>Archived Comments, replied by Abhay Singh</title>
      <description>&lt;p&gt;Doesnt seems to work with new reader :(&lt;/p&gt;</description>
      <pubDate>Fri, 06 Jun 2008 02:11:59 +0000</pubDate>
      <guid isPermaLink="false">userscripts.org:15825:66585</guid>
      <author>Abhay Singh</author>
      <link>http://userscripts.org/posts/66585</link>
    </item>
    <item>
      <title>Archived Comments, replied by Jesse Andrews</title>
      <description>&lt;p&gt;The following is an archive of comments made before threaded discussions was implemented (November 16th, 2008)&lt;/p&gt;</description>
      <pubDate>Wed, 17 Nov 2004 01:05:34 +0000</pubDate>
      <guid isPermaLink="false">userscripts.org:15825:66576</guid>
      <author>Jesse Andrews</author>
      <link>http://userscripts.org/posts/66576</link>
    </item>
  </channel>
</rss>
