Add bookmark TL
This commit is contained in:
parent
f7dbeaef84
commit
2b3feb40ad
|
@ -446,6 +446,7 @@ iframe,
|
|||
}
|
||||
.contextMenu .btn-flat {
|
||||
text-transform: none !important;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.gray {
|
||||
|
|
|
@ -116,7 +116,7 @@ function boostWith(vis) {
|
|||
rt(id, acct_id, false, vis)
|
||||
}
|
||||
//ブックマーク
|
||||
function bkm(id, acct_id, remote) {
|
||||
function bkm(id, acct_id, tlid) {
|
||||
if ($('#pub_' + id).hasClass('bkmed')) {
|
||||
var flag = 'unbookmark'
|
||||
} else {
|
||||
|
@ -140,7 +140,6 @@ function bkm(id, acct_id, remote) {
|
|||
if (json.reblog) {
|
||||
json = json.reblog
|
||||
}
|
||||
if (remote != 'remote') {
|
||||
var fav = json.favourites_count
|
||||
$('[toot-id=' + id + '] .fav_ct').text(fav)
|
||||
$('[toot-id=' + id + '] .rt_ct').text(json.reblogs_count)
|
||||
|
@ -153,9 +152,8 @@ function bkm(id, acct_id, remote) {
|
|||
$('.bkm_' + id).addClass('red-text')
|
||||
$('[toot-id=' + id + ']').addClass('bkmed')
|
||||
}
|
||||
} else {
|
||||
M.toast({ html: lang.lang_status_favWarn, displayLength: 1000 })
|
||||
}
|
||||
var tlidTar = $(`.bookmark-timeline[data-acct=${acct_id}]`).attr('tlid')
|
||||
columnReload(tlidTar,'bookmark')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -948,7 +948,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
|
|||
</div>`
|
||||
}
|
||||
//menuは何個?
|
||||
var menuct = 1
|
||||
var menuct = 2
|
||||
if (viashow != 'hide') {
|
||||
menuct++
|
||||
}
|
||||
|
@ -1106,6 +1106,13 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
|
|||
</a>
|
||||
</div>
|
||||
${trans}
|
||||
<div>
|
||||
<a onclick="postMessage(['openUrl', '${toot.url}'], '*')"
|
||||
class="waves-effect waves-dark btn-flat actct" style="padding:0">
|
||||
<i class="fas text-darken-3 fa-globe"></i>
|
||||
${lang.lang_parse_link}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
|
|
|
@ -56,14 +56,15 @@ function tl(type, data, acct_id, tlid, delc, voice, mode) {
|
|||
)
|
||||
$('#notice_icon_' + tlid).text('notifications')
|
||||
return
|
||||
} /*else if (type == "dm") {
|
||||
//DMなら飛ばす
|
||||
dm(acct_id, tlid, "plus",delc,voice);
|
||||
$("#notice_" + tlid).text(cap(type, data, acct_id) + "(" + localStorage.getItem(
|
||||
"user_" + acct_id) + "@" + domain + ")");
|
||||
$("#notice_icon_" + tlid).text("mail_outline");
|
||||
return;
|
||||
}*/
|
||||
} else if (type == 'bookmark') {
|
||||
//ブックマークなら飛ばす
|
||||
getBookmark(acct_id, tlid)
|
||||
$('#notice_' + tlid).text(
|
||||
cap(type, data, acct_id) + '(' + localStorage.getItem('user_' + acct_id) + '@' + domain + ')'
|
||||
)
|
||||
$('#notice_icon_' + tlid).text('bookmark')
|
||||
return
|
||||
}
|
||||
localStorage.setItem('now', type)
|
||||
todo(cap(type) + ' TL Loading...')
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
|
@ -387,6 +388,9 @@ function moreload(type, tlid) {
|
|||
var data = obj[tlid].data
|
||||
moreTs(tlid, data)
|
||||
return
|
||||
} else if (type == 'bookmark') {
|
||||
getBookmark(acct_id, tlid, true)
|
||||
return
|
||||
}
|
||||
moreloading = true
|
||||
localStorage.setItem('now', type)
|
||||
|
@ -708,6 +712,8 @@ function cap(type, data, acct_id) {
|
|||
var response = 'Twitter'
|
||||
} else if (type == 'tootsearch') {
|
||||
var response = 'tootsearch(' + escapeHTML(data) + ')'
|
||||
} else if (type == 'bookmark') {
|
||||
var response = 'Bookmarks'
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
@ -730,6 +736,8 @@ function com(type, data) {
|
|||
return 'list/' + data + '?'
|
||||
} else if (type == 'dm') {
|
||||
return 'direct?'
|
||||
} else if (type == 'bookmark') {
|
||||
return 'bookmarks?'
|
||||
}
|
||||
}
|
||||
//Misskey
|
||||
|
@ -800,6 +808,8 @@ function icon(type) {
|
|||
var response = 'language'
|
||||
} else if (type == 'tootsearch') {
|
||||
var response = 'search'
|
||||
} else if (type == 'bookmark') {
|
||||
var response = 'bookmark'
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
@ -835,6 +845,9 @@ function reconnector(tlid, type, acct_id, data, mode) {
|
|||
function columnReload(tlid, type) {
|
||||
$('#notice_icon_' + tlid).addClass('red-text')
|
||||
$('#unread_' + tlid + ' .material-icons').removeClass('teal-text')
|
||||
var multi = localStorage.getItem('column')
|
||||
var obj = JSON.parse(multi)
|
||||
var acct_id = obj[tlid].domain
|
||||
if (type == 'mix' || type == 'integrated' || type == 'plus') {
|
||||
if (localStorage.getItem('voice_' + tlid)) {
|
||||
var voice = true
|
||||
|
@ -850,6 +863,9 @@ function columnReload(tlid, type) {
|
|||
} else if (type == 'notf') {
|
||||
$('#notice_icon_' + tlid).removeClass('red-text')
|
||||
notfColumn(acct_id, tlid, '')
|
||||
} else if (type == 'bookmark') {
|
||||
$('#notice_icon_' + tlid).removeClass('red-text')
|
||||
getBookmark(acct_id, tlid, false)
|
||||
} else {
|
||||
var wss = localStorage.getItem('wss_' + tlid)
|
||||
websocket[wss].close()
|
||||
|
@ -1102,3 +1118,52 @@ function asReadEnd() {
|
|||
postMessage(['asReadComp', ''], '*')
|
||||
}
|
||||
}
|
||||
//ブックマーク
|
||||
function getBookmark(acct_id, tlid, more) {
|
||||
moreloading = true
|
||||
console.log(acct_id, tlid, more)
|
||||
if (more) {
|
||||
var sid = $('#timeline_' + tlid + ' .notif-marker')
|
||||
.last()
|
||||
.attr('data-maxid')
|
||||
var ad = '?max_id=' + sid
|
||||
} else {
|
||||
var ad = ''
|
||||
}
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var start = 'https://' + domain + '/api/v1/bookmarks' + ad
|
||||
var httpreq = new XMLHttpRequest()
|
||||
httpreq.open('GET', start, true)
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json')
|
||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
|
||||
httpreq.responseType = 'json'
|
||||
httpreq.send()
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, this.response)
|
||||
}
|
||||
var max_ids = httpreq.getResponseHeader('link')
|
||||
var max_id = 0
|
||||
if (max_ids) {
|
||||
max_ids = max_ids.match(/[?&]{1}max_id=([0-9]+)/)
|
||||
if (max_ids) {
|
||||
max_id = max_ids[1]
|
||||
}
|
||||
}
|
||||
var templete = parse(json, 'bookmark', acct_id, tlid, -1, null)
|
||||
templete = templete + '<div class="hide notif-marker" data-maxid="' + max_id + '"></div>'
|
||||
if (more) {
|
||||
$('#timeline_' + tlid).append(templete)
|
||||
} else {
|
||||
$('#timeline_' + tlid).html(templete)
|
||||
}
|
||||
$('#landing_' + tlid).hide()
|
||||
jQuery('time.timeago').timeago()
|
||||
moreloading = false
|
||||
todc()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -202,6 +202,28 @@ function parseColumn(target, dontclose) {
|
|||
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) {
|
||||
|
@ -728,105 +750,73 @@ function webviewParse(url, key, insert, icnsert, css) {
|
|||
</div>`
|
||||
return html
|
||||
}
|
||||
function unstreamingTL(type, key, basekey, insert, icnsert, left_fold, css, animecss, q) {
|
||||
function unstreamingTL(type, key, basekey, insert, icnsert, left_fold, css, animecss, data) {
|
||||
//type名が関数名
|
||||
if (!left_fold) {
|
||||
var basehtml =
|
||||
'<div style="' +
|
||||
css +
|
||||
'" class="box ' +
|
||||
animecss +
|
||||
'" id="timeline_box_' +
|
||||
basekey +
|
||||
'_parentBox"></div>'
|
||||
`<div style="${css}" class="box ${animecss}" id="timeline_box_${basekey}_parentBox"></div>`
|
||||
$('#timeline-container').append(basehtml)
|
||||
var left_hold =
|
||||
'<a onclick="leftFoldSet(' +
|
||||
key +
|
||||
')" class="setting nex"><i class="material-icons waves-effect nex" title="' +
|
||||
lang.lang_layout_leftFold +
|
||||
'">view_agenda</i></a>' +
|
||||
lang.lang_layout_leftFold +
|
||||
'</span><br>'
|
||||
`<a onclick="leftFoldSet('${key}')" class="setting nex">
|
||||
<i class="material-icons waves-effect nex" title="${lang.lang_layout_leftFold}">view_agenda</i>
|
||||
</a>
|
||||
${lang.lang_layout_leftFold}
|
||||
</span><br>`
|
||||
} else {
|
||||
var left_hold =
|
||||
'<a onclick="leftFoldRemove(' +
|
||||
key +
|
||||
')" class="setting nex"><i class="material-icons waves-effect nex" title="' +
|
||||
lang.lang_layout_leftUnfold +
|
||||
'">view_column</i></a>' +
|
||||
lang.lang_layout_leftUnfold +
|
||||
'</span><br>'
|
||||
`<a onclick="leftFoldRemove('${key}')" class="setting nex">
|
||||
<i class="material-icons waves-effect nex" title="${lang.lang_layout_leftUnfold}">view_column</i>
|
||||
</a>
|
||||
${lang.lang_layout_leftUnfold}
|
||||
</span><br>`
|
||||
}
|
||||
var html =
|
||||
'<div class="boxIn" id="timeline_box_' +
|
||||
key +
|
||||
'_box" tlid="' +
|
||||
key +
|
||||
'"><div class="notice-box z-depth-2" id="menu_' +
|
||||
key +
|
||||
'" style="' +
|
||||
insert +
|
||||
' ">' +
|
||||
'<div class="area-notice"><i class="material-icons waves-effect" id="notice_icon_' +
|
||||
key +
|
||||
'" style="font-size:40px; padding-top:25%;" onclick="tootsearch(' +
|
||||
key +
|
||||
",'" +
|
||||
q +
|
||||
'\');" title="' +
|
||||
lang.lang_layout_gotop +
|
||||
'"></i></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>' +
|
||||
'<div class="column-hide notf-indv-box" id="util-box_' +
|
||||
key +
|
||||
'" style="padding:5px;">' +
|
||||
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="nostr"><div id="landing_' +
|
||||
key +
|
||||
'" style="text-align:center">' +
|
||||
lang.lang_layout_nodata +
|
||||
'</div></div></div>'
|
||||
`<div class="boxIn" id="timeline_box_${key}_box" tlid="${key}">
|
||||
<div class="notice-box z-depth-2" id="menu_${key}" style="${insert} ">
|
||||
<div class="area-notice">
|
||||
<i class="material-icons waves-effect" id="notice_icon_${key}" style="font-size:40px; padding-top:25%;"
|
||||
onclick="${type}('${key}','${data}');" title="${lang.lang_layout_gotop}"></i>
|
||||
</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>
|
||||
<div class="column-hide notf-indv-box" id="util-box_${key}" style="padding:5px;">
|
||||
${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>`
|
||||
$('#timeline_box_' + basekey + '_parentBox').append(html)
|
||||
tootsearch(key, q)
|
||||
if(type == 'tootsearch'){
|
||||
tootsearch(key, data)
|
||||
}else if(type == 'bookmark'){
|
||||
console.log(key, data)
|
||||
bookmark(key, data)
|
||||
}
|
||||
cardCheck(key)
|
||||
ebtCheck(key)
|
||||
mediaCheck(key)
|
||||
|
@ -834,6 +824,15 @@ function unstreamingTL(type, key, basekey, insert, icnsert, left_fold, css, anim
|
|||
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)
|
||||
|
|
|
@ -927,6 +927,9 @@
|
|||
<div class="type waves-effect" data-type="notf">
|
||||
<div><i class="material-icons">notifications</i></div><span>@@notf@@</span>
|
||||
</div>
|
||||
<div class="type waves-effect" data-type="bookmark">
|
||||
<div><i class="material-icons">bookmark</i></div><span>@@bookmark@@</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="noauth" class="hide">@@showThisTL@@
|
||||
|
|
|
@ -125,6 +125,7 @@
|
|||
"integratedTLDes":"Integrated(Local/Home)",
|
||||
"localPlusDes":"LTL+Reply+BT",
|
||||
"notf":"Notifications",
|
||||
"bookmark": "Bookmarks",
|
||||
"showThisTL":"Show this TL:",
|
||||
"webviewWarn":"TweetDeck with customed TJDeck(<a href='https://gist.github.com/cutls/8787a55d2c1c53274e68a427966046a6' target='_blank'>Code</a>/<a href='https://gist.github.com/totoraj930/d1394dadb51d75666a76829f61e7280c' target='_blank'>TJDeck</a>). Keyboard shortcuts will irritate you. When you feel so, you check 'Prefer WebView' on top of the column.",
|
||||
"add":"Add",
|
||||
|
|
|
@ -187,6 +187,7 @@
|
|||
"lang_parse_del": "Delete this",
|
||||
"lang_parse_pin": "Pin this",
|
||||
"lang_parse_unpin": "Unpin this",
|
||||
"lang_parse_link": "Open in a browser",
|
||||
"lang_parse_det": "Details via your main account.",
|
||||
"lang_parse_redraft": "Delete & re-draft",
|
||||
"lang_parse_followed": "Followed you",
|
||||
|
|
|
@ -127,6 +127,7 @@
|
|||
"full": "URL, text and acct(mention to the user)",
|
||||
"notqt": "Disabled(Hide buttons on TLs)",
|
||||
"apiQuote": "API(only some instances)",
|
||||
"showBookmarkAction": "Show a bookmarking toot button",
|
||||
"main": "Default accounts of actions",
|
||||
"mainwarn": "Main account can be set on Account Manager.",
|
||||
"lastacct": "Account you used recently",
|
||||
|
|
|
@ -125,6 +125,7 @@
|
|||
"integratedTLDes":"統合(ローカルとホーム)",
|
||||
"localPlusDes":"統合(LTL+BT+返信)",
|
||||
"notf":"通知",
|
||||
"bookmark": "ブックマーク",
|
||||
"showThisTL":"表示するタイムライン",
|
||||
"webviewWarn":"TweetDeckを表示します。TJDeckをカスタムしたものが読み込まれます(<a href='https://gist.github.com/cutls/8787a55d2c1c53274e68a427966046a6' target='_blank'>Code</a>/<a href='https://gist.github.com/totoraj930/d1394dadb51d75666a76829f61e7280c' target='_blank'>TJDeck</a>)。キーボードショートカットが邪魔をするので、文字入力時はカラムの「WebView優先」にチェックを入れてください。",
|
||||
"add":"追加",
|
||||
|
|
|
@ -187,8 +187,9 @@
|
|||
"lang_parse_del": "削除",
|
||||
"lang_parse_pin": "ピン留めする",
|
||||
"lang_parse_unpin": "ピン留めを解除する",
|
||||
"lang_parse_link": "ブラウザで開く",
|
||||
"lang_parse_det": "詳細(メインアカウント経由)",
|
||||
"lang_parse_redraft": "このトゥートを削除して再編集",
|
||||
"lang_parse_redraft": "削除して再編集",
|
||||
"lang_parse_followed": "フォローされました。",
|
||||
"lang_parse_clientop": "クライアント操作",
|
||||
"lang_parse_clienttxt": " に対する処理を選択してください。",
|
||||
|
|
|
@ -127,6 +127,7 @@
|
|||
"full": "本文・URL・アカウント名",
|
||||
"notqt": "使わない(TL上にボタンも表示されません)",
|
||||
"apiQuote": "パラメーター(対応インスタンス)",
|
||||
"showBookmarkAction": "アクションボタンとしてブックマークを表示する",
|
||||
"main": "投稿後や起動時のアカウント",
|
||||
"mainwarn": "メインアカウントはアカウント設定で指定できます。投稿以外のアカウント選択にも影響します。",
|
||||
"lastacct": "最後に使用したアカウント",
|
||||
|
|
|
@ -371,6 +371,17 @@ var tlConstruction = [
|
|||
checkbox: yesno
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'bkm',
|
||||
storage: 'bookmark',
|
||||
checkbox: true,
|
||||
setValue: 'no',
|
||||
text: {
|
||||
head: '@@showBookmarkAction@@',
|
||||
desc: '',
|
||||
checkbox: yesno
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'replySound',
|
||||
storage: 'replySound',
|
||||
|
|
Loading…
Reference in New Issue
Block a user