Changeset 39079

Show
Ignore:
Timestamp:
11/30/11 02:11:21 (18 months ago)
Author:
NeoCat
Message:

Auto adjust auto_reload timeout after tweet

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • websites/twicli/twicli.js

    r39076 r39079  
    126126} 
    127127var postSeq = 0; 
     128var postTimeout = 2000; 
    128129function postInIFrame(url, done, err, retry) { 
    129130        loading(true); 
     
    136137        pfr.style.display = "none"; 
    137138        var errTimer = false; 
    138         // 5秒(エラー処理指定時は3秒→10秒)で正常終了しなければエラーとみなす 
     139        // 5秒(エラー処理指定時はデフォルト2秒→10秒)で正常終了しなければエラーとみなす 
    139140        errTimer = setTimeout(function(){ 
    140141                loading(false); 
     
    145146                        postNext(); 
    146147                }, 0); 
    147         }, retry?10000:err?3000:5000); 
     148        }, retry?10000:err?postTimeout:5000); 
    148149        var cnt = 0; 
    149150        var onload = pfr.onload = function(){ 
     
    507508                return false; 
    508509        } 
    509         var retry = false; 
     510        var retry = 0; 
    510511        if (st.value == "r" && last_post) { 
    511                 retry = true; 
     512                retry = 1; 
    512513                st.value = last_post; 
    513514                in_reply_to_user = last_in_reply_to_user; 
     
    527528                                                                                "&long=" + geo.coords.longitude : "") + 
    528529                                (in_reply_to_status_id ? "&in_reply_to_status_id=" + in_reply_to_status_id : ""), 
    529                                 function(){ resetFrm(); if (auto_update) update() }, 
     530                                function(){ resetFrm(); if (auto_update) { update_post_check = [2,text]; setTimeout(update, postTimeout); }}, 
    530531                                function(){ if (auto_update) { update_post_check = [retry,text]; update() }}, retry); 
    531532        in_reply_to_user = in_reply_to_status_id = null; 
     
    10611062                if (update_post_check && tw[j].user.screen_name == myname && removeLink(tw[j].text) == removeLink(update_post_check[1])) { 
    10621063                        if ($('fst').value == update_post_check[1]) resetFrm(); 
     1064                        if (update_post_check[0] != 1) postTimeout = Math.max(1000, postTimeout-50); 
    10631065                        update_post_check = false; 
    10641066                } 
     
    10781080        if (update_post_check) { 
    10791081                var st = document.frm.status; 
    1080                 if (!update_post_check[0] && st.value == update_post_check[1] && st.value == last_post) { 
    1081                         st.value = 'r'; 
    1082                         press(1); 
     1082                if (update_post_check[0] != 1)  { 
     1083                        postTimeout = Math.min(10000, postTimeout+500); 
     1084                        if (update_post_check[0] == 0 && st.value == update_post_check[1] && st.value == last_post) { 
     1085                                st.value = 'r'; 
     1086                                press(1); 
     1087                        } else 
     1088                                update_post_check = false; 
    10831089                } else 
    1084                                 update_post_check = false; 
     1090                        update_post_check = false; 
    10851091        } 
    10861092}