thedesk/app/js/ui/layout.js

934 lines
30 KiB
JavaScript
Raw Normal View History

2018-01-28 23:22:43 +11:00
//レイアウトの設定
2019-11-09 00:52:54 +11:00
var websocketOld = []
var websocket = []
2019-11-09 04:05:15 +11:00
var wsHome = []
var wsLocal = []
2019-11-09 00:52:54 +11:00
var websocketNotf = []
2018-01-28 23:22:43 +11:00
2018-03-27 13:39:35 +11:00
//カラム追加ボックストグル
function addColumnMenu() {
2020-04-22 00:56:04 +10:00
$('#left-menu a').removeClass('active')
2019-11-09 00:52:54 +11:00
$('#addColumnMenu').addClass('active')
$('.menu-content').addClass('hide')
$('#add-box').removeClass('hide')
2018-03-27 13:39:35 +11:00
addselCk()
}
2020-05-07 01:31:11 +10:00
$('.type').click(function () {
2019-11-09 00:52:54 +11:00
$('.type').removeClass('active')
$(this).addClass('active')
$('#type-sel').val($(this).attr('data-type'))
})
2018-01-28 23:22:43 +11:00
//最初、カラム変更時に発火
function parseColumn(target, dontclose) {
if (target === 0) {
//this is kuso
2019-11-09 00:52:54 +11:00
target = 'zero'
}
2019-11-09 00:52:54 +11:00
console.log('%c Parse column', 'color:red;font-size:125%')
var size = localStorage.getItem('size')
2018-03-27 13:39:35 +11:00
if (size) {
2020-05-23 14:54:51 +10:00
$('#timeline-container').css('font-size', size + 'px')
$('.toot-reset').css('font-size', size + 'px')
$('.cont-series').css('font-size', size + 'px')
2018-03-27 13:39:35 +11:00
}
2019-11-09 00:52:54 +11:00
if (localStorage.getItem('menu-done')) {
$('#fukidashi').addClass('hide')
2019-04-23 00:16:57 +10:00
}
if (!dontclose && !target) {
2019-11-09 00:52:54 +11:00
tlCloser()
2019-05-11 02:31:15 +10:00
}
2019-11-09 00:52:54 +11:00
var multi = localStorage.getItem('multi')
2019-04-11 02:52:01 +10:00
if (multi) {
2019-11-09 00:52:54 +11:00
var obj = JSON.parse(multi)
2019-05-19 17:39:30 +10:00
2019-11-09 00:52:54 +11:00
var templete
2020-05-07 01:31:11 +10:00
Object.keys(obj).forEach(function (key) {
2019-11-09 00:52:54 +11:00
var acct = obj[key]
2019-10-03 02:38:55 +10:00
2019-11-09 00:52:54 +11:00
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)
2018-07-17 01:39:06 +10:00
//フィルターデータ読もう
2019-11-09 00:52:54 +11:00
getFilter(key)
var domain = localStorage.getItem('domain_' + key)
if (localStorage.getItem('mode_' + domain) == 'misskey') {
localStorage.removeItem('misskey_wss_' + key)
2019-07-09 01:27:18 +10:00
connectMisskey(key, false)
2019-05-11 02:31:15 +10:00
}
2019-11-09 00:52:54 +11:00
localStorage.removeItem('emoji_' + key) //カスタム絵文字カテゴリ分け用旧データ削除
})
2018-03-27 13:39:35 +11:00
}
2019-11-09 00:52:54 +11:00
var acctlist = obj
console.table(obj)
2019-03-19 02:24:46 +11:00
/*var xed=localStorage.getItem("xed");
2018-03-27 13:39:35 +11:00
if(xed){
xpand();
2019-03-19 01:01:45 +11:00
}*/
2019-11-09 00:52:54 +11:00
var col = localStorage.getItem('column')
2018-03-27 13:39:35 +11:00
if (!col) {
2019-11-09 00:52:54 +11:00
var obj = [
{
domain: 0,
2020-05-07 01:31:11 +10:00
type: 'local',
},
2019-11-09 00:52:54 +11:00
]
var json = JSON.stringify(obj)
localStorage.setItem('column', json)
2018-03-27 13:39:35 +11:00
} else {
2019-11-09 00:52:54 +11:00
var obj = JSON.parse(col)
2018-03-27 13:39:35 +11:00
}
var numtarget = false
2019-11-09 00:52:54 +11:00
if (target == 'add') {
var tlidtar = obj.length - 1
obj = [obj[tlidtar]]
} else if (target) {
var tlidtar = target
2019-11-09 00:52:54 +11:00
if (target == 'zero') {
target = 0
}
obj = [obj[target]]
numtarget = true
} else {
var tlidtar = null
2019-11-09 00:52:54 +11:00
if ($('#timeline-container').length) {
$('#timeline-container').html('')
$('.box, .boxIn').resizable('destroy')
}
2018-03-27 13:39:35 +11:00
}
2019-11-09 00:52:54 +11:00
var basekey = 0
2019-05-19 17:39:30 +10:00
for (var key = 0; key < obj.length; key++) {
2019-11-09 00:52:54 +11:00
var next = key + 1
//acctって言いながらタイムライン
2019-11-09 00:52:54 +11:00
var acct = obj[key]
if (tlidtar) {
2019-11-09 00:52:54 +11:00
if (tlidtar == 'zero') {
key = 0
} else {
key = tlidtar
}
}
2019-11-09 00:52:54 +11:00
if (acct.type == 'notf') {
var notf_attr = ' data-notf=' + acct.domain
var if_notf = 'hide'
2019-05-19 17:39:30 +10:00
} else {
2019-11-09 00:52:54 +11:00
var notf_attr = ''
var if_notf = ''
2018-01-28 23:22:43 +11:00
}
2019-11-09 00:52:54 +11:00
if (localStorage.getItem('notification_' + acct.domain)) {
2020-05-07 01:31:11 +10:00
var unique_notf = lang.lang_layout_thisacct.replace('{{notf}}', localStorage.getItem('notification_' + acct.domain))
2019-05-19 17:39:30 +10:00
} else {
2019-11-09 00:52:54 +11:00
if (lang.language == 'ja') {
var notflocale = '通知'
} else if (lang.language == 'en') {
var notflocale = 'Notification'
2018-04-07 14:31:09 +10:00
}
2019-11-09 00:52:54 +11:00
var unique_notf = lang.lang_layout_thisacct.replace('{{notf}}', notflocale)
2019-05-19 17:39:30 +10:00
}
2019-11-09 00:52:54 +11:00
var insert = ''
var icnsert = ''
2019-05-19 17:39:30 +10:00
if (acct.background) {
2019-11-09 00:52:54 +11:00
if (acct.text == 'def') {
2019-05-19 17:39:30 +10:00
} else {
2019-11-09 00:52:54 +11:00
if (acct.text == 'black') {
var txhex = '000000'
var ichex = '9e9e9e'
} else if (acct.text == 'white') {
var txhex = 'ffffff'
var ichex = 'eeeeee'
2019-05-19 17:39:30 +10:00
}
2019-11-09 00:52:54 +11:00
insert = 'background-color:#' + acct.background + '; color: #' + txhex + '; '
icnsert = ' style="color: #' + ichex + '" '
2018-04-07 14:31:09 +10:00
}
}
2019-11-09 00:52:54 +11:00
console.log(acct)
2019-05-19 17:39:30 +10:00
if (acctlist[acct.domain]) {
2019-11-09 00:52:54 +11:00
if (acctlist[acct.domain].background != 'def') {
insert = insert + ' border-bottom:medium solid #' + acctlist[acct.domain].background + ';'
2018-07-07 03:51:48 +10:00
}
2018-06-18 00:26:45 +10:00
}
2019-11-09 00:52:54 +11:00
if (acct.type == 'notf' && localStorage.getItem('setasread') == 'no') {
localStorage.setItem('hasNotfC_' + acct.domain, 'true')
2019-05-19 17:39:30 +10:00
} else {
2019-11-09 00:52:54 +11:00
localStorage.removeItem('hasNotfC_' + acct.domain)
2018-08-17 03:21:40 +10:00
}
2019-11-09 00:52:54 +11:00
var width = localStorage.getItem('width')
2019-09-14 03:10:02 +10:00
if (width) {
2019-11-09 00:52:54 +11:00
var css = ' min-width:' + width + 'px;'
2019-09-14 03:10:02 +10:00
}
2019-11-09 00:52:54 +11:00
if (acct.width) {
var css = ' min-width:' + acct.width + 'px;max-width:' + acct.width + 'px;'
2019-09-14 03:10:02 +10:00
}
2019-11-09 00:52:54 +11:00
if (!css) {
var css = ''
2019-09-14 03:10:02 +10:00
}
2019-11-09 00:52:54 +11:00
if (acct.type == 'webview') {
if (localStorage.getItem('fixwidth')) {
var fixwidth = localStorage.getItem('fixwidth')
var css = ' min-width:' + fixwidth + 'px;'
2019-05-19 17:39:30 +10:00
} else {
2019-11-09 00:52:54 +11:00
var css = ''
2019-02-27 03:51:37 +11:00
}
2019-11-09 00:52:54 +11:00
var html = webviewParse('https://tweetdeck.twitter.com', key, insert, icnsert, css)
$('#timeline-container').append(html)
} else if (acct.type == 'tootsearch') {
2019-05-19 17:39:30 +10:00
if (!acct.left_fold) {
2019-11-09 00:52:54 +11:00
basekey = key
}
2019-09-14 03:10:02 +10:00
2019-11-09 00:52:54 +11:00
var anime = localStorage.getItem('animation')
if (anime == 'yes' || !anime) {
var animecss = 'box-anime'
2019-05-19 17:39:30 +10:00
} else {
2019-11-09 00:52:54 +11:00
var animecss = ''
}
2020-05-07 01:31:11 +10:00
unstreamingTL(acct.type, key, basekey, insert, icnsert, acct.left_fold, css, animecss, acct.data)
2019-11-25 00:12:14 +11:00
} else if (acct.type == 'bookmark') {
2019-11-16 06:58:37 +11:00
if (!acct.left_fold) {
basekey = key
}
var anime = localStorage.getItem('animation')
if (anime == 'yes' || !anime) {
var animecss = 'box-anime'
} else {
var animecss = ''
}
2020-05-07 01:31:11 +10:00
unstreamingTL(acct.type, key, basekey, insert, icnsert, acct.left_fold, css, animecss, acct.domain)
} else if (acct.type == 'utl') {
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: acct.domain, data: acct.data })
2019-11-25 00:12:14 +11:00
} else {
2019-11-09 00:52:54 +11:00
var anime = localStorage.getItem('animation')
if (anime == 'yes' || !anime) {
var animecss = 'box-anime'
2019-05-19 17:39:30 +10:00
} else {
2019-11-09 00:52:54 +11:00
var animecss = ''
2019-05-19 17:39:30 +10:00
}
2019-11-25 00:12:14 +11:00
var unread = `<a id="unread_${key}" onclick="showUnread('${key}','${acct.type}','${acct.domain}')"
2019-11-09 00:52:54 +11:00
class="setting nex" title="${lang.lang_layout_unread}">
<i class="material-icons waves-effect nex">more</i>
</a>${lang.lang_layout_unread}<br>`
2019-11-25 00:12:14 +11:00
var notfDomain = acct.domain
var notfKey = key
var if_tag = ''
var if_tag_btn = ''
2019-11-09 00:52:54 +11:00
if (acct.type == 'notf') {
var exclude =
lang.lang_excluded +
`:<br>
<label>
<input type="checkbox" class="filled-in" id="exc-reply-${key}" ${excludeCk(key, 'mention')} />
<span>
<i class="fas fa-share exc-icons"></i>
</span>
</label>
<label>
<input type="checkbox" class="filled-in" id="exc-fav-${key}" ${excludeCk(key, 'favourite')} />
<span>
<i class="fas fa-star exc-icons"></i>
</span>
</label>
<label>
<input type="checkbox" class="filled-in" id="exc-bt-${key}" ${excludeCk(key, 'reblog')} />
<span>
<i class="fas fa-retweet exc-icons"></i>
</span>
</label>
<label>
<input type="checkbox" class="filled-in" id="exc-follow-${key}" ${excludeCk(key, 'follow')} />
<span>
<i class="fas fa-users exc-icons"></i>
</span>
</label>
<label>
<input type="checkbox" class="filled-in" id="exc-poll-${key}" ${excludeCk(key, 'poll')} />
<span>
<i class="fas fa-tasks exc-icons"></i>
</span>
</label>
2020-05-23 14:54:51 +10:00
<button class="btn waves-effect" style="width:60px; padding:0;" onclick="exclude('${key}')">Filter</button>`
2019-06-15 02:32:59 +10:00
if (checkNotfFilter(key)) {
2019-11-09 00:52:54 +11:00
exclude =
exclude +
2020-05-23 14:54:51 +10:00
`<button class="btn red waves-effect" style="width:60px; padding:0;" onclick="resetNotfFilter('${key}')">
2019-11-09 00:52:54 +11:00
Clear all
</button>`
2019-06-15 02:32:59 +10:00
}
2019-11-09 00:52:54 +11:00
exclude = exclude + '<br>'
2019-11-25 00:12:14 +11:00
notfDomain = 'dummy'
notfKey = 'dummy'
2019-11-09 00:52:54 +11:00
} else if (acct.type == 'home') {
2019-11-25 00:12:14 +11:00
var exclude = `<a onclick="ebtToggle('${key}')" class="setting nex">
2020-05-23 14:54:51 +10:00
<i class="fas fa-retweet waves-effect nex" title="${lang.lang_layout_excludingbt}" style="font-size:24px"></i>
2019-11-09 00:52:54 +11:00
<span id="sta-bt-${key}">Off</span>
</a>
${lang.lang_layout_excludingbt}
<br>`
2019-11-25 00:12:14 +11:00
} else if (acct.type == 'tag') {
2020-05-07 01:31:11 +10:00
if (acct.data.name) {
2020-04-26 18:55:03 +10:00
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 = ''
}
2020-05-23 14:54:51 +10:00
if_tag = `<div class="column-hide notf-indv-box" id="tag-box_${key}" style="padding:5px;">
2020-04-26 18:55:03 +10:00
Base: ${name}<br>
<div id="tagManager-${key}">
all: <input type="text" id="all_tm-${key}"" value="${all}">
any: <input type="text" id="any_tm-${key}" value="${any}">
none: <input type="text" id="none_tm-${key}"" value="${none}">
</div>
<button onclick="addTag('${key}')" class="btn waves-effect" style="width: 100%">Refresh</button>
2019-11-25 00:12:14 +11:00
</div>`
if_tag_btn = `<a onclick="setToggleTag('${key}')" class="setting nex"
2020-05-23 14:54:51 +10:00
title="${lang.lang_layout_tagManager}" style="width:30px">
2019-11-25 00:12:14 +11:00
<i class="material-icons waves-effect nex">note_add</i>
</a>`
unread = ''
2020-04-26 18:55:03 +10:00
var exclude = ''
var if_notf = 'hide'
2019-05-19 17:39:30 +10:00
} else {
2019-11-09 00:52:54 +11:00
var exclude = ''
unread = ''
2019-05-19 17:39:30 +10:00
}
2019-11-25 00:12:14 +11:00
2019-11-09 00:52:54 +11:00
var markers = localStorage.getItem('markers')
if (markers == 'yes') {
markers = true
2019-09-08 10:39:26 +10:00
} else {
2019-09-22 21:36:11 +10:00
markers = false
2019-09-08 10:39:26 +10:00
}
if (!markers) {
2019-11-09 00:52:54 +11:00
unread = ''
2019-09-08 10:39:26 +10:00
}
2019-05-19 17:39:30 +10:00
if (!acct.left_fold) {
2019-11-09 00:52:54 +11:00
basekey = key
if (!numtarget) {
2019-11-25 00:12:14 +11:00
var basehtml = `<div style="${css}" class="box ${animecss}" id="timeline_box_${basekey}_parentBox"></div>`
2019-11-09 00:52:54 +11:00
$('#timeline-container').append(basehtml)
}
2019-11-25 00:12:14 +11:00
var left_hold = `<a onclick="leftFoldSet('${key}')" class="setting nex">
2019-11-09 00:52:54 +11:00
<i class="material-icons waves-effect nex" title="${lang.lang_layout_leftFold}">view_agenda</i>
</a>
${lang.lang_layout_leftFold}<br>`
2019-05-19 17:39:30 +10:00
} else {
2019-11-25 00:12:14 +11:00
var left_hold = `<a onclick="leftFoldRemove('${key}')" class="setting nex">
2019-11-09 00:52:54 +11:00
<i class="material-icons waves-effect nex" title="${lang.lang_layout_leftUnfold}">view_column</i>
</a>
${lang.lang_layout_leftUnfold}<br>`
2019-03-21 06:42:47 +11:00
}
2019-05-19 17:39:30 +10:00
if (key === 0) {
2019-11-09 00:52:54 +11:00
left_hold = ''
2019-03-21 06:42:47 +11:00
}
2020-05-07 01:31:11 +10:00
if (localStorage.getItem('mode_' + localStorage.getItem('domain_' + acct.domain)) == 'misskey') {
2019-11-09 00:52:54 +11:00
var isMisRed = ''
exclude = ''
var if_misskey_hide = 'hide'
2019-05-19 17:39:30 +10:00
} else {
2019-11-09 00:52:54 +11:00
var isMisRed = 'red-text'
var if_misskey_hide = ''
2019-05-08 01:48:59 +10:00
}
2019-11-09 00:52:54 +11:00
if (acct.height) {
var addHeight = ' min-height:' + acct.height + 'px;max-height:' + acct.height + 'px;'
} else {
var addHeight = ''
2019-09-14 03:10:02 +10:00
}
2020-05-10 20:39:49 +10:00
if (acct.type != 'pub' && acct.type != 'pub-media') {
console.log(acct.type, key)
var mediaFil = `<a onclick="mediaToggle('${key}')" class="setting nex">
<i class="material-icons waves-effect nex" title="${lang.lang_layout_mediafil}">perm_media</i>
<span id="sta-media-${key}">On</span>
</a>${lang.lang_layout_mediafil}`
} else {
var mediaFil = `<a onclick="remoteOnly('${key}','${acct.type}')" class="setting nex">
<i class="material-icons waves-effect nex" title="${lang.lang_layout_remoteOnly}">perm_media</i>
<span id="sta-remote-${key}">Off</span>
</a>${lang.lang_layout_remoteOnly}`
}
2019-11-25 00:12:14 +11:00
var html = `
2019-11-09 00:52:54 +11:00
<div class="boxIn" id="timeline_box_${key}_box" tlid="${key}" data-acct="${acct.domain}" style="${addHeight}">
<div class="notice-box z-depth-2" id="menu_${key}" style="${insert}">
<div class="area-notice">
<i class="material-icons waves-effect ${isMisRed}" id="notice_icon_${key}" ${notf_attr}
2020-05-23 14:54:51 +10:00
style="font-size:40px; padding-top:25%;"
2019-11-09 00:52:54 +11:00
onclick="checkStr('${acct.type}','${data}','${acct.domain}', '${key}', '${delc}','${voice}',null)"
2020-04-22 00:56:04 +10:00
title="${lang.lang_layout_gotop}" aria-hidden="true">
2019-11-09 00:52:54 +11:00
</i>
</div>
<div class="area-notice_name">
<span id="notice_${key}" class="tl-title"></span>
</div>
<div class="area-a1">
<a onclick="notfToggle('${acct.domain}','${key}')" class="setting nex ${if_notf}"
title="${unique_notf}" ${icnsert}>
2020-04-22 00:56:04 +10:00
<i class="material-icons waves-effect nex notf-icon_${acct.domain}" aria-hidden="true">notifications</i>
<span class="voice">${unique_notf}</span>
2019-11-09 00:52:54 +11:00
</a>
2020-01-30 01:22:53 +11:00
<span class="cbadge hide notf-announ_${acct.domain}" style="margin-right:0"
onclick="notfToggle('${acct.domain}','${key}')" title="${lang.lang_layout_announ}">
<i class="fas fa-bullhorn"></i>
2020-01-30 01:22:53 +11:00
<span class="notf-announ_${acct.domain}_ct"></span>
2020-04-22 00:56:04 +10:00
<span class="voice">${lang.lang_layout_announ}</span>
</span>
2019-11-25 00:12:14 +11:00
${if_tag_btn}
2019-11-09 00:52:54 +11:00
</div>
<div class="area-sta">
2020-04-22 00:56:04 +10:00
<span class="new badge teal notf-reply_${acct.domain} hide" data-badge-caption="Reply" aria-hidden="true">0</span>
<span class="new badge yellow black-text notf-fav_${acct.domain} hide" data-badge-caption="Fav" aria-hidden="true">0</span>
<span class="new badge blue notf-bt_${acct.domain} hide" data-badge-caption="BT" aria-hidden="true">0</span>
<span class="new badge orange notf-follow_${acct.domain} hide" data-badge-caption="Follow" aria-hidden="true">0</span>
2019-11-09 00:52:54 +11:00
</div>
<div class="area-a2">
<a onclick="removeColumn('${key}')" class="setting nex">
2020-04-22 00:56:04 +10:00
<i class="material-icons waves-effect nex" title="${lang.lang_layout_delthis}" ${icnsert} aria-hidden="true">cancel</i>
<span class="voice">${lang.lang_layout_delthis}</span>
2019-11-09 00:52:54 +11:00
</a>
</div>
<div class="area-a3">
<a onclick="setToggle('${key}')" class="setting nex" title="${lang.lang_layout_setthis}" ${icnsert}>
2020-04-22 00:56:04 +10:00
<i class="material-icons waves-effect nex" aria-hidden="true">settings</i>
<span class="voice">${lang.lang_layout_setthis}</span>
2019-11-09 00:52:54 +11:00
</a>
</div>
</div>
2019-11-16 05:42:23 +11:00
<div class="column-hide notf-indv-box z-depth-4" id="notf-box_${notfKey}">
<div id="announce_${notfKey}" style="border: 1px solid"></div>
2019-11-16 05:42:23 +11:00
<div id="notifications_${notfKey}" data-notf="${notfDomain}" data-type="notf" class="notf-timeline">
2019-11-09 00:52:54 +11:00
</div>
</div>
2020-05-23 14:54:51 +10:00
<div class="column-hide notf-indv-box" id="util-box_${key}" style="padding:5px;">
${unread}
2019-11-09 00:52:54 +11:00
${exclude}${left_hold}
2020-05-10 20:39:49 +10:00
${mediaFil}<br>
2019-11-17 00:47:18 +11:00
<a onclick="cardToggle('${key}')" class="setting nex">
2019-11-09 00:52:54 +11:00
<i class="material-icons waves-effect nex" title="${lang.lang_layout_linkanades}">link</i>
<span id="sta-card-${key}">On</span>
</a>
${lang.lang_layout_linkana}
<br>
<a onclick="voiceToggle('${key}')" class="setting nex">
<i class="material-icons waves-effect nex" title="${lang.lang_layout_tts}">hearing</i>
<span id="sta-voice-${key}">On</span>
</a>
${lang.lang_layout_tts}
TL<br>
<a onclick="columnReload('${key}','${acct.type}')" class="setting nex ${if_misskey_hide}">
<i class="material-icons waves-effect nex" title="${lang.lang_layout_reconnect}">refresh</i>
</a>
<span>
${lang.lang_layout_reconnect}
</span>
<br>
${lang.lang_layout_headercolor}
<br>
<div id="picker_${key}" class="color-picker"></div>
2019-11-25 00:12:14 +11:00
</div>${if_tag}
2019-11-09 00:52:54 +11:00
<div class="tl-box" tlid="${key}">
<div id="timeline_${key}" class="tl ${acct.type}-timeline " tlid="${key}"
data-type="${acct.type}" data-acct="${acct.domain}" data-const="${acct.type}_${acct.domain}">
<div id="landing_${key}" style="text-align:center">
${lang.lang_layout_nodata}
</div>
</div>
</div>`
if (numtarget) {
$('timeline_box_' + key + '_box').html(html)
} else {
$('#timeline_box_' + basekey + '_parentBox').append(html)
}
2019-11-09 00:52:54 +11:00
localStorage.removeItem('pool_' + key)
2019-05-19 17:39:30 +10:00
if (acct.data) {
2019-11-09 00:52:54 +11:00
var data = acct.data
2019-05-19 17:39:30 +10:00
} else {
2019-11-09 00:52:54 +11:00
var data = ''
2019-05-19 17:39:30 +10:00
}
2019-11-09 00:52:54 +11:00
if (localStorage.getItem('catch_' + key)) {
var delc = 'true'
2019-05-19 17:39:30 +10:00
} else {
2019-11-09 00:52:54 +11:00
var delc = 'false'
2019-05-19 17:39:30 +10:00
}
2018-07-22 23:03:46 +10:00
2019-11-09 00:52:54 +11:00
if (localStorage.getItem('voice_' + key)) {
var voice = true
2019-05-19 17:39:30 +10:00
} else {
2019-11-09 00:52:54 +11:00
var voice = false
2019-05-19 17:39:30 +10:00
}
2019-11-09 00:52:54 +11:00
tl(acct.type, data, acct.domain, key, delc, voice, '')
cardCheck(key)
ebtCheck(key)
mediaCheck(key)
catchCheck(key)
voiceCheck(key)
var css = ''
2018-09-10 03:06:00 +10:00
}
2019-03-21 06:42:47 +11:00
}
2019-11-09 00:52:54 +11:00
var box = localStorage.getItem('box')
if (box == 'absolute') {
setTimeout(show, 1000)
2018-03-27 13:39:35 +11:00
}
2019-11-09 00:52:54 +11:00
if (localStorage.getItem('reverse')) {
$('#bottom').removeClass('reverse')
$('.leftside').removeClass('reverse')
2018-09-11 04:59:44 +10:00
}
2019-11-09 00:52:54 +11:00
$('#bottom').removeClass('hide')
if (localStorage.getItem('sec') && localStorage.getItem('sec') != 'nothing') {
secvis(localStorage.getItem('sec'))
2018-09-17 21:55:00 +10:00
}
2019-11-09 00:52:54 +11:00
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')
2019-05-19 17:39:30 +10:00
if (cwt) {
2019-11-09 00:52:54 +11:00
$('#cw-text').val(cwt)
2018-08-05 13:36:23 +10:00
}
}
}
2019-11-09 00:52:54 +11:00
$('.box, .boxIn').resizable({
2019-09-14 03:10:02 +10:00
minHeight: 50,
minWidth: 50,
grid: 50,
2020-05-07 01:31:11 +10:00
resize: function (event, ui) {
2019-11-09 00:52:54 +11:00
$(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')
2019-09-14 03:10:02 +10:00
},
2020-05-07 01:31:11 +10:00
stop: function (event, ui) {
2019-11-09 00:52:54 +11:00
var col = localStorage.getItem('column')
var o = JSON.parse(col)
2019-09-14 03:10:02 +10:00
var width = ui.size.width
var height = ui.size.height
2019-11-09 00:52:54 +11:00
if ($(this).hasClass('boxIn')) {
2019-09-14 03:10:02 +10:00
//縦幅。その縦幅を持つカラムのidは
2019-11-09 00:52:54 +11:00
console.log('tate')
var key = $(this).attr('tlid')
var obj = o[key]
obj.height = height
o[key] = obj
2019-09-14 03:10:02 +10:00
} else {
//横幅。その縦幅を持つカラムのidは
2019-11-09 00:52:54 +11:00
console.log('yoko')
2020-05-07 01:31:11 +10:00
var key = $(this).find('.boxIn').attr('tlid')
2019-11-09 00:52:54 +11:00
var obj = o[key]
obj.width = width
o[key] = obj
2019-09-14 03:10:02 +10:00
}
2019-11-09 00:52:54 +11:00
var json = JSON.stringify(o)
localStorage.setItem('column', json)
2020-05-07 01:31:11 +10:00
},
2019-11-09 00:52:54 +11:00
})
2018-03-27 13:39:35 +11:00
}
2019-05-19 17:39:30 +10:00
function checkStr(type, data, acct_id, key, delc, voice) {
2019-11-09 00:52:54 +11:00
if ($('#notice_icon_' + key).hasClass('red-text') && type != 'notf' && type != 'mix') {
goTop(key)
tlDiff(type, data, acct_id, key, delc, voice, '')
2019-05-19 17:39:30 +10:00
} else {
2019-11-09 00:52:54 +11:00
goTop(key)
2019-04-08 01:14:06 +10:00
}
}
2018-09-17 21:55:00 +10:00
//セカンダリートゥートボタン
2019-05-19 17:39:30 +10:00
function secvis(set) {
2019-11-09 00:52:54 +11:00
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')
2018-09-17 21:55:00 +10:00
}
2019-11-09 00:52:54 +11:00
$('#toot-sec-btn').removeClass('hide')
2018-09-17 21:55:00 +10:00
}
2018-01-28 23:22:43 +11:00
//カラム追加
2018-03-27 13:39:35 +11:00
function addColumn() {
2019-11-09 00:52:54 +11:00
var acct = $('#add-acct-sel').val()
if (acct != 'webview' && acct != 'noauth') {
localStorage.setItem('last-use', acct)
2019-05-20 23:34:58 +10:00
}
2019-11-09 00:52:54 +11:00
var type = $('#type-sel').val()
if (acct == 'noauth') {
acct = $('#noauth-url').val()
type = 'noauth'
} else if (acct == 'webview') {
acct = ''
type = 'webview'
2018-01-28 23:22:43 +11:00
}
2018-03-27 13:39:35 +11:00
var add = {
domain: acct,
2020-05-07 01:31:11 +10:00
type: type,
2019-11-09 00:52:54 +11:00
}
var multi = localStorage.getItem('column')
var obj = JSON.parse(multi)
2019-05-19 17:39:30 +10:00
if (!obj) {
2019-11-09 00:52:54 +11:00
var leng = 0
var json = JSON.stringify([add])
localStorage.setItem('column', json)
2019-05-19 17:39:30 +10:00
} else {
2019-11-09 00:52:54 +11:00
var leng = obj.length
obj.push(add)
var json = JSON.stringify(obj)
localStorage.setItem('column', json)
2018-04-07 14:31:09 +10:00
}
2019-05-19 17:39:30 +10:00
2019-11-09 00:52:54 +11:00
parseColumn('add')
2018-03-27 13:39:35 +11:00
}
2019-05-19 17:39:30 +10:00
function addselCk() {
2019-11-09 00:52:54 +11:00
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')
2019-05-19 17:39:30 +10:00
} else {
2019-11-09 00:52:54 +11:00
$('#auth').removeClass('hide')
$('#noauth').addClass('hide')
$('#webview-add').addClass('hide')
2018-01-28 23:22:43 +11:00
}
2019-11-09 00:52:54 +11:00
if (domain == 'knzk.me' || domain == 'mstdn.y-zu.org') {
2020-05-07 01:31:11 +10:00
$('#type-sel').append('<option value="dm" data-trans="dm" id="direct-add">' + lang.layout_dm + '</option>')
2019-05-19 17:39:30 +10:00
} else {
2019-11-09 00:52:54 +11:00
$('#direct-add').remove()
2018-05-02 14:14:03 +10:00
}
2018-03-27 13:39:35 +11:00
}
//カラム削除
function removeColumn(tlid) {
2019-11-09 00:52:54 +11:00
$('#sort-box').addClass('hide')
$('#sort-box').removeClass('show')
2019-06-26 01:52:15 +10:00
Swal.fire({
title: lang.lang_layout_deleteColumn,
text: lang.lang_layout_deleteColumnDesc,
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: lang.lang_yesno,
2020-05-07 01:31:11 +10:00
cancelButtonText: lang.lang_no,
}).then((result) => {
2019-06-26 01:52:15 +10:00
if (result.value) {
2019-11-09 00:52:54 +11:00
var multi = localStorage.getItem('column')
var obj = JSON.parse(multi)
2020-06-13 02:40:32 +10:00
var data = obj[tlid]
2019-11-09 00:52:54 +11:00
obj.splice(tlid, 1)
var json = JSON.stringify(obj)
localStorage.setItem('column', json)
2019-06-26 01:52:15 +10:00
sortLoad()
2020-06-10 13:09:17 +10:00
$('#timeline_box_' + tlid + '_box').remove()
2020-08-05 13:46:10 +10:00
if (!data.left_fold) {
2020-06-13 02:40:32 +10:00
$('#timeline_box_' + tlid + '_parentBox').remove()
}
2019-06-26 01:52:15 +10:00
}
2019-11-09 00:52:54 +11:00
$('#sort-box').removeClass('hide')
$('#sort-box').addClass('show')
})
2018-04-07 14:31:09 +10:00
}
//設定トグル
function setToggle(tlid) {
2019-11-09 00:52:54 +11:00
colorpicker(tlid)
if ($('#util-box_' + tlid).hasClass('column-hide')) {
$('#util-box_' + tlid).css('display', 'block')
$('#util-box_' + tlid).animate(
{
2020-05-07 01:31:11 +10:00
height: '200px',
2019-11-09 00:52:54 +11:00
},
{
duration: 300,
2020-05-07 01:31:11 +10:00
complete: function () {
2019-11-09 00:52:54 +11:00
$('#util-box_' + tlid).css('overflow-y', 'scroll')
$('#util-box_' + tlid).removeClass('column-hide')
2020-05-07 01:31:11 +10:00
},
2019-09-08 02:44:28 +10:00
}
2019-11-09 00:52:54 +11:00
)
2019-05-19 17:39:30 +10:00
} else {
2019-11-09 00:52:54 +11:00
$('#util-box_' + tlid).css('overflow-y', 'hidden')
$('#util-box_' + tlid).animate(
{
2020-05-07 01:31:11 +10:00
height: '0',
2019-11-09 00:52:54 +11:00
},
{
duration: 300,
2020-05-07 01:31:11 +10:00
complete: function () {
2019-11-09 00:52:54 +11:00
$('#util-box_' + tlid).addClass('column-hide')
$('#util-box_' + tlid).css('display', 'none')
2020-05-07 01:31:11 +10:00
},
2019-09-08 02:44:28 +10:00
}
2019-11-09 00:52:54 +11:00
)
2018-08-10 01:18:35 +10:00
}
2018-04-07 14:31:09 +10:00
}
2019-11-25 00:12:14 +11:00
//タグトグル
//設定トグル
function setToggleTag(tlid) {
if ($('#tag-box_' + tlid).hasClass('column-hide')) {
$('#tag-box_' + tlid).css('display', 'block')
$('#tag-box_' + tlid).animate(
{
2020-05-07 01:31:11 +10:00
height: '200px',
2019-11-25 00:12:14 +11:00
},
{
duration: 300,
2020-05-07 01:31:11 +10:00
complete: function () {
2019-11-25 00:12:14 +11:00
$('#tag-box_' + tlid).css('overflow-y', 'scroll')
$('#tag-box_' + tlid).removeClass('column-hide')
2020-05-07 01:31:11 +10:00
},
2019-11-25 00:12:14 +11:00
}
)
} else {
$('#tag-box_' + tlid).css('overflow-y', 'hidden')
$('#tag-box_' + tlid).animate(
{
2020-05-07 01:31:11 +10:00
height: '0',
2019-11-25 00:12:14 +11:00
},
{
duration: 300,
2020-05-07 01:31:11 +10:00
complete: function () {
2019-11-25 00:12:14 +11:00
$('#tag-box_' + tlid).addClass('column-hide')
$('#tag-box_' + tlid).css('display', 'none')
2020-05-07 01:31:11 +10:00
},
2019-11-25 00:12:14 +11:00
}
)
}
}
2019-05-19 17:39:30 +10:00
function colorpicker(key) {
2019-11-25 00:12:14 +11:00
temp = `<div onclick="coloradd('${key}','def','def')" class="pointer">Default</div>
2019-11-09 00:52:54 +11:00
<div onclick="coloradd('${key}','f44336','white')" class="red white-text pointer">Red</div>
<div onclick="coloradd('${key}','e91e63','white')" class="pink white-text pointer">Pink</div>
<div onclick="coloradd('${key}','9c27b0','white')" class="purple white-text pointer">Purple</div>
<div onclick="coloradd('${key}','673ab7','white')" class="deep-purple white-text pointer">Deep-purple</div>
<div onclick="coloradd('${key}','3f51b5','white')" class="indigo white-text pointer">Indigo</div>
<div onclick="coloradd('${key}','2196f3','white')" class="blue white-text pointer">Blue</div>
<div onclick="coloradd('${key}','03a9f4','black')" class="light-blue black-text pointer">Light-blue</div>
<div onclick="coloradd('${key}','00bcd4','black')" class="cyan black-text pointer">Cyan</div>
<div onclick="coloradd('${key}','009688','white')" class="teal white-text pointer">Teal</div>
<div onclick="coloradd('${key}','4caf50','black')" class="green black-text pointer">Green</div>
<div onclick="coloradd('${key}','8bc34a','black')" class="light-green black-text pointer">Light-green</div>
<div onclick="coloradd('${key}','cddc39','black')" class="lime black-text pointer">Lime</div>
<div onclick="coloradd('${key}','ffeb3b','black')" class="yellow black-text pointer">Yellow</div>
<div onclick="coloradd('${key}','ffc107','black')" class="amber black-text pointer">Amber</div>
<div onclick="coloradd('${key}','ff9800','black')" class="orange black-text pointer">Orange</div>
<div onclick="coloradd('${key}','ff5722','white')" class="deep-orange white-text pointer">Deep-orange</div>
<div onclick="coloradd('${key}','795548','white')" class="brown white-text pointer">Brown</div>
<div onclick="coloradd('${key}','9e9e9e','white')" class="grey white-text pointer">Grey</div>
<div onclick="coloradd('${key}','607d8b','white')" class="blue-grey white-text pointer">Blue-grey</div>
<div onclick="coloradd('${key}','000000','white')" class="black white-text pointer">Black</div>
<div onclick="coloradd('${key}','ffffff','black')" class="white black-text pointer">White</div>`
$('#picker_' + key).html(temp)
2018-04-07 14:31:09 +10:00
}
2019-05-19 17:39:30 +10:00
function coloradd(key, bg, txt) {
2019-11-09 00:52:54 +11:00
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', '')
2019-05-19 17:39:30 +10:00
} else {
2019-11-09 00:52:54 +11:00
$('#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'
2019-05-19 17:39:30 +10:00
}
2019-11-09 00:52:54 +11:00
$('#menu_' + key + ' .nex').css('color', '#' + ichex)
$('#menu_' + key).css('color', '#' + bghex)
2018-04-07 14:31:09 +10:00
}
2018-09-10 03:06:00 +10:00
}
//禁断のTwitter
2019-05-19 17:39:30 +10:00
function webviewParse(url, key, insert, icnsert, css) {
2019-11-25 00:12:14 +11:00
var html = `<div class="box" id="timeline_box_${key}_box" tlid="${key}" style="${css}">
2019-11-09 00:52:54 +11:00
<div class="notice-box z-depth-2" id="menu_${key}" style="${insert}">
<div class="area-notice">
2020-05-23 14:54:51 +10:00
<i class="fab fa-twitter waves-effect" id="notice_icon_${key}" style="font-size:40px; padding-top:25%;"></i>
2019-11-09 00:52:54 +11:00
</div>
<div class="area-notice_name tl-title">WebView('${url}')</div>
2020-08-05 13:46:10 +10:00
<div class="area-sta">
</div>
2019-11-09 00:52:54 +11:00
<div class="area-a2">
<a onclick="removeColumn('${key}')" class="setting nex">
<i class="material-icons waves-effect nex" title="${lang.lang_layout_delthis}" ${icnsert}>cancel</i>
</a>
</div>
<div class="area-a3">
<a onclick="setToggle('${key}')" class="setting nex" title="${lang.lang_layout_setthis}" ${icnsert}>
<i class="material-icons waves-effect nex">settings</i>
</a>
</div>
</div>
<div class="column-hide notf-indv-box z-depth-4" id="notf-box_${key}"></div>
2020-05-23 14:54:51 +10:00
<div class="column-hide notf-indv-box" id="util-box_${key}" style="padding:5px;">
2019-11-09 00:52:54 +11:00
${lang.lang_layout_headercolor}
<br>
<div id="picker_${key}" class="color-picker"></div>
</div>
<div class="tl-box" tlid="${key}" style="width:100%;height:100%;">
<div id="timeline_${key}" class="tl" tlid="${key}" data-type="webview" style="width:100%;height:100%;">
<webview src="${url}" style="width:100%;height:100%;" id="webview" preload="./js/platform/twitter.js"></webview>
</div>
</div>
</div>`
return html
2019-03-21 06:42:47 +11:00
}
2019-11-16 06:58:37 +11:00
function unstreamingTL(type, key, basekey, insert, icnsert, left_fold, css, animecss, data) {
//type名が関数名
2019-05-19 17:39:30 +10:00
if (!left_fold) {
2019-11-25 00:12:14 +11:00
var basehtml = `<div style="${css}" class="box ${animecss}" id="timeline_box_${basekey}_parentBox"></div>`
2019-11-09 00:52:54 +11:00
$('#timeline-container').append(basehtml)
2019-11-25 00:12:14 +11:00
var left_hold = `<a onclick="leftFoldSet('${key}')" class="setting nex">
2019-11-16 06:58:37 +11:00
<i class="material-icons waves-effect nex" title="${lang.lang_layout_leftFold}">view_agenda</i>
</a>
${lang.lang_layout_leftFold}
</span><br>`
2019-05-19 17:39:30 +10:00
} else {
2019-11-25 00:12:14 +11:00
var left_hold = `<a onclick="leftFoldRemove('${key}')" class="setting nex">
2019-11-16 06:58:37 +11:00
<i class="material-icons waves-effect nex" title="${lang.lang_layout_leftUnfold}">view_column</i>
</a>
${lang.lang_layout_leftUnfold}
</span><br>`
}
2020-08-05 13:46:10 +10:00
if (type == 'utl') {
2020-05-10 22:52:01 +10:00
var dataHtml = false
} else {
var dataHtml = data
}
2019-11-25 00:12:14 +11:00
var html = `<div class="boxIn" id="timeline_box_${key}_box" tlid="${key}">
2019-11-16 06:58:37 +11:00
<div class="notice-box z-depth-2" id="menu_${key}" style="${insert} ">
<div class="area-notice">
2020-05-23 14:54:51 +10:00
<i class="material-icons waves-effect" id="notice_icon_${key}" style="font-size:40px; padding-top:25%;"
2020-05-10 22:52:01 +10:00
onclick="${type}('${key}','${dataHtml}');" title="${lang.lang_layout_gotop}"></i>
2019-11-16 06:58:37 +11:00
</div>
<div class="area-notice_name">
<span id="notice_${key}" class="tl-title"></span>
</div>
<div class="area-a1"></div>
<div class="area-sta"></div>
<div class="area-a2">
<a onclick="removeColumn('${key}')" class="setting nex">
<i class="material-icons waves-effect nex" title="${lang.lang_layout_delthis}"${icnsert}>cancel</i>
</a>
</div>
<div class="area-a3">
<a onclick="setToggle('${key}')" class="setting nex" title="${lang.lang_layout_setthis}" ${icnsert}>
<i class="material-icons waves-effect nex">settings</i>
</a>
</div>
</div>
2020-05-23 14:54:51 +10:00
<div class="column-hide notf-indv-box" id="util-box_${key}" style="padding:5px;">
2019-11-16 06:58:37 +11:00
${left_hold}
<a onclick="mediaToggle('${key}')" class="setting nex">
<i class="material-icons waves-effect nex" title="${lang.lang_layout_mediafil}">perm_media</i>
<span id="sta-media-${key}">On</span>
</a>
${lang.lang_layout_mediafil}<br>
${lang.lang_layout_headercolor}<br>
<div id="picker_${key}" class="color-picker"></div>
</div>
<div class="tl-box" tlid="${key}">
<div id="timeline_${key}" class="tl ${type}-timeline" tlid="${key}" data-type="${type}" data-acct="${data}">
<div id="landing_${key}" style="text-align:center">
${lang.lang_layout_nodata}
</div>
</div>
</div>`
2019-11-09 00:52:54 +11:00
$('#timeline_box_' + basekey + '_parentBox').append(html)
2019-11-25 00:12:14 +11:00
if (type == 'tootsearch') {
2019-11-16 06:58:37 +11:00
tootsearch(key, data)
2019-11-25 00:12:14 +11:00
} else if (type == 'bookmark') {
2019-11-16 06:58:37 +11:00
console.log(key, data)
bookmark(key, data)
2020-05-07 01:31:11 +10:00
} else if (type == 'utl') {
utl(key, data.acct, data.data)
2019-11-16 06:58:37 +11:00
}
2019-11-09 00:52:54 +11:00
cardCheck(key)
ebtCheck(key)
mediaCheck(key)
catchCheck(key)
voiceCheck(key)
return true
}
2019-11-25 00:12:14 +11:00
function bookmark(key, data) {
2019-11-16 06:58:37 +11:00
console.log(key, data)
if (localStorage.getItem('voice_' + key)) {
var voice = true
} else {
var voice = false
}
tl('bookmark', '', data, key, 'false', voice, '')
}
2020-05-07 01:31:11 +10:00
function utl(key, acct_id, data) {
2020-08-05 13:46:10 +10:00
if (!data) {
2020-05-10 22:52:01 +10:00
var multi = localStorage.getItem('column')
var obj = JSON.parse(multi)
data = obj[key].data
acct_id = obj[key].domain
}
2020-08-05 13:46:10 +10:00
2020-05-07 01:31:11 +10:00
console.log(key, data)
if (localStorage.getItem('voice_' + key)) {
var voice = true
} else {
var voice = false
}
tl('utl', data, acct_id, key, 'false', voice, '')
}
2019-05-19 17:39:30 +10:00
function leftFoldSet(key) {
2019-11-09 00:52:54 +11:00
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()
2019-03-21 06:42:47 +11:00
}
2019-05-19 17:39:30 +10:00
function leftFoldRemove(key) {
2019-11-09 00:52:54 +11:00
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()
}