This commit is contained in:
cutls 2019-10-08 23:46:59 +09:00
parent 8140e56cbc
commit ce84069429
2 changed files with 14 additions and 9 deletions

View File

@ -18,23 +18,24 @@ function fav(id, acct_id, remote) {
httpreq.onreadystatechange = function () {
if (httpreq.readyState === 4) {
var json = httpreq.response;
if(json.reblog){
json = json.reblog
}
if (remote != "remote") {
//APIのふぁぼカウントがおかしい
if ($("[toot-id=" + id + "] .fav_ct").text() == json.favourites_count) {
if (flag == "unfavourite") {
var fav = json.favourites_count - 1;
if ( fav * 1 < 0){ fav = 0}
} else {
var fav = json.favourites_count + 1;
var fav = json.favourites_count;
//var fav = json.favourites_count;
}
} else {
var fav = json.favourites_count;
}
$("[toot-id=" + id + "] .fav_ct").text(fav);
if (!json.reblog) {
} else {
$("[toot-id=" + id + "] .rt_ct").text(fav);
}
$("[toot-id=" + id + "] .rt_ct").text(json.reblogs_count);
if ($("[toot-id=" + id + "]").hasClass("faved")) {
$("[toot-id=" + id + "]").removeClass("faved");
$(".fav_" + id).removeClass("yellow-text");
@ -72,18 +73,22 @@ function rt(id, acct_id, remote, vis) {
httpreq.onreadystatechange = function () {
if (httpreq.readyState === 4) {
var json = httpreq.response;
if(json.reblog){
json = json.reblog
}
console.log(["Success: boost", json]);
if (remote != "remote") {
$("[toot-id=" + id + "] .fav_ct").text(json.favourites_count);
if (!json.reblog) {
if (flag == "unreblog") {
var rt = json.reblogs_count - 1;
if ( rt * 1 < 0){ rt = 0}
} else {
var rt = json.reblogs_count + 1;
var rt = json.reblogs_count;
}
$("[toot-id=" + id + "] .rt_ct").text(rt);
} else {
$("[toot-id=" + id + "] .rt_ct").text(json.reblog.reblogs_count);
$("[toot-id=" + id + "] .rt_ct").text(json.reblogs_count);
}
if ($("[toot-id=" + id + "]").hasClass("rted")) {

View File

@ -862,7 +862,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
acct_id + ',\'' + visen +
'\')" class="waves-effect waves-dark btn-flat actct rep-btn" data-men="' + to_mention + '" data-visen="' + visen + '" style="padding:0" title="' + lang.lang_parse_replyto + '"><i class="fas fa-share"></i><span class="rep_ct">' + replyct +
'</a></span></a></div>' +
'<div class="action ' + can_rt + ' ' + disp["rt"] + ' ' + noauth + '"><a onclick="rt(\'' + toot.id + '\',' + acct_id +
'<div class="action ' + can_rt + ' ' + disp["rt"] + ' ' + noauth + '"><a onclick="rt(\'' + uniqueid + '\',' + acct_id +
',\'' + tlid +
'\')" class="waves-effect waves-dark btn-flat actct bt-btn" style="padding:0" title="' + lang.lang_parse_bt + '"><i class="fas fa-retweet ' +
if_rt + ' rt_' + toot.id + '"></i><span class="rt_ct">' + toot.reblogs_count +
@ -870,7 +870,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
'<div class="action ' + can_rt + ' ' + disp["qt"] + ' ' + noauth + ' ' + qtClass + '"><a onclick="qt(\'' + toot.id + '\',' + acct_id +
',\'' + toot.account.acct + '\',\'' + toot.url +
'\')" class="waves-effect waves-dark btn-flat actct" style="padding:0" title="' + lang.lang_parse_quote + '"><i class="text-darken-3 fas fa-quote-right"></i></a></div>' +
'<div class="action ' + disp["fav"] + ' ' + noauth + '"><a onclick="fav(\'' + toot.id + '\',' + acct_id +
'<div class="action ' + disp["fav"] + ' ' + noauth + '"><a onclick="fav(\'' + uniqueid + '\',' + acct_id +
',\'' + tlid +
'\')" class="waves-effect waves-dark btn-flat actct fav-btn" style="padding:0" title="' + lang.lang_parse_fav + '"><i class="fas text-darken-3 fa-star' +
if_fav + ' fav_' + toot.id + '"></i><span class="fav_ct">' + toot.favourites_count +