// ==UserScript==
// @name          Google Reader UI Yacca Version
// @description	 Google Reader Fix Scripts 
// @author        Shawn
// @include       http://www.google.com/reader/view/*
// @include       https://www.google.com/reader/view/*
// ==/UserScript==
(function(){var A='@namespace url(http://www.w3.org/1999/xhtml);body{font-family:Lucida Grande,Helvetica,Arial,sans-serif;background:#fff}#nav{width:200px;position:absolute;top:-26px}#lhn-add-subscription{margin:3px 0 2px 2px}#chrome{margin-left:200px}#gbar,#logo-container,#viewer-footer{display:none}#search{top:0;left:440px}#main{top:24px}#search-input{height:16px;margin:3px 4px 0 0;padding:0}#search-restrict-button,#search-submit{margin:1px 0 0}.lhn-section-footer{background:#f8f8f8;border-top:1px solid #ccc}.scroll-tree{font-size:12px;line-height:2}#sub-tree{width:200px}.scroll-tree .icon{top:4px}#current-entry .card{border-color:#ccc}#sub-tree ul ul li a{padding-left:19px}#viewer-top-controls{padding:1px 3px}#chrome-title{font-size:14px;line-height:1.4}#chrome-header{padding:2px 11px}#viewer-details-toggle{float:left};#viewer-details-toggle{text-align:left}#viewer-header{position:absolute;top:1px;right:150px;background:none}#entries.list .collapsed .entry-secondary{margin:0 9em 0 13em}';if(typeof GM_addStyle!="undefined"){GM_addStyle(A)}else{if(typeof addStyle!="undefined"){addStyle(A)}else{var C=document.getElementsByTagName("head");if(C.length>0){var B=document.createElement("style");B.type="text/css";B.appendChild(document.createTextNode(A));C[0].appendChild(B)}}}})();var g_totaltext;function $(A){return document.getElementById(A)}function calcUnread(){var D=new Array();var J=document.evaluate("//li[contains(@class, 'folder')]//li[contains(@class, 'folder')]",document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);var K=0;var A=false;for(var F=0;F<J.snapshotLength;F++){var B=document.evaluate(".//li[contains(@class, 'unread')]/a/span/span[contains(@class, 'unread-count')]",J.snapshotItem(F),null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);var L=0;var G=false;for(var E=0;E<B.snapshotLength;E++){var C=B.snapshotItem(E).innerHTML.match(/\((\d*)\+?\)/);if(C){var I=parseInt(C[1],10);L+=I;if(B.snapshotItem(E).innerHTML.match(/\(100\+\)/)){G=true;A=true}if(D.indexOf(B.snapshotItem(E).parentNode.parentNode.href)<0){K+=I;D[D.length]=B.snapshotItem(E).parentNode.parentNode.href}}}if(L>0){var H=document.evaluate(".//a/span/span[contains(@class, 'unread-count')]",J.snapshotItem(F),null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;if(H){H.innerHTML="&nbsp;("+L+(G?"+":"")+")"}}}if(K>0){g_totaltext=K+(A?"+":"");$("reading-list-unread-count").innerHTML=" ("+g_totaltext+")"}}function modifySubtree(){if($("reading-list-unread-count").textContent.match(/1000\+/)){calcUnread()}}if($("reading-list-selector")){$("reading-list-unread-count").addEventListener("DOMSubtreeModified",modifySubtree,false);window.setTimeout(modifySubtree,5000);window.setInterval(function(){calcUnread();if(g_totaltext){document.title=document.title.replace(/1000\+/,g_totaltext).replace("Google Reader","GReader")}},3000)};unsafeWindow.document.watch("title",function(C,A,B){if(matches=B.match(/Google Reader \((\d+\+?)\)/)){B="("+matches[1]+") Google Reader"}return(B)});function setRuleStyle(A,B){var E=document.styleSheets;var F;var D;for(i=0;i<E.length;i++){F=E[i].cssRules||E[i].rules;for(var C=0;C<F.length;C++){if(F[C].selectorText&&F[C].selectorText.indexOf(A)!=-1){D=F[C].style.cssText=B;break}}}}setRuleStyle(".entry .entry-body, .entry .entry-title","max-width: 100%;")