Add dropdown and bookmark

This commit is contained in:
cutls 2019-11-16 03:42:23 +09:00
parent 31472e3206
commit f7dbeaef84
9 changed files with 318 additions and 169 deletions

View File

@ -415,6 +415,38 @@ iframe,
color: var(--color); color: var(--color);
transition: 0.5s; transition: 0.5s;
} }
#contextWrap {
position: fixed;
width: 199vw;
height: 100vh;
z-index: 9998;
}
.contextMenu {
position: fixed;
background-color: var(--box);
z-index: 9999;
border-radius: 5px;
padding: 5px;
}
.contextMenu.bottom:before {
content: '';
position: absolute;
top: 100%;
right: 27px;
border: 15px solid transparent;
border-top: 15px solid var(--box);
}
.contextMenu.top:before {
content: '';
position: absolute;
top: -30px;
right: 27px;
border: 15px solid transparent;
border-bottom: 15px solid var(--box);
}
.contextMenu .btn-flat {
text-transform: none !important;
}
.gray { .gray {
color: var(--gray); color: var(--gray);

View File

@ -115,6 +115,50 @@ function boostWith(vis) {
var acct_id = $('#tootmodal').attr('data-acct') var acct_id = $('#tootmodal').attr('data-acct')
rt(id, acct_id, false, vis) rt(id, acct_id, false, vis)
} }
//ブックマーク
function bkm(id, acct_id, remote) {
if ($('#pub_' + id).hasClass('bkmed')) {
var flag = 'unbookmark'
} else {
var flag = 'bookmark'
}
var domain = localStorage.getItem('domain_' + acct_id)
var at = localStorage.getItem('acct_' + acct_id + '_at')
var start = 'https://' + domain + '/api/v1/statuses/' + id + '/' + flag
var httpreq = new XMLHttpRequest()
httpreq.open('POST', 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, json)
}
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)
if (flag == 'unbookmark') {
$('.bkmStr_' + id).text(lang.lang_parse_bookmark)
$('.bkm_' + id).removeClass('red-text')
$('[toot-id=' + id + ']').removeClass('bkmed')
} else {
$('.bkmStr_' + id).text(lang.lang_parse_unbookmark)
$('.bkm_' + id).addClass('red-text')
$('[toot-id=' + id + ']').addClass('bkmed')
}
} else {
M.toast({ html: lang.lang_status_favWarn, displayLength: 1000 })
}
}
}
}
//フォロー //フォロー
async function follow(acct_id, resolve) { async function follow(acct_id, resolve) {
@ -406,12 +450,14 @@ function pin(id, acct_id) {
setLog(start, this.status, this.response) setLog(start, this.status, this.response)
} }
console.log(['Success: pinned', json]) console.log(['Success: pinned', json])
if ($('[toot-id=' + id + ']').hasClass('pined')) { if (flag == 'unpin') {
$('[toot-id=' + id + ']').removeClass('pined') $('[toot-id=' + id + ']').removeClass('pined')
$('.pin_' + id).removeClass('blue-text') $('.pin_' + id).removeClass('blue-text')
$('.pinStr_' + id).text(lang.lang_parse_pin)
} else { } else {
$('[toot-id=' + id + ']').addClass('pined') $('[toot-id=' + id + ']').addClass('pined')
$('.pin_' + id).addClass('blue-text') $('.pin_' + id).addClass('blue-text')
$('.pinStr_' + id).text(lang.lang_parse_unpin)
} }
} }
} }
@ -574,23 +620,30 @@ function staEx(mode) {
}) })
return return
} }
function toggleAction(id, tlid, acct_id) { function toggleAction(elem, height) {
if (tlid == 'notf') { var cont = elem.parents('.cvo').find('.contextMenu')
var tlide = '[data-acct=' + acct_id + '] .notf-timeline' if (cont.hasClass('hide')) {
} else if (tlid == 'user') { $('#contextWrap').removeClass('hide')
var tlide = '#his-tl-contents' var left = elem.offset().left + 60
var top = elem.offset().top - height
if (top < 75) {
top = elem.offset().top + 45
cont.removeClass('bottom')
cont.addClass('top')
} else { } else {
var tlide = '[tlid=' + tlid + ']' cont.removeClass('top')
cont.addClass('bottom')
} }
if (!$(tlide + ' [toot-id=' + id + ']').hasClass('ext-mode')) { cont.css('top', top + 'px')
$(tlide + ' [toot-id=' + id + '] .type-a').hide() cont.css('right', `calc(100vw - ${left}px)`)
$(tlide + ' [toot-id=' + id + '] .type-b').show() cont.removeClass('hide')
$(tlide + ' [toot-id=' + id + ']').addClass('ext-mode') elem
$(tlide + ' [toot-id=' + id + '] .act-icon').text('expand_less') .parents('.cvo')
.find('.act-icon')
.text('expand_less')
} else { } else {
$(tlide + ' [toot-id=' + id + '] .type-b').hide() $('#contextWrap').addClass('hide')
$(tlide + ' [toot-id=' + id + '] .type-a').show() $('.contextMenu').addClass('hide')
$(tlide + ' [toot-id=' + id + ']').removeClass('ext-mode') $('.act-icon').text('expand_more')
$(tlide + ' [toot-id=' + id + '] .act-icon').text('expand_more')
} }
} }

