diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-05-28 17:18:07 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-05-28 17:18:07 +0200 |
commit | 3ccd8021b7fdc6028a9eb6db1f265572759dca26 (patch) | |
tree | 64fa01f63fb2cd815e3dfded91ee2cd93be64039 /src | |
parent | 517119dfc65a185062b473499988ddea13959fcd (diff) |
Fix youtube comment like count after youtube update
Diffstat (limited to 'src')
-rw-r--r-- | src/Body.cpp | 19 | ||||
-rw-r--r-- | src/plugins/Youtube.cpp | 6 |
2 files changed, 14 insertions, 11 deletions
diff --git a/src/Body.cpp b/src/Body.cpp index 8cc139c..3e05a78 100644 --- a/src/Body.cpp +++ b/src/Body.cpp @@ -469,6 +469,7 @@ namespace QuickMedia { } mouse_left_clicked = false; + clicked_body_item = nullptr; return; } @@ -647,14 +648,6 @@ namespace QuickMedia { window.setView(prev_view); - mouse_left_clicked = false; - if(clicked_body_item) { - auto clicked_body_item_tmp = clicked_body_item; // tmp because below call to body_item_select_callback may call this same draw function - clicked_body_item = nullptr; - if(body_item_select_callback) - body_item_select_callback(clicked_body_item_tmp.get()); - } - const float item_target_top_diff = item_background_target_pos_y; const float item_target_bottom_diff = (item_background_target_pos_y + item_background_target_height + spacing_y) - body_size.y; if(((body_size_changed && attach_side == AttachSide::BOTTOM) || selected_item_diff < 0) && item_target_top_diff < 0.0f) { @@ -685,6 +678,14 @@ namespace QuickMedia { else page_scroll -= item_target_bottom_diff*page_scroll_speed; } + + mouse_left_clicked = false; + if(clicked_body_item) { + auto clicked_body_item_tmp = clicked_body_item; // tmp because below call to body_item_select_callback may call this same draw function + clicked_body_item = nullptr; + if(body_item_select_callback) + body_item_select_callback(clicked_body_item_tmp.get()); + } } void Body::update_dirty_state(BodyItem *body_item, float width) { @@ -1052,6 +1053,8 @@ namespace QuickMedia { } } else if(item->thumbnail_size.x > 0) { text_offset_x += image_padding_x + content_size.x; + if(!merge_with_previous) + image_height = content_size.y; } if(load_texture) diff --git a/src/plugins/Youtube.cpp b/src/plugins/Youtube.cpp index a93dcb6..e4f152f 100644 --- a/src/plugins/Youtube.cpp +++ b/src/plugins/Youtube.cpp @@ -812,11 +812,11 @@ namespace QuickMedia { body_item->thumbnail_size = body_item->thumbnail_size; } - const Json::Value &like_count_json = comment_renderer_json["likeCount"]; - if(like_count_json.isInt64()) { + std::optional<std::string> vote_count = yt_json_get_text(comment_renderer_json, "voteCount"); + if(vote_count) { if(!description.empty()) description += '\n'; - description += "👍 " + std::to_string(like_count_json.asInt64()); + description += "👍 " + vote_count.value(); } const Json::Value &reply_count_json = comment_renderer_json["replyCount"]; |