Changeset 18407

Show
Ignore:
Timestamp:
08/29/08 01:21:37 (4 months ago)
Author:
NeoCat
Message:

add "getNext" to reply/user tab

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • websites/twicli/twicli.html

    r18348 r18407  
    3131.lock { position: relative; top: 2px; left: 0; } 
    3232.close { color: red; } 
     33#next { text-align: center; background-color: #999; color: #fec; cursor: pointer; } 
    3334#rep { display: none; background-color: #fee; position: absolute; width: 90%; left: 4%; top: 200px; border: #666 4px solid; z-index: 2; padding: 2px; font-size: small; } 
    3435#user_info { margin: 1px; border: #888 solid 1px: } 
     
    157158                $("loading").style.display = "block"; 
    158159                rep_top = cumulativeOffset(ele)[1] + 20; 
    159                 reply_ele = loadXDomainScript('http://twitter.com/statuses/show/'+id+'.json?seq='+(seq++)+'&callback=dispReply2', reply_ele); 
     160                reply_ele = loadXDomainScript('http://twitter.com/statuses/show/'+id+'.json?callback=dispReply2', reply_ele); 
    160161                return; 
    161162        } 
     
    277278// 受信twitを表示 
    278279function twShow(tw) { 
    279         twShowToNode(tw, $("tw"), false, true, true); 
     280        twShowToNode(tw, $("tw"), false, false, true, true); 
    280281} 
    281282function twShow2(tw) { 
    282283        var user_info = $("user_info"); 
    283         if (user_info && tw.length > 0) { 
     284        var tmp = $("tmp"); 
     285        if (tmp) tmp.parentNode.removeChild(tmp); 
     286        if (cur_page == 1 && user_info && tw.length > 0) { 
    284287                var user = tw[0].user; 
    285288                user_info.innerHTML = '<table><tr><td><img align="left" src="' + user.profile_image_url + '"></td><td>' + 
     
    293296                                                                        '&user_a=' + myname + '&user_b=' + user.screen_name + '&callback=twFollow', update_ele2); 
    294297        } 
    295         twShowToNode(tw, $("tw2c"), !!user_info); 
    296 } 
    297 function twShowToNode(tw, twNode, no_name, animation, check_since) { 
     298        twShowToNode(tw, $("tw2c"), !!user_info, cur_page > 1); 
     299        if (selected_menu.id == "reply" || selected_menu.id == "user") 
     300                $("tw2c").innerHTML += '<div onClick="getNext(this)" id="next">▽</div>'; 
     301} 
     302function twShowToNode(tw, twNode, no_name, after, animation, check_since) { 
    298303        $('loading').style.display = 'none'; 
    299304        if (failover_timeout) clearTimeout(failover_timeout); 
     
    304309        var dummy = pNode.appendChild(document.createElement('div')); 
    305310        for (var i = len-1; i >= 0; i--) { 
    306                 if (check_since && since_id && since_id >= tw[i].id) 
     311                if (check_since && since_id && since_id >= tw[i].id || $(twNode.id + "-" + tw[i].id)) 
    307312                        continue; 
    308313                if (tw[i].user) { 
     
    327332                pNode.style.minHeight = 0; 
    328333        } 
    329         twNode.insertBefore(pNode, twNode.childNodes[0]); 
     334        if (after) 
     335                twNode.appendChild(pNode); 
     336        else 
     337                twNode.insertBefore(pNode, twNode.childNodes[0]); 
    330338        if (animation2) 
    331339                animate(pNode, maxH, (new Date).getTime()); 
    332340        else if (animation) { 
    333341                $('rep').style.top = (rep_top += pNode.clientHeight); 
    334                 scrollBy(0, pNode.clientHeight); 
     342                scrollBy(0, pNode.clientHeight+1); 
    335343        } 
    336344        if (animation) { 
     
    351359        elem.style.maxHeight = Math.ceil(max*(1-Math.cos((t-start)/1000*Math.PI))/2); 
    352360        setTimeout(animate, 50, elem, max, start); 
     361} 
     362// 次ページ取得 
     363function getNext(ele) { 
     364        var tmp = document.createElement("div"); 
     365        tmp.id = "tmp"; 
     366        tmp.innerHTML = "<p></p>"; 
     367        ele.parentNode.appendChild(tmp); 
     368        ele.parentNode.removeChild(ele); 
     369        $("loading").style.display = "block"; 
     370        if (selected_menu.id == "user") 
     371                update_ele2 = loadXDomainScript('http://twitter.com/statuses/user_timeline.json?seq=' + (seq++) + 
     372                                                                '&page=' + (++cur_page) + '&id=' + last_user + '&callback=twShow2', update_ele2); 
     373        else if (selected_menu.id == "reply") 
     374                update_ele2 = loadXDomainScript('http://twitter.com/statuses/replies.json?seq=' + (seq++) + 
     375                                                                '&page=' + (++cur_page) + '&callback=twShow2', update_ele2); 
    353376} 
    354377// タイムライン切り替え 
     
    363386        $("rep").style.display = "none"; 
    364387        scrollTo(0, 1); 
     388        cur_page = 1; 
    365389} 
    366390function switchTL() {