//レイアウトの設定 var websocketOld = []; var websocket = []; var websocketHome = []; var websocketLocal = []; var websocketNotf = []; //カラム追加ボックストグル function addColumnMenu() { $("#left-menu div").removeClass("active"); $("#addColumnMenu").addClass("active"); $(".menu-content").addClass("hide"); $("#add-box").removeClass("hide"); addselCk() } $('.type').click(function () { $(".type").removeClass("active"); $(this).addClass("active"); $("#type-sel").val($(this).attr("data-type")) }) //最初、カラム変更時に発火 function parseColumn(dontclose) { console.log("%c Parse column", "color:red;font-size:125%"); var size = localStorage.getItem("size"); if (size) { $("#timeline-container").css("font-size", size + "px"); $(".toot-reset").css("font-size", size + "px"); $(".cont-series").css("font-size", size + "px"); } if (localStorage.getItem("menu-done")) { $("#fukidashi").addClass("hide") } if (!dontclose) { tlCloser(); } var multi = localStorage.getItem("multi"); if (multi) { var obj = JSON.parse(multi); var templete; Object.keys(obj).forEach(function (key) { var acct = obj[key]; localStorage.setItem("name_" + key, acct.name); localStorage.setItem("user_" + key, acct.user); localStorage.setItem("user-id_" + key, acct.id); localStorage.setItem("prof_" + key, acct.prof); localStorage.setItem("domain_" + key, acct.domain); localStorage.setItem("acct_" + key + "_at", acct.at); notf(key, 0); ckdb(key); //フィルターデータ読もう getFilter(key); var domain = localStorage.getItem("domain_" + key); if (localStorage.getItem("mode_" + domain) == "misskey") { localStorage.removeItem("misskey_wss_" + key) connectMisskey(key, false) } }); } var acctlist = obj; console.table(obj); /*var xed=localStorage.getItem("xed"); if(xed){ xpand(); }*/ var col = localStorage.getItem("column"); if (!col) { var obj = [{ domain: 0, type: 'local' }]; var json = JSON.stringify(obj); localStorage.setItem("column", json); } else { var obj = JSON.parse(col); } if ($("#timeline-container").length) { $("#timeline-container").html(""); } var basekey = 0; for (var key = 0; key < obj.length; key++) { var next = key + 1; var acct = obj[key]; if (acct.type == "notf") { var notf_attr = ' data-notf=' + acct.domain; var if_notf = "hide"; } else { var notf_attr = ''; var if_notf = ""; } if (localStorage.getItem("notification_" + acct.domain)) { var unique_notf = lang.lang_layout_thisacct.replace("{{notf}}", localStorage.getItem("notification_" + acct.domain)); } else { if (lang.language == "ja") { var notflocale = "通知"; } else if (lang.language == "en") { var notflocale = "Notification"; } var unique_notf = lang.lang_layout_thisacct.replace("{{notf}}", notflocale); } var insert = ""; var icnsert = ""; if (acct.background) { if (acct.text == "def") { } else { if (acct.text == "black") { var txhex = "000000"; var ichex = "9e9e9e" } else if (acct.text == "white") { var txhex = "ffffff"; var ichex = "eeeeee" } insert = 'background-color:#' + acct.background + '; color: #' + txhex + '; '; icnsert = ' style="color: #' + ichex + '" '; } } console.log(acct); if (acctlist[acct.domain]) { if (acctlist[acct.domain].background != "def") { insert = insert + " border-bottom:medium solid #" + acctlist[acct.domain].background + ";"; } } if (acct.type == "notf" && localStorage.getItem("setasread") == "no") { localStorage.setItem("hasNotfC_" + acct.domain, "true"); } else { localStorage.removeItem("hasNotfC_" + acct.domain); } if (acct.type == "webview") { if (localStorage.getItem("fixwidth")) { var fixwidth = localStorage.getItem("fixwidth"); var css = " min-width:" + fixwidth + "px;" } else { var css = ""; } var html = webviewParse("https://tweetdeck.twitter.com", key, insert, icnsert, css); $("#timeline-container").append(html); } else if (acct.type == "tootsearch") { if (!acct.left_fold) { basekey = key; } var width = localStorage.getItem("width"); if (width) { var css = " min-width:" + width + "px;" } var anime = localStorage.getItem("animation"); if (anime == "yes" || !anime) { var animecss = "box-anime"; } else { var animecss = ""; } unstreamingTL(acct.type, key, basekey, insert, icnsert, acct.left_fold, css, animecss, acct.data); } else { var width = localStorage.getItem("width"); if (width) { var css = " min-width:" + width + "px;" } var anime = localStorage.getItem("animation"); if (anime == "yes" || !anime) { var animecss = "box-anime"; } else { var animecss = ""; } if (acct.type == "notf") { var exclude = lang.lang_excluded + ':
' + ' ' + ' ' + ' ' + ' ' + ''; if (checkNotfFilter(key)) { exclude = exclude + '' } exclude = exclude + "
"; } else if (acct.type == "home") { var exclude = 'Off' + lang.lang_layout_excludingbt + '
'; } else { var exclude = ""; } if (!acct.left_fold) { basekey = key; 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 + '
'; } if (key === 0) { left_hold = ''; } if (localStorage.getItem("mode_" + localStorage.getItem("domain_" + acct.domain)) == "misskey") { var isMisRed = "" exclude = "" var if_misskey_hide = "hide" } else { var isMisRed = "red-text" var if_misskey_hide = "" } var html = '
' + '
' + exclude + left_hold + 'perm_mediaOn' + lang.lang_layout_mediafil + '
linkOn' + lang.lang_layout_linkana + '
hearingOn' + lang.lang_layout_tts + 'TL
low_priority' + lang.lang_layout_reconnect + '
' + lang.lang_layout_headercolor + '
' + lang.lang_layout_nodata + '
' $('#timeline_box_' + basekey + '_parentBox').append(html); localStorage.removeItem("pool_" + key); if (acct.data) { var data = acct.data; } else { var data = ""; } if (localStorage.getItem("catch_" + key)) { var delc = "true"; } else { var delc = "false"; } if (localStorage.getItem("voice_" + key)) { var voice = true; } else { var voice = false; } tl(acct.type, data, acct.domain, key, delc, voice, ""); cardCheck(key); ebtCheck(key); mediaCheck(key); catchCheck(key); voiceCheck(key); } } var box = localStorage.getItem("box"); if (box == "absolute") { setTimeout(show, 1000); } if (localStorage.getItem("reverse")) { $("#bottom").removeClass("reverse"); $(".leftside").removeClass("reverse"); } $("#bottom").removeClass("hide"); if (localStorage.getItem("sec") && localStorage.getItem("sec") != "nothing") { secvis(localStorage.getItem("sec")); } favTag(); var cw = localStorage.getItem("always-cw"); if (cw == "yes") { if (!$("#cw").hasClass("cw-avail")) { $("#cw-text").show(); $("#cw").addClass("yellow-text"); $("#cw").addClass("cw-avail"); var cwt = localStorage.getItem("cw-text"); if (cwt) { $("#cw-text").val(cwt); } } } } function checkStr(type, data, acct_id, key, delc, voice) { if ($('#notice_icon_' + key).hasClass("red-text") && type != "notf" && type != "mix") { goTop(key); tlDiff(type, data, acct_id, key, delc, voice, ""); } else { goTop(key); } } //セカンダリートゥートボタン function secvis(set) { if (set == "public") { $("#toot-sec-icon").text("public"); $("#toot-sec-btn").addClass("purple"); } else if (set == "unlisted") { $("#toot-sec-icon").text("lock_open"); $("#toot-sec-btn").addClass("blue"); } else if (set == "private") { $("#toot-sec-icon").text("lock"); $("#toot-sec-btn").addClass("orange"); } else if (set == "direct") { $("#toot-sec-icon").text("mail"); $("#toot-sec-btn").addClass("red"); } else if (set == "limited") { $("#toot-sec-icon").text("group"); $("#toot-sec-btn").addClass("teal"); } else if (set == "local") { $("#toot-sec-icon").text("visibility"); $("#toot-sec-btn").addClass("light-blue"); } $("#toot-sec-btn").removeClass("hide"); } //カラム追加 function addColumn() { var acct = $("#add-acct-sel").val(); if (acct != "webview" && acct != "noauth") { localStorage.setItem("last-use", acct); } var type = $("#type-sel").val(); if (acct == "noauth") { acct = $("#noauth-url").val(); type = "noauth" } else if (acct == "webview") { acct = ""; type = "webview" } var add = { domain: acct, type: type }; var multi = localStorage.getItem("column"); var obj = JSON.parse(multi); if (!obj) { var leng = 0; var json = JSON.stringify([add]); localStorage.setItem("column", json); } else { var leng = obj.length; obj.push(add); var json = JSON.stringify(obj); localStorage.setItem("column", json); } parseColumn(); } function addselCk() { var acct = $("#add-acct-sel").val(); var domain = localStorage.getItem("domain_" + acct); if (acct == "webview") { $("#auth").addClass("hide"); $("#noauth").addClass("hide"); $("#webview-add").removeClass("hide"); } else if (acct == "noauth") { $("#auth").addClass("hide"); $("#noauth").removeClass("hide"); $("#webview-add").addClass("hide"); } else { $("#auth").removeClass("hide"); $("#noauth").addClass("hide"); $("#webview-add").addClass("hide"); } if (domain == "knzk.me" || domain == "mstdn.y-zu.org") { $("#type-sel").append(''); } else { $("#direct-add").remove(); } } //カラム削除 function removeColumn(tlid) { $("#sort-box").addClass("hide"); $("#sort-box").removeClass("show"); Swal.fire({ title: lang.lang_layout_deleteColumn, text: lang.lang_layout_deleteColumnDesc, type: 'warning', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', confirmButtonText: lang.lang_yesno, cancelButtonText: lang.lang_no }).then((result) => { if (result.value) { var multi = localStorage.getItem("column"); var obj = JSON.parse(multi); obj.splice(tlid, 1); var json = JSON.stringify(obj); localStorage.setItem("column", json); parseColumn() sortLoad() } $("#sort-box").removeClass("hide"); $("#sort-box").addClass("show"); }); } //設定トグル function setToggle(tlid) { colorpicker(tlid); if ($("#util-box_" + tlid).hasClass("column-hide")) { $("#util-box_" + tlid).css("display", "block") $("#util-box_" + tlid).animate({ 'height': '200px' }, { 'duration': 300, 'complete': function () { $("#util-box_" + tlid).css("overflow-y", "scroll") $("#util-box_" + tlid).removeClass("column-hide") } }); } else { $("#util-box_" + tlid).css("overflow-y", "hidden") $("#util-box_" + tlid).animate({ 'height': '0' }, { 'duration': 300, 'complete': function () { $("#util-box_" + tlid).addClass("column-hide") $("#util-box_" + tlid).css("display", "none") } }); } } function colorpicker(key) { temp = '
Default
' + '
Red
' + '
Pink
' + '
Purple
' + '
Deep-purple
' + '
Indigo
' + '
Blue
' + '
Light-blue
' + '
Cyan
' + '
Teal
' + '
Green
' + '
Light-green
' + '
Lime
' + '
Yellow
' + '
Amber
' + '
Orange
' + '
Deep-orange
' + '
Brown
' + '
Grey
' + '
Blue-grey
' + '
Black
' + '
White
'; $("#picker_" + key).html(temp); } function coloradd(key, bg, txt) { var col = localStorage.getItem("column"); var o = JSON.parse(col); var obj = o[key]; obj.background = bg; obj.text = txt; o[key] = obj; var json = JSON.stringify(o); localStorage.setItem("column", json); if (txt == "def") { $("#menu_" + key).css("background-color", ""); $("#menu_" + key).css("color", ""); } else { $("#menu_" + key).css('background-color', '#' + bg); if (txt == "black") { var bghex = "000000"; var ichex = "9e9e9e" } else if (txt == "white") { var bghex = "ffffff"; var ichex = "eeeeee" } $("#menu_" + key + " .nex").css('color', '#' + ichex); $("#menu_" + key).css('color', '#' + bghex); } } //禁断のTwitter function webviewParse(url, key, insert, icnsert, css) { var html = '
' + '
' + lang.lang_layout_headercolor + '
'; return html; } function unstreamingTL(type, key, basekey, insert, icnsert, left_fold, css, animecss, q) { if (!left_fold) { 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 + '
'; } var html = '
' + '
' + left_hold + 'perm_mediaOn' + lang.lang_layout_mediafil + '
' + lang.lang_layout_headercolor + '
' + lang.lang_layout_nodata + '
' $('#timeline_box_' + basekey + '_parentBox').append(html); tootsearch(key, q); cardCheck(key); ebtCheck(key); mediaCheck(key); catchCheck(key); voiceCheck(key); return true; } function leftFoldSet(key) { var multi = localStorage.getItem("column"); var obj = JSON.parse(multi); obj[key].left_fold = true; var json = JSON.stringify(obj); localStorage.setItem("column", json); parseColumn(); } function leftFoldRemove(key) { var multi = localStorage.getItem("column"); var obj = JSON.parse(multi); obj[key].left_fold = false; var json = JSON.stringify(obj); localStorage.setItem("column", json); parseColumn(); }