Created
May 29, 2012 13:50
-
-
Save xulapp/2828479 to your computer and use it in GitHub Desktop.
Google Reader Auto Change Start Page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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