//Integrated TL function mixtl(acct_id, tlid, type,delc,voice) { console.log(delc); localStorage.removeItem("morelock") localStorage.setItem("now", type); todo("Integrated TL Loading...(Local)"); //まずLocal var domain = localStorage.getItem("domain_" + acct_id); var at = localStorage.getItem("acct_"+ acct_id + "_at"); var start = "https://" + domain + "/api/v1/timelines/public?local=true"; fetch(start, { method: 'GET', headers: { 'content-type': 'application/json', 'Authorization': 'Bearer ' + at }, }).then(function(response) { return response.json(); }).catch(function(error) { todo(error); console.error(error); }).then(function(jsonL) { var start = "https://" + domain + "/api/v1/timelines/home"; fetch(start, { method: 'GET', headers: { 'content-type': 'application/json', 'Authorization': 'Bearer ' + at }, }).then(function(response) { return response.json(); }).catch(function(error) { todo(error); console.error(error); }).then(function(jsonH) { var homearr=[]; var timeline = jsonL.concat(jsonH); timeline.sort(function(a,b){ if(date(a.created_at,"unix")>=date(b.created_at,"unix")) return -1; if(date(a.created_at,"unix")10){ reconnector(tlid,type,acct_id,data) }else{ localStorage.setItem("delete",del*1+1) } if(delc=="true"){ $("[toot-id=" + JSON.parse(mess.data).payload + "]").addClass("emphasized"); $("[toot-id=" + JSON.parse(mess.data).payload + "]").addClass("by_delcatch"); }else{ $("[toot-id=" + JSON.parse(mess.data).payload + "]").hide(); $("[toot-id=" + JSON.parse(mess.data).payload + "]").remove(); } } else if (type == "update") { localStorage.removeItem("delete"); if(TLtype=="integrated"){ var templete = parse([obj], '', acct_id, tlid); }else if(TLtype=="plus"){ if(obj.account.acct==obj.account.username){ var templete = parse([obj], '', acct_id, tlid,"",mute); }else{ var templete=""; } } if($("#timeline_" + tlid +" [toot-id=" + obj.id + "]").length < 1){ if(voice){ say(obj.content) } var templete = parse([obj], type, acct_id, tlid,"",mute); var pool = localStorage.getItem("pool_" + tlid); if (pool) { pool = templete + pool; } else { pool = templete } localStorage.setItem("pool_" + tlid, pool); scrollck(); additional(acct_id, tlid); jQuery("time.timeago").timeago(); }else{ todo("二重取得発生中"); } } } websocketLocal[wslid].onerror = function(error) { console.error('WebSocket Error ' + error); if(mode=="error"){ $("#notice_icon_" + tlid).addClass("red-text"); todo('WebSocket Error ' + error); }else{ reconnector(tlid,TLtype,acct_id,"","error"); } }; websocketLocal[wslid].onclose = function() { console.error('WebSocketLocal Closing by error:' + tlid); if(mode=="error"){ $("#notice_icon_" + tlid).addClass("red-text"); todo('WebSocket Closed'); }else{ reconnector(tlid,TLtype,acct_id,"","error"); } }; websocketHome[wshid].onerror = function(error) { console.error('WebSocket Error ' + error); if(mode=="error"){ $("#notice_icon_" + tlid).addClass("red-text"); todo('WebSocket Error ' + error); }else{ reconnector(tlid,TLtype,acct_id,"","error"); } }; websocketHome[wshid].onclose = function() { console.error('WebSocketHome Closing by error:' + tlid); if(mode=="error"){ $("#notice_icon_" + tlid).addClass("red-text"); todo('WebSocket Closed'); }else{ reconnector(tlid,TLtype,acct_id,"","error"); } }; } //ある程度のスクロールで発火 function mixmore(tlid,type) { var multi = localStorage.getItem("column"); var obj = JSON.parse(multi); var acct_id = obj[tlid].domain; todo("Integrated TL MoreLoading...(Local)"); var domain = localStorage.getItem("domain_" + acct_id); var at = localStorage.getItem("acct_"+ acct_id + "_at"); var sid = $("#timeline_" + tlid + " .cvo").last().attr("unique-id"); var start = "https://" + domain + "/api/v1/timelines/public?local=true&max_id="+sid; fetch(start, { method: 'GET', headers: { 'content-type': 'application/json', 'Authorization': 'Bearer ' + at }, }).then(function(response) { return response.json(); }).catch(function(error) { todo(error); console.error(error); }).then(function(jsonL) { var start = "https://" + domain + "/api/v1/timelines/home?max_id="+sid; fetch(start, { method: 'GET', headers: { 'content-type': 'application/json', 'Authorization': 'Bearer ' + at }, }).then(function(response) { return response.json(); }).catch(function(error) { todo(error); console.error(error); }).then(function(jsonH) { var homearr=[]; var timeline = jsonL.concat(jsonH); timeline.sort(function(a,b){ if(date(a.created_at,"unix")>date(b.created_at,"unix")) return -1; if(date(a.created_at,"unix")