mirror of
https://github.com/iv-org/invidious.git
synced 2025-11-23 09:55:29 +00:00
Don't wait on server for subscription count
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
<div class="pure-g h-box">
|
||||
<div class="pure-u-2-3">
|
||||
<h3 id="count"><%= subscriptions.size %> subscriptions</h3>
|
||||
<h3><span id="count"><%= subscriptions.size %></span> subscriptions</h3>
|
||||
</div>
|
||||
<div class="pure-u-1-3" style="text-align:right;">
|
||||
<h3>
|
||||
@@ -44,6 +44,8 @@
|
||||
function remove_subscription(target) {
|
||||
var row = target.parentNode.parentNode.parentNode.parentNode;
|
||||
row.style.display = "none";
|
||||
var count = document.getElementById("count")
|
||||
count.innerText = count.innerText - 1;
|
||||
|
||||
var url = "/subscription_ajax?action_remove_subscriptions=1&redirect=false&c=" + target.getAttribute("data-id");
|
||||
var xhr = new XMLHttpRequest();
|
||||
@@ -54,9 +56,7 @@ function remove_subscription(target) {
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState == 4) {
|
||||
if (xhr.status == 200) {
|
||||
document.getElementById("count").innerHTML = xhr.response.countText;
|
||||
} else {
|
||||
if (xhr.status != 200) {
|
||||
row.style.display = "";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user