View File

@ -278,10 +278,10 @@ function cardHtml(json, acct_id, id) {
if(isHad) { if(isHad) {
var prved = `<img class="emoji" draggable="false" alt="✅" var prved = `<img class="emoji" draggable="false" alt="✅"
src="https://twemoji.maxcdn.com/v/12.1.3/72x72/2705.png">` src="https://twemoji.maxcdn.com/v/12.1.3/72x72/2705.png">`
var title = lang.lang_cards_link var title = lang.lang_cards_transted
}else{ }else{
var prved = '' var prved = '<img class="emoji" draggable="false" alt="⚠️" src="https://twemoji.maxcdn.com/v/12.1.4/72x72/26a0.png">'
var title = '' var title = lang.lang_cards_untransted
} }
analyze =`<a onclick="cardHtmlShow('${acct_id}','${id}')" class="add-show pointer" title="${title}"> analyze =`<a onclick="cardHtmlShow('${acct_id}','${id}')" class="add-show pointer" title="${title}">
${lang.lang_parse_html}(${domain})${prved} ${lang.lang_parse_html}(${domain})${prved}

View File

@ -8,12 +8,12 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
localStorage.setItem('lastunix_' + tlid, date(obj[0].created_at, 'unix')) localStorage.setItem('lastunix_' + tlid, date(obj[0].created_at, 'unix'))
} }
var actb = 're,rt,fav,qt,del,pin,red' var actb = 're,rt,fav,qt,bkm'
if (actb) { if (actb) {
var actb = actb.split(',') var actb = actb.split(',')
var disp = {} var disp = {}
for (var k = 0; k < actb.length; k++) { for (var k = 0; k < actb.length; k++) {
if (k < 4) { if (k < 5) {
var tp = 'type-a' var tp = 'type-a'
} else { } else {
var tp = 'type-b' var tp = 'type-b'
@ -35,6 +35,12 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
var qtClass = '' var qtClass = ''
} }
} }
var bkm = localStorage.getItem('bookmark')
if (bkm == 'no' || !bkm) {
var bkmClass = 'hide'
} else {
var bkmClass = ''
}
var datetype = localStorage.getItem('datetype') var datetype = localStorage.getItem('datetype')
var nsfwtype = localStorage.getItem('nsfw') var nsfwtype = localStorage.getItem('nsfw')
var sent = localStorage.getItem('sentence') var sent = localStorage.getItem('sentence')
@ -148,13 +154,13 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
var wordmute = [] var wordmute = []
} }
//via通知 //via通知
var viashow = localStorage.getItem('viashow') var viashowVal = localStorage.getItem('viashow')
if (!viashow) { if (viashowVal == 'yes') {
viashow = 'via-hide' var viashowSet = true
} } else {
if (viashow == 'hide') { var viashowSet = false
viashow = 'via-hide'
} }
var viashow = ''
//認証なしTL //認証なしTL
if (mix == 'noauth') { if (mix == 'noauth') {
var noauth = 'hide' var noauth = 'hide'
@ -460,6 +466,11 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
var via = '' var via = ''
viashow = 'hide' viashow = 'hide'
} else { } else {
if (viashowSet) {
viashow = ''
} else {
viashow = 'hide'
}
var via = escapeHTML(toot.application.name) var via = escapeHTML(toot.application.name)
if (empCli) { if (empCli) {
//強調チェック //強調チェック
@ -733,7 +744,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
} }
if (toot.account.acct == localStorage.getItem('user_' + acct_id)) { if (toot.account.acct == localStorage.getItem('user_' + acct_id)) {
var if_mine = '' var if_mine = ''
var mine_via = 'type-b' var mine_via = ''
var can_rt = '' var can_rt = ''
} else { } else {
var if_mine = 'hide' var if_mine = 'hide'
@ -756,9 +767,20 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
if (toot.pinned) { if (toot.pinned) {
var if_pin = 'blue-text' var if_pin = 'blue-text'
var pin_app = 'pinnedToot' var pin_app = 'pinnedToot'
var pinStr = lang.lang_parse_unpin
} else { } else {
var if_pin = '' var if_pin = ''
var pin_app = '' var pin_app = ''
var pinStr = lang.lang_parse_pin
}
if (toot.bookmarked) {
var if_bkm = 'red-text'
var bkm_app = 'bkmed'
var bkmStr = lang.lang_parse_unbookmark
} else {
var if_bkm = ''
var bkm_app = ''
var bkmStr = lang.lang_parse_bookmark
} }
//アニメ再生 //アニメ再生
if (gif == 'yes') { if (gif == 'yes') {
@ -851,10 +873,10 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
} }
//日本語じゃない //日本語じゃない
if (toot.language != lang.language && toot.language) { if (toot.language != lang.language && toot.language) {
var trans = `<div class="action pin"> var trans = `<div class="">
<a onclick="trans('${toot.language}','${lang.language}')" <a onclick="trans('${toot.language}','${lang.language}')"
class="waves-effect waves-dark btn-flat actct" style="padding:0" title="${lang.lang_parse_trans}"> class="waves-effect waves-dark btn-flat actct" style="padding:0">
<i class="material-icons">g_translate</i> <i class="material-icons">g_translate</i>${lang.lang_parse_trans}
</a> </a>
</div>` </div>`
} else { } else {
@ -925,11 +947,25 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
</div> </div>
</div>` </div>`
} }
//menuは何個
var menuct = 1
if (viashow != 'hide') {
menuct++
}
if (if_mine != 'hide') {
menuct = menuct + 3
}
if (noauth == 'hide') {
menuct = 0
}
if (trans != '') {
menuct++
}
templete = templete =
templete + templete +
`<div `<div
id="pub_${toot.id}" id="pub_${toot.id}"
class="cvo ${mouseover} ${boostback} ${fav_app} ${rt_app} ${pin_app} ${hasmedia} ${animecss}" class="cvo ${mouseover} ${boostback} ${fav_app} ${rt_app} ${pin_app} ${bkm_app} ${hasmedia} ${animecss}"
toot-id="${id}" unique-id="${uniqueid}" data-medias="${media_ids}" unixtime="${date( toot-id="${id}" unique-id="${uniqueid}" data-medias="${media_ids}" unixtime="${date(
obj[key].created_at, obj[key].created_at,
'unix' 'unix'
@ -939,15 +975,15 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
onclick="mov('${toot.id}','${tlid}','cl')" onclick="mov('${toot.id}','${tlid}','cl')"
onmouseout="resetmv('mv')" onmouseout="resetmv('mv')"
> >
<div class="area-notice"><span class="gray sharesta">${notice}${home}</span></div> <div class="area-notice grid"><span class="gray sharesta">${notice}${home}</span></div>
<div class="area-icon"> <div class="area-icon grid">
<a onclick="udg('${toot.account.id}','${acct_id}');" user="${toot.account.acct}" class="udg"> <a onclick="udg('${toot.account.id}','${acct_id}');" user="${toot.account.acct}" class="udg">
<img draggable="false" src="${avatar}" width="40" class="prof-img" <img draggable="false" src="${avatar}" width="40" class="prof-img"
user="${toot.account.acct}" onerror="this.src='../../img/loading.svg'"/> user="${toot.account.acct}" onerror="this.src='../../img/loading.svg'"/>
</a> </a>
${noticeavatar} ${noticeavatar}
</div> </div>
<div class="area-display_name"> <div class="area-display_name grid">
<div class="flex-name"> <div class="flex-name">
<span class="user">${dis_name}</span> <span class="user">${dis_name}</span>
<span class="sml gray" style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis; cursor:text;"> <span class="sml gray" style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis; cursor:text;">
@ -961,7 +997,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
</span> </span>
</div> </div>
</div> </div>
<div class="area-toot"> <div class="area-toot grid">
${tickerdom} ${tickerdom}
<span class="${api_spoil} cw_text_${toot.id}"> <span class="${api_spoil} cw_text_${toot.id}">
<span class="cw_text">${spoil}</span> <span class="cw_text">${spoil}</span>
@ -970,12 +1006,12 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
<div class="toot ${spoiler}">${content}</div> <div class="toot ${spoiler}">${content}</div>
${poll}${viewer} ${poll}${viewer}
</div> </div>
<div class="area-additional"> <div class="area-additional grid">
<span class="additional">${analyze}</span> <span class="additional">${analyze}</span>
${mentions}${tags} ${mentions}${tags}
</div> </div>
<div class="area-vis">${vis}</div> <div class="area-vis grid">${vis}</div>
<div class="area-actions"> <div class="area-actions grid">
<div class="action ${antinoauth}"> <div class="action ${antinoauth}">
<a onclick="detEx('${toot.url}','main')" class="waves-effect waves-dark details" style="padding:0"> <a onclick="detEx('${toot.url}','main')" class="waves-effect waves-dark details" style="padding:0">
${lang.lang_parse_det} ${lang.lang_parse_det}
@ -1008,6 +1044,13 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
<i class="text-darken-3 fas fa-quote-right"></i> <i class="text-darken-3 fas fa-quote-right"></i>
</a> </a>
</div> </div>
<div class="action ${disp['bkm']} ${noauth} ${bkmClass}">
<a onclick="bkm('${toot.id}','${acct_id}','${tlid}')"
class="waves-effect waves-dark btn-flat actct bkm-btn" style="padding:0"
title="${lang.lang_parse_bookmark}">
<i class="fas text-darken-3 fa-bookmark bkm_${toot.id} ${if_bkm}"></i>
</a>
</div>
<div class="action ${disp['fav']} ${noauth}"> <div class="action ${disp['fav']} ${noauth}">
<a onclick="fav('${uniqueid}','${acct_id}','${tlid}')" <a onclick="fav('${uniqueid}','${acct_id}','${tlid}')"
class="waves-effect waves-dark btn-flat actct fav-btn" style="padding:0" class="waves-effect waves-dark btn-flat actct fav-btn" style="padding:0"
@ -1016,35 +1059,11 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
<span class="fav_ct">${toot.favourites_count}</span> <span class="fav_ct">${toot.favourites_count}</span>
</a> </a>
</div> </div>
<div class="${if_mine} action ${disp['del']} ${noauth}">
<a onclick="del('${toot.id}','${acct_id}')" class="waves-effect waves-dark btn-flat actct"
style="padding:0" title="${lang.lang_parse_del}">
<i class="fas fa-trash"></i>
</a>
</div>
<div class="${if_mine} action pin ${disp['pin']} ${noauth}">
<a onclick="pin('${
toot.id
}','${acct_id}')" class="waves-effect waves-dark btn-flat actct" style="padding:0"
title="${lang.lang_parse_pin}">
<i class="fas fa-map-pin pin_${toot.id} ${if_pin}"></i>
</a>
</div>
<div class="${if_mine} action ${disp['red']} ${noauth}">
<a onclick="redraft('${toot.id}','${acct_id}')" class="waves-effect waves-dark btn-flat actct"
style="padding:0" title="${lang.lang_parse_redraft}">
<i class="material-icons">redo</i>
</a>
</div>
${trans}
</div> </div>
<div class="area-side"> <div class="area-side">
<span class="cbadge viabadge waves-effect ${viashow} ${mine_via}" style="max-width:60px;" <div class="action ${noauth}">
onclick="client('${$.strip_tags(via)}')" title="via ${$.strip_tags(via)}">${via}</span> <a onclick="toggleAction($(this), ${menuct * 39 + 6})"
<div class="action ${if_mine} ${noauth}"> class="ctxMenu waves-effect waves-dark btn-flat" style="padding:0">
<a onclick="toggleAction('${
toot.id
}','${tlid}','${acct_id}')" class="waves-effect waves-dark btn-flat" style="padding:0">
<i class="text-darken-3 material-icons act-icon">expand_more</i> <i class="text-darken-3 material-icons act-icon">expand_more</i>
</a> </a>
</div> </div>
@ -1054,6 +1073,40 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
<i class="text-darken-3 material-icons">more_vert</i></a> <i class="text-darken-3 material-icons">more_vert</i></a>
</div> </div>
</div> </div>
<div class="contextMenu hide z-depth-4">
<div class="${viashow}">
via ${escapeHTML(via)}<br>
<a onclick="client('${$.strip_tags(via)}')" class="pointer">${lang.lang_parse_clientop}</a>
</div>
<div>
<a onclick="bkm('${toot.id}','${acct_id}','${tlid}')"
class="waves-effect waves-dark btn-flat actct bkm-btn" style="padding:0">
<i class="fas text-darken-3 fa-bookmark bkm_${toot.id} ${if_bkm}"></i>
<span class="bkmStr_${toot.id}">${bkmStr}</span>
</a>
</div>
<div class="${if_mine}">
<a onclick="del('${toot.id}','${acct_id}')" class="waves-effect waves-dark btn-flat actct"
style="padding:0">
<i class="fas fa-trash"></i>${lang.lang_parse_del}
</a>
</div>
<div class="${if_mine}">
<a onclick="pin('${
toot.id
}','${acct_id}')" class="waves-effect waves-dark btn-flat actct" style="padding:0">
<i class="fas fa-map-pin pin_${toot.id} ${if_pin}"></i>
<span class="pinStr_${toot.id}">${pinStr}</span>
</a>
</div>
<div class="${if_mine}">
<a onclick="redraft('${toot.id}','${acct_id}')" class="waves-effect waves-dark btn-flat actct"
style="padding:0">
<i class="material-icons">redo</i>${lang.lang_parse_redraft}
</a>
</div>
${trans}
</div>
</div> </div>
` `
} }
@ -1077,7 +1130,6 @@ function userparse(obj, auth, acct_id, tlid, popup) {
Object.keys(obj).forEach(function(key) { Object.keys(obj).forEach(function(key) {
var toot = obj[key] var toot = obj[key]
if (toot) { if (toot) {
console.log(['Parsing', toot])
if (!toot.username) { if (!toot.username) {
var raw = toot var raw = toot
toot = toot.account toot = toot.account
@ -1093,8 +1145,7 @@ function userparse(obj, auth, acct_id, tlid, popup) {
var locked = '' var locked = ''
} }
if (auth == 'request') { if (auth == 'request') {
var authhtml = var authhtml = `<i class="material-icons gray pointer" onclick="request('${toot.id}','authorize','${acct_id}')" title="Accept">
`<i class="material-icons gray pointer" onclick="request('${toot.id}','authorize','${acct_id}')" title="Accept">
person_add person_add
</i>  </i> 
<i class="material-icons gray pointer" onclick="request('${toot.id}','reject','${acct_id}')" title="Reject"> <i class="material-icons gray pointer" onclick="request('${toot.id}','reject','${acct_id}')" title="Reject">
@ -1165,11 +1216,9 @@ function userparse(obj, auth, acct_id, tlid, popup) {
var avatar = '../../img/missing.svg' var avatar = '../../img/missing.svg'
} }
if (tlid == 'dir' && acct_id == 'noauth') { if (tlid == 'dir' && acct_id == 'noauth') {
var udg = var udg = `<a onclick="udgEx('${toot.url}','main');" user="${toot.acct}" class="udg">`
`<a onclick="udgEx('${toot.url}','main');" user="${toot.acct}" class="udg">`
} else { } else {
var udg = var udg = `<a onclick="udg('${toot.id}','${acct_id}');" user="${toot.acct}" class="udg">`
`<a onclick="udg('${toot.id}','${acct_id}');" user="${toot.acct}" class="udg">`
} }
var latest = date(toot.last_status_at, 'relative') var latest = date(toot.last_status_at, 'relative')
if (toot.last_status_at) { if (toot.last_status_at) {
@ -1224,6 +1273,7 @@ function userparse(obj, auth, acct_id, tlid, popup) {
} }
//クライアントダイアログ //クライアントダイアログ
function client(name) { function client(name) {
$('#contextWrap').addClass('hide')
if (name != 'Unknown') { if (name != 'Unknown') {
//聞く //聞く
Swal.fire({ Swal.fire({
@ -1300,8 +1350,7 @@ function pollParse(poll, acct_id) {
var myvote = lang.lang_parse_endedvote var myvote = lang.lang_parse_endedvote
var result_hide = '' var result_hide = ''
} else { } else {
var myvote = var myvote = `<a onclick="voteMastodon('${acct_id}','${poll.id}')" class="votebtn">${lang.lang_parse_vote}</a><br>`
`<a onclick="voteMastodon('${acct_id}','${poll.id}')" class="votebtn">${lang.lang_parse_vote}</a><br>`
if (choices[0].votes_count === 0 || choices[0].votes_count > 0) { if (choices[0].votes_count === 0 || choices[0].votes_count > 0) {
myvote = myvote =
myvote + myvote +
@ -1341,10 +1390,9 @@ function pollParse(poll, acct_id) {
${voteit} ${voteit}
</div>` </div>`
}) })
pollHtml = pollHtml = `<div class="vote_${acct_id}_${poll.id}">
`<div class="vote_${acct_id}_${poll.id}">
${pollHtml}${myvote} ${pollHtml}${myvote}
<a onclick="voteMastodonrefresh(${acct_id}','${poll.id}')" class="pointer"> <a onclick="voteMastodonrefresh('${acct_id}','${poll.id}')" class="pointer">
${lang.lang_manager_refresh} ${lang.lang_manager_refresh}
</a> </a>
<span class="cbadge cbadge-hover" title="${date(poll.expires_at, 'absolute')}"> <span class="cbadge cbadge-hover" title="${date(poll.expires_at, 'absolute')}">

View File

@ -214,6 +214,8 @@ function parseColumn(target, dontclose) {
class="setting nex" title="${lang.lang_layout_unread}"> class="setting nex" title="${lang.lang_layout_unread}">
<i class="material-icons waves-effect nex">more</i> <i class="material-icons waves-effect nex">more</i>
</a>` </a>`
var notfDomain = acct.domain
var notfKey = key
if (acct.type == 'notf') { if (acct.type == 'notf') {
var exclude = var exclude =
lang.lang_excluded + lang.lang_excluded +
@ -257,6 +259,8 @@ function parseColumn(target, dontclose) {
</button>` </button>`
} }
exclude = exclude + '<br>' exclude = exclude + '<br>'
notfDomain = "dummy"
notfKey = "dummy"
} else if (acct.type == 'home') { } else if (acct.type == 'home') {
var exclude = var exclude =
`<a onclick="ebtToggle('${key}')" class="setting nex"> `<a onclick="ebtToggle('${key}')" class="setting nex">
@ -353,8 +357,8 @@ function parseColumn(target, dontclose) {
</a> </a>
</div> </div>
</div> </div>
<div class="column-hide notf-indv-box z-depth-4" id="notf-box_${key}"> <div class="column-hide notf-indv-box z-depth-4" id="notf-box_${notfKey}">
<div id="notifications_${key}" data-notf="${acct.domain}" data-type="notf" class="notf-timeline"> <div id="notifications_${notfKey}" data-notf="${notfDomain}" data-type="notf" class="notf-timeline">
</div> </div>
</div> </div>
<div class="column-hide notf-indv-box" id="util-box_${key}" style="padding:5px;"> <div class="column-hide notf-indv-box" id="util-box_${key}" style="padding:5px;">

View File

@ -1,135 +1,140 @@
/*ささやきボックス(Cr民並感)*/ /*ささやきボックス(Cr民並感)*/
//✕隠す //✕隠す
function hide() { function hide() {
$("#right-side").hide() $('#right-side').hide()
$("#right-side").css("width", "300px") $('#right-side').css('width', '300px')
$("#left-side").css("width", "100%") $('#left-side').css('width', '100%')
var width = localStorage.getItem("postbox-width"); var width = localStorage.getItem('postbox-width')
if (width) { if (width) {
width = width.replace("px", "") * 1 width = width.replace('px', '') * 1
} else { } else {
width = 300 width = 300
} }
$("#post-box").css("width", width) $('#post-box').css('width', width)
$('#post-box').fadeOut() $('#post-box').fadeOut()
$("#post-box").removeClass("appear") $('#post-box').removeClass('appear')
$("#emoji").addClass("hide") $('#emoji').addClass('hide')
$("#left-side").show(); $('#left-side').show()
$("#default-emoji").show(); $('#default-emoji').show()
$("#unreact").show(); $('#unreact').show()
$("#addreact").addClass("hide"); $('#addreact').addClass('hide')
} }
//最小化 //最小化
function mini() { function mini() {
$("body").toggleClass("mini-post"); $('body').toggleClass('mini-post')
if ($("body").hasClass("mini-post")) { if ($('body').hasClass('mini-post')) {
$(".mini-btn").text("expand_less"); $('.mini-btn').text('expand_less')
} else { } else {
$(".mini-btn").text("expand_more"); $('.mini-btn').text('expand_more')
} }
} }
//最小化時に展開 //最小化時に展開
function show() { function show() {
$("#post-box").addClass("appear") $('#post-box').addClass('appear')
$("#textarea").focus(); $('#textarea').focus()
console.log("show" + localStorage.getItem("postbox-left")); console.log('show' + localStorage.getItem('postbox-left'))
var left = localStorage.getItem("postbox-left"); var left = localStorage.getItem('postbox-left')
if (left > $('body').width() - $('#post-box').width()) { if (left > $('body').width() - $('#post-box').width()) {
left = $('body').width() - $('#post-box').width(); left = $('body').width() - $('#post-box').width()
} else if (left < 0) { } else if (left < 0) {
left = 0; left = 0
} }
var top = localStorage.getItem("postbox-top"); var top = localStorage.getItem('postbox-top')
if (top > $('body').height() - $('#post-box').height()) { if (top > $('body').height() - $('#post-box').height()) {
top = $('body').height() - $('#post-box').height(); top = $('body').height() - $('#post-box').height()
} else if (top < 0) { } else if (top < 0) {
top = 0; top = 0
} }
$('#post-box').css("left", left + "px") $('#post-box').css('left', left + 'px')
$('#post-box').css("top", top + "px") $('#post-box').css('top', top + 'px')
var width = localStorage.getItem("postbox-width"); var width = localStorage.getItem('postbox-width')
if (width) { if (width) {
$('#post-box').css("width", width + "px") $('#post-box').css('width', width + 'px')
} else { } else {
$('#post-box').css("width", "300px") $('#post-box').css('width', '300px')
} }
$('#post-box').fadeIn(); $('#post-box').fadeIn()
$('#textarea').characterCounter(); $('#textarea').characterCounter()
mdCheck() mdCheck()
} }
$(function() { $(function() {
$("#post-box").draggable({ $('#post-box').draggable({
handle: "#post-bar", handle: '#post-bar',
stop: function() { stop: function() {
var left = $('#post-box').offset().left; var left = $('#post-box').offset().left
if (left > $('body').width() - $('#post-box').width()) { if (left > $('body').width() - $('#post-box').width()) {
left = $('body').width() - $('#post-box').width(); left = $('body').width() - $('#post-box').width()
} else if (left < 0) { } else if (left < 0) {
left = 0; left = 0
} }
var top = $('#post-box').offset().top; var top = $('#post-box').offset().top
if (top > $('body').height() - $('#post-box').height()) { if (top > $('body').height() - $('#post-box').height()) {
top = $('body').height() - $('#post-box').height(); top = $('body').height() - $('#post-box').height()
} else if (top < 0) { } else if (top < 0) {
top = 0; top = 0
} }
localStorage.setItem("postbox-left", left); localStorage.setItem('postbox-left', left)
localStorage.setItem("postbox-top", top); localStorage.setItem('postbox-top', top)
} }
}); })
$("#post-box").resizable({ $('#post-box').resizable({
minHeight: 150, minHeight: 150,
minWidth: 100, minWidth: 100,
stop: function(event, ui) { stop: function(event, ui) {
$("#textarea").blur() $('#textarea').blur()
localStorage.setItem("postbox-width", ui.size.width); localStorage.setItem('postbox-width', ui.size.width)
} }
}); })
}); })
//コード受信 //コード受信
if (location.search) { if (location.search) {
var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/); var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/)
var mode = m[1]; var mode = m[1]
var codex = m[2]; var codex = m[2]
if (mode == "share") { if (mode == 'share') {
$('textarea').focus(); $('textarea').focus()
$("#textarea").val(decodeURI(codex)); $('#textarea').val(decodeURI(codex))
show(); show()
$("body").removeClass("mini-post"); $('body').removeClass('mini-post')
$(".mini-btn").text("expand_less"); $('.mini-btn').text('expand_less')
} }
} }
$('#posttgl').click(function(e) { $('#posttgl').click(function(e) {
if (!$('#post-box').hasClass("appear")) { if (!$('#post-box').hasClass('appear')) {
show(); show()
} else { } else {
hide(); hide()
} }
$('.cvo').removeClass("selectedToot") $('.cvo').removeClass('selectedToot')
selectedColumn = 0 selectedColumn = 0
selectedToot = 0 selectedToot = 0
}); })
$("#timeline-container,#group").click(function (e) { $('#timeline-container,#group').click(function(e) {
if (localStorage.getItem("box") != "absolute") { if (localStorage.getItem('box') != 'absolute') {
if ($('#post-box').hasClass("appear") && !localStorage.getItem("nohide")) { if ($('#post-box').hasClass('appear') && !localStorage.getItem('nohide')) {
hide(); hide()
} }
} }
$('.cvo').removeClass("selectedToot") $('.cvo').removeClass('selectedToot')
selectedColumn = 0 selectedColumn = 0
selectedToot = 0 selectedToot = 0
localStorage.removeItem("nohide") localStorage.removeItem('nohide')
}); })
$('#contextWrap').click(function(e) {
$('#contextWrap').addClass('hide')
$('.contextMenu').addClass('hide')
$('.act-icon').text('expand_more')
})
$('#textarea,#cw-text').focusout(function(e) { $('#textarea,#cw-text').focusout(function(e) {
localStorage.setItem("nohide", true) localStorage.setItem('nohide', true)
var countup = function() { var countup = function() {
localStorage.removeItem("nohide") localStorage.removeItem('nohide')
} }
//setTimeout(remove, 100); //setTimeout(remove, 100);
$('.cvo').removeClass("selectedToot") $('.cvo').removeClass('selectedToot')
selectedColumn = 0 selectedColumn = 0
selectedToot = 0 selectedToot = 0
}); })

View File

@ -84,6 +84,7 @@
</div> </div>
</div> </div>
</div> </div>
<div id="contextWrap" class="hide"></div>
<div id="post-box" class="z-depth-5"> <div id="post-box" class="z-depth-5">
<div id="post-bar" class="drag-bar"><span id="unreact">@@post-new@@</span><span id="addreact" <div id="post-bar" class="drag-bar"><span id="unreact">@@post-new@@</span><span id="addreact"
class="hide">Reaction</span></div> class="hide">Reaction</span></div>

View File

@ -182,8 +182,11 @@
"lang_parse_bt": "Boost this toot", "lang_parse_bt": "Boost this toot",
"lang_parse_fav": "Favourite this toot", "lang_parse_fav": "Favourite this toot",
"lang_parse_quote": "Quote this toot", "lang_parse_quote": "Quote this toot",
"lang_parse_del": "Delete this toot", "lang_parse_bookmark": "Bookmark this",
"lang_parse_pin": "Pin this toot", "lang_parse_unbookmark": "Unbookmark this",
"lang_parse_del": "Delete this",
"lang_parse_pin": "Pin this",
"lang_parse_unpin": "Unpin this",
"lang_parse_det": "Details via your main account.", "lang_parse_det": "Details via your main account.",
"lang_parse_redraft": "Delete & re-draft", "lang_parse_redraft": "Delete & re-draft",
"lang_parse_followed": "Followed you", "lang_parse_followed": "Followed you",

View File

@ -181,9 +181,12 @@
"lang_parse_replyto": "このトゥートに返信", "lang_parse_replyto": "このトゥートに返信",
"lang_parse_bt": "このトゥートをブースト", "lang_parse_bt": "このトゥートをブースト",
"lang_parse_fav": "このトゥートをお気に入り登録", "lang_parse_fav": "このトゥートをお気に入り登録",
"lang_parse_bookmark": "ブックマークに追加",
"lang_parse_unbookmark": "ブックマークから削除",
"lang_parse_quote": "このトゥートを引用", "lang_parse_quote": "このトゥートを引用",
"lang_parse_del": "このトゥートを削除", "lang_parse_del": "削除",
"lang_parse_pin": "このトゥートをピン留め", "lang_parse_pin": "ピン留めする",
"lang_parse_unpin": "ピン留めを解除する",
"lang_parse_det": "詳細(メインアカウント経由)", "lang_parse_det": "詳細(メインアカウント経由)",
"lang_parse_redraft": "このトゥートを削除して再編集", "lang_parse_redraft": "このトゥートを削除して再編集",
"lang_parse_followed": "フォローされました。", "lang_parse_followed": "フォローされました。",