Skip to content

Commit 89439e1

Browse files
committed
Add link to '/clear_watch_history' in '/feed/history'
1 parent 65cc517 commit 89439e1

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/invidious/views/history.ecr

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22
<title>History - Invidious</title>
33
<% end %>
44

5+
<div class="pure-g h-box">
6+
<div class="pure-u-2-3">
7+
<h3><span id="count"><%= user.watched.size %></span> videos</h3>
8+
</div>
9+
<div class="pure-u-1-3" style="text-align:right;">
10+
<h3>
11+
<a href="/clear_watch_history">Clear watch history</a>
12+
</h3>
13+
</div>
14+
</div>
15+
516
<div class="pure-g">
617
<% watched.each_slice(4) do |slice| %>
718
<% slice.each do |item| %>
@@ -34,6 +45,8 @@
3445
function mark_unwatched(target) {
3546
var tile = target.parentNode.parentNode.parentNode.parentNode;
3647
tile.style.display = "none";
48+
var count = document.getElementById("count")
49+
count.innerText = count.innerText - 1;
3750
3851
var url = "/mark_unwatched?redirect=false&id=" + target.getAttribute("data-id");
3952
var xhr = new XMLHttpRequest();
@@ -45,6 +58,7 @@ function mark_unwatched(target) {
4558
xhr.onreadystatechange = function() {
4659
if (xhr.readyState == 4) {
4760
if (xhr.status != 200) {
61+
count.innerText = count.innerText - 1 + 2;
4862
tile.style.display = "";
4963
}
5064
}

src/invidious/views/subscription_manager.ecr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ function remove_subscription(target) {
5757
xhr.onreadystatechange = function() {
5858
if (xhr.readyState == 4) {
5959
if (xhr.status != 200) {
60+
count.innerText = count.innerText - 1 + 2;
6061
row.style.display = "";
6162
}
6263
}

0 commit comments

Comments
 (0)