Skip to content

Commit

Permalink
WIP Fix #131
Browse files Browse the repository at this point in the history
  • Loading branch information
cutls committed Oct 8, 2019
1 parent 8140e56 commit ce84069
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
19 changes: 12 additions & 7 deletions app/js/post/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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")) {
Expand Down
4 changes: 2 additions & 2 deletions app/js/tl/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -862,15 +862,15 @@ 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 +
'</span></a></div>' +
'<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 +
Expand Down

0 comments on commit ce84069

Please sign in to comment.