Cannot unfav/unBT

This commit is contained in:
cutls 2019-12-12 00:05:40 +09:00
parent 140e47d842
commit 7366d9ce98

View File

@ -1,7 +1,7 @@
//お気に入り登録やブースト等、フォローやブロック等 //お気に入り登録やブースト等、フォローやブロック等
//お気に入り登録 //お気に入り登録
function fav(id, acct_id, remote) { function fav(id, acct_id, remote) {
if ($('#pub_' + id).hasClass('faved')) { if ($(`.cvo[unique-id=${id}]`).hasClass('faved')) {
var flag = 'unfavourite' var flag = 'unfavourite'
} else { } else {
var flag = 'favourite' var flag = 'favourite'
@ -57,7 +57,7 @@ function fav(id, acct_id, remote) {
//ブースト //ブースト
function rt(id, acct_id, remote, vis) { function rt(id, acct_id, remote, vis) {
if ($('#pub_' + id).hasClass('rted')) { if ($(`.cvo[unique-id=${id}]`).hasClass('rted')) {
var flag = 'unreblog' var flag = 'unreblog'
} else { } else {
var flag = 'reblog' var flag = 'reblog'
@ -117,7 +117,7 @@ function boostWith(vis) {
} }
//ブックマーク //ブックマーク
function bkm(id, acct_id, tlid) { function bkm(id, acct_id, tlid) {
if ($('#pub_' + id).hasClass('bkmed')) { if ($(`.cvo[unique-id=${id}]`).hasClass('bkmed')) {
var flag = 'unbookmark' var flag = 'unbookmark'
} else { } else {
var flag = 'bookmark' var flag = 'bookmark'
@ -424,7 +424,7 @@ function redraft(id, acct_id) {
vis(vismode) vis(vismode)
$('#media').val(medias) $('#media').val(medias)
var ct = 0 var ct = 0
if(medias && medias != 'null') { if (medias && medias != 'null') {
ct = medias.split(',').length ct = medias.split(',').length
} }
$('[toot-id=' + id + '] img.toot-img').each(function(i, elem) { $('[toot-id=' + id + '] img.toot-img').each(function(i, elem) {
@ -436,7 +436,7 @@ function redraft(id, acct_id) {
}) })
localStorage.setItem('nohide', true) localStorage.setItem('nohide', true)
show() show()
if(json.text){ if (json.text) {
var html = json.text var html = json.text
} else { } else {
var html = $('[toot-id=' + id + '] .toot').html() var html = $('[toot-id=' + id + '] .toot').html()
@ -452,12 +452,12 @@ function redraft(id, acct_id) {
cw() cw()
$('#cw-text').val(json.spoiler_text) $('#cw-text').val(json.spoiler_text)
} }
if (json.sensitive){ if (json.sensitive) {
$('#nsfw').addClass('yellow-text') $('#nsfw').addClass('yellow-text')
$('#nsfw').html('visibility') $('#nsfw').html('visibility')
$('#nsfw').addClass('nsfw-avail') $('#nsfw').addClass('nsfw-avail')
} }
if(json.in_reply_to_id){ if (json.in_reply_to_id) {
$('#reply').val(json.in_reply_to_id) $('#reply').val(json.in_reply_to_id)
} }
} }
@ -467,7 +467,7 @@ function redraft(id, acct_id) {
} }
//ピン留め //ピン留め
function pin(id, acct_id) { function pin(id, acct_id) {
if ($('#pub_' + id).hasClass('pined')) { if ($(`.cvo[unique-id=${id}]`).hasClass('pined')) {
var flag = 'unpin' var flag = 'unpin'
} else { } else {
var flag = 'pin' var flag = 'pin'
@ -647,13 +647,17 @@ function staEx(mode) {
console.error(error) console.error(error)
}) })
.then(function(json) { .then(function(json) {
var id = json.statuses[0].id if (json.statuses) {
if (mode == 'rt') { if (json.statuses[0]) {
rt(id, acct_id, 'remote') var id = json.statuses[0].id
} else if (mode == 'fav') { if (mode == 'rt') {
fav(id, acct_id, 'remote') rt(id, acct_id, 'remote')
} else if (mode == 'reply') { } else if (mode == 'fav') {
reEx(id) fav(id, acct_id, 'remote')
} else if (mode == 'reply') {
reEx(id)
}
}
} }
}) })
return return