Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xulapp/2828479 to your computer and use it in GitHub Desktop.
Save xulapp/2828479 to your computer and use it in GitHub Desktop.
Google Reader Auto Change Start Page
// ==UserScript==
// @id googlereaderautochangestartpage@http://twitter.com/xulapp
// @name Google Reader Auto Change Start Page
// @version 1.0
// @namespace http://twitter.com/xulapp
// @author xulapp
// @description
// @include http://www.google.tld/reader/view/*
// @include https://www.google.tld/reader/view/*
// @run-at document-start
// ==/UserScript==
(function googleReaderAutoChangeStartPage() {
var VAR = '_STREAM_LIST_UNREAD_COUNTS';
var lastValue;
Object.defineProperty(unsafeWindow, VAR, {
get: function() lastValue,
set: function(v) {
if (v !== null) {
lastValue = v;
return;
}
delete unsafeWindow[VAR];
unsafeWindow[VAR] = null;
var all;
lastValue.unreadcounts.every(function(item) {
if (!/\/reading-list$/.test(item.id))
return true;
all = item;
});
if (!all)
return;
if (all.count < 10)
history.pushState(null, '', '#stream/' + encodeURIComponent(all.id));
},
configurable: true,
enumerable: true,
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment