Show
Ignore:
Timestamp:
08/02/08 18:27:41 (4 months ago)
Author:
cho45
Message:

Expand できないときは Expand 表示しないように

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/javascript/userscripts/hatena.haiku.expandrepliestree.user.js

    r16978 r16979  
    5555                        // 深すぎるので、さらに展開するためのリンクをつけたうえで終了する。 
    5656                        return next(function (i) { 
    57                                 if (!$X("boolean(.//a[.//img[@alt='Reply to'] and not(@style)])", entry)) return; 
     57                        //var entries = $X("//div[@class='entries']/div[@class='entry'][.//img[@alt='Reply to'] or .//span[@class='replies']/a]"); 
     58                                if (!$X("boolean( .//a[.//img[@alt='Reply to'] and not(@class = '__loaded')] | .//span[@class='replies']/a[not(@class = '__loaded')] )", entry)) return; 
    5859                                log("level too deep. Please click the link to expand more."); 
    5960                                addExpandLink(entry, function () { 
     
    8889                                if (e._expanded) return next(); 
    8990 
    90                                 if (a) a.style.opacity = "0.2"; 
     91                                if (a) { 
     92                                        a.style.opacity = "0.2"; 
     93                                        a.className = "__loaded"; 
     94                                } 
     95 
    9196                                e = applyJavaScript(e); 
    9297                                var body = $X("./div[@class='list-body']", e)[0]; 
    9398                                entry.parentNode.insertBefore(e, entry); 
    9499                                body.appendChild(entry); 
     100 
     101                                $X("./div[@class='list-body']/div[@class='info']/span[@class='replies']/a[@href]", e).forEach(function (a) { 
     102                                                log(a); 
     103                                        // 既にロードされているなら半透明にしとく 
     104                                        var raw_href = $X("string(@href)", a); 
     105                                        if ($X("boolean(.//span[@class='timestamp']/a[@href = '"+raw_href+"'])", e)) { 
     106                                                a.style.opacity = "0.2"; 
     107                                                a.className = "__loaded"; 
     108                                        } 
     109                                }); 
     110 
    95111                                return wait(WAIT).next(function () { 
    96112                                        return call(expandReplies, e, level - 1); 
     
    108124                                        // don't show if this was showed entry 
    109125                                        var raw_href = $X("string(@href)", a); 
    110                                         if ($X("boolean(.//span[@class='timestamp']/a[@href = '"+raw_href+"'])", entry)) { 
    111                                                 a.style.opacity = "0.2"; 
    112                                                 return next(); 
    113                                         } 
     126                                        if (a.className == "__loaded") return next(); 
     127 
    114128                                        // don't load already showed entry 
    115129                                        var es = $X("//div[@class='entry' and .//span[@class='timestamp']/a[@href = '"+raw_href+"']]"); 
     
    123137                                        function appendAndLoadNext (e) { 
    124138                                                a.style.opacity = "0.2"; 
    125                                                 $X("./div[@class='list-body']/div/a[img[@alt='Reply to']]", e)[0].style.opacity = "0.2"; 
     139                                                a.className = "__loaded"; 
     140 
     141                                                var parentLink = $X("./div[@class='list-body']/div/a[img[@alt='Reply to']]", e)[0] 
     142                                                parentLink.style.opacity = "0.2"; 
     143                                                parentLink.className = "__loaded"; 
    126144 
    127145                                                // 時系列に並ぶ様に注意する