WIP Fix #131
This commit is contained in:
parent
8140e56cbc
commit
ce84069429
|
@ -18,23 +18,24 @@ function fav(id, acct_id, remote) {
|
||||||
httpreq.onreadystatechange = function () {
|
httpreq.onreadystatechange = function () {
|
||||||
if (httpreq.readyState === 4) {
|
if (httpreq.readyState === 4) {
|
||||||
var json = httpreq.response;
|
var json = httpreq.response;
|
||||||
|
if(json.reblog){
|
||||||
|
json = json.reblog
|
||||||
|
}
|
||||||
if (remote != "remote") {
|
if (remote != "remote") {
|
||||||
//APIのふぁぼカウントがおかしい
|
//APIのふぁぼカウントがおかしい
|
||||||
if ($("[toot-id=" + id + "] .fav_ct").text() == json.favourites_count) {
|
if ($("[toot-id=" + id + "] .fav_ct").text() == json.favourites_count) {
|
||||||
if (flag == "unfavourite") {
|
if (flag == "unfavourite") {
|
||||||
var fav = json.favourites_count - 1;
|
var fav = json.favourites_count - 1;
|
||||||
|
if ( fav * 1 < 0){ fav = 0}
|
||||||
} else {
|
} else {
|
||||||
var fav = json.favourites_count + 1;
|
var fav = json.favourites_count;
|
||||||
//var fav = json.favourites_count;
|
//var fav = json.favourites_count;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var fav = json.favourites_count;
|
var fav = json.favourites_count;
|
||||||
}
|
}
|
||||||
$("[toot-id=" + id + "] .fav_ct").text(fav);
|
$("[toot-id=" + id + "] .fav_ct").text(fav);
|
||||||
if (!json.reblog) {
|
$("[toot-id=" + id + "] .rt_ct").text(json.reblogs_count);
|
||||||
} else {
|
|
||||||
$("[toot-id=" + id + "] .rt_ct").text(fav);
|
|
||||||
}
|
|
||||||
if ($("[toot-id=" + id + "]").hasClass("faved")) {
|
if ($("[toot-id=" + id + "]").hasClass("faved")) {
|
||||||
$("[toot-id=" + id + "]").removeClass("faved");
|
$("[toot-id=" + id + "]").removeClass("faved");
|
||||||
$(".fav_" + id).removeClass("yellow-text");
|
$(".fav_" + id).removeClass("yellow-text");
|
||||||
|
@ -72,18 +73,22 @@ function rt(id, acct_id, remote, vis) {
|
||||||
httpreq.onreadystatechange = function () {
|
httpreq.onreadystatechange = function () {
|
||||||
if (httpreq.readyState === 4) {
|
if (httpreq.readyState === 4) {
|
||||||
var json = httpreq.response;
|
var json = httpreq.response;
|
||||||
|
if(json.reblog){
|
||||||
|
json = json.reblog
|
||||||
|
}
|
||||||
console.log(["Success: boost", json]);
|
console.log(["Success: boost", json]);
|
||||||
if (remote != "remote") {
|
if (remote != "remote") {
|
||||||
$("[toot-id=" + id + "] .fav_ct").text(json.favourites_count);
|
$("[toot-id=" + id + "] .fav_ct").text(json.favourites_count);
|
||||||
if (!json.reblog) {
|
if (!json.reblog) {
|
||||||
if (flag == "unreblog") {
|
if (flag == "unreblog") {
|
||||||
var rt = json.reblogs_count - 1;
|
var rt = json.reblogs_count - 1;
|
||||||
|
if ( rt * 1 < 0){ rt = 0}
|
||||||
} else {
|
} else {
|
||||||
var rt = json.reblogs_count + 1;
|
var rt = json.reblogs_count;
|
||||||
}
|
}
|
||||||
$("[toot-id=" + id + "] .rt_ct").text(rt);
|
$("[toot-id=" + id + "] .rt_ct").text(rt);
|
||||||
} else {
|
} 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")) {
|
if ($("[toot-id=" + id + "]").hasClass("rted")) {
|
||||||
|
|
|
@ -862,7 +862,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
|
||||||
acct_id + ',\'' + visen +
|
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 +
|
'\')" 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>' +
|
'</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 +
|
',\'' + tlid +
|
||||||
'\')" class="waves-effect waves-dark btn-flat actct bt-btn" style="padding:0" title="' + lang.lang_parse_bt + '"><i class="fas fa-retweet ' +
|
'\')" 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 +
|
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 +
|
'<div class="action ' + can_rt + ' ' + disp["qt"] + ' ' + noauth + ' ' + qtClass + '"><a onclick="qt(\'' + toot.id + '\',' + acct_id +
|
||||||
',\'' + toot.account.acct + '\',\'' + toot.url +
|
',\'' + 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>' +
|
'\')" 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 +
|
',\'' + 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' +
|
'\')" 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 +
|
if_fav + ' fav_' + toot.id + '"></i><span class="fav_ct">' + toot.favourites_count +
|
||||||
|
|
Loading…
Reference in New Issue
Block a user