//レイアウトの設定 var websocketOld = [] var websocket = [] var wsHome = [] var wsLocal = [] var websocketNotf = [] //カラム追加ボックストグル function addColumnMenu() { $('#left-menu a').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(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) { $('#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 && !target) { 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) } localStorage.removeItem('emoji_' + key) //カスタム絵文字カテゴリ分け用旧データ削除 }) } 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) } 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('') $('.box, .boxIn').resizable('destroy') } } 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' } 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) } var width = localStorage.getItem('width') if (width) { var css = ' min-width:' + width + 'px;' } if (acct.width) { var css = ' min-width:' + acct.width + 'px;max-width:' + acct.width + 'px;' } if (!css) { var css = '' } 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 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 if (acct.type == 'bookmark') { if (!acct.left_fold) { basekey = key } 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.domain ) } else { var anime = localStorage.getItem('animation') if (anime == 'yes' || !anime) { var animecss = 'box-anime' } else { var animecss = '' } var unread = ` more ${lang.lang_layout_unread}
` var notfDomain = acct.domain var notfKey = key var if_tag = '' var if_tag_btn = '' if (acct.type == 'notf') { var exclude = lang.lang_excluded + `:
` if (checkNotfFilter(key)) { exclude = exclude + `` } exclude = exclude + '
' notfDomain = 'dummy' notfKey = 'dummy' } else if (acct.type == 'home') { var exclude = ` Off ${lang.lang_layout_excludingbt}
` } else if (acct.type == 'tag') { if(acct.data.name) { var name = acct.data.name var all = acct.data.all var any = acct.data.any var none = acct.data.none } else { var name = acct.data var all = '' var any = '' var none = '' } if_tag = `
Base: ${name}
all: any: none:
` if_tag_btn = ` note_add ` unread = '' var exclude = '' var if_notf = 'hide' } else { var exclude = '' unread = '' } var markers = localStorage.getItem('markers') if (markers == 'yes') { markers = true } else { markers = false } if (!markers) { unread = '' } if (!acct.left_fold) { basekey = key 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}
` } 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 = '' } if (acct.height) { var addHeight = ' min-height:' + acct.height + 'px;max-height:' + acct.height + 'px;' } else { var addHeight = '' } var html = `
${unread} ${exclude}${left_hold} perm_media On ${lang.lang_layout_mediafil}
link On ${lang.lang_layout_linkana}
hearing On ${lang.lang_layout_tts} TL
refresh ${lang.lang_layout_reconnect}
${lang.lang_layout_headercolor}
${if_tag}
${lang.lang_layout_nodata}
` 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 } 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 css = '' } } 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) } } } $('.box, .boxIn').resizable({ minHeight: 50, minWidth: 50, grid: 50, resize: function(event, ui) { $(this).css('min-width', ui.size.width + 'px') $(this).css('max-width', ui.size.width + 'px') $(this).css('min-height', ui.size.height + 'px') $(this).css('max-height', ui.size.height + 'px') }, stop: function(event, ui) { var col = localStorage.getItem('column') var o = JSON.parse(col) var width = ui.size.width var height = ui.size.height if ($(this).hasClass('boxIn')) { //縦幅。その縦幅を持つカラムのidは console.log('tate') var key = $(this).attr('tlid') var obj = o[key] obj.height = height o[key] = obj } else { //横幅。その縦幅を持つカラムのidは console.log('yoko') var key = $(this) .find('.boxIn') .attr('tlid') var obj = o[key] obj.width = width o[key] = obj } var json = JSON.stringify(o) localStorage.setItem('column', json) } }) } 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('add') } 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) sortLoad() $('#timeline_box_' + tlid + '_parentBox').remove() } $('#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 setToggleTag(tlid) { if ($('#tag-box_' + tlid).hasClass('column-hide')) { $('#tag-box_' + tlid).css('display', 'block') $('#tag-box_' + tlid).animate( { height: '200px' }, { duration: 300, complete: function() { $('#tag-box_' + tlid).css('overflow-y', 'scroll') $('#tag-box_' + tlid).removeClass('column-hide') } } ) } else { $('#tag-box_' + tlid).css('overflow-y', 'hidden') $('#tag-box_' + tlid).animate( { height: '0' }, { duration: 300, complete: function() { $('#tag-box_' + tlid).addClass('column-hide') $('#tag-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', '') $('#menu_' + key + ' .nex').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, data) { //type名が関数名 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_media On ${lang.lang_layout_mediafil}
${lang.lang_layout_headercolor}
${lang.lang_layout_nodata}
` $('#timeline_box_' + basekey + '_parentBox').append(html) if (type == 'tootsearch') { tootsearch(key, data) } else if (type == 'bookmark') { console.log(key, data) bookmark(key, data) } cardCheck(key) ebtCheck(key) mediaCheck(key) catchCheck(key) voiceCheck(key) return true } function bookmark(key, data) { console.log(key, data) if (localStorage.getItem('voice_' + key)) { var voice = true } else { var voice = false } tl('bookmark', '', data, key, 'false', voice, '') } 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() }