Show
Ignore:
Timestamp:
08/02/08 00:19:28 (4 months ago)
Author:
cho45
Message:

ぶらさがっている reply が時系列に並ぶ様に

Files:
1 modified

Legend:

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

    r16959 r16962  
    5656                                var es = $X("//div[@class='entry' and .//span[@class='timestamp']/a[@href = '"+raw_href+"']]"); 
    5757                                if (es.length) return appendAndLoadNext(es[0]); 
    58                                 log(a.href); 
    5958                                return xhttp.get(a.href).next(function (data) { 
    6059                                        // remove unnecessary tags 
     
    6665                                        a.style.opacity = "0.2"; 
    6766                                        $X("./div[@class='list-body']/div/a[img[@src='/images/icon-replylink.gif']]", e)[0].style.opacity = "0.2"; 
    68                                         body.appendChild(applyJavaScript(e)); 
     67 
     68                                        // 時系列に並ぶ様に注意する 
     69                                        var time = $X("string(div/div/span[@class='timestamp']/a)", e); 
     70                                        var ref = $X("./div[@class='entry']", body).filter(function (i) { 
     71                                                return $X("string(div/div/span[@class='timestamp']/a)", i) < time; 
     72                                        })[0]; 
     73 
     74                                        body.insertBefore(applyJavaScript(e), ref); 
    6975                                        return wait(WAIT).next(function () { 
    7076                                                return call(expandChildReplies, e); 
     
    7278                                } 
    7379                        }) 
    74                 );//.next(function () { 
    75 //                      // sort by timestamp 
    76 //                      $X("li[@class='entry']", body).map(function (i) { 
    77 //                              return { 
    78 //                                      time: $X("string(div/div/span[@class='timestamp']/a/@href)", i).match(/\d+$/)[0], 
    79 //                                      elem: i 
    80 //                              }; 
    81 //                      }).sort(function (a, b) { 
    82 //                              return b.time - a.time; 
    83 //                      }).forEach(function (i) { 
    84 //                              body.appendChild(i.elem); 
    85 //                      }); 
    86 //              }); 
     80                ); 
    8781        } 
    8882 
     
    171165 
    172166function log (m) { 
    173 //              var c = unsafeWindow.console; 
    174 //              if (c) c.log.apply(c, arguments); 
    175         var o = Array.prototype.concat.apply([], arguments); 
    176         if (window.console) { 
    177                 window.console.log(o.join(", ")); 
    178         } else 
    179         if (GM_log) { 
    180                 GM_log(o); 
    181         } else { 
    182                 location.href = "javascript:(function () { if (window.console) console.log.apply(console.log, "+o.toSource()+") })();"; 
    183         } 
     167        unsafeWindow.console.log(uneval(m)); 
    184168 
    185169        if (!arguments.callee.element) {