Skip to content

Commit

Permalink
Part 45
Browse files Browse the repository at this point in the history
  • Loading branch information
BaseMax committed Jun 1, 2020
1 parent 0b02c12 commit 46d5123
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
<button type="button" onClick="call_tl_func({0:{tl_constructor:{uint4:0x5717da40}}},logout)">LogOut</button><br-->
<select id="users_list" onchange="reset_history_forward()">
</select>
<button type="button" onClick="getHistory()">Get History</button>
<button id="history" type="button" onClick="getHistory()">Get History</button>
<button id="resend" type="button" onClick="resendHistory()" disabled>ReSend</button>
<button type="button" onClick="sendHistory()">S. History</button>
<!--button type="button" onClick="sendHistory()">S. History</button-->
<button type="button" onClick="sendMessage()">S. test message</button>
<button type="button" onClick="sendSmile()">S. smile</button>
<button type="button" onClick="sendMedia()">S. media</button>
Expand Down
22 changes: 11 additions & 11 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
var forwarded_history=null
var msg_counter = 0
var history_length = 0
var portion = 100
var portion = 20
var history_pos = 0
var history_forwarded = 0
var history_forward_source = null
function resendHistory(){
document.getElementById('resend').disabled= true
var peer=JSON.parse(userlist.options[userlist.selectedIndex].value)
var r=r_with_peer(peer)
//var peer=JSON.parse(userlist.options[userlist.selectedIndex].value)
var r=history_forward_source//r_with_peer(peer)
r["_offset_id"]=0
r["_offset_date"]=0
r["_add_offset"]=history_pos
Expand All @@ -33,7 +34,7 @@
function forwardHistory(){
if(forwarded_history != null){
if(msg_counter == 0)msg_counter=forwarded_history.messages[0]
var peer=JSON.parse(userlist.options[0].value)
var peer=JSON.parse(userlist.options[userlist.selectedIndex].value)
var r=r_with_peer(peer)
r["_flags"] = 0
r["_msg_id"]=forwarded_history.messages[msg_counter].id
Expand Down Expand Up @@ -90,11 +91,7 @@
history_length = 0
history_pos = 0
history_forwarded = 0
if(userlist.selectedIndex > 1){
document.getElementById('resend').disabled= false
} else {
document.getElementById('resend').disabled= true
}
document.getElementById('resend').disabled= false
document.getElementById('resend').innerHTML="ReSend "// + history_forwarded + " out of " + history_length
}
function sendHistory(){
Expand Down Expand Up @@ -207,8 +204,10 @@
document.getElementById('tgresult').querySelectorAll('*').forEach(n => n.remove());
}
function getHistory(){
var peer=JSON.parse(userlist.options[userlist.selectedIndex].value)
var r=r_with_peer(peer)
var peer = JSON.parse(userlist.options[userlist.selectedIndex].value)
history_forward_source = r_with_peer(peer)
document.getElementById('history').innerHTML = "Get History from "+userlist.options[userlist.selectedIndex].text
/*
r["_offset_id"]=0
r["_offset_date"]=0
r["_add_offset"]=0
Expand All @@ -217,6 +216,7 @@
r["_min_id"]=0
r["_hash"]=0
get_history(r,get_history_result)
*/
}
function get_history_result(){
document.getElementById('tgresult').appendChild(renderjson(arguments[0],"get history"));
Expand Down

0 comments on commit 46d5123

Please sign in to comment.