diff --git a/app/js/login/login.js b/app/js/login/login.js index de9f4da7..dbbb9b7d 100644 --- a/app/js/login/login.js +++ b/app/js/login/login.js @@ -492,7 +492,7 @@ function multiSelector(parseC) { } $('select').formSelect(); if(!parseC){ - parseColumn(true); + parseColumn(null, true); } } diff --git a/app/js/platform/end.js b/app/js/platform/end.js index 41b81d02..7b474647 100644 --- a/app/js/platform/end.js +++ b/app/js/platform/end.js @@ -139,7 +139,7 @@ onmessage = function (e) { } else if (e.data[0] == "toastSaved") { M.toast({ html: lang.lang_img_DLDone + e.data[1][0] + '', displayLength: 5000 }) } else if (e.data[0] == "parseColumn") { - parseColumn() + parseColumn(e.data[1]) } else if (e.data[0] == "exportSettingsCore") { exportSettingsCore() } else if (e.data[0] == "fontList") { diff --git a/app/js/post/use-txtbox.js b/app/js/post/use-txtbox.js index 8ef8c083..e4eaa5c1 100644 --- a/app/js/post/use-txtbox.js +++ b/app/js/post/use-txtbox.js @@ -58,7 +58,7 @@ function qt(id, acct_id, at, url) { html = $.strip_tags(html); $("#textarea").val("\n" + "@" + at + " " + html + "\n" + url); } - $("#textarea").focus(); $("#post-acct-sel").val(acct_id); $('select').formSelect(); + $("#textarea").focus(); } \ No newline at end of file diff --git a/app/js/tl/filter.js b/app/js/tl/filter.js index 9e098c41..2c52d94a 100644 --- a/app/js/tl/filter.js +++ b/app/js/tl/filter.js @@ -77,12 +77,12 @@ function catchToggle(tlid) { localStorage.removeItem("catch_" + tlid); $("#sta-del-" + tlid).text("Off"); $("#sta-del-" + tlid).css("color", 'red'); - parseColumn(); + parseColumn(tlid); } else { localStorage.setItem("catch_" + tlid, "true"); $("#sta-del-" + tlid).text("On"); $("#sta-del-" + tlid).css("color", '#009688'); - parseColumn(); + parseColumn(tlid); } } function catchCheck(tlid) { @@ -421,7 +421,7 @@ function exclude(key) { } else { } localStorage.setItem("exclude-" + key, excludetxt) - parseColumn(); + parseColumn(key); } function excludeCk(key, target) { var exc = localStorage.getItem("exclude-" + key); @@ -444,7 +444,7 @@ function checkNotfFilter(tlid){ } function resetNotfFilter(tlid){ localStorage.setItem("exclude-" + tlid, "") - parseColumn(); + parseColumn(tlid); } function notfFilter(id,tlid,acct_id){ var excludetxt = localStorage.getItem("exclude-" + tlid); @@ -454,5 +454,5 @@ function notfFilter(id,tlid,acct_id){ excludetxt = "?account_id="+id } localStorage.setItem("exclude-" + tlid, excludetxt) - parseColumn(); + parseColumn(tlid); } \ No newline at end of file diff --git a/app/js/tl/poll.js b/app/js/tl/poll.js index 0340c853..03bd218d 100644 --- a/app/js/tl/poll.js +++ b/app/js/tl/poll.js @@ -89,8 +89,9 @@ function voteMastodonrefresh(acct_id, id) { var start = "https://" + domain + "/api/v1/polls/" + id; httpreqd.open('GET', start, true); httpreqd.setRequestHeader('Content-Type', 'application/json'); + httpreqd.setRequestHeader('Authorization', 'Bearer ' + at); httpreqd.responseType = 'json'; - httpreqd.send(JSON.stringify({ i: at, noteId: id })); + httpreqd.send(); httpreqd.onreadystatechange = function () { if (httpreqd.readyState == 4) { var json = httpreqd.response; @@ -109,7 +110,7 @@ function voteMastodonrefresh(acct_id, id) { } poll = poll + '
' + escapeHTML(choice.title) + '(' + choice.votes_count + ')
'; }); - poll = poll + myvote + '' + lang.lang_manager_refresh + '' + date(json.expires_at, datetype) + ''; $('.vote_' + acct_id + '_' + json.id).html(poll) diff --git a/app/js/tl/speech.js b/app/js/tl/speech.js index 098cc17e..b38eb5c5 100644 --- a/app/js/tl/speech.js +++ b/app/js/tl/speech.js @@ -56,12 +56,12 @@ function voiceToggle(tlid) { speechSynthesis.cancel() $("#sta-voice-" + tlid).text("Off"); $("#sta-voice-" + tlid).css("color", 'red'); - parseColumn(); + parseColumn(tlid); } else { localStorage.setItem("voice_" + tlid, "true"); $("#sta-voice-" + tlid).text("On"); $("#sta-voice-" + tlid).css("color", '#009688'); - parseColumn(); + parseColumn(tlid); } } function voiceCheck(tlid) { diff --git a/app/js/tl/src.js b/app/js/tl/src.js index 95fd946d..956f8358 100644 --- a/app/js/tl/src.js +++ b/app/js/tl/src.js @@ -86,7 +86,7 @@ function tsAdd(q) { obj.push(add); var json = JSON.stringify(obj); localStorage.setItem("column", json); - parseColumn(); + parseColumn('add'); } function tootsearch(tlid, q) { var start = "https://tootsearch.chotto.moe/api/v1/search?from=0&sort=created_at%3Adesc&q=" + q diff --git a/app/js/tl/tl.js b/app/js/tl/tl.js index bc82f9bc..ae9605e4 100644 --- a/app/js/tl/tl.js +++ b/app/js/tl/tl.js @@ -20,7 +20,7 @@ function tl(type, data, acct_id, tlid, delc, voice, mode) { obj.push(add); var json = JSON.stringify(obj); localStorage.setItem("column", json); - parseColumn(); + parseColumn('add'); return; } @@ -824,4 +824,40 @@ function reconnector(tlid, type, acct_id, data, mode) { M.toast({ html: lang.lang_tl_reconnect, displayLength: 2000 }) } +function columnReload(tlid, type){ + $("#notice_icon_" + tlid).addClass("red-text"); + if (type == "mix" || type == "integrated" || type == "plus") { + if (localStorage.getItem("voice_" + tlid)) { + var voice = true; + } else { + var voice = false; + } + if (localStorage.getItem("filter_" + acct_id) != "undefined") { + var mute = getFilterType(JSON.parse(localStorage.getItem("filter_" + acct_id)), type); + } else { + var mute = []; + } + var wssh = localStorage.getItem("wssH_" + tlid); + websocketHome[wssh].close(); + var wssl = localStorage.getItem("wssL_" + tlid); + websocketLocal[wssl].close(); + parseColumn(tlid) + } else if (type == "notf") { + notfColumn(acct_id, tlid, "") + } else { + var wss = localStorage.getItem("wss_" + tlid); + websocket[wss].close(); + if (localStorage.getItem("voice_" + tlid)) { + var voice = true; + } else { + var voice = false; + } + if (localStorage.getItem("filter_" + acct_id) != "undefined") { + var mute = getFilterType(JSON.parse(localStorage.getItem("filter_" + acct_id)), type); + } else { + var mute = []; + } + parseColumn(tlid) + } +} strAliveInt() \ No newline at end of file diff --git a/app/js/ui/layout.js b/app/js/ui/layout.js index 9dc541d0..20b7d446 100644 --- a/app/js/ui/layout.js +++ b/app/js/ui/layout.js @@ -20,7 +20,11 @@ $('.type').click(function () { $("#type-sel").val($(this).attr("data-type")) }) //最初、カラム変更時に発火 -function parseColumn(dontclose) { +function parseColumn(target, dontclose) { + if (target === 0) { + //this is kuso + target = "zero" + } console.log("%c Parse column", "color:red;font-size:125%"); var size = localStorage.getItem("size"); if (size) { @@ -31,7 +35,7 @@ function parseColumn(dontclose) { if (localStorage.getItem("menu-done")) { $("#fukidashi").addClass("hide") } - if (!dontclose) { + if (!dontclose && !target) { tlCloser(); } @@ -76,13 +80,36 @@ function parseColumn(dontclose) { } else { var obj = JSON.parse(col); } - if ($("#timeline-container").length) { - $("#timeline-container").html(""); + var numtarget = false + if (target == "add") { + var tlidtar = obj.length - 1 + obj = [obj[tlidtar]] + } else if (target) { + var tlidtar = target + if (target == "zero") { + target = 0 + } + obj = [obj[target]] + numtarget = true + } else { + var tlidtar = null + if ($("#timeline-container").length) { + $("#timeline-container").html(""); + } } var basekey = 0; for (var key = 0; key < obj.length; key++) { var next = key + 1; + //acctって言いながらタイムライン var acct = obj[key]; + if (tlidtar) { + if (tlidtar == "zero") { + key = 0 + } else { + key = tlidtar + } + + } if (acct.type == "notf") { var notf_attr = ' data-notf=' + acct.domain; var if_notf = "hide"; @@ -183,8 +210,10 @@ function parseColumn(dontclose) { } if (!acct.left_fold) { basekey = key; - var basehtml = '
'; - $("#timeline-container").append(basehtml); + if (!numtarget) { + var basehtml = '
'; + $("#timeline-container").append(basehtml); + } var left_hold = 'view_agenda' + lang.lang_layout_leftFold + '

'; } else { var left_hold = 'view_column' + lang.lang_layout_leftUnfold + '
'; @@ -220,10 +249,14 @@ function parseColumn(dontclose) { ')" class="setting nex">linkOn' + lang.lang_layout_linkana + '
hearingOn' + lang.lang_layout_tts + 'TL
low_priority' + lang.lang_layout_reconnect + '
' + lang.lang_layout_headercolor + '
On' + lang.lang_layout_tts + 'TL
refresh' + lang.lang_layout_reconnect + '
' + lang.lang_layout_headercolor + '
' + lang.lang_layout_nodata + '
' - $('#timeline_box_' + basekey + '_parentBox').append(html); + if (numtarget) { + $('timeline_box_' + key + '_box').html(html) + } else { + $('#timeline_box_' + basekey + '_parentBox').append(html) + } localStorage.removeItem("pool_" + key); if (acct.data) { var data = acct.data; @@ -337,7 +370,7 @@ function addColumn() { localStorage.setItem("column", json); } - parseColumn(); + parseColumn('add'); } function addselCk() { var acct = $("#add-acct-sel").val(); @@ -381,8 +414,8 @@ function removeColumn(tlid) { obj.splice(tlid, 1); var json = JSON.stringify(obj); localStorage.setItem("column", json); - parseColumn() sortLoad() + $("#timeline_box_" + tlid + "_parentBox").remove() } $("#sort-box").removeClass("hide"); $("#sort-box").addClass("show"); diff --git a/app/js/ui/sort.js b/app/js/ui/sort.js index 06b8dc5b..06c4b1f2 100644 --- a/app/js/ui/sort.js +++ b/app/js/ui/sort.js @@ -1,5 +1,6 @@ //ソートデータ読み込み -function sortload() { +function sortLoad () { + $("#sort").html(""); var col = localStorage.getItem("column"); if (col) { var obj = JSON.parse(col); @@ -104,7 +105,7 @@ function sort() { localStorage.setItem("column", json); $("#sort").html(""); M.toast({ html: "Sorted", displayLength: 3000 }) - sortload(); + sortLoad(); parseColumn(); sortMenu() } @@ -115,5 +116,5 @@ function sortMenu() { $(".menu-content").addClass("hide"); $("#sort-box").removeClass("hide"); $("#sort").html(""); - sortload(); + sortLoad(); } \ No newline at end of file